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[];
|
users: ShareWithOption[];
|
||||||
groups: ShareWithOption[];
|
groups: ShareWithOption[];
|
||||||
circles: ShareWithOption[];
|
circles: ShareWithOption[];
|
||||||
|
exact: {
|
||||||
|
users: ShareWithOption[];
|
||||||
|
groups: ShareWithOption[];
|
||||||
|
circles: ShareWithOption[];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Api {
|
class Api {
|
||||||
|
@ -243,9 +248,14 @@ class Api {
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
users: response.data.ocs.data.exact.users,
|
users: [],
|
||||||
groups: response.data.ocs.data.exact.groups,
|
groups: [],
|
||||||
circles: response.data.ocs.data.exact.circles || [],
|
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;
|
const data = response.data.ocs.data;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
users: [...data.users, ...data.exact.users],
|
users: data.users,
|
||||||
groups: [...data.groups, ...data.exact.groups],
|
groups: data.groups,
|
||||||
circles: [...(data.circles || []), ...(data.exact.circles || [])],
|
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) {
|
function renderSearchResults(options: ShareWith|undefined) {
|
||||||
const results = options ? [
|
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.users.filter(user => !excluded.userIds.includes(user.value.shareWith)),
|
||||||
...options.groups.filter(group => !excluded.groupIds.includes(group.value.shareWith)),
|
...options.groups.filter(group => !excluded.groupIds.includes(group.value.shareWith)),
|
||||||
...options.circles.filter(circle => !excluded.circleIds.includes(circle.value.shareWith)),
|
...options.circles.filter(circle => !excluded.circleIds.includes(circle.value.shareWith)),
|
||||||
|
|
Loading…
Reference in New Issue