Show staff notes on flagged posts
This commit is contained in:
parent
0eafd26f25
commit
3f5816204e
|
@ -0,0 +1,24 @@
|
|||
import { showStaffNotes } from 'discourse/plugins/discourse-staff-notes/discourse-staff-notes/lib/staff-notes';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
|
||||
export default {
|
||||
shouldRender(args, component) {
|
||||
return component.siteSettings.staff_notes_enabled;
|
||||
},
|
||||
|
||||
setupComponent(args, component) {
|
||||
let model = args.flaggedPost.get('user');
|
||||
component.set(
|
||||
'staffNotesCount',
|
||||
model.get('custom_fields.staff_notes_count') || 0
|
||||
);
|
||||
},
|
||||
|
||||
actions: {
|
||||
showStaffNotes() {
|
||||
const store = getOwner(this).lookup('store:main');
|
||||
const user = this.get('args.flaggedPost.user');
|
||||
showStaffNotes(store, user.get('id'), count => this.set('staffNotesCount', count));
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
{{#if staffNotesCount}}
|
||||
{{show-staff-notes show="showStaffNotes" count=staffNotesCount}}
|
||||
{{/if}}
|
Loading…
Reference in New Issue