class Github::Notification

Included Modules

Defined in:

github/models.cr

Constant Summary

GENERIC_MESSAGE = "なにかあったみたいです。確認してみましょう!"
MENTION_REASONS = {"assign", "author", "comment", "invitation", "mention", "team_mention", "review_requested"}
REASON_MESSAGES = {"mention" => "メンションされました", "team_mention" => "メンションされました", "review_requested" => "レビューを依頼されました", "assign" => "アサインされました", "author" => "自分の PR/Issue に動きがありました", "comment" => "コメントがつきました", "state_change" => "状態が変わりました", "subscribed" => "ウォッチ中のリポジトリで動きがありました", "ci_activity" => "CI の実行結果が届きました", "invitation" => "招待が届きました"}

reason(なぜ自分に通知されたか)ごとの表示文言。update? による 「更新があったみたいです」一辺倒だと通知理由が伝わらないため、reason を 文面に反映する(issue #96)。GitHub 側の reason 追加に耐えるよう、 未知の reason は reason_message で汎用文言にフォールバックする。

Constructors

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]

Instance Method Detail

def display_title : String | Nil #

一目で対象が分かるよう owner/repo#番号 タイトル 形式にする。 番号が取れない(Commit など)場合はタイトルのみ、リポジトリ名が無ければ 番号のみにフォールバックする(issue #96)。


[View source]
def link(comment : Comment) : String | Nil #

対象へ飛べるリンク。コメントの html_url を優先し、無ければリポジトリの html_url にフォールバックしてリンク無し通知を無くす(issue #96)。


[View source]
def mention? : Bool #

[View source]
def pretext : String #

通知の pretext(botのセリフ)。[<type>] <reason 文言> 形式。


[View source]
def reason : String #

[View source]
def reason_message : String #

[View source]
def repository : Repository #

[View source]
def subject : Subject #

[View source]
def subscription_url : String | Nil #

[View source]
def updated_at : Time #

分割送信時にチャンク単位で既読化するため、通知の更新時刻を保持する。 last_read_at に渡すことで送信済み分だけを既読化できる(issue #94)。


[View source]