╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─────────────╮ │src/ui/Repo/Events.zig│ ╰──────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │329 var thread_id: [evt.event_id_size]u8 = undefined; │ │330 _ = std.fmt.hexToBytes(&thread_id, &record.event.thread_id) catch return error.InvalidEventId; │ │331 const thread_kind = (try evt.readEventKind(hash_kind, kind_map, &thread_id)) orelse return item; │ │332 + if (repo_event.threadRole(thread_kind) == null) return item; │ │333 const route = ui.RoutablePage.repoThreadCommentRoute(thread_kind, identity, &record.event.thread_id, item.id, 0) orelse return item;│ │334 item.view_url = try route.toUrl(arena); │ │335 }, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │340 var parent_id: [evt.event_id_size]u8 = undefined; │ │341 _ = std.fmt.hexToBytes(&parent_id, &record.event.parent_id) catch return error.InvalidEventId; │ │342 const parent_kind = (try evt.readEventKind(hash_kind, kind_map, &parent_id)) orelse return item; │ │343 + if (repo_event.threadRole(parent_kind) == null) return item; │ │344 const route = ui.RoutablePage.repoThreadCommentsRoute(parent_kind, identity, &record.event.parent_id, 0) orelse return item;│ │345 item.view_url = try route.toUrl(arena); │ │346 }, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │347 .patch => { │ │348 const record = (try evt.readRecordSubset(evt.Patch, Authored, DB, hash_kind, haxy_moment, arena, id)) orelse return null;│ │349 item.author = try ui.Author.initFromEmail(admin_moment, arena, record.author_email); │ │345 - if (!include_view_url) return item; │ │350 + if (!include_view_url or repo_event.threadRole(.patch) == null) return item; │ │351 const route = ui.RoutablePage.repoThreadCommentsRoute(.patch, identity, item.id, 0) orelse return error.RouteTooLong; │ │352 item.view_url = try route.toUrl(arena); │ │353 }, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────────╮ │src/ui/Repo/Header.zig│ ╰──────────────────────╯ ╭─────────────────────────────────────────────╮ │14 const commits_tab_label = "commits"; │ │15 const files_tab_label = "files"; │ │16 const refs_tab_label = "refs"; │ │17 +const discuss_tab_label = "discuss"; │ │18 const issues_tab_label = "issues"; │ │19 const patches_tab_label = "patches"; │ │19 -const discuss_tab_label = "discuss"; │ │20 const events_tab_label = "events"; │ │21 const new_tab_label = "new"; │ │22 const new_repo_tab_bottom_label = "repo";│ ╰─────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │31 // the ref/oid this page is viewing; the value is url-encoded │ │32 ref_or_oid: RefOrOid, │ │33 ref_or_oid_value: []const u8, │ │34 -// the issues tab's label filter, url-encoded ("" = unfiltered), so the tab links│ │35 -// back to the filtered list. │ │34 +// each thread tab's label filter, url-encoded ("" = unfiltered), so the tab │ │35 +// links back to the filtered list. │ │36 +discussions_label: []const u8, │ │37 issues_label: []const u8, │ │38 patches_label: []const u8, │ │38 -discussions_label: []const u8, │ │39 │ │40 const Self = @This(); │ │41 │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │42 -pub fn init(arena: *std.heap.ArenaAllocator, name: []const u8, owner_name: []const u8, ref_or_oid: RefOrOid, ref_or_oid_value: []const u8, issues_label: []const u8, patches_label: []const u8, discussions_label: []const u8) !Self {│ │42 +pub fn init(arena: *std.heap.ArenaAllocator, name: []const u8, owner_name: []const u8, ref_or_oid: RefOrOid, ref_or_oid_value: []const u8, discussions_label: []const u8, issues_label: []const u8, patches_label: []const u8) !Self {│ │43 return .{ │ │44 .name = name, │ │45 .owner_name = owner_name, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────╮ │46 .title = try ui.Title.init(arena, name, .scanlines),│ │47 .ref_or_oid = ref_or_oid, │ │48 .ref_or_oid_value = ref_or_oid_value, │ │49 + .discussions_label = discussions_label, │ │50 .issues_label = issues_label, │ │51 .patches_label = patches_label, │ │51 - .discussions_label = discussions_label, │ │52 }; │ │53 } │ │54 │ ╰────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │157 const changes_link = try ui.inPageTabLink(session, changes_route, current_tag == changes_tag); │ │158 const refs_route = ui.RoutablePage.repoRefsRoute(identity, .branch, "") orelse return error.RouteTooLong; │ │159 const refs_link = try ui.inPageTabLink(session, refs_route, current_tag == .repo_refs); │ │160 + const discussions_route = ui.RoutablePage.repoDiscussionsRoute(identity, data.discussions_label, "") orelse return error.RouteTooLong;│ │161 + const discussions_link = try ui.inPageTabLink(session, discussions_route, current_tag == .repo_discussions); │ │162 const issues_route = ui.RoutablePage.repoIssuesRoute(identity, .open, data.issues_label, "") orelse return error.RouteTooLong; │ │163 const issues_link = try ui.inPageTabLink(session, issues_route, current_tag == .repo_issues); │ │164 const patches_route = ui.RoutablePage.repoPatchesRoute(identity, .open, data.patches_label, "") orelse return error.RouteTooLong; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │165 const patches_link = try ui.inPageTabLink(session, patches_route, current_tag == .repo_patches); │ │164 - const discussions_route = ui.RoutablePage.repoDiscussionsRoute(identity, data.discussions_label, "") orelse return error.RouteTooLong;│ │165 - const discussions_link = try ui.inPageTabLink(session, discussions_route, current_tag == .repo_discussions); │ │166 const events_route = ui.RoutablePage.repoEventsRoute(identity, .active, null, "", null) orelse return error.RouteTooLong; │ │167 const events_link = try ui.inPageTabLink(session, events_route, current_tag == .repo_events); │ │168 const new_repo_route = ui.RoutablePage{ .repo_repo_new = Array.from(identity) orelse return error.RouteTooLong }; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │221 }); │ │222 } │ │223 │ │224 - // issues tab │ │225 - { │ │226 - var text_box = try wgt.TextBox.init(allocator, issues_tab_label, .{ .border = .single, .round_corners = true, .wrap_kind = .none }); │ │224 + // discuss tab, unless it is off │ │225 + if (page.repo.event.discuss_role != null) { │ │226 + var text_box = try wgt.TextBox.init(allocator, discuss_tab_label, .{ .border = .single, .round_corners = true, .wrap_kind = .none });│ │227 errdefer text_box.deinit(allocator); │ │228 text_box.getFocus().mode = .all; │ │229 - text_box.getFocus().kind = .{ .custom = issues_link }; │ │229 + text_box.getFocus().kind = .{ .custom = discussions_link }; │ │230 try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │231 - if (current_tag == .repo_issues) selected_tab = text_box.getFocus().id; │ │231 + if (current_tag == .repo_discussions) selected_tab = text_box.getFocus().id; │ │232 try tabs_box.children.put(allocator, text_box.getFocus().id, .{ │ │233 .widget = .{ .text_box = text_box }, │ │234 .rect = null, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯