mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Refactor composer-/topic-presence-display (#29455)
Re-land #29262 as the d-shared-edits incompatibility has now been resolved. This reverts commit a59c07fc45.
This commit is contained in:
@@ -187,6 +187,11 @@ export default class Composer extends RestModel {
|
||||
|
||||
@service dialog;
|
||||
|
||||
@tracked topic;
|
||||
@tracked post;
|
||||
@tracked reply;
|
||||
@tracked whisper;
|
||||
|
||||
unlistTopic = false;
|
||||
noBump = false;
|
||||
draftSaving = false;
|
||||
@@ -200,7 +205,6 @@ export default class Composer extends RestModel {
|
||||
@not("creatingPrivateMessage") notCreatingPrivateMessage;
|
||||
@not("privateMessage") notPrivateMessage;
|
||||
@or("creatingTopic", "editingFirstPost") topicFirstPost;
|
||||
@equal("action", REPLY) replyingToTopic;
|
||||
@equal("composeState", OPEN) viewOpen;
|
||||
@equal("composeState", DRAFT) viewDraft;
|
||||
@equal("composeState", FULLSCREEN) viewFullscreen;
|
||||
@@ -263,6 +267,14 @@ export default class Composer extends RestModel {
|
||||
return categoryId ? Category.findById(categoryId) : null;
|
||||
}
|
||||
|
||||
get replyingToTopic() {
|
||||
return this.get("action") === REPLY;
|
||||
}
|
||||
|
||||
get editingPost() {
|
||||
return isEdit(this.get("action"));
|
||||
}
|
||||
|
||||
@discourseComputed("category.minimumRequiredTags")
|
||||
minimumRequiredTags(minimumRequiredTags) {
|
||||
return minimumRequiredTags || 0;
|
||||
@@ -286,11 +298,6 @@ export default class Composer extends RestModel {
|
||||
);
|
||||
}
|
||||
|
||||
@discourseComputed("action")
|
||||
editingPost(action) {
|
||||
return isEdit(action);
|
||||
}
|
||||
|
||||
@observes("composeState")
|
||||
composeStateChanged() {
|
||||
const oldOpen = this.composerOpened;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import EmberObject, { computed } from "@ember/object";
|
||||
import { dependentKeyCompat } from "@ember/object/compat";
|
||||
import Evented from "@ember/object/evented";
|
||||
import { cancel, debounce, next, once, throttle } from "@ember/runloop";
|
||||
import Service, { service } from "@ember/service";
|
||||
@@ -108,12 +109,11 @@ class PresenceChannel extends EmberObject.extend(Evented) {
|
||||
this.trigger("change", this);
|
||||
}
|
||||
|
||||
@computed("_presenceState.users", "subscribed")
|
||||
@dependentKeyCompat
|
||||
get users() {
|
||||
if (!this.subscribed) {
|
||||
return;
|
||||
if (this.get("subscribed")) {
|
||||
return this.get("_presenceState.users");
|
||||
}
|
||||
return this._presenceState?.users;
|
||||
}
|
||||
|
||||
@computed("_presenceState.count", "subscribed")
|
||||
|
||||
@@ -34,10 +34,7 @@ export default function (helper) {
|
||||
}
|
||||
|
||||
export function getChannelInfo(name) {
|
||||
return (
|
||||
channels[name] ||
|
||||
(channels[name] = { count: 0, users: [], last_message_id: 0 })
|
||||
);
|
||||
return (channels[name] ||= { count: 0, users: [], last_message_id: 0 });
|
||||
}
|
||||
|
||||
export async function joinChannel(name, user) {
|
||||
|
||||
Reference in New Issue
Block a user