-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix?: Allow mentions from non-post objects #79
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
davwheat
approved these changes
Nov 26, 2021
imorland
changed the title
Allow mentions from non-post objects
fix?: Allow mentions from non-post objects
Nov 26, 2021
SychO9
requested changes
Nov 26, 2021
askvortsov1
approved these changes
Nov 27, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. I wonder if it might be worth separating out the common logic into a separate method.
SychO9
reviewed
Nov 27, 2021
askvortsov1
approved these changes
Nov 27, 2021
SychO9
approved these changes
Nov 28, 2021
askvortsov1
pushed a commit
that referenced
this pull request
Mar 11, 2022
askvortsov1
pushed a commit
that referenced
this pull request
May 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2902
Changes proposed in this pull request:
Extensions such as
askvortsov/flarum-moderator-warnings
,fof/pages
andfof/moderator-notes
allow for mentioning a user outside of aPost
. This functionality was broken in the1.0
release due to pulling the user directly from the post relationship.This is an interim solution, first proposed by @datitisev in #2902, until the refactor of the
Formatter
API.I added
&& $post->exists
to the conditional proposed in the issue, as this maintains the current expectation of extensions using the formatter in this way (ie passingnew Post()
to the renderer.Examples:
https://github.com/FriendsOfFlarum/moderator-notes/blob/7496beb5abcdec2c2a48505c1c05dc4343831548/src/Api/Serializer/ModeratorNotesSerializer.php#L49
https://github.com/askvortsov1/flarum-moderator-warnings/blob/5be9d5cf272c88262fb0161f3a0b80c7eb445bd2/src/Api/Serializer/WarningSerializer.php#L47
Screenshot
With this change:
Without this change:
Necessity
Confirmed
composer test
).Required changes: