Skip to content

Visual BUG fix after adding new friend+DM#1541

Open
LW-Davide wants to merge 14 commits intospacebarchat:masterfrom
LW-Davide:master
Open

Visual BUG fix after adding new friend+DM#1541
LW-Davide wants to merge 14 commits intospacebarchat:masterfrom
LW-Davide:master

Conversation

@LW-Davide
Copy link

Visual BUG, ​​after adding a new friend and (without refreshing the page) immediately creating a DM, the displayed name is your own name instead of the other person's name

Visual BUG, ​​after adding a new friend and (without refreshing the page) immediately creating a DM, the displayed name is your own name instead of the other person's name
@LW-Davide
Copy link
Author

LW-Davide commented Feb 18, 2026

(changing the if (recipients.length === 1) ... may not be needed)

Comment on lines -497 to +502
data: channel_dto,
data: channel_dto.excludedRecipients([creator_user_id]),
user_id: creator_user_id,
});
}

if (recipients.length === 1) return channel_dto;
else return channel_dto.excludedRecipients([creator_user_id]);
if (recipients.length === 1) return channel_dto.excludedRecipients([creator_user_id]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to test, but iirc this causes discord clients to crash (they need at least one recipient)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(specifically causes a crash in case there's a DM where the other user's account has been deleted)

Copy link
Author

@LW-Davide LW-Davide Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a check in case the account is deleted, Discord doesn't like the creator to be in the recipients and causes bugs.

After adding a new friend & opening the DM:
image

(It fixes itself with a page reload, but it's still annoying)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the account is deleted, the relation will return exactly one recipient, which is exactly what this code was trying to work around iirc (as all user data is deleted together with the author)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but it's causing a bug for non-deleted users.

Also found another issue, when trying to delete an account:
update or delete on table "users" violates foreign key constraint "FK_8ff3d1961a48b693810c9f99853" on table "user_settings_protos" Key (id)=(1473723585167176120) is still referenced from table "user_settings_protos".

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's the easy solution, i think @ChrisChrome still has that in uncommitted changes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added another commit, which solves the user deletion error

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also tested the two patches, and the Discord client doesn't crash, the chat itself becomes a "self-chat" after the second user gets deleted

image

Is a "user deleted" function implemented? Or the chat should just disappear?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few commits to handle deleted users. If you can, please check them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the result on client side when a user is deleted:

DS:
image
image

Fermi:
image

This aims to fix the account deletion error.
This needs to avoid empty or self recipients in case of deleted users
This needs to avoid empty or self recipients in case of deleted users, same logic as for src/util/dtos/DmChannelDTO.ts‎
Integrating commit c671db2 from the original project, which fixes the issue: "Fix user self delete not removing settings protos"
…clients to reconnect

It tries to use Session.delete on this.session_id, but it's just a TEMP session name, so it doesn't match the one in the DB, which is this.session.session_id.

Sometimes, when your internet is unstable, it may trigger, so we give a 5-second delay to avoid false positives.
Merging with spacebarchat/spacebarchat
Merging with spacebarchat/spacebarchat
More time in case of page reload before setting the user to offline
Replicating Discord's actions when adding a friend
Merging with spacebarchat/spacebarchat
Merging with spacebarchat/spacebarchat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants