mirror of
https://github.com/discourse/discourse.git
synced 2026-08-18 00:44:59 -05:00
FIX: Liked notifications should not be consolidated across multiple users.
This commit is contained in:
@@ -89,9 +89,14 @@ class PostActionNotifier
|
|||||||
user_liked_consolidated_notification =
|
user_liked_consolidated_notification =
|
||||||
user_notifications
|
user_notifications
|
||||||
.where(
|
.where(
|
||||||
"created_at > ? AND notification_type = ?",
|
"
|
||||||
|
created_at > ? AND
|
||||||
|
notification_type = ? AND
|
||||||
|
data::json ->> 'display_username' = ?
|
||||||
|
",
|
||||||
consolidation_window,
|
consolidation_window,
|
||||||
Notification.types[:liked_consolidated]
|
Notification.types[:liked_consolidated],
|
||||||
|
post_action.user.username_lower
|
||||||
)
|
)
|
||||||
.first
|
.first
|
||||||
|
|
||||||
|
|||||||
@@ -346,6 +346,21 @@ describe PostAction do
|
|||||||
expect(notification.read).to eq(false)
|
expect(notification.read).to eq(false)
|
||||||
expect(data["count"]).to eq(6)
|
expect(data["count"]).to eq(6)
|
||||||
|
|
||||||
|
# Like from a different user shouldn't be consolidated
|
||||||
|
expect do
|
||||||
|
PostAction.act(
|
||||||
|
Fabricate(:user),
|
||||||
|
Fabricate(:post, user: likee),
|
||||||
|
PostActionType.types[:like]
|
||||||
|
)
|
||||||
|
end.to change { likee.reload.notifications.count }.by(1)
|
||||||
|
|
||||||
|
notification = likee.notifications.last
|
||||||
|
|
||||||
|
expect(notification.notification_type).to eq(
|
||||||
|
Notification.types[:liked]
|
||||||
|
)
|
||||||
|
|
||||||
freeze_time(
|
freeze_time(
|
||||||
SiteSetting.likes_notification_consolidation_window_mins.minutes.since
|
SiteSetting.likes_notification_consolidation_window_mins.minutes.since
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user