╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─────────────╮ │src/ui/Repo/Events.zig│ ╰──────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │138 return .{ │ │139 .identity = try aa.dupe(u8, identity), │ │140 .view = view, │ │141 + .selected = null, │ │142 .active = .{}, │ │143 .removed = .{}, │ │144 .header = if (local) try Header.empty(aa, failure) else Header.remote(),│ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │402 if (self.header().getSelectedIndex()) |index| │ │403 self.contentStack().getFocus().child_id = self.contentStack().children.keys()[index]; │ │404 const view = self.selectedView(); │ │402 - if (ui.RoutablePage.repoEventsRoute(self.data.identity, view, null, "")) |route| │ │405 + var selected_kind: ?evt.EventKind = null; │ │406 + var selected_id: []const u8 = ""; │ │407 + if (view == self.data.view) { │ │408 + if (self.data.selected) |selected| { │ │409 + selected_kind = selected.kind; │ │410 + selected_id = selected.id; │ │411 + } │ │412 + } │ │413 + if (ui.RoutablePage.repoEventsRoute(self.data.identity, view, selected_kind, selected_id)) |route|│ │414 self.session.data.current_page = route; │ │415 try self.refreshDetail(allocator); │ │416 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────────╮ │src/ui/Repo/Issues.zig│ ╰──────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │288 .closed => closed_root = order_key, │ │289 } │ │290 // form urls keep their view; otherwise the issue's status picks it. │ │291 - if (view != .edit and view != .new_comment and view != .edit_comment) resolved_view = switch (issue_event.event.status) { │ │291 + if (view != .edit and view != .new_comment and view != .edit_comment and view != .remove) resolved_view = switch (issue_event.event.status) {│ │292 .open => .open, │ │293 .closed => .closed, │ │294 }; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │608 .edit => ui.RoutablePage.repoThreadEditRoute(.issue, data.identity, data.selected_id) orelse return error.RouteTooLong, │ │609 .new_comment => ui.RoutablePage.repoThreadCommentNewRoute(.issue, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, │ │610 .edit_comment => ui.RoutablePage.repoThreadCommentEditRoute(.issue, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong,│ │611 + .remove => ui.RoutablePage.repoThreadRemoveRoute(.issue, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, │ │612 .resolve => ui.RoutablePage.repoIssuesResolveRoute(data.identity, data.selected_id, data.theirs_picks) orelse return error.RouteTooLong, │ │613 else => ui.RoutablePage.repoThreadNewRoute(.issue, data.identity) orelse return error.RouteTooLong, │ │614 }; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────╮ │617 .edit => "edit", │ │618 .new_comment => "reply",│ │619 .edit_comment => "edit",│ │620 + .remove => "remove", │ │621 .resolve => "resolve", │ │622 else => "new", │ │623 }; │ ╰─────────────────────────────────────────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Threads.zig│ ╰───────────────────────╯ ╭─────────────────────────────────────────────────╮ │43 description_id: [view_count]?usize, │ │44 author_id: [view_count]?usize, │ │45 status_button_id: [view_count]?usize,│ │46 - remove_button_id: [view_count]?usize,│ │46 │ │47 const header_index: usize = 0; │ │48 const stack_index: usize = 1; │ ╰─────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │73 pub fn viewIndex(view: ViewKind) usize { │ │74 const name = @tagName(view); │ │75 if (std.mem.eql(u8, name, "tags")) return tags_view_index; │ │77 - if (std.mem.eql(u8, name, "new") or std.mem.eql(u8, name, "edit") or std.mem.eql(u8, name, "new_comment") or std.mem.eql(u8, name, "edit_comment") or std.mem.eql(u8, name, "resolve")) return form_view_index; │ │76 + if (std.mem.eql(u8, name, "new") or std.mem.eql(u8, name, "edit") or std.mem.eql(u8, name, "new_comment") or std.mem.eql(u8, name, "edit_comment") or std.mem.eql(u8, name, "remove") or std.mem.eql(u8, name, "resolve")) return form_view_index;│ │77 if (std.mem.eql(u8, name, "conflicts")) return conflict_view_index; │ │78 if (std.mem.eql(u8, name, "description")) unreachable; │ │79 inline for (@typeInfo(Status).@"enum".fields, 0..) |field, index| { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │118 │ │119 fn editCommentRoute(identity: []const u8, thread_id: []const u8, comment_id: []const u8) ?ui.RoutablePage {│ │120 return ui.RoutablePage.repoThreadCommentEditRoute(kind, identity, thread_id, comment_id); │ │121 + } │ │122 + │ │123 + fn removeRoute(identity: []const u8, thread_id: []const u8, comment_id: []const u8) ?ui.RoutablePage { │ │124 + return ui.RoutablePage.repoThreadRemoveRoute(kind, identity, thread_id, comment_id); │ │125 } │ │126 │ │127 fn editRoute(identity: []const u8, selected: []const u8) ?ui.RoutablePage { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │232 // logged-out session can't create events, so the unauthorized view │ │233 // stands in. │ │234 if (session.data.is_local or session.data.user_id != null) { │ │232 - if (data.view == .new_comment or data.view == .edit_comment) { │ │235 + if (data.view == .remove) { │ │236 + const aa = session.page_arena.allocator(); │ │237 + const route = removeRoute(data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong;│ │238 + const action = try std.fmt.allocPrint(aa, "form:{s}", .{try route.toUrl(session.page_arena)}); │ │239 + const event_name = if (data.comment_id.len == 0) @tagName(kind) else "comment"; │ │240 + const label = try std.fmt.allocPrint(aa, "remove {s}", .{event_name}); │ │241 + var center = try initRemoveForm(allocator, action, label); │ │242 + errdefer center.deinit(allocator); │ │243 + try stack.children.put(allocator, center.getFocus().id, .{ .center = center }); │ │244 + } else if (data.view == .new_comment or data.view == .edit_comment) { │ │245 const editing = data.view == .edit_comment; │ │246 const route = if (editing) │ │247 editCommentRoute(data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────╮ │336 .description_id = @splat(null), │ │337 .author_id = @splat(null), │ │338 .status_button_id = @splat(null),│ │327 - .remove_button_id = @splat(null),│ │339 }; │ │340 } │ │341 │ ╰──────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯