Fix crash when conversations have no valid participants (#10078)
* Never return empty participants for conversations Fixes #10068 * Fix client-side crash when conversations have no participants
This commit is contained in:
parent
359d26a053
commit
8e7fc7ec73
|
@ -22,7 +22,7 @@ export default class DisplayName extends React.PureComponent {
|
||||||
suffix = `+${others.size - 2}`;
|
suffix = `+${others.size - 2}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (others) {
|
if (others && others.size > 0) {
|
||||||
account = others.first();
|
account = others.first();
|
||||||
} else {
|
} else {
|
||||||
account = this.props.account;
|
account = this.props.account;
|
||||||
|
|
|
@ -326,7 +326,7 @@ class Status extends ImmutablePureComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otherAccounts) {
|
if (otherAccounts && otherAccounts.size > 0) {
|
||||||
statusAvatar = <AvatarComposite accounts={otherAccounts} size={48} />;
|
statusAvatar = <AvatarComposite accounts={otherAccounts} size={48} />;
|
||||||
} else if (account === undefined || account === null) {
|
} else if (account === undefined || account === null) {
|
||||||
statusAvatar = <Avatar account={status.get('account')} size={48} />;
|
statusAvatar = <Avatar account={status.get('account')} size={48} />;
|
||||||
|
|
|
@ -30,7 +30,8 @@ class AccountConversation < ApplicationRecord
|
||||||
if participant_account_ids.empty?
|
if participant_account_ids.empty?
|
||||||
[account]
|
[account]
|
||||||
else
|
else
|
||||||
Account.where(id: participant_account_ids)
|
participants = Account.where(id: participant_account_ids)
|
||||||
|
participants.empty? ? [account] : participants
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue