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

Insert a mention when clicking user's name in the timeline #3858

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

frebib
Copy link
Contributor

@frebib frebib commented Nov 12, 2024

Content

Clicking on a user's name in the timeline inserts a mention into the composer. Clicking on the avatar retains the old behaviour of opening the user details view.

Currently this doesn't work with the RTE due to some required changes in the RTE library that I haven't attempted yet.
One small "bug" is that the cursor is unconditionally jumped to the end of the text, not to the end of the mention (although the same happens when manually inserting a mention)

Motivation and context

By popular demand; also element-hq/element-x-ios#1527
This mirrors Element Android and Element Web behaviour.

Screenshots / GIFs

screen-20241112-124613.2.mp4

Tests

  • Step 1
  • Step 2
  • Step ...

Tested devices

  • Physical
  • Emulator
  • OS version(s): Android 15

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

Signed-off-by: Joe Groocock <me@frebib.net>
Copy link
Contributor

Thank you for your contribution! Here are a few things to check in the PR to ensure it's reviewed as quickly as possible:

  • Your branch should be based on origin/develop, at least when it was created.
  • The title of the PR will be used for release notes, so it needs to describe the change visible to the user.
  • The test pass locally running ./gradlew test.
  • The code quality check suite pass locally running ./gradlew runQualityChecks.
  • If you modified anything related to the UI, including previews, you'll have to run the Record screenshots GH action in your forked repo: that will generate compatible new screenshots. However, given Github Actions limitations, it will prevent the CI from running temporarily, until you upload a new commit after that one. To do so, just pull the latest changes and push an empty commit.

} else {
val end = markdownTextEditorState.selection.last
// Create a suggestion at the current selection (or end) so insertSuggestion() knows where to add the pill
markdownTextEditorState.currentSuggestion = Suggestion(end, end, SuggestionType.Mention, "")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This feels like a bit of a hack; not sure I like it. Maybe it would be better to move this to MarkdownTextEditorState and tidy it up a bit

@frebib frebib changed the title Insert a mention when clicking user name Insert a mention when clicking user's name in the timeline Nov 12, 2024
@frebib
Copy link
Contributor Author

frebib commented Nov 15, 2024

An issue with this that I can't work out is why focusing the composer doesn't open the onscreen keyboard 🤔

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.

1 participant