DEV: Remove unused attributes when publishing read/new.

This commit is contained in:
Alan Guo Xiang Tan 2021-08-06 15:29:35 +08:00
parent 8e45fdfbb1
commit e157925308
2 changed files with 6 additions and 13 deletions

View File

@ -417,7 +417,6 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
topic_id: 111, topic_id: 111,
message_type: "unread", message_type: "unread",
payload: { payload: {
topic_id: 111,
category_id: 123, category_id: 123,
topic_tag_ids: [44], topic_tag_ids: [44],
tags: ["pending"], tags: ["pending"],
@ -479,7 +478,6 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
assert.deepEqual( assert.deepEqual(
trackingState.findState(111), trackingState.findState(111),
{ {
topic_id: 111,
category_id: 123, category_id: 123,
topic_tag_ids: [44], topic_tag_ids: [44],
tags: ["pending"], tags: ["pending"],
@ -543,7 +541,6 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
message_type: "read", message_type: "read",
topic_id: 112, topic_id: 112,
payload: { payload: {
topic_id: 112,
last_read_post_number: 4, last_read_post_number: 4,
highest_post_number: 4, highest_post_number: 4,
notification_level: NotificationLevels.TRACKING, notification_level: NotificationLevels.TRACKING,
@ -575,7 +572,6 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
topic_id: 222, topic_id: 222,
message_type: "new_topic", message_type: "new_topic",
payload: { payload: {
topic_id: 222,
category_id: 123, category_id: 123,
topic_tag_ids: [44], topic_tag_ids: [44],
tags: ["pending"], tags: ["pending"],
@ -648,7 +644,6 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
assert.deepEqual( assert.deepEqual(
trackingState.findState(222), trackingState.findState(222),
{ {
topic_id: 222,
category_id: 123, category_id: 123,
topic_tag_ids: [44], topic_tag_ids: [44],
tags: ["pending"], tags: ["pending"],
@ -764,17 +759,17 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
trackingState.notifyIncoming({ trackingState.notifyIncoming({
message_type: "new_topic", message_type: "new_topic",
topic_id: 1, topic_id: 1,
payload: { category_id: 2, topic_id: 1 }, payload: { category_id: 2 },
}); });
trackingState.notifyIncoming({ trackingState.notifyIncoming({
message_type: "new_topic", message_type: "new_topic",
topic_id: 2, topic_id: 2,
payload: { category_id: 3, topic_id: 2 }, payload: { category_id: 3 },
}); });
trackingState.notifyIncoming({ trackingState.notifyIncoming({
message_type: "new_topic", message_type: "new_topic",
topic_id: 3, topic_id: 3,
payload: { category_id: 1, topic_id: 3 }, payload: { category_id: 1 },
}); });
assert.equal( assert.equal(
@ -789,17 +784,17 @@ discourseModule("Unit | Model | topic-tracking-state", function (hooks) {
trackingState.notifyIncoming({ trackingState.notifyIncoming({
message_type: "new_topic", message_type: "new_topic",
topic_id: 1, topic_id: 1,
payload: { category_id: 2, topic_id: 1 }, payload: { category_id: 2 },
}); });
trackingState.notifyIncoming({ trackingState.notifyIncoming({
message_type: "new_topic", message_type: "new_topic",
topic_id: 2, topic_id: 2,
payload: { category_id: 3, topic_id: 2 }, payload: { category_id: 3 },
}); });
trackingState.notifyIncoming({ trackingState.notifyIncoming({
message_type: "new_topic", message_type: "new_topic",
topic_id: 3, topic_id: 3,
payload: { category_id: 1, topic_id: 3 }, payload: { category_id: 1 },
}); });
assert.equal( assert.equal(

View File

@ -52,7 +52,6 @@ class TopicTrackingState
last_read_post_number: nil, last_read_post_number: nil,
highest_post_number: 1, highest_post_number: 1,
created_at: topic.created_at, created_at: topic.created_at,
topic_id: topic.id,
category_id: topic.category_id, category_id: topic.category_id,
archetype: topic.archetype, archetype: topic.archetype,
created_in_new_period: true created_in_new_period: true
@ -237,7 +236,6 @@ class TopicTrackingState
payload: { payload: {
last_read_post_number: last_read_post_number, last_read_post_number: last_read_post_number,
highest_post_number: highest_post_number, highest_post_number: highest_post_number,
topic_id: topic_id,
notification_level: notification_level notification_level: notification_level
} }
} }