╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────╮ │src/ui/Repo.zig│ ╰───────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │361 try Files.emptyResult(aa, handle, requested_ref_or_oid orelse .branch, requested_ref_value, files_dir), │ │362 Changes{ .commits = try Commits.emptyResult(aa, handle, requested_ref_or_oid orelse .branch, requested_ref_value, commits_base_oid) }, │ │363 try Refs.emptyResult(arena, repo_identity.identity, refs_kind, refs_from, refs_search), │ │364 + try Discussions.emptyResult(aa, repo_identity.identity, discussions_label, discussions_search, discussions_selected, discussions_comment, discussions_comments_start, discussions_view),│ │365 try Issues.emptyResult(aa, repo_identity.identity, issues_label, issues_search, issues_selected, issues_comment, issues_comments_start, issues_theirs, issues_view), │ │366 try Patches.emptyResult(aa, repo_identity.identity, patches_label, patches_search, patches_selected, patches_comment, patches_comments_start, patches_theirs, patches_view), │ │349 - try Discussions.emptyResult(aa, repo_identity.identity, discussions_label, discussions_search, discussions_selected, discussions_comment, discussions_comments_start, discussions_view),│ │367 try Events.empty(aa, repo_identity.identity, events_view, session.local != null, session.data.sync_failure), │ │368 }; │ │369 }; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────╮ │370 if (route == .repo_undo and undo_data == null) return error.NotFound;│ │371 if (route == .repo_repo and settings == null) return error.NotFound; │ │372 if (undo_data) |*undo| undo.clear = undo_clear; │ │373 + discussions.repo_source = source; │ │374 issues.repo_source = source; │ │375 patches.repo_source = source; │ │376 patches.repo_id = repo_id_maybe; │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────╮ │359 - discussions.repo_source = source; │ │377 │ │378 return .{ │ │379 // use the files tab's resolved ref for the header│ ╰───────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │363 - .header = try Header.init(arena, repo.event.name, owner_name, files.ref_or_oid, files.ref_or_oid_value, issues.label, patches.label, discussions.label),│ │380 + .header = try Header.init(arena, repo.event.name, owner_name, files.ref_or_oid, files.ref_or_oid_value, discussions.label, issues.label, patches.label),│ │381 .repo = repo, │ │382 .handle = handle, │ │383 .files = files, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────╮ │384 .changes = changes, │ │385 .refs = refs, │ │386 + .discussions = discussions,│ │387 .issues = issues, │ │388 .patches = patches, │ │371 - .discussions = discussions,│ │389 .events = events, │ │390 .undo = undo_data, │ │391 .settings = settings, │ ╰────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │392 .quit = Quit.init(), │ │393 }; │ │394 +} │ │395 + │ │396 +// the viewer a tab's comment bar sees, which is none below the tab's role │ │397 +fn tabViewer(handle: ui.RepoHandle, repo: evt.Repo.Record, kind: evt.EventKind) ?ui.Viewer {│ │398 + const viewer = handle.viewer orelse return null; │ │399 + const tab_role = repo.event.threadRole(kind) orelse return null; │ │400 + return if (viewer.role.atLeast(tab_role)) viewer else null; │ │401 } │ │402 │ │403 pub const View = struct { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │449 try stack.children.put(allocator, refs_view.getFocus().id, .{ .repo_refs = refs_view }); │ │450 } │ │451 │ │452 + // discussions and their comment permalinks. │ │453 + if (data.repo.event.discuss_role != null) { │ │454 + var discussions_view = try Discussions.View.init(allocator, &data.discussions, session); │ │455 + errdefer discussions_view.deinit(allocator); │ │456 + try stack.children.put(allocator, discussions_view.getFocus().id, .{ .repo_discussions = discussions_view });│ │457 + } │ │458 + │ │459 // issues — the repo's issue tracker and comment permalinks. │ │429 - { │ │460 + if (data.repo.event.issue_role != null) { │ │461 var issues_view = try Issues.View.init(allocator, &data.issues, session); │ │462 errdefer issues_view.deinit(allocator); │ │463 try stack.children.put(allocator, issues_view.getFocus().id, .{ .repo_issues = issues_view }); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │464 } │ │465 │ │466 // patches and their comment permalinks. │ │436 - { │ │467 + if (data.repo.event.patch_role != null) { │ │468 var patches_view = try Patches.View.init(allocator, &data.patches, session); │ │469 errdefer patches_view.deinit(allocator); │ │470 try stack.children.put(allocator, patches_view.getFocus().id, .{ .repo_patches = patches_view });│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │471 } │ │472 │ │442 - // discussions and their comment permalinks. │ │443 - { │ │444 - var discussions_view = try Discussions.View.init(allocator, &data.discussions, session); │ │445 - errdefer discussions_view.deinit(allocator); │ │446 - try stack.children.put(allocator, discussions_view.getFocus().id, .{ .repo_discussions = discussions_view });│ │447 - } │ │448 - │ │473 if (data.handle.canWrite()) { │ │474 var events_view = try Events.View.init(allocator, &data.events, session); │ │475 errdefer events_view.deinit(allocator); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │524 // tab's own search box. │ │525 const results = data.files.find != null or │ │526 (data.changes == .commits and data.changes.commits.search != null) or │ │503 - data.issues.search != null or data.patches.search != null or data.discussions.search != null;│ │527 + data.discussions.search != null or data.issues.search != null or data.patches.search != null;│ │528 self.getFocus().child_id = box.children.keys()[if (results) stack_index else header_index]; │ │529 return self; │ │530 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯