mirror of
https://github.com/flarum/core.git
synced 2025-08-26 01:34:16 +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:
@@ -4,6 +4,16 @@ flarum-mentions:
|
||||
# UNIQUE KEYS - The following keys are used in only one location each.
|
||||
##
|
||||
|
||||
# Translations in this namespace are used by the admin interface.
|
||||
admin:
|
||||
|
||||
# These translations are used in the mentions Settings page.
|
||||
settings:
|
||||
allow_username_format_label: Allow username mention format (@Username)
|
||||
allow_username_format_text: |
|
||||
The current format for user mentions is @"Display Name"#ID.
|
||||
This setting allows using the old format of @Username, however it will still be converted to the new format upon saving.
|
||||
|
||||
# Translations in this namespace are used by the forum user interface.
|
||||
forum:
|
||||
|
||||
@@ -36,6 +46,10 @@ flarum-mentions:
|
||||
user:
|
||||
mentions_link: Mentions
|
||||
|
||||
# These translations are used in the post mentions
|
||||
post_mention:
|
||||
deleted_text: "[unknown]"
|
||||
|
||||
# Translations in this namespace are used in emails sent by the forum.
|
||||
email:
|
||||
|
||||
|
Reference in New Issue
Block a user