Skip to content

Reply action: harmonize condition #1271

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

Merged
merged 4 commits into from
Sep 12, 2023
Merged

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Sep 11, 2023

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Harmonize condition to enable or disable reply action.

Motivation and context

Closes #1173

Screenshots / GIFs

Tests

  • Create a poll and try to reply it with a swipe gesture. Before: it's possible. After: not possible to swipe.
  • In a room with no write power level, long click on a message. Before: Reply action is there. After: it's not there.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@bmarty bmarty requested a review from a team as a code owner September 11, 2023 14:39
@bmarty bmarty requested review from jmartinesp and removed request for a team September 11, 2023 14:39
add(TimelineItemAction.Reply)
if (userCanSendMessage) {
add(TimelineItemAction.Reply)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is fix 1

@@ -189,7 +190,7 @@ fun TimelineItemRow(
TimelineItemEventRow(
event = timelineItem,
isHighlighted = highlightedItem == timelineItem.identifier(),
canReply = canReply,
canReply = userHasPermissionToSendMessage && timelineItem.content.canBeReplied(),
Copy link
Member Author

Choose a reason for hiding this comment

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

This is fix 2

@github-actions
Copy link
Contributor

github-actions bot commented Sep 11, 2023

📱 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/rS1h4c

@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Patch coverage: 72.06% and project coverage change: +0.24% 🎉

Comparison is base (e6ecedf) 57.42% compared to head (e3d2fe9) 57.66%.
Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1271      +/-   ##
===========================================
+ Coverage    57.42%   57.66%   +0.24%     
===========================================
  Files         1086     1087       +1     
  Lines        28270    28570     +300     
  Branches      5806     5857      +51     
===========================================
+ Hits         16234    16475     +241     
- Misses        9495     9525      +30     
- Partials      2541     2570      +29     
Files Changed Coverage Δ
...ent/android/features/messages/impl/MessagesView.kt 58.20% <0.00%> (-1.19%) ⬇️
...id/features/messages/impl/timeline/TimelineView.kt 44.17% <0.00%> (-0.62%) ⬇️
...oid/libraries/designsystem/preview/PreviewGroup.kt 0.00% <ø> (ø)
...networkmonitor/api/ui/ConnectivityIndicatorView.kt 71.42% <63.63%> (-2.39%) ⬇️
...eatures/roomlist/impl/components/RoomListTopBar.kt 62.96% <68.35%> (+13.66%) ⬆️
...android/libraries/designsystem/components/Bloom.kt 75.00% <75.00%> (ø)
...ent/android/features/roomlist/impl/RoomListView.kt 56.77% <85.71%> (-0.24%) ⬇️
...tures/messages/impl/actionlist/ActionListEvents.kt 100.00% <100.00%> (ø)
...es/messages/impl/actionlist/ActionListPresenter.kt 82.35% <100.00%> (+0.53%) ⬆️
...atures/messages/impl/timeline/TimelinePresenter.kt 91.78% <100.00%> (ø)
... and 4 more

... and 7 files with indirect coverage changes

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

Copy link
Member

@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, a minor comment.

@@ -101,7 +103,8 @@ class ActionListPresenter @Inject constructor(
buildList {
val isMineOrCanRedact = timelineItem.isMine || userCanRedact

// TODO Poll: Reply to poll
// TODO Poll: Reply to poll. Ensure to update `fun TimelineItemEventContent.canBeReplied()`
Copy link
Member

Choose a reason for hiding this comment

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

👌

* Determine if the event content can be replied to.
* Note: it should match the logic in [io.element.android.features.messages.impl.actionlist.ActionListPresenter].
*/
fun TimelineItemEventContent.canBeReplied(): Boolean =
Copy link
Member

Choose a reason for hiding this comment

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

Nit: it should probably be canBeRepliedTo.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bmarty bmarty merged commit 05a3b64 into develop Sep 12, 2023
@bmarty bmarty deleted the feature/bma/replyCondition branch September 12, 2023 13:13
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

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.

Reply action: harmonize condition
2 participants