use app events to force refresh of specific post
This commit is contained in:
parent
5819ea4670
commit
faaa055d3e
|
@ -11,6 +11,7 @@ export default {
|
||||||
initialize(container) {
|
initialize(container) {
|
||||||
const siteSettings = container.lookup("site-settings:main");
|
const siteSettings = container.lookup("site-settings:main");
|
||||||
const currentUser = container.lookup("current-user:main");
|
const currentUser = container.lookup("current-user:main");
|
||||||
|
const appEvents = container.lookup("service:app-events");
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!siteSettings.user_notes_enabled ||
|
!siteSettings.user_notes_enabled ||
|
||||||
|
@ -100,8 +101,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
icon: "pencil-alt",
|
icon: "pencil-alt",
|
||||||
label: "user_notes.attach",
|
label: "user_notes.attach",
|
||||||
action: async (post) => {
|
action: (post) => {
|
||||||
await new Promise((resolve) => {
|
|
||||||
showUserNotes(
|
showUserNotes(
|
||||||
store,
|
store,
|
||||||
attrs.user_id,
|
attrs.user_id,
|
||||||
|
@ -109,11 +109,13 @@ export default {
|
||||||
const ucf = post.user_custom_fields || {};
|
const ucf = post.user_custom_fields || {};
|
||||||
ucf.user_notes_count = count;
|
ucf.user_notes_count = count;
|
||||||
post.set("user_custom_fields", ucf);
|
post.set("user_custom_fields", ucf);
|
||||||
resolve();
|
|
||||||
|
appEvents.trigger("post-stream:refresh", {
|
||||||
|
id: post.id,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
{ postId: attrs.id }
|
{ postId: attrs.id }
|
||||||
);
|
);
|
||||||
});
|
|
||||||
},
|
},
|
||||||
secondaryAction: "closeAdminMenu",
|
secondaryAction: "closeAdminMenu",
|
||||||
className: "add-user-note",
|
className: "add-user-note",
|
||||||
|
|
Loading…
Reference in New Issue