mirror of https://github.com/sualko/cloud_bbb
feat: show exact match first in sharing widget (#112)
parent
10f9126d42
commit
f2f9852bb8
|
@ -75,6 +75,11 @@ export interface ShareWith {
|
|||
users: ShareWithOption[];
|
||||
groups: ShareWithOption[];
|
||||
circles: ShareWithOption[];
|
||||
exact: {
|
||||
users: ShareWithOption[];
|
||||
groups: ShareWithOption[];
|
||||
circles: ShareWithOption[];
|
||||
}
|
||||
}
|
||||
|
||||
class Api {
|
||||
|
@ -243,9 +248,14 @@ class Api {
|
|||
});
|
||||
|
||||
return {
|
||||
users: [],
|
||||
groups: [],
|
||||
circles: [],
|
||||
exact: {
|
||||
users: response.data.ocs.data.exact.users,
|
||||
groups: response.data.ocs.data.exact.groups,
|
||||
circles: response.data.ocs.data.exact.circles || [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -264,9 +274,14 @@ class Api {
|
|||
const data = response.data.ocs.data;
|
||||
|
||||
return {
|
||||
users: [...data.users, ...data.exact.users],
|
||||
groups: [...data.groups, ...data.exact.groups],
|
||||
circles: [...(data.circles || []), ...(data.exact.circles || [])],
|
||||
users: data.users,
|
||||
groups: data.groups,
|
||||
circles: data.circles || [],
|
||||
exact: {
|
||||
users: data.exact.users,
|
||||
groups: data.exact.groups,
|
||||
circles: data.exact.circles || [],
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,9 @@ const ShareSelection: React.FC<Props> = (props) => {
|
|||
|
||||
function renderSearchResults(options: ShareWith|undefined) {
|
||||
const results = options ? [
|
||||
...options.exact.users.filter(user => !excluded.userIds.includes(user.value.shareWith)),
|
||||
...options.exact.groups.filter(group => !excluded.groupIds.includes(group.value.shareWith)),
|
||||
...options.exact.circles.filter(circle => !excluded.circleIds.includes(circle.value.shareWith)),
|
||||
...options.users.filter(user => !excluded.userIds.includes(user.value.shareWith)),
|
||||
...options.groups.filter(group => !excluded.groupIds.includes(group.value.shareWith)),
|
||||
...options.circles.filter(circle => !excluded.circleIds.includes(circle.value.shareWith)),
|
||||
|
|
Loading…
Reference in New Issue