╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────╮ │38 comments: Comment.Window = .empty, │ │39 attachments: []const Attachment.WithId = &.{},│ │40 draft: bool = false, │ │41 - revision_ready: bool = false, │ │41 fork_oid: []const u8 = "", │ │42 target_branch: []const u8 = "", │ │43 no_changes: bool = false, │ ╰──────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────╮ │150 return ui.RoutablePage.repoPatchesResolveRoute(identity, selected, picks); │ │151 } │ │152 │ │153 +pub fn publishRoute(identity: []const u8, selected: []const u8) ?ui.RoutablePage {│ │154 + return ui.RoutablePage.repoPatchPublishRoute(identity, selected); │ │155 +} │ │156 + │ │157 pub fn createDraft( │ │158 data: *const Self, │ │159 session: *ui.Session, │ ╰───────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │381 } │ │382 }; │ │383 empty.drafts = drafts_window; │ │381 - if (draft_selected and view != .edit and view != .remove) empty.view = .drafts; │ │384 + if (draft_selected and view != .edit and view != .publish and view != .remove) empty.view = .drafts;│ │385 │ │386 // an explicitly named published patch that doesn't exist is a bad url │ │387 // (NotFound -> 404); drafts, tags, and bare routes can use the empty fallback. │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │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, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯