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

Fix bug displaying user ID when quoting own message #1332

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class QuoteView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
// Author
val author = contactDb.getContactWithSessionID(authorPublicKey)
val localNumber = TextSecurePreferences.getLocalNumber(context)
val quoteIsLocalUser = localNumber != null && localNumber == author?.sessionID
val quoteIsLocalUser = localNumber != null && author == null
Copy link

Choose a reason for hiding this comment

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

I think the issue originally arose from the author (Contact) being null, since we are no longer storing a contact for our own user anymore. Although I'm not sure the other cases where the call to get the contact with a session ID will return null either, in the case that the contact is deleted for some reason, or maybe you only receive messages which include quotes from messages that no longer exist (so wouldn't have stored a contact against the original message?)

It might be more effective to compare localNumber != null && authorPublicKey == localNumber, although I'm not sure what would happen in the case of blinded messages in an open group server conversation. But probably a safer comparison than the case where the author is null. Thanks for tracking down and fixing this issue!

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your suggestion. Sounds good, I'm going to try this later today!

Copy link
Author

Choose a reason for hiding this comment

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

Sorry for taking so long. I finally got to test this and it works. It seems your solution is better, so I'm going to implement this. Thanks for your suggestion


val authorDisplayName =
if (quoteIsLocalUser) context.getString(R.string.QuoteView_you)
Expand Down