From 93767c302321f1f6e230a5570cce9170b80d42b9 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 17 Nov 2017 13:00:35 -0600 Subject: [PATCH 1/2] Fix post replacement test failure. --- test/unit/post_replacement_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/post_replacement_test.rb b/test/unit/post_replacement_test.rb index 42d1fa824..5c9f0447f 100644 --- a/test/unit/post_replacement_test.rb +++ b/test/unit/post_replacement_test.rb @@ -246,7 +246,7 @@ class PostReplacementTest < ActiveSupport::TestCase context "a post when replaced with a HTML source" do should "record the image URL as the replacement URL, not the HTML source" do replacement_url = "https://twitter.com/nounproject/status/540944400767922176" - image_url = "http://pbs.twimg.com/media/B4HSEP5CUAA4xyu.png:orig" + image_url = "https://pbs.twimg.com/media/B4HSEP5CUAA4xyu.png:orig" @post.replace!(replacement_url: replacement_url) assert_equal(image_url, @post.replacements.last.replacement_url) From 26679dd7ab91772d4f4570275c0ebf5fbc0a059c Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 17 Nov 2017 12:52:12 -0600 Subject: [PATCH 2/2] Fix #3323: Exclude post replacements from Mod Actions. --- app/models/post_replacement.rb | 5 ----- test/unit/post_replacement_test.rb | 7 +------ 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/app/models/post_replacement.rb b/app/models/post_replacement.rb index 3ce7b5aac..347fd6eb2 100644 --- a/app/models/post_replacement.rb +++ b/app/models/post_replacement.rb @@ -56,7 +56,6 @@ class PostReplacement < ApplicationRecord if md5_changed post.comments.create!({creator: User.system, body: comment_replacement_message, do_not_bump_post: true}, without_protection: true) - ModAction.log(modaction_replacement_message) else post.queue_backup end @@ -123,10 +122,6 @@ class PostReplacement < ApplicationRecord %("#{creator.name}":[/users/#{creator.id}] replaced this post with a new image:\n\n#{replacement_message}) end - def modaction_replacement_message - "replaced post ##{post.id}:\n\n#{replacement_message}" - end - def replacement_message linked_source = linked_source(replacement_url) linked_source_was = linked_source(post.source_was) diff --git a/test/unit/post_replacement_test.rb b/test/unit/post_replacement_test.rb index 5c9f0447f..dd2af939f 100644 --- a/test/unit/post_replacement_test.rb +++ b/test/unit/post_replacement_test.rb @@ -46,7 +46,6 @@ class PostReplacementTest < ActiveSupport::TestCase @post.update(source: "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png") @post.replace!(replacement_url: "https://www.google.com/intl/en_ALL/images/logo.gif", tags: "-tag1 tag2") @upload = Upload.last - @mod_action = ModAction.last end context "that is then undone" do @@ -95,10 +94,6 @@ class PostReplacementTest < ActiveSupport::TestCase assert_equal(false, @post.is_pending) end - should "log a mod action" do - assert_match(/replaced post ##{@post.id}/, @mod_action.description) - end - should "leave a system comment" do comment = @post.comments.last @@ -264,7 +259,7 @@ class PostReplacementTest < ActiveSupport::TestCase should "not queue a deletion or log a comment" do upload_file("#{Rails.root}/test/files/test.jpg", "test.jpg") do |file| - assert_no_difference(["@post.comments.count", "ModAction.count"]) do + assert_no_difference(["@post.comments.count"]) do @post.replace!(replacement_file: file, replacement_url: "") end end