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

When clicking avatar, ask before starting new private conversation. #2683

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from
Open
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 @@ -65,12 +65,12 @@ export const MessageAvatar = (props: Props) => {
}

const userName = authorName || authorProfileName || sender;
const convoWithSender = getConversationController().get(sender);

const onMessageAvatarClick = useCallback(async () => {
if (isPublic && !PubKey.hasBlindedPrefix(sender)) {
// public chat but session id not blinded. disable showing user details if we do not have an active convo with that user.
// an unactive convo with that user means that we never chatted with that id directyly, but only through a sogs
const convoWithSender = getConversationController().get(sender);
if (!convoWithSender || !convoWithSender.get('active_at')) {
// for some time, we might still get some unblinded messages, as in message sent unblinded because
// * older clients still send unblinded message and those are allowed by sogs if they doesn't enforce blinding
Expand Down Expand Up @@ -101,6 +101,20 @@ export const MessageAvatar = (props: Props) => {
);

privateConvoToOpen = foundRealSessionId || privateConvoToOpen;

if (foundRealSessionId && convoWithSender.get('active_at')) {
// We know this user's real id and have an active conversation with
// him. Go to it.
await getConversationController()
.get(privateConvoToOpen)
.setOriginConversationID(selectedConvoKey);

await openConversationWithMessages({ conversationKey: privateConvoToOpen, messageId: null });

return;
}
// Public and blinded key for this message. Fall through to asking if we
// should start a conversation, which will send SOGS blinded message request.
}

await getConversationController()
Expand Down