Skip to content

Commit

Permalink
Merge pull request #11779 from nextcloud/fix/noid/update-messages-gro…
Browse files Browse the repository at this point in the history
…ups-when-removed
  • Loading branch information
DorraJaouad authored Mar 12, 2024
2 parents 9c5a927 + 0f62360 commit 264ddc1
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/components/MessagesList/MessagesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,20 @@ export default {
},

softUpdateByDateGroups(oldDateGroups, newDateGroups) {
// Check if we have this group in the old list already and it is unchanged
Object.keys(newDateGroups).forEach(dateTimestamp => {
if (oldDateGroups[dateTimestamp]) {
// the group by date has changed, we update its content (groups by author)
this.softUpdateAuthorGroups(oldDateGroups[dateTimestamp], newDateGroups[dateTimestamp], dateTimestamp)
const dateTimestamps = new Set([...Object.keys(oldDateGroups), ...Object.keys(newDateGroups)])

dateTimestamps.forEach(dateTimestamp => {
if (newDateGroups[dateTimestamp]) {
if (oldDateGroups[dateTimestamp]) {
// the group by date has changed, we update its content (groups by author)
this.softUpdateAuthorGroups(oldDateGroups[dateTimestamp], newDateGroups[dateTimestamp], dateTimestamp)
} else {
// the group is new
this.messagesGroupedByDateByAuthor[dateTimestamp] = newDateGroups[dateTimestamp]
}
} else {
// the group is new
this.messagesGroupedByDateByAuthor[dateTimestamp] = newDateGroups[dateTimestamp]
// the group is not in the new list, remove it
delete this.messagesGroupedByDateByAuthor[dateTimestamp]
}
})
},
Expand Down

0 comments on commit 264ddc1

Please sign in to comment.