-
Notifications
You must be signed in to change notification settings - Fork 289
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
feat: introduce variations to fail to add users (WPB-2299) #15497
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,9 +38,15 @@ import {useMessageFocusedTabIndex} from './util'; | |
|
||
import {FailedToAddUsersMessage as FailedToAddUsersMessageEntity} from '../../../entity/message/FailedToAddUsersMessage'; | ||
|
||
export enum ErrorMessageType { | ||
offlineBackEnd = 'OfflineBackEnd', | ||
nonFullyConnectedGraph = 'NonFullyConnectedGraph', | ||
} | ||
|
||
export interface FailedToAddUsersMessageProps { | ||
isMessageFocused: boolean; | ||
message: FailedToAddUsersMessageEntity; | ||
errorMessageType?: ErrorMessageType; | ||
userState?: UserState; | ||
} | ||
|
||
|
@@ -49,6 +55,7 @@ const config = Config.getConfig(); | |
const FailedToAddUsersMessage: React.FC<FailedToAddUsersMessageProps> = ({ | ||
isMessageFocused, | ||
message, | ||
errorMessageType = ErrorMessageType.offlineBackEnd, | ||
userState = container.resolve(UserState), | ||
}) => { | ||
const messageFocusedTabIndex = useMessageFocusedTabIndex(isMessageFocused); | ||
|
@@ -101,15 +108,28 @@ const FailedToAddUsersMessage: React.FC<FailedToAddUsersMessageProps> = ({ | |
data-uie-name="element-message-failed-to-add-users" | ||
data-uie-value={total <= 1 ? '1-user-not-added' : 'multi-users-not-added'} | ||
> | ||
<p | ||
css={warning} | ||
dangerouslySetInnerHTML={{ | ||
__html: | ||
total <= 1 | ||
? t('failedToAddParticipant', {name: users[0].name(), domain: users[0].domain}) | ||
: t('failedToAddParticipants', {total: total.toString()}), | ||
}} | ||
/> | ||
{total <= 1 && ( | ||
<p data-uie-name="1-user-not-added-details" data-uie-value={users[0].id}> | ||
<span | ||
css={warning} | ||
dangerouslySetInnerHTML={{ | ||
__html: t(`failedToAddParticipantSingularOfflineBackEnd`, { | ||
name: users[0].name(), | ||
domain: users[0].domain, | ||
}), | ||
}} | ||
/> | ||
{learnMore} | ||
</p> | ||
)} | ||
{total > 1 && ( | ||
<p | ||
css={warning} | ||
dangerouslySetInnerHTML={{ | ||
__html: t(`failedToAddParticipantsPlural`, {total: total.toString()}), | ||
}} | ||
/> | ||
)} | ||
Comment on lines
+111
to
+132
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be simplified to just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could, I kept it the way @thisisamir98 did it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The result will be the same, I'm fine with it |
||
</div> | ||
<p className="message-body-actions"> | ||
<MessageTime | ||
|
@@ -122,41 +142,29 @@ const FailedToAddUsersMessage: React.FC<FailedToAddUsersMessageProps> = ({ | |
<div className="message-body"> | ||
{isOpen && ( | ||
<> | ||
{total <= 1 && ( | ||
Comment on lines
143
to
-125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. condition |
||
<p data-uie-name="1-user-not-added-details" data-uie-value={users[0].id}> | ||
{Object.entries(groupedUsers).map(([domain, domainUsers]) => ( | ||
<p | ||
key={domain} | ||
data-uie-name="multi-user-not-added-details" | ||
data-uie-value={domain} | ||
style={{lineHeight: 'var(--line-height-sm)'}} | ||
> | ||
<span | ||
css={warning} | ||
dangerouslySetInnerHTML={{ | ||
__html: t('failedToAddParticipantDetails', {name: users[0].name(), domain: users[0].domain}), | ||
__html: t(`failedToAddParticipantsPluralDetails${errorMessageType}`, { | ||
name: domainUsers[domainUsers.length - 1].name(), | ||
names: | ||
domainUsers.length === 2 | ||
? domainUsers[0].name() | ||
: domainUsers.map(user => user.name()).join(', '), | ||
domain, | ||
}), | ||
}} | ||
/> | ||
{learnMore} | ||
</p> | ||
)} | ||
{total > 1 && | ||
Object.entries(groupedUsers).map(([domain, domainUsers]) => ( | ||
<p | ||
key={domain} | ||
data-uie-name="multi-user-not-added-details" | ||
data-uie-value={domain} | ||
style={{lineHeight: 'var(--line-height-sm)'}} | ||
> | ||
<span | ||
css={warning} | ||
dangerouslySetInnerHTML={{ | ||
__html: t('failedToAddParticipantsDetails', { | ||
name: domainUsers[domainUsers.length - 1].name(), | ||
names: | ||
domainUsers.length === 2 | ||
? domainUsers[0].name() | ||
: domainUsers.map(user => user.name()).join(', '), | ||
domain, | ||
}), | ||
}} | ||
/> | ||
{learnMore} | ||
</p> | ||
))} | ||
))} | ||
</> | ||
)} | ||
{total > 1 && ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The different error messages are not part of the scope of the September release.
The only error message displayed stays the same as offline back-end