Skip to content
This repository was archived by the owner on Sep 27, 2024. It is now read-only.

Integrate mention parsing #719

Merged
merged 56 commits into from
Jun 16, 2023
Merged

Conversation

artcodespace
Copy link
Contributor

@artcodespace artcodespace commented Jun 13, 2023

This PR integrates the new parsing functions in the following ways:

  • adds an is_valid_uri helper function to the matrix_mentions crate
  • updates the MentionNode type quite a bit to accommodate the parsing changes
  • updates the output as html/md of the MentionNode to address eg using mx_id inside room mentions and in markdown output
  • enables us to detect when a link is a mention (for editing messages etc)
  • updates tests where required
  • enables the matrix mention parsing to handle non matrix permalinks

This will close the outstanding points on #679 , namely

replace the inner text of a room mention link with the mxId (think this is what the spec dictates, should this be the same for users?)
Markdown output (to attach to body)

replace mention link representations with just the mxId, prefixed with @ or # as appropriate

Closes #679

@artcodespace artcodespace force-pushed the alunturner/integrate-mention-parsing branch from 7e07d89 to 1e2b95f Compare June 13, 2023 16:43
@artcodespace artcodespace marked this pull request as ready for review June 14, 2023 12:15
@artcodespace artcodespace requested a review from a team June 14, 2023 13:08
@codecov-commenter
Copy link

codecov-commenter commented Jun 14, 2023

Codecov Report

Patch coverage: 68.32% and project coverage change: +1.20 🎉

Comparison is base (4712ec2) 88.56% compared to head (4028efc) 89.76%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #719      +/-   ##
============================================
+ Coverage     88.56%   89.76%   +1.20%     
============================================
  Files           148       83      -65     
  Lines         17228    14617    -2611     
  Branches        789        0     -789     
============================================
- Hits          15258    13121    -2137     
+ Misses         1780     1496     -284     
+ Partials        190        0     -190     
Flag Coverage Δ
uitests ?
uitests-android ?
uitests-ios ?
unittests 89.76% <68.32%> (+1.50%) ⬆️
unittests-android ?
unittests-ios ?
unittests-rust 89.76% <68.32%> (-0.44%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
bindings/wysiwyg-ffi/src/ffi_composer_model.rs 27.46% <0.00%> (-3.62%) ⬇️
bindings/wysiwyg-wasm/src/lib.rs 19.48% <0.00%> (-0.62%) ⬇️
crates/matrix_mentions/src/lib.rs 100.00% <ø> (ø)
crates/wysiwyg/src/composer_model/mentions.rs 79.41% <78.84%> (-19.05%) ⬇️
crates/wysiwyg/src/dom/parser/parse.rs 97.90% <90.90%> (-0.17%) ⬇️
crates/wysiwyg/src/dom/nodes/mention_node.rs 99.34% <97.87%> (-0.66%) ⬇️
crates/matrix_mentions/src/mention.rs 99.23% <100.00%> (+0.62%) ⬆️
crates/wysiwyg/src/dom/nodes/dom_node.rs 88.71% <100.00%> (-0.05%) ⬇️

... and 65 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@aringenbach aringenbach left a comment

Choose a reason for hiding this comment

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

Looks good to me

What is our plan for supporting custom permalink URls ?

@artcodespace artcodespace requested a review from jonnyandrew June 16, 2023 09:14
@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

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@artcodespace artcodespace merged commit 4f375fc into main Jun 16, 2023
@artcodespace artcodespace deleted the alunturner/integrate-mention-parsing branch June 16, 2023 10:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to output html and markdown formatted specifically for message content
4 participants