mirror of
https://github.com/discourse/discourse.git
synced 2025-03-27 02:15:38 +08:00
DEV: linting of discourse-presence (#10722)
This commit is contained in:
parent
baa407fd9b
commit
4b94af077d
@ -54,7 +54,9 @@ const Presence = EmberObject.extend({
|
||||
this.channel,
|
||||
(message) => {
|
||||
const { user, state } = message;
|
||||
if (this.get("currentUser.id") === user.id) return;
|
||||
if (this.get("currentUser.id") === user.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case REPLYING:
|
||||
@ -100,7 +102,9 @@ const Presence = EmberObject.extend({
|
||||
},
|
||||
|
||||
publish(state, whisper, postId, staffOnly) {
|
||||
if (this.get("currentUser.hide_profile_and_presence")) return;
|
||||
if (this.get("currentUser.hide_profile_and_presence")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const data = {
|
||||
state,
|
||||
@ -128,7 +132,9 @@ const Presence = EmberObject.extend({
|
||||
_removeUser(user) {
|
||||
[this.users, this.editingUsers].forEach((users) => {
|
||||
const existingUser = users.findBy("id", user.id);
|
||||
if (existingUser) users.removeObject(existingUser);
|
||||
if (existingUser) {
|
||||
users.removeObject(existingUser);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -158,7 +164,9 @@ const Presence = EmberObject.extend({
|
||||
}
|
||||
|
||||
if (attrs && attrs.post_id) {
|
||||
if (u.post_id === attrs.post_id) usersLength++;
|
||||
if (u.post_id === attrs.post_id) {
|
||||
usersLength++;
|
||||
}
|
||||
} else {
|
||||
usersLength++;
|
||||
}
|
||||
|
@ -15,12 +15,16 @@ const PresenceManager = Service.extend({
|
||||
},
|
||||
|
||||
subscribe(topicId, type) {
|
||||
if (!topicId) return;
|
||||
if (!topicId) {
|
||||
return;
|
||||
}
|
||||
this._getPresence(topicId).subscribe(type);
|
||||
},
|
||||
|
||||
unsubscribe(topicId, type) {
|
||||
if (!topicId) return;
|
||||
if (!topicId) {
|
||||
return;
|
||||
}
|
||||
const presence = this._getPresence(topicId);
|
||||
|
||||
if (presence.unsubscribe(type)) {
|
||||
@ -29,17 +33,23 @@ const PresenceManager = Service.extend({
|
||||
},
|
||||
|
||||
users(topicId) {
|
||||
if (!topicId) return [];
|
||||
if (!topicId) {
|
||||
return [];
|
||||
}
|
||||
return this._getPresence(topicId).users;
|
||||
},
|
||||
|
||||
editingUsers(topicId) {
|
||||
if (!topicId) return [];
|
||||
if (!topicId) {
|
||||
return [];
|
||||
}
|
||||
return this._getPresence(topicId).editingUsers;
|
||||
},
|
||||
|
||||
publish(topicId, state, whisper, postId, staffOnly) {
|
||||
if (!topicId) return;
|
||||
if (!topicId) {
|
||||
return;
|
||||
}
|
||||
return this._getPresence(topicId).publish(
|
||||
state,
|
||||
whisper,
|
||||
|
Loading…
x
Reference in New Issue
Block a user