From 5c07f9c2ec41c41a526ab34d4316b6826c1e0cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Mon, 16 Jul 2018 03:48:50 +0200 Subject: [PATCH 1/3] Add rooms in the default candidate types to look for when sharing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- apps/files_sharing/lib/Controller/ShareesAPIController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index ee95661d4c6..c39547bdea5 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -70,6 +70,7 @@ class ShareesAPIController extends OCSController { 'remote_groups' => [], 'emails' => [], 'circles' => [], + 'rooms' => [], ], 'users' => [], 'groups' => [], @@ -78,6 +79,7 @@ class ShareesAPIController extends OCSController { 'emails' => [], 'lookup' => [], 'circles' => [], + 'rooms' => [], ]; protected $reachedEndFor = []; @@ -162,6 +164,10 @@ class ShareesAPIController extends OCSController { if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) { $shareTypes[] = Share::SHARE_TYPE_EMAIL; } + + if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_ROOM)) { + $shareTypes[] = Share::SHARE_TYPE_ROOM; + } } else { $shareTypes[] = Share::SHARE_TYPE_GROUP; $shareTypes[] = Share::SHARE_TYPE_EMAIL; From 7ce520e83e432fcff3909670158d9a3df1069527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Mon, 16 Jul 2018 03:51:45 +0200 Subject: [PATCH 2/3] Add support for rooms in the list of candidates to share with UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- core/js/sharedialogview.js | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 9fa1847d3d5..90da279bdb9 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -159,13 +159,16 @@ }, function (result) { if (result.ocs.meta.statuscode === 100) { - var filter = function(users, groups, remotes, remote_groups, emails, circles) { + var filter = function(users, groups, remotes, remote_groups, emails, circles, rooms) { if (typeof(emails) === 'undefined') { emails = []; } if (typeof(circles) === 'undefined') { circles = []; } + if (typeof(rooms) === 'undefined') { + rooms = []; + } var usersLength; var groupsLength; @@ -173,6 +176,7 @@ var remoteGroupsLength; var emailsLength; var circlesLength; + var roomsLength; var i, j; @@ -251,6 +255,14 @@ break; } } + } else if (share.share_type === OC.Share.SHARE_TYPE_ROOM) { + roomsLength = rooms.length; + for (j = 0; j < roomsLength; j++) { + if (rooms[j].value.shareWith === share.share_with) { + rooms.splice(j, 1); + break; + } + } } } }; @@ -261,7 +273,8 @@ result.ocs.data.exact.remotes, result.ocs.data.exact.remote_groups, result.ocs.data.exact.emails, - result.ocs.data.exact.circles + result.ocs.data.exact.circles, + result.ocs.data.exact.rooms ); var exactUsers = result.ocs.data.exact.users; @@ -276,8 +289,12 @@ if (typeof(result.ocs.data.circles) !== 'undefined') { exactCircles = result.ocs.data.exact.circles; } + var exactRooms = []; + if (typeof(result.ocs.data.rooms) !== 'undefined') { + exactRooms = result.ocs.data.exact.rooms; + } - var exactMatches = exactUsers.concat(exactGroups).concat(exactRemotes).concat(exactRemoteGroups).concat(exactEmails).concat(exactCircles); + var exactMatches = exactUsers.concat(exactGroups).concat(exactRemotes).concat(exactRemoteGroups).concat(exactEmails).concat(exactCircles).concat(exactRooms); filter( result.ocs.data.users, @@ -285,7 +302,8 @@ result.ocs.data.remotes, result.ocs.data.remote_groups, result.ocs.data.emails, - result.ocs.data.circles + result.ocs.data.circles, + result.ocs.data.rooms ); var users = result.ocs.data.users; @@ -301,8 +319,12 @@ if (typeof(result.ocs.data.circles) !== 'undefined') { circles = result.ocs.data.circles; } + var rooms = []; + if (typeof(result.ocs.data.rooms) !== 'undefined') { + rooms = result.ocs.data.rooms; + } - var suggestions = exactMatches.concat(users).concat(groups).concat(remotes).concat(remoteGroups).concat(emails).concat(circles).concat(lookup); + var suggestions = exactMatches.concat(users).concat(groups).concat(remotes).concat(remoteGroups).concat(emails).concat(circles).concat(rooms).concat(lookup); deferred.resolve(suggestions, exactMatches); } else { @@ -432,6 +454,8 @@ text = t('core', '{sharee} (email)', { sharee: text }, undefined, { escape: false }); } else if (item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) { text = t('core', '{sharee} ({type}, {owner})', {sharee: text, type: item.value.circleInfo, owner: item.value.circleOwner}, undefined, {escape: false}); + } else if (item.value.shareType === OC.Share.SHARE_TYPE_ROOM) { + text = t('core', '{sharee} (conversation)', { sharee: text }, undefined, { escape: false }); } var insert = $("