diff --git a/app/authorization/client/hasPermission.js b/app/authorization/client/hasPermission.js index 8b7fda69bca1..33cee33364fe 100644 --- a/app/authorization/client/hasPermission.js +++ b/app/authorization/client/hasPermission.js @@ -5,11 +5,11 @@ import { ChatPermissions } from './lib/ChatPermissions'; function atLeastOne(permissions = [], scope) { return permissions.some((permissionId) => { - const permission = ChatPermissions.findOne(permissionId); + const permission = ChatPermissions.findOne(permissionId, { fields: { roles: 1 } }); const roles = (permission && permission.roles) || []; return roles.some((roleName) => { - const role = Models.Roles.findOne(roleName); + const role = Models.Roles.findOne(roleName, { fields: { scope: 1 } }); const roleScope = role && role.scope; const model = Models[roleScope]; @@ -20,11 +20,11 @@ function atLeastOne(permissions = [], scope) { function all(permissions = [], scope) { return permissions.every((permissionId) => { - const permission = ChatPermissions.findOne(permissionId); + const permission = ChatPermissions.findOne(permissionId, { fields: { roles: 1 } }); const roles = (permission && permission.roles) || []; return roles.some((roleName) => { - const role = Models.Roles.findOne(roleName); + const role = Models.Roles.findOne(roleName, { fields: { scope: 1 } }); const roleScope = role && role.scope; const model = Models[roleScope]; diff --git a/app/models/client/models/Subscriptions.js b/app/models/client/models/Subscriptions.js index 602f06c5e271..5d2f9198daf0 100644 --- a/app/models/client/models/Subscriptions.js +++ b/app/models/client/models/Subscriptions.js @@ -14,7 +14,7 @@ Object.assign(Subscriptions, { rid: roomId, }; - const subscription = this.findOne(query); + const subscription = this.findOne(query, { fields: { roles: 1 } }); return subscription && Array.isArray(subscription.roles) && subscription.roles.includes(roleName); }, { maxAge: 1000 }), diff --git a/app/threads/client/flextab/thread.html b/app/threads/client/flextab/thread.html index 863ebb2c6751..64d88d2c8735 100644 --- a/app/threads/client/flextab/thread.html +++ b/app/threads/client/flextab/thread.html @@ -14,9 +14,9 @@

{{_ 'Thread'}}
diff --git a/app/threads/client/flextab/thread.js b/app/threads/client/flextab/thread.js index d8dbaf39500a..96f70d058cd3 100644 --- a/app/threads/client/flextab/thread.js +++ b/app/threads/client/flextab/thread.js @@ -95,7 +95,7 @@ Template.thread.onRendered(function() { const tmid = this.state.get('tmid'); this.threadsObserve && this.threadsObserve.stop(); - this.threadsObserve = Messages.find({ tmid }).observe({ + this.threadsObserve = Messages.find({ tmid, _updatedAt: { $gt: new Date() } }).observe({ added: ({ _id, ...message }) => { const { atBottom } = this; this.Threads.upsert({ _id }, message); diff --git a/app/threads/client/flextab/threads.html b/app/threads/client/flextab/threads.html index 812d43eadf5e..a8a457119a7e 100644 --- a/app/threads/client/flextab/threads.html +++ b/app/threads/client/flextab/threads.html @@ -1,30 +1,35 @@