FIX: `Group#mentionable` and `Group#messageable` not fully working.
This commit is contained in:
parent
4ae3a4e89e
commit
91c5f928c2
|
@ -85,7 +85,11 @@ export default Ember.Component.extend({
|
|||
const $input = this.$('.d-editor-input');
|
||||
$input.autocomplete({
|
||||
template: findRawTemplate('user-selector-autocomplete'),
|
||||
dataSource: term => userSearch({ term, topicId, includeGroups: true }),
|
||||
dataSource: term => userSearch({
|
||||
term,
|
||||
topicId,
|
||||
includeMentionableGroups: true
|
||||
}),
|
||||
key: "@",
|
||||
transformComplete: v => v.username || v.name
|
||||
});
|
||||
|
|
|
@ -48,9 +48,9 @@ export default Ember.Controller.extend({
|
|||
};
|
||||
},
|
||||
|
||||
@computed("model.mentionable")
|
||||
displayGroupMessageButton(mentionable) {
|
||||
return this.currentUser && mentionable;
|
||||
@computed("model.messageable")
|
||||
displayGroupMessageButton(messageable) {
|
||||
return this.currentUser && messageable;
|
||||
},
|
||||
|
||||
@observes('model.user_count')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class GroupShowSerializer < BasicGroupSerializer
|
||||
attributes :is_group_user, :is_group_owner, :mentionable
|
||||
attributes :is_group_user, :is_group_owner, :mentionable, :messageable
|
||||
|
||||
def include_is_group_user?
|
||||
authenticated?
|
||||
|
@ -21,6 +21,10 @@ class GroupShowSerializer < BasicGroupSerializer
|
|||
authenticated?
|
||||
end
|
||||
|
||||
def include_messageable?
|
||||
authenticated?
|
||||
end
|
||||
|
||||
def mentionable
|
||||
Group.mentionable(scope.user).exists?(id: object.id)
|
||||
end
|
||||
|
|
|
@ -132,7 +132,7 @@ QUnit.test("Admin Viewing Group", assert => {
|
|||
andThen(() => {
|
||||
assert.ok(find(".nav-pills li a[title='Edit Group']").length === 1, 'it should show edit group tab if user is admin');
|
||||
assert.ok(find(".nav-pills li a[title='Logs']").length === 1, 'it should show Logs tab if user is admin');
|
||||
|
||||
assert.equal(count('.group-message-button'), 1, 'it displays show group message button');
|
||||
assert.equal(find('.group-info-name').text(), 'Awesome Team', 'it should display the group name');
|
||||
});
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ export default {
|
|||
"public_exit":true,
|
||||
"flair_url": 'fa-adjust',
|
||||
"is_group_owner":true,
|
||||
"mentionable":true
|
||||
"mentionable":true,
|
||||
"messageable":true
|
||||
}
|
||||
},
|
||||
"/groups/discourse/counts.json":{
|
||||
|
|
Loading…
Reference in New Issue