From 834c86678fc9b0900d8ce83365068c41bc34f63f Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Fri, 17 May 2019 12:54:27 +0800 Subject: [PATCH] FIX: Missing post revision when editing the first post. --- app/controllers/topics_controller.rb | 1 + spec/requests/topics_controller_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index d2aec7a29a2..98e914743e8 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -330,6 +330,7 @@ class TopicsController < ApplicationController changes.delete(:title) if topic.title == changes[:title] changes.delete(:category_id) if topic.category_id.to_i == changes[:category_id].to_i + changes.delete(:tags_empty_array) if !topic.tags.exists? success = true diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rb index 910144c7cd1..e30cca34e11 100644 --- a/spec/requests/topics_controller_spec.rb +++ b/spec/requests/topics_controller_spec.rb @@ -1002,7 +1002,8 @@ RSpec.describe TopicsController do it "doesn't call the PostRevisor when there is no changes" do expect do put "/t/#{topic.slug}/#{topic.id}.json", params: { - category_id: topic.category_id + category_id: topic.category_id, + tags_empty_array: true } end.not_to change(PostRevision.all, :count)