This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/app/initializers/subscribe-user-changes.js
Bianca Nenciu 760c9a5698
FEATURE: Show draft count in user menu and activity (#13812)
This commit adds the number of drafts a user has next to the "Draft"
label in the user preferences menu and activity tab. The count is
updated via MessageBus when a draft is created or destroyed.
2021-07-27 14:05:33 +03:00

16 lines
330 B
JavaScript

export default {
name: "subscribe-user-changes",
after: "message-bus",
initialize(container) {
const user = container.lookup("current-user:main");
if (user) {
const bus = container.lookup("message-bus:main");
bus.subscribe("/user", (data) => {
user.setProperties(data);
});
}
},
};