
NotificationMail: Fix incorrect order of messages
The order of messages of merged notification was incorrectly reversed. This bug was caused by 96f7a52.
@ff9319d53dc4daee327161e7f4965c3a75e0dff8
--- app/models/NotificationMail.java
+++ app/models/NotificationMail.java
... | ... | @@ -274,7 +274,7 @@ |
274 | 274 |
Set<User> commentReceivers = event.findReceivers(); |
275 | 275 |
|
276 | 276 |
if (ObjectUtils.equals(stateReceivers, commentReceivers)) { |
277 |
- stateChangedEvent.merge(event); |
|
277 |
+ stateChangedEvent.getMessageSources().add(0, event); |
|
278 | 278 |
// No need to add the current event because it was merged. |
279 | 279 |
continue; |
280 | 280 |
} else { |
... | ... | @@ -285,6 +285,7 @@ |
285 | 285 |
// a. the notification of both of state-change and comment |
286 | 286 |
Set<User> intersect = new HashSet<>( |
287 | 287 |
CollectionUtils.intersection(stateReceivers, commentReceivers)); |
288 |
+ |
|
288 | 289 |
MergedNotificationEvent mergedEvent = new MergedNotificationEvent( |
289 | 290 |
stateChangedEvent, Arrays.asList(event, stateChangedEvent)); |
290 | 291 |
mergedEvent.setReceivers(intersect); |
--- app/notification/MergedNotificationEvent.java
+++ app/notification/MergedNotificationEvent.java
... | ... | @@ -38,7 +38,7 @@ |
38 | 38 |
public MergedNotificationEvent(@Nonnull INotificationEvent main, |
39 | 39 |
@Nonnull List<INotificationEvent> messageSources) { |
40 | 40 |
this.main = main; |
41 |
- this.messageSources = new ArrayList<>(messageSources); |
|
41 |
+ this.messageSources = new LinkedList<>(messageSources); |
|
42 | 42 |
} |
43 | 43 |
|
44 | 44 |
public MergedNotificationEvent(@Nonnull INotificationEvent main) { |
... | ... | @@ -113,7 +113,7 @@ |
113 | 113 |
this.receivers = receivers; |
114 | 114 |
} |
115 | 115 |
|
116 |
- public void merge(INotificationEvent event) { |
|
117 |
- this.messageSources.add(event); |
|
116 |
+ public List<INotificationEvent> getMessageSources() { |
|
117 |
+ return messageSources; |
|
118 | 118 |
} |
119 | 119 |
} |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?