mirror of
https://github.com/chylex/Nextcloud-News.git
synced 2025-04-09 19:15:42 +02:00
(+) Blocking multiple sharing request to the same user
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
This commit is contained in:
parent
b5df8bbec9
commit
a78287a777
@ -25,7 +25,17 @@ app.controller('ShareController', function (ShareResource) {
|
||||
});
|
||||
};
|
||||
|
||||
// Dict <itemId, List<Int>(user_id)>: Local mapping b/w users & articles: [Article 1 : <Jimmy, Aurelien, ...>, Article 2: <...>]
|
||||
this.usersSharedArticles = {};
|
||||
|
||||
this.shareItem = function(itemId, userId) {
|
||||
if (this.usersSharedArticles[itemId] && this.usersSharedArticles[itemId].includes(userId)) {return ; }
|
||||
|
||||
// quick initialization (instead of if (...) : [])
|
||||
this.usersSharedArticles[itemId] = this.usersSharedArticles[itemId] ? this.usersSharedArticles[itemId] : [];
|
||||
|
||||
this.usersSharedArticles[itemId].push(userId);
|
||||
|
||||
var response = ShareResource.shareItem(itemId, userId);
|
||||
response.then((result) => {
|
||||
return result;
|
||||
|
@ -119,7 +119,7 @@
|
||||
</form>
|
||||
|
||||
|
||||
<a
|
||||
<a
|
||||
ng-repeat="user in Share.userList"
|
||||
ng-click="Share.shareItem(item.id, user.value.shareWith)">
|
||||
{{ user.value.shareWith }}
|
||||
|
Loading…
Reference in New Issue
Block a user