プロジェクト

全般

プロフィール

バグ #1233 » 0001-copy_description_filter_dm.patch

cob odo, 2018-08-03 18:51

差分を表示:

core/plugin/twitter/model/directmessage.rb
17 17
    field.bool   :exact                                     # true if complete data
18 18
    field.time   :created                                   # posted time
19 19

  
20
    alias_method :description, :text
20
    alias_method :body, :text
21 21

  
22 22
    def self.memory
23 23
      @memory ||= DirectMessageMemory.new end
......
30 30
      @to_show ||= self[:text].gsub(/&(gt|lt|quot|amp);/){|m| {'gt' => '>', 'lt' => '<', 'quot' => '"', 'amp' => '&'}[$1] }.freeze
31 31
    end
32 32

  
33
    def description
34
      self[:text].to_s.gsub(Plugin::Twitter::Message::DESCRIPTION_UNESCAPE_REGEXP, &Plugin::Twitter::Message::DESCRIPTION_UNESCAPE_RULE)
35
    end
36

  
33 37
    def from_me?(world = Enumerator.new{|y| Plugin.filtering(:worlds, y) })
34 38
      case world
35 39
      when Enumerable
core/plugin/twitter/model/message.rb
636 636
  def body
637 637
    self[:message].to_s.freeze
638 638
  end
639
  alias_method :description, :body
639

  
640
  def description
641
    self[:message].to_s.gsub(Plugin::Twitter::Message::DESCRIPTION_UNESCAPE_REGEXP, &Plugin::Twitter::Message::DESCRIPTION_UNESCAPE_RULE)
642
  end
640 643

  
641 644
  # Message#body と同じだが、投稿制限文字数を超えていた場合には、収まるように末尾を捨てる。
642 645
  def to_s
core/plugin/twitter/twitter.rb
364 364
  def score_by_entity(tweet)
365 365
    score = Array.new
366 366
    cur = 0
367
    text = tweet.description
367
    text = tweet.body
368 368
    tweet[:entities].flat_map{|kind, entities|
369 369
      case kind
370 370
      when :hashtags
......
466 466
          uri: user.uri,
467 467
          reference: user)
468 468
      else
469
        screen_name = user_entity[:screen_name] || tweet.description[Range.new(*user_entity[:indices])]
469
        screen_name = user_entity[:screen_name] || tweet.body[Range.new(*user_entity[:indices])]
470 470
        Diva::Model(:score_hyperlink).new(
471 471
          description: "@#{screen_name}",
472 472
          uri: "https://twitter.com/#{screen_name}")
(8-8/8)