Commit Graph

83 Commits

Author SHA1 Message Date
Ian Morland
b0fa795cc9
fix: extensions not being able to use the renderer without context (#3382) 2022-04-07 17:53:37 +01:00
Ian Morland
7d3bc4a092 fix?: Allow mentions from non-post objects (#79) 2021-11-28 09:52:29 +01:00
Sami Mazouz
6a5d7e9864 Fix unrecognised user/post mentions (#71)
* fix: Use proper mentionsUsers serializer
The only reason we haven't seen any issues with this up until now is because we have not has to include the relationship in any responses.

* fix: User/Post mentions showing as deleted after saving
The reason this happens is because the modified relationship is not refreshed, so the formatter doesn't recognize the new mentions as valid.
2021-08-30 18:23:59 +01:00
Sami Mazouz
af9e5a9cc9 Eager load more necessary related mentions (#72)
* perf: Eager load related mentions from the extender

These missing relations caused more queries to be called, the more mentions posts have the more queries produced.

* perf: Eager load models in show endpoints

Can't use the extender for that
2021-08-23 20:33:42 +01:00
SychO9
cc62044e6f Support smart quotes in mentions format 2021-05-24 21:49:31 +01:00
Alexander Skvortsov
8ed08b63cd Fix mentioned filtering (#67) 2021-05-04 14:57:29 -04:00
Sami Mazouz
e407c66784 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
2021-04-21 10:58:54 +01:00
Alexander Skvortsov
cd3934e358 Use RequestUtil to access actor 2021-04-08 00:03:18 -04:00
Sami Mazouz
46aabd2ae5 Eager load mentionedBy and only missing relations (#64) 2021-03-25 15:37:47 +01:00
Alexander Skvortsov
b922257468 Use non-deprecated translator interface 2021-03-13 17:10:23 -05:00
Ian Morland
d368aa4e55 Fix incorrect display_name showing in email notifications (#59) 2020-12-21 12:43:27 -05:00
Alexander Skvortsov
198f8ae870 Ensure nullable arguments are indeed nullable 2020-12-13 16:38:24 -05:00
Alexander Skvortsov
3198de4b9b Use Formatter extender for rendering callbacks 2020-12-08 11:41:05 -05:00
Sami Mazouz
256e821289 Use new extenders (#58) 2020-12-08 11:15:52 -05:00
Alexander Skvortsov
9ef207fa85 Translate notification emails (#50) 2020-10-01 11:16:20 -04:00
Matthew Kilgore
d1cf21dcd2 Replaced depreciated helper function with classfull function 2020-07-25 21:08:49 -04:00
Tariq Hussein
2ecfe5da7b Check reply with mention can be read by original poster (#39) 2020-05-20 17:01:34 -04:00
Franz Liedke
a552b957ba Use new Model extender 2020-04-24 15:55:50 +02:00
Robert Turner
9c674f0a8b Fix mentioning a deleted user's post (#41)
Fixes #1956 - ErrorException: Trying to get property 'display_name' of 
non-object. ConfigureMentions::addPostId method set mention details 
based on if there was an existing post. This caused an error if there 
was an existing post, but the user who posted had been deleted. The 
mention details are now only set if there is a user associated with the 
post being mentioned.
2020-03-06 23:04:24 +01:00
Franz Liedke
3390bd5b02 Apply fixes from StyleCI 2019-11-29 23:02:17 +00:00
Shivanshu Patel
7afdbb1ea9 Remove like with and compare with equals (#37)
`_` is special character in mysql so like query was fetching different result for user who's unsername starts with or contains `_`
2019-08-16 15:57:35 +02:00
bdumaspilhou
b9c4a003f2 Fixes : use display_name in mail and in subject (#35) 2019-03-06 23:25:23 +01:00
Franz Liedke
70a66a9529 Get rid of event subscribers that resolve services too early
Refs flarum/core#1578.
2018-12-16 16:24:05 +01:00
Franz Liedke
c2cabd7c2e I can do this! 2018-12-15 16:24:31 +01:00
Franz Liedke
99adb8e998 Fix copy-paste mistake 2018-12-15 16:01:03 +01:00
Franz Liedke
3656072ff4 Use Formatter extender to avoid resolving the UrlGenerator too early
Refs flarum/core#1578.
Fixes flarum/core#1703.
2018-12-15 12:06:58 +01:00
Toby Zerner
7075998b87 Use canonical username for user profile link. fixes flarum/core#1265 2018-11-14 12:10:24 +10:30
Toby Zerner
8d67e6dcf5 Fix live preview 2018-09-21 11:41:32 +09:30
Toby Zerner
67c7b45dc8 Database changes (#34)
* Implement database changes

* Split foreign keys in to their own migrations; rename pivot tables

* Use whereColumn

* Update core attribute names
2018-09-16 20:50:16 +02:00
Clark Winkelmann
5bf642046d Remove unused parameter 2018-03-07 04:04:19 +01:00
Franz Liedke
30e21bb37d Remove unused import 2018-01-17 08:27:19 +01:00
Franz Liedke
ee07f29d5a Adapt new bootstrap format, use Asset extender 2018-01-16 23:27:32 +01:00
Toby Zerner
89ec1d77df Fix class names 2017-12-27 16:09:20 +10:30
Toby Zerner
2d9839ee66 Fix relationship method arguments
As per https://laravel.com/docs/5.5/upgrade (under "Eloquent")
2017-12-26 20:21:47 +10:30
Toby Zerner
c145121516 Merge branch 'master' into next-back
# Conflicts:
#	src/Listener/AddPostMentionedByRelationship.php
#	src/Listener/FormatPostMentions.php
#	src/Listener/FormatUserMentions.php
#	src/Listener/UpdatePostMentionsMetadata.php
#	src/Listener/UpdateUserMentionsMetadata.php
2017-12-26 20:20:31 +10:30
Franz Liedke
41980082ea Fix class names 2017-10-03 19:44:29 +02:00
Franz Liedke
d528cd03e2 Fix class names 2017-10-03 19:22:33 +02:00
Franz Liedke
3fc150cd23 Update namespaces for beta 8
Refs flarum/core#1235.
2017-10-01 20:25:23 +02:00
Toby Zerner
17e181bb0d Fix notifications not including post content 2017-09-22 16:45:45 +09:30
Toby Zerner
fa3194fcef Apply fixes from StyleCI
[ci skip] [skip ci]
2017-09-20 07:37:55 +00:00
Toby Zerner
408d882598 Update to sub in "display names" from database when rendering
This also improves the behaviour of mentions in the JS preview (no more
broken links, mention is only picked up if corresponding user/post is
found).

See flarum/core#1246

Closes flarum/core#315
2017-09-19 20:16:30 +09:30
Toby Zerner
1d79d8edeb Apply fixes from StyleCI
[ci skip] [skip ci]
2016-11-29 05:29:44 +00:00
Toby Zerner
18a4b6d4b1 Fix another fatal error 2016-09-03 22:32:06 +09:30
Toby Zerner
ab6e899c7e Fix fatal error when viewing a discussion with multiple pages of posts 2016-09-03 22:30:22 +09:30
Toby Zerner
f267a63ffe Apply visibility permissions to mentionedBy relationship. fixes flarum/core#853 2016-09-03 21:50:09 +09:30
Toby Zerner
999ef82d55 Use new event name 2016-06-03 11:02:05 +09:30
Franz Liedke
2ddfb11614 Make StyleCI happy 2016-03-23 19:56:24 +09:00
Sajjad Hasehmian
6f39123bad Check access before send Mention notification 2016-03-04 13:53:15 +03:30
Toby Zerner
47ec802166 Applied fixes from StyleCI 2016-02-25 22:56:19 -05:00
Sajjad Hasehmian
b4d7c18eb9 Add Mentions section to user profile (fixes flarum/core#319) 2016-02-04 01:04:08 +03:30