diff --git a/lua/octo/gh/graphql.lua b/lua/octo/gh/graphql.lua index a4d363f9..e21e6aa9 100644 --- a/lua/octo/gh/graphql.lua +++ b/lua/octo/gh/graphql.lua @@ -1739,6 +1739,12 @@ query($endCursor: String) { viewerCanUpdate viewerCanDelete } + ... on RenamedTitleEvent { + actor { login } + createdAt + previousTitle + currentTitle + } ... on PullRequestReview { id body @@ -2005,6 +2011,12 @@ query($endCursor: String) { } createdAt } + ... on RenamedTitleEvent { + actor { login } + createdAt + previousTitle + currentTitle + } } } labels(first: 20) { diff --git a/lua/octo/model/octo-buffer.lua b/lua/octo/model/octo-buffer.lua index 3042ee58..859cae5d 100644 --- a/lua/octo/model/octo-buffer.lua +++ b/lua/octo/model/octo-buffer.lua @@ -211,6 +211,9 @@ function OctoBuffer:render_issue() elseif item.__typename == "ReviewDismissedEvent" then writers.write_review_dismissed_event(self.bufnr, item) prev_is_event = true + elseif item.__typename == "RenamedTitleEvent" then + writers.write_renamed_title_event(self.bufnr, item) + prev_is_event = true end end if prev_is_event then diff --git a/lua/octo/ui/colors.lua b/lua/octo/ui/colors.lua index fdab1e08..20b557ad 100644 --- a/lua/octo/ui/colors.lua +++ b/lua/octo/ui/colors.lua @@ -64,6 +64,7 @@ local function get_hl_groups() NormalFront = { fg = get_fg "Normal" or colors.white }, Viewer = { fg = colors.black, bg = colors.blue }, Editable = { bg = float_bg }, + Strikethrough = { fg = colors.grey, gui = "strikethrough" }, } end diff --git a/lua/octo/ui/writers.lua b/lua/octo/ui/writers.lua index 1dc84f0c..29df094b 100644 --- a/lua/octo/ui/writers.lua +++ b/lua/octo/ui/writers.lua @@ -1323,6 +1323,29 @@ function M.write_commit_event(bufnr, item) write_event(bufnr, vt) end +function M.write_renamed_title_event(bufnr, item) + local vt = {} + local conf = config.values + table.insert(vt, { conf.timeline_marker .. " ", "OctoTimelineMarker" }) + table.insert(vt, { "EVENT: ", "OctoTimelineItemHeading" }) + if utils.is_blank(item.actor) then + table.insert(vt, { "Title renamed", "OctoTimelineItemHeading" }) + write_event(bufnr, vt) + return + end + + table.insert(vt, { + item.actor.login, + item.actor.login == vim.g.octo_viewer and "OctoUserViewer" or "OctoUser", + }) + table.insert(vt, { " changed the title ", "OctoTimelineItemHeading" }) + table.insert(vt, { item.previousTitle, "OctoStrikethrough" }) + table.insert(vt, { " ", "OctoTimelineItemHeading" }) + table.insert(vt, { item.currentTitle, "OctoDetailsLabel" }) + table.insert(vt, { " " .. utils.format_date(item.createdAt), "OctoDate" }) + write_event(bufnr, vt) +end + function M.write_merged_event(bufnr, item) -- local actor_bubble = bubbles.make_user_bubble( -- item.actor.login,