Skip to content

Commit

Permalink
feat:cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacper-RF committed Oct 23, 2023
1 parent 01fe113 commit cf65743
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
8 changes: 4 additions & 4 deletions packages/common/src/transformUserInfoMessages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('transformUserInfoMessages', () => {
pubKey: 'pubKey',
}

const transformedMessage = transformUserInfoMessages(ownerNickname, communityName, userNickname, message)
const transformedMessage = transformUserInfoMessages(userNickname, message)
const expectedTransformedMessage = {
id: 'id',
type: 3,
Expand All @@ -46,7 +46,7 @@ describe('transformUserInfoMessages', () => {
signature: 'sig',
}

const transformedMessage = transformUserInfoMessages(ownerNickname, communityName, userNickname, message, true)
const transformedMessage = transformUserInfoMessages(userNickname, message, true)

const expectedTransformedMessage = {
id: 'id',
Expand All @@ -73,7 +73,7 @@ describe('transformUserInfoMessages', () => {
pubKey: 'pubKey',
}

const transformedMessage = transformUserInfoMessages(ownerNickname, communityName, userNickname, message)
const transformedMessage = transformUserInfoMessages(userNickname, message)

const expectedTransformedMessage = {
id: 'id',
Expand Down Expand Up @@ -102,7 +102,7 @@ describe('transformUserInfoMessages', () => {
pubKey: 'pubKey',
}

const transformedMessage = transformUserInfoMessages(ownerNickname, communityName, userNickname, message)
const transformedMessage = transformUserInfoMessages(userNickname, message)
const expectedTransformedMessage = {
id: 'id',
type: 3,
Expand Down
2 changes: 0 additions & 2 deletions packages/common/src/transformUserInfoMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { ChannelMessage, DisplayableMessage, InfoMessagesType, MessageType } fro
type MessageVariants = DisplayableMessage | ChannelMessage

export function transformUserInfoMessages<T extends MessageVariants>(
ownerNickname: string,
communityName: string,
userNickname: string,
message: T,
isForNotification = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export const BasicMessageComponent: React.FC<BasicMessageProps & FileActionsProp
const downloadStatus = downloadStatuses[message.id]

if (message.type === MessageType.Info && message.nickname !== ownerNickname) {
message = transformUserInfoMessages(ownerNickname, communityName, message.nickname, message)
message = transformUserInfoMessages(message.nickname, message)
if (message.message === '') return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ export function* displayMessageNotificationSaga(
if (message.type === MessageType.Info && sender !== ownerNickname) {
message = yield* call<typeof transformUserInfoMessages<ChannelMessage>>(
transformUserInfoMessages,
ownerNickname || 'owner',
currentCommunity?.name || '',
sender,
message,
true
Expand Down

0 comments on commit cf65743

Please sign in to comment.