From ad134a02b9853fbe848d9f61927df834e5fc6957 Mon Sep 17 00:00:00 2001 From: cobodo Date: Thu, 2 Aug 2018 18:56:24 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BB=A5=E4=B8=8B=E3=81=AE3=E3=83=91=E3=82=BF?= =?UTF-8?q?=E3=83=BC=E3=83=B3=E3=81=A7HTML=E5=AE=9F=E4=BD=93=E5=8F=82?= =?UTF-8?q?=E7=85=A7=E3=82=92=E8=A7=A3=E9=99=A4=E3=81=97=E3=81=9F=E3=82=82?= =?UTF-8?q?=E3=81=AE=E3=81=AB=E3=81=99=E3=82=8B=20*=20=E3=80=8C=E6=9C=AC?= =?UTF-8?q?=E6=96=87=E3=82=92=E3=82=B3=E3=83=94=E3=83=BC=E3=80=8D=E3=82=B3?= =?UTF-8?q?=E3=83=9E=E3=83=B3=E3=83=89=20*=20extract=E3=83=97=E3=83=A9?= =?UTF-8?q?=E3=82=B0=E3=82=A4=E3=83=B3=E3=81=8B=E3=82=89=E3=81=AE=E9=80=9A?= =?UTF-8?q?=E7=9F=A5(:popup=5Fnotify)=E3=81=AB=E4=B9=97=E3=82=8B=E6=9C=AC?= =?UTF-8?q?=E6=96=87=20*=20entity=E3=81=8C=E7=84=A1=E3=81=84=E5=A0=B4?= =?UTF-8?q?=E5=90=88=E3=81=AE=E6=9C=AC=E6=96=87=E8=A1=A8=E7=A4=BA=20refs?= =?UTF-8?q?=20#1233?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/plugin/twitter/model/message.rb | 5 ++++- core/plugin/twitter/twitter.rb | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/plugin/twitter/model/message.rb b/core/plugin/twitter/model/message.rb index f305b5a0..918d4a31 100644 --- a/core/plugin/twitter/model/message.rb +++ b/core/plugin/twitter/model/message.rb @@ -636,7 +636,10 @@ class Plugin::Twitter::Message < Diva::Model def body self[:message].to_s.freeze end - alias_method :description, :body + + def description + self[:message].to_s.gsub(Plugin::Twitter::Message::DESCRIPTION_UNESCAPE_REGEXP, &Plugin::Twitter::Message::DESCRIPTION_UNESCAPE_RULE) + end # Message#body と同じだが、投稿制限文字数を超えていた場合には、収まるように末尾を捨てる。 def to_s diff --git a/core/plugin/twitter/twitter.rb b/core/plugin/twitter/twitter.rb index 21c2b886..4ab5e96d 100644 --- a/core/plugin/twitter/twitter.rb +++ b/core/plugin/twitter/twitter.rb @@ -364,7 +364,7 @@ Plugin.create(:twitter) do def score_by_entity(tweet) score = Array.new cur = 0 - text = tweet.description + text = tweet.body tweet[:entities].flat_map{|kind, entities| case kind when :hashtags @@ -466,7 +466,7 @@ Plugin.create(:twitter) do uri: user.uri, reference: user) else - screen_name = user_entity[:screen_name] || tweet.description[Range.new(*user_entity[:indices])] + screen_name = user_entity[:screen_name] || tweet.body[Range.new(*user_entity[:indices])] Diva::Model(:score_hyperlink).new( description: "@#{screen_name}", uri: "https://twitter.com/#{screen_name}") -- 2.17.1