Project

General

Profile

提案 #1241 » model-score.patch

cob odo, 2018-05-12 20:04

View differences:

core/plugin/score/select.rb
4 4
  extend self
5 5

  
6 6
  def score_by_score(model, target_note=model)
7
    if model === target_note && model.respond_to?(:score)
8
      return score_expand(model.score, model)
9
    end
10

  
7 11
    _, _, available_score_list = Plugin.filtering(:score_filter, model, target_note, Set.new)
8 12
    selected_score = choose_best_score(available_score_list)
9 13
    if selected_score &&  !selected_score.all? { |s| s.is_a?(Plugin::Score::TextNote) }
core/plugin/twitter/model/message.rb
717 717
    "#<#{self.class.name}: #{id} #{user.inspect} #{to_show}>"
718 718
  end
719 719

  
720
  # Twitter Entity情報を元にScoreをあれする
721
  def score
722
    Plugin[:twitter].score_by_entity(self) + Plugin[:twitter].extended_entity_media(self)
723
  end
724

  
720 725
  private
721 726

  
722 727
  def add_retweet_in_this_thread(child, created_at=child[:created])
core/plugin/twitter/twitter.rb
291 291
    [url, posted_url_length(url)]
292 292
  end
293 293

  
294
  # Twitter Entity情報を元にScoreをあれする
295
  filter_score_filter do |message, note, yielder|
296
    if message == note && %i<twitter_tweet twitter_direct_message>.include?(message.class.slug)
297
      score = score_by_entity(message) + extended_entity_media(message)
298
      if !score.all?{|n| n.class.slug == :score_text }
299
        yielder << score
300
      end
301
    end
302
    [message, note, yielder]
303
  end
304

  
305 294
  # 正規表現マッチで、ユーザのSNっぽいやつをユーザページにリンクする
306 295
  filter_score_filter do |message, note, yielder|
307 296
    if message != note && %i<twitter_tweet twitter_direct_message>.include?(message.class.slug)
    (1-1/1)