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

Redact message on displayed notification #3320

Merged
merged 9 commits into from
Aug 29, 2024

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Aug 21, 2024

Content

Ensure that any message currently displayed in a notification is removed when the Event is redacted.

Note: request SDK change in matrix-org/matrix-rust-sdk#3868.

Motivation and context

Closes #3310

Screenshots / GIFs

NotificationRedaction

Tests

  • Alice send a message to Bob and Bob observes the notification
  • Alice redacts the message
  • Bob now see the the message is replaced by "Message removed" in the notification.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

@bmarty bmarty force-pushed the feature/bma/cleanNotificationOfRedactedEvent branch from 4770b4a to 32835ad Compare August 21, 2024 08:18
@@ -418,6 +418,7 @@ class DefaultNotificationCreator @Inject constructor(
event.imageUri?.let {
message.setData("image/", it)
}
message.extras.putString(MESSAGE_EVENT_ID, event.eventId.value)
Copy link
Member Author

Choose a reason for hiding this comment

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

Put the eventId into the bundle so that we may be able to find the message to redact it.

@bmarty bmarty force-pushed the feature/bma/cleanNotificationOfRedactedEvent branch from 32835ad to d867a5f Compare August 28, 2024 08:36
Copy link
Contributor

github-actions bot commented Aug 28, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/iKYYmw

Copy link

codecov bot commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 75.40984% with 30 lines in your changes missing coverage. Please review.

Project coverage is 82.66%. Comparing base (45c216c) to head (61c6607).
Report is 31 commits behind head on develop.

Files with missing lines Patch % Lines
...ibraries/push/impl/push/OnRedactedEventReceived.kt 44.44% 19 Missing and 1 partial ⚠️
...es/push/impl/notifications/NotificationRenderer.kt 81.39% 5 Missing and 3 partials ⚠️
...mpl/notifications/factories/NotificationCreator.kt 80.00% 0 Missing and 1 partial ⚠️
...oid/libraries/push/impl/push/DefaultPushHandler.kt 92.30% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3320      +/-   ##
===========================================
- Coverage    82.69%   82.66%   -0.03%     
===========================================
  Files         1681     1683       +2     
  Lines        39415    39475      +60     
  Branches      4788     4796       +8     
===========================================
+ Hits         32594    32633      +39     
- Misses        5147     5166      +19     
- Partials      1674     1676       +2     

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

@bmarty bmarty marked this pull request as ready for review August 28, 2024 09:32
@bmarty bmarty requested a review from a team as a code owner August 28, 2024 09:32
@bmarty bmarty requested review from ganfra and removed request for a team August 28, 2024 09:32
@bmarty bmarty added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Aug 28, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Aug 28, 2024
Copy link

sonarcloud bot commented Aug 28, 2024

Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

One small remark/question otherwise LGTM

@@ -94,7 +95,10 @@ private fun MessageLikeEventContent.toContent(senderId: UserId): NotificationCon
is MessageLikeEventContent.RoomMessage -> {
NotificationContent.MessageLike.RoomMessage(senderId, EventMessageMapper().mapMessageType(messageType))
}
is MessageLikeEventContent.RoomRedaction -> NotificationContent.MessageLike.RoomRedaction(redactedEventId = redactedEventId, reason = reason)
is MessageLikeEventContent.RoomRedaction -> NotificationContent.MessageLike.RoomRedaction(
redactedEventId = redactedEventId?.let(::EventId),
Copy link
Member

Choose a reason for hiding this comment

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

Maybe NotificationContent.MessageLike.RoomRedaction.redactedEventId should be an EventId instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it's the case. If you mean MessageLikeEventContent.RoomRedaction.redactedEventId it's a type from the SDK, so it's a String.

@bmarty bmarty merged commit d80f70f into develop Aug 29, 2024
23 of 25 checks passed
@bmarty bmarty deleted the feature/bma/cleanNotificationOfRedactedEvent branch August 29, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Change For updates to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redacted messages continue to show in notification previews
2 participants