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

[Technical] Open stickers using the thumbnail url if the main url is empty #2157

Merged
merged 3 commits into from
Jan 4, 2024

Conversation

surakin
Copy link
Contributor

@surakin surakin commented Jan 3, 2024

This is a workaround for matrix-org/matrix-spec#1667

Several bridges (see mautrix/whatsapp#680) correctly send stickers as encrypted images but the spec doesn't cover that and the Rust SDK fails to parse them unless the url field is there (it can be an empty string)

This change makes sure the media viewer opens the sticker using the thumbnail url (if present) and it does not open if not (instead of trying to load an empty url and end with an error message)

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Use the thumbnail url if the event's main url is empty

Motivation and context

Adding the real url might confuse other clients.

Screenshots / GIFs

Tests

  • Bridge a sticker from whatsapp/telegram/signal with the patch that adds the url field
    OR
    Copy the event and send it to a room manually adding the url field
  • See the sticker, click it, it opens

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

…rl is an empty string

Signed-off-by: Marco Antonio Alvarez <surakin@gmail.com>
Signed-off-by: Marco Antonio Alvarez <surakin@gmail.com>
@surakin surakin requested a review from a team as a code owner January 3, 2024 18:30
@surakin surakin requested review from jmartinesp and removed request for a team January 3, 2024 18:30
@surakin
Copy link
Contributor Author

surakin commented Jan 3, 2024

Did I break the Community PR notice? :P

Signed-off-by: Marco Antonio Alvarez <surakin@gmail.com>
Copy link

codecov bot commented Jan 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4f6c742) 66.97% compared to head (f0baf9e) 66.97%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2157   +/-   ##
========================================
  Coverage    66.97%   66.97%           
========================================
  Files         1375     1375           
  Lines        34221    34219    -2     
  Branches      7545     7544    -1     
========================================
  Hits         22919    22919           
+ Misses        7664     7663    -1     
+ Partials      3638     3637    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jmartinesp jmartinesp added Run-Maestro Starts a Maestro Cloud session to run integration tests and removed Run-Maestro Starts a Maestro Cloud session to run integration tests labels Jan 4, 2024
Copy link
Contributor

@jmartinesp jmartinesp 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 fix!

@jmartinesp jmartinesp merged commit a81fddd into element-hq:develop Jan 4, 2024
14 of 15 checks passed
@surakin surakin deleted the sticker-preview branch January 4, 2024 08:41
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.

None yet

2 participants