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 reply fallback leaking sender locale #1610

Merged
merged 2 commits into from
Jul 4, 2020
Merged

Fix reply fallback leaking sender locale #1610

merged 2 commits into from
Jul 4, 2020

Conversation

tulir
Copy link
Contributor

@tulir tulir commented Jul 3, 2020

This pull request fixes the privacy issue where the sender's locale leaks whenever they reply to a message. It is also more conforming to the spec, as the spec does not state that clients should translate the fallback.

Receiver-side translations should be added in #174

Signed-off-by: Tulir Asokan <tulir@maunium.net>

Pull Request Checklist

  • Changes has been tested on an Android device or Android emulator with API 16
  • UI change has been tested on both light and dark themes
  • Pull request is based on the develop branch
  • Pull request updates CHANGES.md
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

LGTM thanks for the PR. 2 remarks though

<string name="reply_to_an_image">sent an image.</string>
<string name="reply_to_a_video">sent a video.</string>
<string name="reply_to_an_audio_file">sent an audio file.</string>
<string name="reply_to_a_file">sent a file.</string>
Copy link
Member

Choose a reason for hiding this comment

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

Should be also removed from the translations file. I'm surprised that lint does not complain...

Copy link
Member

Choose a reason for hiding this comment

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

But maybe for the moment we should keep the strings, even if they are not used anymore.

Copy link
Contributor Author

@tulir tulir Jul 3, 2020

Choose a reason for hiding this comment

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

I changed the commits so all the strings are removed in a single commit (separate from the commit that fixes reply fallbacks) that can be easily reverted if needed

@@ -489,6 +487,6 @@ internal class LocalEchoEventFactory @Inject constructor(
// </blockquote>
// </mx-reply>
// No whitespace because currently breaks temporary formatted text to Span
const val REPLY_PATTERN = """<mx-reply><blockquote><a href="%s">%s</a><a href="%s">%s</a><br />%s</blockquote></mx-reply>%s"""
const val REPLY_PATTERN = """<mx-reply><blockquote><a href="%s">In reply to</a><a href="%s">%s</a><br />%s</blockquote></mx-reply>%s"""
Copy link
Member

Choose a reason for hiding this comment

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

This is not new but I think a space is missing between the two links.

Copy link
Contributor Author

@tulir tulir Jul 3, 2020

Choose a reason for hiding this comment

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

I added the space now, but is the

No whitespace because currently breaks temporary formatted text to Span

comment referring to that or something else?

Copy link
Member

Choose a reason for hiding this comment

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

No, looking at the history, it seems that before the string was defined on several lines. But I think it's ok like that.

Copy link
Member

Choose a reason for hiding this comment

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

(thanks)

tulir added 2 commits July 3, 2020 23:12
Signed-off-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Tulir Asokan <tulir@maunium.net>
@bmarty bmarty merged commit a1dc383 into element-hq:develop Jul 4, 2020
@tulir tulir deleted the fix-reply-fallback branch July 4, 2020 10:23
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