Fix audit log error when custom emoji is copied from remote server#11876
Merged
Gargron merged 1 commit intoSep 17, 2019
Merged
Conversation
Gargron
reviewed
Sep 17, 2019
Member
There was a problem hiding this comment.
I need to check why output of custom_emoji.copy! doesn't work, but this would be wrong, since it will log the creation of the remote emoji, and not the local one...
Contributor
Author
There was a problem hiding this comment.
I understand your concern. It seems that the output of custom_emoji.copy! is just true/false. Following changes are acceptable for you? I'll send pull request later.
diff --git a/app/models/custom_emoji.rb b/app/models/custom_emoji.rb
index edb1bec..0dacaf6 100644
--- a/app/models/custom_emoji.rb
+++ b/app/models/custom_emoji.rb
@@ -63,7 +63,7 @@ class CustomEmoji < ApplicationRecord
def copy!
copy = self.class.find_or_initialize_by(domain: nil, shortcode: shortcode)
copy.image = image
- copy.save!
+ copy.tap(&:save!)
end
Member
There was a problem hiding this comment.
Oh yes, that is a good fix! I've run into that mistake a few times before
bfec420 to
725115a
Compare
Gargron
approved these changes
Sep 17, 2019
hiyuki2578
pushed a commit
to ProjectMyosotis/mastodon
that referenced
this pull request
Oct 2, 2019
This file contains hidden or 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
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.

Expected behaviour
When I copy custom emojis from remote server,
Actual behaviour
When I copy custom emojis from remote server,
Steps to reproduce the problem
In admin/custom_emojis pages, check some custom emoji and click "copy" button.
Specifications
master branch