Skip to content

Commit 5d677d8

Browse files
ClearlyClaireGargron
authored andcommitted
Fix crash when conversations have no valid participants (mastodon#10078)
* Never return empty participants for conversations Fixes mastodon#10068 * Fix client-side crash when conversations have no participants
1 parent ce07ada commit 5d677d8

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

app/javascript/mastodon/components/display_name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class DisplayName extends React.PureComponent {
2222
suffix = `+${others.size - 2}`;
2323
}
2424
} else {
25-
if (others) {
25+
if (others && others.size > 0) {
2626
account = others.first();
2727
} else {
2828
account = this.props.account;

app/javascript/mastodon/components/status.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ class Status extends ImmutablePureComponent {
326326
);
327327
}
328328

329-
if (otherAccounts) {
329+
if (otherAccounts && otherAccounts.size > 0) {
330330
statusAvatar = <AvatarComposite accounts={otherAccounts} size={48} />;
331331
} else if (account === undefined || account === null) {
332332
statusAvatar = <Avatar account={status.get('account')} size={48} />;

app/models/account_conversation.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def participant_accounts
3030
if participant_account_ids.empty?
3131
[account]
3232
else
33-
Account.where(id: participant_account_ids)
33+
participants = Account.where(id: participant_account_ids)
34+
participants.empty? ? [account] : participants
3435
end
3536
end
3637

0 commit comments

Comments
 (0)