mirror of
https://github.com/discourse/discourse.git
synced 2025-06-08 00:27:32 +08:00
FIX: discourse-presence breaks composer for users.
This commit is contained in:
@ -24,7 +24,7 @@ export default Component.extend({
|
|||||||
|
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
subscribe() {
|
subscribe() {
|
||||||
this.presenceManager && this.presenceManager.subscribe();
|
this.presenceManager.subscribe();
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
@ -44,7 +44,6 @@ export default Component.extend({
|
|||||||
|
|
||||||
@observes("reply", "title")
|
@observes("reply", "title")
|
||||||
typing() {
|
typing() {
|
||||||
if (this.presenceManager) {
|
|
||||||
let action = this.action;
|
let action = this.action;
|
||||||
|
|
||||||
if (action !== REPLY && action !== EDIT) {
|
if (action !== REPLY && action !== EDIT) {
|
||||||
@ -58,7 +57,6 @@ export default Component.extend({
|
|||||||
this.whisper,
|
this.whisper,
|
||||||
action === EDIT ? postId : undefined
|
action === EDIT ? postId : undefined
|
||||||
);
|
);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes("whisper")
|
@observes("whisper")
|
||||||
@ -68,17 +66,15 @@ export default Component.extend({
|
|||||||
|
|
||||||
@observes("post.id")
|
@observes("post.id")
|
||||||
stopEditing() {
|
stopEditing() {
|
||||||
if (this.presenceManager && !this.get("post.id")) {
|
if (!this.get("post.id")) {
|
||||||
this.presenceManager.publish(CLOSED, this.whisper);
|
this.presenceManager.publish(CLOSED, this.whisper);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@on("willDestroyElement")
|
@on("willDestroyElement")
|
||||||
composerClosing() {
|
composerClosing() {
|
||||||
if (this.presenceManager) {
|
|
||||||
this._cancelThrottle();
|
this._cancelThrottle();
|
||||||
this.presenceManager.publish(CLOSED, this.whisper);
|
this.presenceManager.publish(CLOSED, this.whisper);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_cancelThrottle() {
|
_cancelThrottle() {
|
||||||
|
@ -11,11 +11,11 @@ export default Component.extend({
|
|||||||
|
|
||||||
@on("didInsertElement")
|
@on("didInsertElement")
|
||||||
subscribe() {
|
subscribe() {
|
||||||
this.presenceManager && this.presenceManager.subscribe();
|
this.presenceManager.subscribe();
|
||||||
},
|
},
|
||||||
|
|
||||||
@on("willDestroyElement")
|
@on("willDestroyElement")
|
||||||
_destroyed() {
|
_destroyed() {
|
||||||
this.presenceManager && this.presenceManager.unsubscribe();
|
this.presenceManager.unsubscribe();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -97,6 +97,8 @@ const PresenceManager = EmberObject.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
publish(state, whisper, postId) {
|
publish(state, whisper, postId) {
|
||||||
|
if (this.get("currentUser.hide_profile_and_presence")) return;
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
state,
|
state,
|
||||||
topic_id: this.get("topic.id")
|
topic_id: this.get("topic.id")
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
export default {
|
export default {
|
||||||
shouldRender(_, ctx) {
|
shouldRender(args, component) {
|
||||||
return ctx.siteSettings.presence_enabled;
|
return (
|
||||||
|
component.siteSettings.presence_enabled &&
|
||||||
|
args.model.topic &&
|
||||||
|
args.model.topic.presenceManager
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
export default {
|
export default {
|
||||||
shouldRender(_, ctx) {
|
shouldRender(args, component) {
|
||||||
return ctx.siteSettings.presence_enabled;
|
return (
|
||||||
|
component.siteSettings.presence_enabled && args.model.presenceManager
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,7 @@ function initializeDiscoursePresence(api) {
|
|||||||
const currentUser = api.getCurrentUser();
|
const currentUser = api.getCurrentUser();
|
||||||
const siteSettings = api.container.lookup("site-settings:main");
|
const siteSettings = api.container.lookup("site-settings:main");
|
||||||
|
|
||||||
if (currentUser && !currentUser.hide_profile_and_presence) {
|
if (currentUser) {
|
||||||
api.modifyClass("model:topic", {
|
api.modifyClass("model:topic", {
|
||||||
presenceManager: null
|
presenceManager: null
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user