╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │500 var closed_window = try thread.loadWindow(Self, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_patch, closed_set, closed_root, conflict_set, empty.selected_id, thread_comments_start); │ │501 var merged_window = try thread.loadWindow(Self, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_patch, merged_set, merged_root, conflict_set, empty.selected_id, thread_comments_start); │ │502 var conflicts_window = try thread.loadWindow(Self, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_patch, conflict_set, conflicts_root, conflict_set, empty.selected_id, thread_comments_start);│ │500 - try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &open_window); │ │501 - try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &closed_window); │ │502 - try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &merged_window); │ │503 - try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &conflicts_window); │ │503 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, target_branch, &open_window); │ │504 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, target_branch, &closed_window); │ │505 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, target_branch, &merged_window); │ │506 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, target_branch, &conflicts_window); │ │507 if (view == .conflicts and conflicts_window.count > 0) resolved_view = .conflicts; │ │508 │ │509 const comment_page = if (empty.comment_id.len == 0) │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────╮ │540 arena: *std.heap.ArenaAllocator, │ │541 admin_moment: ?evt.AdminDB.HashMap(.read_only),│ │542 repo: *rp.Repo(repo_kind, repo_opts), │ │543 + default_target_branch: []const u8, │ │544 target: *Window, │ │545 ) !void { │ │546 if (target.items.len == 0) return; │ ╰────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │551 const record = try evt.Fork.readById(evt.AdminDB, evt.admin_repo_opts.hash, moment, arena, &id);│ │552 item.fork_exists = if (record) |value| !value.removed else false; │ │553 } │ │550 - const revision = item.record.event.revision orelse continue; │ │554 + const revision = item.record.event.revision orelse { │ │555 + if (item.fork_exists) item.target_branch = default_target_branch; │ │556 + continue; │ │557 + }; │ │558 const target_branch = revision.targetBranch() orelse continue; │ │559 item.fork_oid = revision.source_oid; │ │560 item.target_branch = target_branch; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │653 const fork_oid = (try fork_repo.readRef(io, fork.ref)) orelse return null; │ │654 const moment = evt.currentMoment(.{}, fork_repo) catch return null; │ │655 const patch = (try evt.Patch.readById(evt.EventDB(.sha1), .sha1, moment, arena, &id)) orelse return null;│ │649 - var revision_ready = false; │ │656 var target_branch = default_target_branch; │ │657 if (patch.event.revision) |revision| { │ │658 target_branch = revision.targetBranch() orelse return null; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │653 - const revision_id = evt.parseEventId(&revision.id) catch return null; │ │654 - if (try evt.PatchRev.readById(evt.EventDB(.sha1), .sha1, moment, arena, &revision_id)) |record|│ │655 - revision_ready = revision.matches(record); │ │659 } │ │660 const target_oid = if (target_branch.len != 0) │ │661 try target_repo.readRef(io, .{ .kind = .head, .name = target_branch }) │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │666 .record = patch, │ │667 .author = try ui.Author.initFromEmail(admin_moment, arena, patch.author_email), │ │668 .draft = true, │ │666 - .revision_ready = revision_ready, │ │669 .fork_oid = try aa.dupe(u8, &fork_oid), │ │670 .target_branch = try aa.dupe(u8, target_branch), │ │671 .no_changes = if (target_oid) |oid| std.mem.eql(u8, &oid, &fork_oid) else false,│ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │793 if (session.local == null) { │ │794 const route = switch (data.view) { │ │795 .edit => ui.RoutablePage.repoThreadEditRoute(.patch, data.identity, data.selected_id) orelse return error.RouteTooLong, │ │796 + .publish => ui.RoutablePage.repoPatchPublishRoute(data.identity, data.selected_id) orelse return error.RouteTooLong, │ │797 .new_comment => ui.RoutablePage.repoThreadCommentNewRoute(.patch, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, │ │798 .edit_comment => ui.RoutablePage.repoThreadCommentEditRoute(.patch, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong,│ │799 .remove => ui.RoutablePage.repoThreadRemoveRoute(.patch, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │803 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.new));│ │804 const label: []const u8 = switch (data.view) { │ │805 .edit => "edit", │ │806 + .publish => "publish", │ │807 .new_comment => "reply", │ │808 .edit_comment => "edit", │ │809 .remove => "remove", │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────────────╮ │src/ui/widget/thread.zig│ ╰────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │467 │ │468 fn draftsRoute(identity: []const u8) ?ui.RoutablePage { │ │469 return if (supports_drafts) Data.draftsRoute(identity) else null; │ │470 + } │ │471 + │ │472 + fn publishRoute(identity: []const u8, selected: []const u8) ?ui.RoutablePage { │ │473 + return if (supports_drafts) Data.publishRoute(identity, selected) else null;│ │474 } │ │475 │ │476 fn forkRoute(identity: []const u8, id: []const u8) ?ui.RoutablePage { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │532 } │ │533 │ │534 if (supports_drafts and entryDraft(entry)) { │ │531 - if (entry.revision_ready) { │ │532 - const route = listRoute(self.data.identity, @enumFromInt(0), "", entry.id) orelse return error.RouteTooLong; │ │533 - row.getFocus().kind = .{ .custom = try std.fmt.allocPrint(pa, "form:{s}/publish", .{try route.toUrl(self.session.page_arena)}) };│ │534 - try addToolButton(allocator, row, "publish", "submit"); │ │535 - } │ │535 + const route = publishRoute(self.data.identity, entry.id) orelse return error.RouteTooLong; │ │536 + try addToolButton(allocator, row, "publish", try std.fmt.allocPrint(pa, "a:{s}", .{try route.toUrl(self.session.page_arena)})); │ │537 if (self.session.data.user_id != null) { │ │538 const edit_route = ui.RoutablePage.repoThreadEditRoute(kind, self.data.identity, entry.id) orelse return error.RouteTooLong; │ │539 try addToolButton(allocator, row, "edit", try std.fmt.allocPrint(pa, "a:{s}", .{try edit_route.toUrl(self.session.page_arena)}));│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯