feat(timeline): Expose method to send galleries in matrix-sdk-ui#5125
feat(timeline): Expose method to send galleries in matrix-sdk-ui#5125bnjbvr merged 16 commits intomatrix-org:mainfrom
Conversation
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5125 +/- ##
==========================================
- Coverage 85.90% 85.88% -0.02%
==========================================
Files 335 335
Lines 36511 36522 +11
==========================================
+ Hits 31364 31367 +3
- Misses 5147 5155 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| // Eventually, the media is updated with the final MXC IDs… | ||
| sleep(Duration::from_secs(2)).await; |
There was a problem hiding this comment.
Do we need the sleep, considering that below we're using assert_let_timeout! (which can be configured with a higher timeout than the default)?
There was a problem hiding this comment.
Interestingly I have to use 3 seconds inside assert_let_timeout to replace the 2 seconds from sleep but this still feels better because the code is shorter.
There was a problem hiding this comment.
Oh, looks like the sleepdelay was just increased from 2 to 4 seconds in 8a5d4f0.
| | MessageType::Video(_) | ||
| | MessageType::VerificationRequest(_) => true, | ||
| #[cfg(feature = "unstable-msc4274")] | ||
| MessageType::Gallery(_) => false, |
There was a problem hiding this comment.
I think this should be true, so as to display galleries by default. Wouldn't this make the test you've added fail, since it'd filter out the gallery event from rendering into an item? Maybe that's why CI's failing now.
There was a problem hiding this comment.
Oh, right! 🤦♂️
Have switched it around. It didn't seem to affect the test, however, which is mildly concerning. 🤔
There was a problem hiding this comment.
The test is likely not running; investigating.
There was a problem hiding this comment.
Hah:
- CI didn't run the test because the feature flag isn't ever enabled for the UI crate. I think we could decide that we support galleries by default in the timeline, so we could get rid of it now. Alternatively, we could enable the feature just a bit ahead of time in the FFI layer
Cargo.toml, so that it's enabled workspace-wide, and included in testing. I think the latter would be great, since the FFI layer likely will want it anyways. - @stefanceriu and I noticed a bug that local echoes never get filtered out based on content, and this is what's happening here, since the current is sending a gallery. Can you add, in this test or another one, a gallery message received via sync from another user, so we can make sure that the filtering actually works? (and temporarily revert the patch that switched this from false to true, to make sure it does filter? no need to add a specific test for the filtering)
There was a problem hiding this comment.
Oh! 🤯
Ok, I hope I got all of this right. The test now does fail for me also locally (with the erroneous false). When I switch back to true, it succeeds.
There was a problem hiding this comment.
Does it? Looks like it's the sending of the media gallery that fails, not the filtering out…
There was a problem hiding this comment.
Oh, you're right. 🤦♂️ Ok, will have to look into what's going on there now. 🤔
There was a problem hiding this comment.
Looks like the media config requests need mocking after merging in main. Added those and switched back to false so the CI should now fail timing out waiting for the sent gallery.
There was a problem hiding this comment.
Thanks, it seems to be failing as intended now: no item is pushed, while we expected one 🥳 Good job making the test meaningful and winning over CI!
There was a problem hiding this comment.
Lets hope it actually turns green now. 😅🤞
Yes indeed, there's one more PR needed to expose galleries on the FFI layer. I just tried to keep this one here as small as possible because the other one will probably have some lengthy mapping to FFI types again. 🙈 |
bnjbvr
left a comment
There was a problem hiding this comment.
Requesting changes, because of the latest in-thread comment i've posted, to be super explicit. Let's test this in CI! :)
|
Thanks @Johennes, and great job as usual! |
Addendum to #5125 to allow sending galleries from the FFI crate. This is the final PR for galleries (apart from possible enhancements to report the upload status in #5008). This is somewhat lengthy again, apologies. Most of the changes are just wrappers and type mapping, however. So I was hoping that it's relatively straightforward to review in bulk. Happy to try and elaborate on the changes or break them up into smaller commits if that helps, however. --------- Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
This was broken out of #4838 and is a step towards implementing matrix-org/matrix-spec-proposals#4274. Building upon #4977, a new method
Timeline::send_galleryin matrix-sdk-ui for sending galleries.