-
Notifications
You must be signed in to change notification settings - Fork 177
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
Restore intentional mentions in the markdown/plain text editor #3193
Restore intentional mentions in the markdown/plain text editor #3193
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3193 +/- ##
===========================================
+ Coverage 76.12% 76.15% +0.02%
===========================================
Files 1643 1645 +2
Lines 38668 38738 +70
Branches 7475 7496 +21
===========================================
+ Hits 29437 29501 +64
- Misses 5341 5343 +2
- Partials 3890 3894 +4 ☔ View full report in Codecov by Sentry. |
@@ -397,7 +402,22 @@ class MessageComposerPresenter @Inject constructor( | |||
canCreatePoll = canCreatePoll.value, | |||
attachmentsState = attachmentsState.value, | |||
memberSuggestions = memberSuggestions.toPersistentList(), | |||
eventSink = { handleEvents(it) } | |||
resolveMentionDisplay = remember(mentionSpanTheme) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just put that in a val before the actual creation of the MessageComposerState?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a remembered lambda, you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean I just prefer not creating instances in the state constuctor, should just map values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 small remarks, otherwise LGTM
val pillified = helper.pillify(text) | ||
val mentionSpans = pillified.getMentionSpans() | ||
assertThat(mentionSpans).hasSize(1) | ||
assertThat(mentionSpans.firstOrNull()?.type).isEqualTo(MentionSpan.Type.USER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change to this? mentionsSpans.firstOrNull()?.let { assertThat(...)....}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not equivalent test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion error wouldn't be the same, but we have the hasSize()
check before. I could also either extract the value to a variable and keep it nullable or use first()
instead and have the tests crash in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd vote for using first()
, it will not crash since line 52 is checking for the collection size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sorry that was what I had in mind, not firstOrNull
|
Content
TextPillificationHelper
to add pills to existing MD text by using regexes searching for raw ids and links pointing to permalinks with ids.MentionSpanProvider
intoMentionSpanProvider
andMentionSpanTheme
, which contains the info about colors, typography and spacing to use inMentionSpan
.MentionSpan
so those values can be update after the span creation.Motivation and context
Fixes #2966
Screenshots / GIFs
No UI changes, I just renamed a preview.
Tests
@room and @someotheruser
.Tested devices
Checklist