Skip to content

Commit

Permalink
Use pubkey instead of username when grouping messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkabuki committed Sep 12, 2023
1 parent 5249807 commit 71dd65d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export const currentChannelMessagesMergedBySender = createSelector(dailyGroupedC
const last = merged[index][0]

if (
last.nickname === message.nickname &&
last?.pubKey === message?.pubKey &&
message.createdAt - last.createdAt < 300 &&
message.type !== MessageType.Info &&
last.type !== MessageType.Info
Expand Down
3 changes: 2 additions & 1 deletion packages/state-manager/src/sagas/users/users.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export const allUsers = createSelector(csrsMapping, certificatesMapping, (csrs,
users[pubKey] = {
...csrs[pubKey],
isRegistered,
isDuplicated
isDuplicated,
pubKey
}
})
return users
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const displayableMessage = (message: ChannelMessage, user: User): Display
nickname: user.username,
isRegistered: user.isRegistered,
isDuplicated: user.isDuplicated,
pubKey: user.pubKey,
media: message.media,
}
}
1 change: 1 addition & 0 deletions packages/types/src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface DisplayableMessage {
media?: FileMetadata
isRegistered?: boolean
isDuplicated?: boolean
pubKey?: string
}

export type MessagesGroupsType = Record<string, DisplayableMessage[]>
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface User {
dmPublicKey: string
isRegistered?: boolean
isDuplicated?: boolean
pubKey?: string
}

export interface SendCertificatesResponse {
Expand Down

0 comments on commit 71dd65d

Please sign in to comment.