1
0
mirror of https://github.com/flarum/core.git synced 2025-07-31 21:50:50 +02:00

New mentions format, decouple usernames from mentions (#65)

* Convert user mentions to new `@"Display Name"#ID` format

* Handle deleted user's mentions

* Convert post mentions to `@"Display Name"#pID` format

* Handle deleted user's post mentions and deleted posts mentions

* Clean display name of `"#{letters}{numbers}` (replace with underscore _)

* Adapt integration tests to new mention formats

* Use a deleted attribute for user mentions

* Introduce cleanDisplayName util

* Detect new format with autocomplete

* Slug needed on rendering only

* Invalidate user mention tag when ID is invalid
This used to be implicitly done, when there was a username attribute configured, formatter would check that all attributes are available and if not invalidate.

since we now only have `displayname` and `id` attributes which are both available from the regex matching, formatter doesn't implicitly invalidate anymore and therefore validates ANY matches. So we explicitly invalidate the tag when the ID does not match a user.

* Allow username mention format with a setting

* Add tests for turning setting on/off

* Move setting check to tag filter
Because the configurator caches, changing the setting only takes effect after the cache is cleared.

* fix: showing autocomplete at the right moment

* Add dockblocks to explain unparsing process
This commit is contained in:
Sami Mazouz
2021-04-21 10:58:54 +01:00
committed by GitHub
parent 057517688c
commit e407c66784
18 changed files with 878 additions and 35 deletions

View File

@@ -4,6 +4,7 @@
border-radius: @border-radius;
padding: 2px 5px;
border: 0 !important;
font-weight: 600;
blockquote & {
background: @body-bg;
@@ -13,6 +14,12 @@
color: @link-color;
}
}
.UserMention, .PostMention {
&--deleted {
opacity: 0.8;
filter: grayscale(1);
}
}
.PostMention {
margin: 0 3px;