From fd23167f985d79a7bc395ef12d66635abe6c484d Mon Sep 17 00:00:00 2001 From: bohung Date: Mon, 9 May 2022 23:11:07 +0800 Subject: [PATCH] Fix bug. --- app/models/site_feed.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/site_feed.rb b/app/models/site_feed.rb index 0b4574d..846a528 100644 --- a/app/models/site_feed.rb +++ b/app/models/site_feed.rb @@ -99,7 +99,9 @@ class SiteFeed request = Net::HTTP::Post.new("/xhr/#{self.channel_key.pluralize}/feed_add_remote/#{self.feed_uid}", 'Content-Type' => 'application/json') request.body = {"url"=>root_url}.to_json response = http_req.request(request) - self.update(:enable_notify=>true) + if response.code.to_i == 200 + self.update(:enable_notify=>true) + end end end end @@ -116,7 +118,9 @@ class SiteFeed request = Net::HTTP::Post.new("/xhr/#{self.channel_key.pluralize}/feed_remove_remote/#{self.feed_uid}", 'Content-Type' => 'application/json') request.body = {"url"=>root_url}.to_json response = http_req.request(request) - self.update(:enable_notify=>false) + if response.code.to_i == 200 + self.update(:enable_notify=>false) + end end end end