╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │123 │ │124 pub const RefKind = enum { branch, tag }; │ │125 │ │126 - pub const IssuesView = enum { open, closed, tags, new, edit, description, new_comment, edit_comment, conflicts, resolve }; │ │126 + pub const IssuesView = enum { open, closed, tags, new, edit, description, new_comment, edit_comment, remove, conflicts, resolve };│ │127 │ │128 - pub const DiscussionsView = enum { all, tags, new, edit, description, new_comment, edit_comment }; │ │128 + pub const DiscussionsView = enum { all, tags, new, edit, description, new_comment, edit_comment, remove }; │ │129 │ │130 pub const EventsView = enum { active, removed }; │ │131 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │453 switch (route) { │ │454 .repo_issues => |*thread| thread.view = .edit_comment, │ │455 .repo_discussions => |*thread| thread.view = .edit_comment, │ │456 + else => unreachable, │ │457 + } │ │458 + return route; │ │459 + } │ │460 + │ │461 + // build the confirmation route for removing a thread or comment. │ │462 + pub fn repoThreadRemoveRoute(kind: evt.EventKind, identity: []const u8, thread_id: []const u8, comment_id: []const u8) ?RoutablePage {│ │463 + var route = if (comment_id.len == 0) │ │464 + repoThreadCommentsRoute(kind, identity, thread_id, 0) orelse return null │ │465 + else │ │466 + repoThreadCommentRoute(kind, identity, thread_id, comment_id, 0) orelse return null; │ │467 + switch (route) { │ │468 + .repo_issues => |*thread| thread.view = .remove, │ │469 + .repo_discussions => |*thread| thread.view = .remove, │ │470 else => unreachable, │ │471 } │ │472 return route; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │629 else │ │630 try std.fmt.allocPrint(arena.allocator(), "{s}/" ++ issue_seg ++ "{s}/" ++ comment_seg ++ "{s}/new", .{ prefix, i.selected.slice(), i.comment.slice() }); │ │631 if (i.view == .edit_comment) break :blk try std.fmt.allocPrint(arena.allocator(), "{s}/" ++ issue_seg ++ "{s}/" ++ comment_seg ++ "{s}/edit", .{ prefix, i.selected.slice(), i.comment.slice() });│ │632 + if (i.view == .remove) break :blk if (i.comment.len == 0) │ │633 + try std.fmt.allocPrint(arena.allocator(), "{s}/" ++ issue_seg ++ "{s}/remove", .{ prefix, i.selected.slice() }) │ │634 + else │ │635 + try std.fmt.allocPrint(arena.allocator(), "{s}/" ++ issue_seg ++ "{s}/" ++ comment_seg ++ "{s}/remove", .{ prefix, i.selected.slice(), i.comment.slice() }); │ │636 if (i.view == .conflicts) break :blk if (i.selected.len == 0) │ │637 try std.fmt.allocPrint(arena.allocator(), "{s}/issues/conflicts", .{prefix}) │ │638 else │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │659 else │ │660 try std.fmt.allocPrint(arena.allocator(), "{s}/" ++ discussion_seg ++ "{s}/" ++ comment_seg ++ "{s}/new", .{ prefix, t.selected.slice(), t.comment.slice() }); │ │661 if (t.view == .edit_comment) break :blk try std.fmt.allocPrint(arena.allocator(), "{s}/" ++ discussion_seg ++ "{s}/" ++ comment_seg ++ "{s}/edit", .{ prefix, t.selected.slice(), t.comment.slice() });│ │662 + if (t.view == .remove) break :blk if (t.comment.len == 0) │ │663 + try std.fmt.allocPrint(arena.allocator(), "{s}/" ++ discussion_seg ++ "{s}/remove", .{ prefix, t.selected.slice() }) │ │664 + else │ │665 + try std.fmt.allocPrint(arena.allocator(), "{s}/" ++ discussion_seg ++ "{s}/" ++ comment_seg ++ "{s}/remove", .{ prefix, t.selected.slice(), t.comment.slice() }); │ │666 if (t.comment.len != 0) break :blk if (t.comments_start == 0) │ │667 try std.fmt.allocPrint(arena.allocator(), "{s}/" ++ discussion_seg ++ "{s}/" ++ comment_seg ++ "{s}", .{ prefix, t.selected.slice(), t.comment.slice() }) │ │668 else │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │833 if (!params.only(&.{})) return null; │ │834 if (std.mem.eql(u8, last, "new")) return repoThreadCommentNewRoute(.issue, pair, issue_id, comment_id); │ │835 if (std.mem.eql(u8, last, "edit")) return repoThreadCommentEditRoute(.issue, pair, issue_id, comment_id);│ │836 + if (std.mem.eql(u8, last, "remove")) return repoThreadRemoveRoute(.issue, pair, issue_id, comment_id); │ │837 return null; │ │838 } │ │839 if (!params.only(&.{.start})) return null; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │844 if (word) |tail| { │ │845 if (std.mem.eql(u8, tail, "new")) return if (params.only(&.{})) repoThreadCommentNewRoute(.issue, pair, issue_id, "") else null; │ │846 if (std.mem.eql(u8, tail, "edit")) return if (params.only(&.{})) repoThreadEditRoute(.issue, pair, issue_id) else null; │ │847 + if (std.mem.eql(u8, tail, "remove")) return if (params.only(&.{})) repoThreadRemoveRoute(.issue, pair, issue_id, "") else null; │ │848 if (std.mem.eql(u8, tail, "description")) return if (params.only(&.{})) repoThreadDescriptionRoute(.issue, pair, issue_id) else null;│ │849 if (std.mem.eql(u8, tail, "resolve")) { │ │850 if (!params.only(&.{.theirs})) return null; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │868 if (!params.only(&.{})) return null; │ │869 if (std.mem.eql(u8, last, "new")) return repoThreadCommentNewRoute(.discussion, pair, discussion_id, comment_id); │ │870 if (std.mem.eql(u8, last, "edit")) return repoThreadCommentEditRoute(.discussion, pair, discussion_id, comment_id);│ │871 + if (std.mem.eql(u8, last, "remove")) return repoThreadRemoveRoute(.discussion, pair, discussion_id, comment_id); │ │872 return null; │ │873 } │ │874 if (!params.only(&.{.start})) return null; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │879 if (word) |tail| { │ │880 if (std.mem.eql(u8, tail, "new")) return if (params.only(&.{})) repoThreadCommentNewRoute(.discussion, pair, discussion_id, "") else null; │ │881 if (std.mem.eql(u8, tail, "edit")) return if (params.only(&.{})) repoThreadEditRoute(.discussion, pair, discussion_id) else null; │ │882 + if (std.mem.eql(u8, tail, "remove")) return if (params.only(&.{})) repoThreadRemoveRoute(.discussion, pair, discussion_id, "") else null; │ │883 if (std.mem.eql(u8, tail, "description")) return if (params.only(&.{})) repoThreadDescriptionRoute(.discussion, pair, discussion_id) else null;│ │884 return null; │ │885 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Comment.zig│ ╰───────────────────────╯ ╭─────────────────────────────────────────╮ │138 │ │139 pub const Item = struct { │ │140 box: wgt.Box(ui.Widget), │ │141 - id: [evt.event_id_size]u8, │ │142 - remove_button_id: ?usize, │ │141 │ │142 const metadata_index: usize = 0;│ │143 const body_index: usize = 1; │ ╰─────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │147 pub fn init(allocator: std.mem.Allocator, session: *ui.Session, identity: []const u8, thread_kind: evt.EventKind, entry: CommentWithId) !Item {│ │148 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .vert }); │ │149 errdefer box.deinit(allocator); │ │152 - var remove_button_id: ?usize = null; │ │150 │ │151 { │ │152 var bar = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .horiz }); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯