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,
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(

View File

@ -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
}
}