From e1579253082b0ed270b8e38d3d0033c2d3071358 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Fri, 6 Aug 2021 15:29:35 +0800 Subject: [PATCH] DEV: Remove unused attributes when publishing read/new. --- .../unit/models/topic-tracking-state-test.js | 17 ++++++----------- app/models/topic_tracking_state.rb | 2 -- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js b/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js index 83cf49e7027..c910a3c6a58 100644 --- a/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js +++ b/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js @@ -417,7 +417,6 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) { topic_id: 111, message_type: "unread", payload: { - topic_id: 111, category_id: 123, topic_tag_ids: [44], tags: ["pending"], @@ -479,7 +478,6 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) { assert.deepEqual( trackingState.findState(111), { - topic_id: 111, category_id: 123, topic_tag_ids: [44], tags: ["pending"], @@ -543,7 +541,6 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) { message_type: "read", topic_id: 112, payload: { - topic_id: 112, last_read_post_number: 4, highest_post_number: 4, notification_level: NotificationLevels.TRACKING, @@ -575,7 +572,6 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) { topic_id: 222, message_type: "new_topic", payload: { - topic_id: 222, category_id: 123, topic_tag_ids: [44], tags: ["pending"], @@ -648,7 +644,6 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) { assert.deepEqual( trackingState.findState(222), { - topic_id: 222, category_id: 123, topic_tag_ids: [44], tags: ["pending"], @@ -764,17 +759,17 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) { trackingState.notifyIncoming({ message_type: "new_topic", topic_id: 1, - payload: { category_id: 2, topic_id: 1 }, + payload: { category_id: 2 }, }); trackingState.notifyIncoming({ message_type: "new_topic", topic_id: 2, - payload: { category_id: 3, topic_id: 2 }, + payload: { category_id: 3 }, }); trackingState.notifyIncoming({ message_type: "new_topic", topic_id: 3, - payload: { category_id: 1, topic_id: 3 }, + payload: { category_id: 1 }, }); assert.equal( @@ -789,17 +784,17 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) { trackingState.notifyIncoming({ message_type: "new_topic", topic_id: 1, - payload: { category_id: 2, topic_id: 1 }, + payload: { category_id: 2 }, }); trackingState.notifyIncoming({ message_type: "new_topic", topic_id: 2, - payload: { category_id: 3, topic_id: 2 }, + payload: { category_id: 3 }, }); trackingState.notifyIncoming({ message_type: "new_topic", topic_id: 3, - payload: { category_id: 1, topic_id: 3 }, + payload: { category_id: 1 }, }); assert.equal( diff --git a/app/models/topic_tracking_state.rb b/app/models/topic_tracking_state.rb index 15199c9745c..e5ea071b426 100644 --- a/app/models/topic_tracking_state.rb +++ b/app/models/topic_tracking_state.rb @@ -52,7 +52,6 @@ class TopicTrackingState last_read_post_number: nil, highest_post_number: 1, created_at: topic.created_at, - topic_id: topic.id, category_id: topic.category_id, archetype: topic.archetype, created_in_new_period: true @@ -237,7 +236,6 @@ class TopicTrackingState payload: { last_read_post_number: last_read_post_number, highest_post_number: highest_post_number, - topic_id: topic_id, notification_level: notification_level } }