FIX: Only save custom fields when unassigning a topic.

FIX: Only save custom fields when unassigning a topic.

From 6e7f01e5d49b6733754b6c2f87ab262bb6582025 Mon Sep 17 00:00:00 2001
From: Guo Xiang Tan <tgx_world@hotmail.com>
Date: Thu, 26 Jul 2018 08:57:24 +0800
Subject: [PATCH] FIX: Only save custom fields when unassigning a topic.


diff --git a/lib/topic_assigner.rb b/lib/topic_assigner.rb
index 3748ac9..b172b89 100644
--- a/lib/topic_assigner.rb
+++ b/lib/topic_assigner.rb
@@ -194,7 +194,7 @@ SQL
     if assigned_to_id = @topic.custom_fields["assigned_to_id"]
       @topic.custom_fields["assigned_to_id"] = nil
       @topic.custom_fields["assigned_by_id"] = nil
-      @topic.save!
+      @topic.save_custom_fields
 
       post = @topic.posts.where(post_number: 1).first
       return unless post.present?

GitHub

1 Like