Skip to content

Commit 955e6cb

Browse files
ahurokmergify[bot]
andauthored
feat(api): respect hidden collaborators (#4346)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 051bd7c commit 955e6cb

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

src/api/FileCollaborators.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ class FileCollaborators extends MarkerBasedAPI {
104104
successCallback: ({ entries: Array<SelectorItem<UserMini | GroupMini>>, next_marker: ?string }) => void,
105105
errorCallback: ElementsErrorCallback,
106106
searchStr: string,
107-
{ includeGroups = false }: { includeGroups: boolean } = {},
107+
{
108+
includeGroups = false,
109+
respectHiddenCollabs = false,
110+
}: { includeGroups: boolean, respectHiddenCollabs: boolean } = {},
108111
) => {
109112
// Do not fetch without filter
110113
if (!searchStr || searchStr.trim() === '') {
@@ -115,6 +118,7 @@ class FileCollaborators extends MarkerBasedAPI {
115118
filter_term: searchStr,
116119
include_groups: includeGroups,
117120
include_uploader_collabs: false,
121+
respect_hidden_collabs: respectHiddenCollabs,
118122
});
119123
};
120124
}

src/api/__tests__/FileCollaborators.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ describe('api/FileCollaborators', () => {
7878
filter_term: searchStr,
7979
include_groups: false,
8080
include_uploader_collabs: false,
81+
respect_hidden_collabs: false,
8182
});
8283
});
8384

@@ -93,6 +94,25 @@ describe('api/FileCollaborators', () => {
9394
filter_term: searchStr,
9495
include_groups: true,
9596
include_uploader_collabs: false,
97+
respect_hidden_collabs: false,
98+
});
99+
});
100+
101+
test('should get collaborators respecting hidden collaborators', () => {
102+
const searchStr = 'foo';
103+
const respectHiddenCollabs = true;
104+
const successCb = jest.fn();
105+
const errorCb = jest.fn();
106+
107+
fileCollaborators.getCollaboratorsWithQuery('file_id', successCb, errorCb, searchStr, {
108+
respectHiddenCollabs,
109+
});
110+
111+
expect(fileCollaborators.getFileCollaborators).toBeCalledWith('file_id', successCb, errorCb, {
112+
filter_term: searchStr,
113+
include_groups: false,
114+
include_uploader_collabs: false,
115+
respect_hidden_collabs: true,
96116
});
97117
});
98118
});

src/elements/content-sidebar/ActivitySidebar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,7 @@ class ActivitySidebar extends React.PureComponent<Props, State> {
952952
searchStr,
953953
{
954954
includeGroups: true,
955+
respectHiddenCollabs: true,
955956
},
956957
);
957958
}, DEFAULT_COLLAB_DEBOUNCE);

src/elements/content-sidebar/__tests__/ActivitySidebar.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ describe('elements/content-sidebar/ActivitySidebar', () => {
919919
let instance;
920920
let wrapper;
921921

922-
test('should get collaborators with groups', () => {
922+
test('should get collaborators with groups and respect hidden collaborators', () => {
923923
wrapper = getWrapper();
924924
instance = wrapper.instance();
925925

@@ -933,6 +933,7 @@ describe('elements/content-sidebar/ActivitySidebar', () => {
933933
search,
934934
{
935935
includeGroups: true,
936+
respectHiddenCollabs: true,
936937
},
937938
);
938939
});

0 commit comments

Comments
 (0)