From 08ba1538b4f8921bf20e2452bc11afe316a17f21 Mon Sep 17 00:00:00 2001 From: cobodo Date: Sat, 23 Mar 2019 23:54:38 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A1=E3=82=A4=E3=83=B3=E3=82=A2=E3=82=A4?= =?UTF-8?q?=E3=82=B3=E3=83=B3=E4=B8=8A=E3=81=AE=E3=81=B5=E3=81=81=E3=81=BC?= =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=E3=81=8C=E3=81=B5=E3=81=81?= =?UTF-8?q?=E3=81=BC=E7=8A=B6=E6=85=8B=E3=81=AB=E3=82=88=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E6=AD=A3=E3=81=97=E3=81=8F=E3=83=88=E3=82=B0=E3=83=AB=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/plugin/twitter/model/message.rb | 7 +------ core/plugin/twitter/twitter.rb | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/core/plugin/twitter/model/message.rb b/core/plugin/twitter/model/message.rb index 2d900448..640cc57c 100644 --- a/core/plugin/twitter/model/message.rb +++ b/core/plugin/twitter/model/message.rb @@ -140,12 +140,7 @@ class Plugin::Twitter::Message < Diva::Model # この投稿のお気に入り状態を返す。お気に入り状態だった場合にtrueを返す def favorite?(user_or_world=Service.primary) return unless user_or_world - case user_or_world.class.slug - when :twitter_user - favorited_by.include?(user_or_world) - when :twitter - favorited_by.include?(user_or_world.user_obj) - end + Plugin[:twitter].favorited?(self, user_or_world) end # 投稿がシステムメッセージだった場合にtrueを返す diff --git a/core/plugin/twitter/twitter.rb b/core/plugin/twitter/twitter.rb index 681a2a0d..f712c092 100644 --- a/core/plugin/twitter/twitter.rb +++ b/core/plugin/twitter/twitter.rb @@ -113,6 +113,7 @@ Plugin.create(:twitter) do }) do |twitter, tweet| Plugin.call(:before_favorite, twitter, twitter.user_obj, tweet) (twitter/'favorites/create'.freeze).message(id: tweet.id).next{ |favorited_tweet| + favorited_tweet.favorited_by.add(twitter.user_obj) Plugin.call(:favorite, twitter, twitter.user_obj, favorited_tweet) favorited_tweet }.trap{ |e| -- 2.17.1