Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing title renaming event #707

Merged
merged 9 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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