Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add debug logs for unregistered label #2057

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,17 @@ export const BasicMessageComponent: React.FC<BasicMessageProps & FileActionsProp
? UserLabelType.UNREGISTERED
: null

console.log('Unregistered Debug - Basic Message', { userLabel })

const infoMessage = messageDisplayData.type === 3 // 3 stands for MessageType.Info

console.log('Unregistered Debug - Basic Message', { infoMessage })

// Grey out sender name if the first message hasn't been sent yet
const pending: boolean = pendingMessages[messageDisplayData.id] !== undefined

console.log('Unregistered Debug - Basic Message - condition to display label', userLabel && !infoMessage)

return (
<StyledListItem
className={classNames({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const UserLabel: React.FC<UserLabelProps> = ({
const isUnregistered = type === UserLabelType.UNREGISTERED
const handleOpen = isUnregistered ? unregisteredUsernameModalHandleOpen : duplicatedUsernameModalHandleOpen

console.log('Unregistered Debug - UserLabel Component', { isUnregistered })

return (
<StyledGrid>
<Grid
Expand Down
25 changes: 15 additions & 10 deletions packages/state-manager/src/sagas/users/users.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,19 @@ export const allUsers = createSelector(csrsMapping, certificatesMapping, (csrs,
const allUsernames: string[] = Object.values(csrs).map(u => u.username)
const duplicateUsernames: string[] = allUsernames.filter((val, index) => allUsernames.indexOf(val) !== index)

// Temporary backward compatiblility! Old communities do not have csrs
Object.keys(certs).map(pubKey => {
users[pubKey] = {
...certs[pubKey],
isRegistered: true,
isDuplicated: false,
pubKey,
}
console.log('Unregistered Debug - allUsers selector - certs - user', users[pubKey])
})

Object.keys(csrs).map(pubKey => {
if (users[pubKey]) return
const username = csrs[pubKey].username

let isDuplicated: boolean
Expand All @@ -89,23 +101,16 @@ export const allUsers = createSelector(csrsMapping, certificatesMapping, (csrs,
}

const isRegistered = Boolean(certs[pubKey])
console.log('Unregistered Debug - allUsers selector - csrs - certs[pubKey]', certs[pubKey])
users[pubKey] = {
...csrs[pubKey],
isRegistered,
isDuplicated,
pubKey,
}
console.log('Unregistered Debug - allUsers selector - csrs - user', users[pubKey])
})
// Temporary backward compatiblility! Old communities do not have csrs
Object.keys(certs).map(pubKey => {
if (users[pubKey]) return
users[pubKey] = {
...certs[pubKey],
isRegistered: true,
isDuplicated: false,
pubKey,
}
})

return users
})

Expand Down
Loading