╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─────────────╮ │src/ui/Repo/Events.zig│ ╰──────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │297 }, │ │298 .repo => { │ │299 const record = (try evt.readRecordSubset(evt.Repo, Owned, DB, hash_kind, haxy_moment, arena, id)) orelse return null;│ │300 - if (admin_moment) |moment| { │ │301 - if (try evt.User.readById(evt.AdminDB, evt.admin_repo_opts.hash, moment, arena, record.event.user_id)) |user| │ │302 - item.author = .{ .user_name = user.event.name }; │ │303 - } │ │304 - }, │ │305 - .fork => { │ │306 - const record = (try evt.readRecordSubset(evt.Fork, Owned, DB, hash_kind, haxy_moment, arena, id)) orelse return null;│ │300 if (admin_moment) |moment| { │ │301 if (try evt.User.readById(evt.AdminDB, evt.admin_repo_opts.hash, moment, arena, record.event.user_id)) |user| │ │302 item.author = .{ .user_name = user.event.name }; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │303 } │ │304 }, │ │305 + .fork => _ = (try evt.readRecordSubset(evt.Fork, struct { removed: bool }, DB, hash_kind, haxy_moment, arena, id)) orelse return null,│ │306 .issue => { │ │307 const record = (try evt.readRecordSubset(evt.Issue, Authored, DB, hash_kind, haxy_moment, arena, id)) orelse return null; │ │308 item.author = try ui.Author.initFromEmail(admin_moment, arena, record.author_email); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────────────────────────────────────────────────────╮ │153 commit_count: ?u64 = null, │ │154 no_changes: bool = false, │ │155 fork_exists: bool = false, │ │156 + // the name of the user whose fork backs the patch│ │157 + forker: []const u8 = "", │ │158 mergeability: pch.Mergeability = .{}, │ │159 }; │ │160 │ ╰───────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │256 │ │257 pub fn listRoute(identity: []const u8, status: Status, label: []const u8, selected: []const u8) ?ui.RoutablePage {│ │258 return ui.RoutablePage.repoPatchesRoute(identity, status, label, selected); │ │259 +} │ │260 + │ │261 +// a fork route's identity names the forker and the target repo │ │262 +fn forkIdentity(buffer: []u8, identity: []const u8, entry: PatchWithId) ![]const u8 { │ │263 + const repo_identity = ui.RoutablePage.RepoIdentity.parse(identity) orelse return error.RouteTooLong; │ │264 + return std.fmt.bufPrint(buffer, "{s}/{s}", .{ entry.forker, repo_identity.name }) catch error.RouteTooLong; │ │265 } │ │266 │ │267 pub fn commitsRoute(identity: []const u8, entry: PatchWithId) !?ui.RoutablePage { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │268 + var buffer: [ui.RoutablePage.repo_identity_max_len]u8 = undefined; │ │269 if (entry.fork_exists and entry.record.event.status.kind() != .merged) │ │261 - return ui.RoutablePage.forkCommitsRoute(identity, entry.id, "", 0, "") orelse error.RouteTooLong; │ │270 + return ui.RoutablePage.forkCommitsRoute(try forkIdentity(&buffer, identity, entry), entry.id, "", 0, "") orelse error.RouteTooLong;│ │271 if (entry.revision_oid.len == 0 or entry.base_oid.len == 0) return null; │ │272 return ui.RoutablePage.repoCommitsRoute(identity, .object, entry.revision_oid, 0, "", entry.base_oid) orelse error.RouteTooLong; │ │273 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │278 // merged patches show what actually landed, including conflict resolutions │ │279 .merged => |merged| merged.patchrev_id, │ │280 .open, .closed => blk: { │ │272 - if (entry.fork_exists) return ui.RoutablePage.forkDiffRoute(identity, entry.id, 0, "") orelse error.RouteTooLong; │ │281 + if (entry.fork_exists) { │ │282 + var buffer: [ui.RoutablePage.repo_identity_max_len]u8 = undefined; │ │283 + return ui.RoutablePage.forkDiffRoute(try forkIdentity(&buffer, identity, entry), entry.id, 0, "") orelse error.RouteTooLong;│ │284 + } │ │285 if (patch.source_branch == null) return null; │ │286 break :blk (patch.revision orelse return null).id; │ │287 }, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────╮ │322 data: *const Self, │ │323 session: *ui.Session, │ │324 allocator: std.mem.Allocator,│ │313 - author: evt.CommitAuthor, │ │325 + actor: ui.Actor, │ │326 title: []const u8, │ │327 labels: []const u8, │ │328 description: []const u8, │ ╰──────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────╮ │347 .description = description, │ │348 .target_branch = target_branch,│ │349 .source_branch = branch, │ │338 - }, null, author), │ │350 + }, null, actor.author), │ │351 } │ │352 }, │ │353 } │ ╰────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │355 } │ │356 if (session.data.host_kind == .local) return error.InvalidSourceBranch; │ │357 const repos_dir = session.repos_dir orelse return error.NotFound; │ │346 - const admin_repo = session.admin_repo orelse return error.NotFound; │ │347 - const user_id = session.userId() orelse return error.NotFound; │ │358 + const user_id = actor.user_id orelse return error.NotFound; │ │359 const repo_id = data.repo_id orelse return error.NotFound; │ │360 + const repo_user_id = actor.repo_user_id orelse return error.NotFound; │ │361 if (!evt.Patch.branchValid(target_branch) or !try repo_source.hasBranch(io, allocator, target_branch)) return error.InvalidTargetBranch;│ │350 - const fork_path = try fork.create(.{}, io, allocator, repos_dir, admin_repo, .{ │ │362 + var user_repo = (try evt.openUserRepo(io, allocator, repos_dir, &user_id)) orelse return error.NotFound; │ │363 + defer user_repo.deinit(io, allocator); │ │364 + const fork_path = try fork.create(.{}, io, allocator, repos_dir, &user_repo, .{ │ │365 .id = id, │ │366 .user_id = user_id, │ │367 .repo_id = repo_id, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────╮ │368 + .repo_user_id = repo_user_id,│ │369 .title = title, │ │370 .description = description, │ │371 .labels = labels, │ ╰──────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯