mastodon/app/models
ThibG 5d5c0f4f43 Twidere mention workaround (#5552)
* Work around Twidere and Tootdon bug

Tootdon and Twidere construct @user@domain handles from mentions in toots based
solely on the mention text and account URI's domain without performing any
webfinger call or retrieving account info from the Mastodon server.

As a result, when a remote user has WEB_DOMAIN ≠ LOCAL_DOMAIN, Twidere and
Tootdon will construct the mention as @user@WEB_DOMAIN. Now, this will usually
resolve to the correct account (since the recommended configuration is to have
WEB_DOMAIN perform webfinger redirections to LOCAL_DOMAIN) when processing
mentions, but won't do so when displaying them (as it does not go through the
whole account resolution at that time).

This change rewrites mentions to the resolved account, so that displaying the
mentions will work.

* Use lookbehind instead of non-capturing group in MENTION_RE

Indeed, substitutions with the previous regexp would erroneously eat any
preceding whitespace, which would lead to concatenated mentions in the
previous commit.

Note that users will “lose” up to one character space per mention for their
toots, as that regexp is also used to remove the domain-part of mentioned
users for character counting purposes, and it also erroneously removed the
preceding character if it was a space.
2017-11-07 19:08:14 +01:00
..
concerns Fix #4908 - Do not keep remote file names, generate random (#4934) 2017-09-14 16:41:59 +02:00
form Default follows for new users (#4871) 2017-09-10 09:58:38 +02:00
web Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
account.rb Twidere mention workaround (#5552) 2017-11-07 19:08:14 +01:00
account_domain_block.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
account_filter.rb Improve admin UI for custom emojis, add copy/disable/enable (#5231) 2017-10-05 23:42:05 +02:00
account_moderation_note.rb foreign_key, non-nullable, dependent: destroy in account_moderation_notes (#5294) 2017-10-10 13:12:17 +02:00
application_record.rb Fix rubocop issues, introduce usage of frozen literal to improve performance 2016-11-15 16:56:29 +01:00
block.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
context.rb Refactor JSON templates to be generated with ActiveModelSerializers instead of Rabl (#4090) 2017-07-07 04:02:06 +02:00
conversation.rb Conditional validations no longer accept strings for if/unless (#3124) 2017-05-19 03:11:23 +02:00
conversation_mute.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
custom_emoji.rb Show the local couterpart of emoji when it exists in /admin/custom_emojis (#5467) 2017-11-07 14:49:32 +01:00
custom_emoji_filter.rb Improve admin UI for custom emojis, add copy/disable/enable (#5231) 2017-10-05 23:42:05 +02:00
domain_block.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
email_domain_block.rb Implement EmailBlackList (#5109) 2017-10-04 15:16:10 +02:00
export.rb
favourite.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
feed.rb Non-Serial ("Snowflake") IDs (#4801) 2017-10-04 09:56:37 +02:00
follow.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
follow_request.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
import.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
instance.rb Add Instance class to list admin records (#3443) 2017-05-31 20:38:44 +02:00
instance_filter.rb Add instance search feature (#4925) 2017-09-13 12:30:07 +02:00
media_attachment.rb Increase attachment descriptions to 420 characters (#5139) 2017-09-29 02:30:00 +02:00
mention.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
mute.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
notification.rb Fix UserTrackingConcern firing on every request, optimize some queries (#5368) 2017-10-13 16:44:29 +02:00
preview_card.rb Increase max height of preview card image (#5092) 2017-09-25 17:10:49 +02:00
remote_follow.rb rescue HTTP::ConnectionError in RemoteFollowController#create (#4726) 2017-08-28 19:12:09 +02:00
remote_profile.rb Introduce OStatus::TagManager (#5008) 2017-09-19 18:08:08 +02:00
report.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
report_filter.rb Admin reports with accounts (#2092) 2017-04-18 19:36:18 +02:00
search.rb Refactor JSON templates to be generated with ActiveModelSerializers instead of Rabl (#4090) 2017-07-07 04:02:06 +02:00
session_activation.rb Refactor Web::PushSubscription, remove welcome message (#4524) 2017-09-01 13:35:23 +02:00
setting.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
site_upload.rb Uploads for admin site settings (#4913) 2017-09-14 00:04:30 +02:00
status.rb Optimize Status#permitted_for 500x (account timeline) (#5373) 2017-10-13 16:53:43 +02:00
status_pin.rb Allow multiple pinned statuses to be shown and make them be ordered b… (#4690) 2017-08-25 18:50:52 +02:00
stream_entry.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
subscription.rb Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
tag.rb add validation to tag name (#4194) 2017-07-14 11:02:49 +02:00
user.rb Add ability to disable login and mark accounts as memorial (#5615) 2017-11-07 19:06:44 +01:00
web.rb