Update staff note icon to appear on reviewable

Flagged posts have been folded into the review queue - this makes
staff notes appear on the flags in the review queue

Icon appears as a shorthand pencil emoji
This commit is contained in:
Jeff Wong 2020-04-08 14:17:35 -07:00
parent 934cde9016
commit 1a60f5670f
4 changed files with 23 additions and 12 deletions

View File

@ -1,5 +1,6 @@
import { showUserNotes } from "discourse/plugins/discourse-user-notes/discourse-user-notes/lib/user-notes";
import { getOwner } from "discourse-common/lib/get-owner";
import { emojiUrlFor } from "discourse/lib/text";
export default {
shouldRender(args, component) {
@ -7,17 +8,20 @@ export default {
},
setupComponent(args, component) {
const model = args.flaggedPost.user;
component.set(
"userNotesCount",
model.get("custom_fields.user_notes_count") || 0
);
const model = args.user;
const userNotesCount = model.get("custom_fields.user_notes_count") || 0;
component.setProperties({
userNotesCount,
emojiEnabled: component.siteSettings.enable_emoji,
emojiUrl: emojiUrlFor("pencil"),
userNotesTitle: I18n.t("user_notes.show", { count: userNotesCount })
});
},
actions: {
showUserNotes() {
const store = getOwner(this).lookup("store:main");
const user = this.get("args.flaggedPost.user");
const user = this.get("args.user");
showUserNotes(store, user.id, count => this.set("userNotesCount", count));
}
}

View File

@ -0,0 +1,9 @@
{{#if userNotesCount}}
<a href {{action "showUserNotes"}} title="{{userNotesTitle}}">
{{#if emojiEnabled}}
<img src={{emojiUrl}} title={{userNotesTitle}} alt="pencil" class="emoji">
{{else}}
{{d-icon "sticky-note"}}
{{/if}}
</a>
{{/if}}

View File

@ -1,6 +0,0 @@
{{#if userNotesCount}}
{{show-user-notes
show=(action "showUserNotes")
count=userNotesCount
}}
{{/if}}

View File

@ -4,6 +4,10 @@
}
}
.show-user-notes-on-flags {
display: inline-block;
}
.modal-body.user-notes-modal {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;