DEV: Remove unnecessary logic in TopicTrackingState on the client side (#16900)

There is no need for the extra protection on the client side if there is
a bug on the server side. In fact, we want the bug to be surfaced so
that it can be fixed on the server side.
This commit is contained in:
Alan Guo Xiang Tan 2022-05-25 11:28:57 +08:00 committed by GitHub
parent 0d16d77401
commit 0b8177de54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 11 deletions

View File

@ -189,9 +189,6 @@ const TopicTrackingState = EmberObject.extend({
if (!this.newIncoming) { if (!this.newIncoming) {
return; return;
} }
if (data.payload && data.payload.archetype === "private_message") {
return;
}
const filter = this.filter; const filter = this.filter;
const filterCategory = this.filterCategory; const filterCategory = this.filterCategory;
@ -482,8 +479,6 @@ const TopicTrackingState = EmberObject.extend({
return Array.from(this.states.values()).filter( return Array.from(this.states.values()).filter(
(topic) => (topic) =>
filterFn(topic) && filterFn(topic) &&
topic.archetype !== "private_message" &&
!topic.deleted &&
(!categoryId || subcategoryIds.has(topic.category_id)) && (!categoryId || subcategoryIds.has(topic.category_id)) &&
(!tagId || (topic.tags && topic.tags.indexOf(tagId) > -1)) && (!tagId || (topic.tags && topic.tags.indexOf(tagId) > -1)) &&
(type !== "new" || (type !== "new" ||
@ -863,12 +858,10 @@ const TopicTrackingState = EmberObject.extend({
_trackedTopics(opts = {}) { _trackedTopics(opts = {}) {
return Array.from(this.states.values()) return Array.from(this.states.values())
.map((topic) => { .map((topic) => {
if (topic.archetype !== "private_message" && !topic.deleted) { let newTopic = isNew(topic);
let newTopic = isNew(topic); let unreadTopic = isUnread(topic);
let unreadTopic = isUnread(topic); if (newTopic || unreadTopic || opts.includeAll) {
if (newTopic || unreadTopic || opts.includeAll) { return { topic, newTopic, unreadTopic };
return { topic, newTopic, unreadTopic };
}
} }
}) })
.compact(); .compact();