Skip to content

Commit

Permalink
Merge pull request #707 from wd60622/add-rename-events
Browse files Browse the repository at this point in the history
  • Loading branch information
wd60622 authored Dec 14, 2024
2 parents 7241a11 + 3e47269 commit b9c727f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lua/octo/gh/graphql.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,12 @@ query($endCursor: String) {
viewerCanUpdate
viewerCanDelete
}
... on RenamedTitleEvent {
actor { login }
createdAt
previousTitle
currentTitle
}
... on PullRequestReview {
id
body
Expand Down Expand Up @@ -2005,6 +2011,12 @@ query($endCursor: String) {
}
createdAt
}
... on RenamedTitleEvent {
actor { login }
createdAt
previousTitle
currentTitle
}
}
}
labels(first: 20) {
Expand Down
3 changes: 3 additions & 0 deletions lua/octo/model/octo-buffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lua/octo/ui/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 23 additions & 0 deletions lua/octo/ui/writers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b9c727f

Please sign in to comment.