╭ changed ──────╮ │src/ui/Repo.zig│ ╰───────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────╮ │24 pub const Comment = @import("./Repo/Comment.zig"); │ │25 pub const Undo = @import("./Repo/Undo.zig"); │ │26 pub const Events = @import("./Repo/Events.zig"); │ │27 +pub const Settings = @import("./Repo/Settings.zig");│ │28 pub const Quit = @import("./Quit.zig"); │ │29 │ │30 header: Header, │ ╰────────────────────────────────────────────────────────╯ ╭───────────────────────────────╮ │38 discussions: Discussions, │ │39 events: Events, │ │40 undo: ?Undo = null, │ │41 +settings: ?Settings = null,│ │42 quit: Quit, │ │43 │ │44 const Self = @This(); │ ╰───────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │276 const undo_clear = route == .repo_undo and route.repo_undo.clear; │ │277 // only xit repos have undo history, so it's read in their branch below │ │278 var undo_data: ?Undo = null; │ │279 + // only the owner sees the settings, which show the repo's hash kind │ │280 + var settings: ?Settings = null; │ │281 const files, const changes, const refs, var issues, var patches, var discussions, const events = blk: {│ │282 read: { │ │283 const io = session.io orelse break :read; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │294 try evt.consume(.local, .repo, repo_kind, opened.self_repo_opts, io, gpa, opened, evt.events_ref, &.{}); │ │295 try pch.refreshBranches(.local, repo_kind, opened.self_repo_opts, io, gpa, opened, null, null); │ │296 } │ │297 + if (session.data.host_kind == .server and handle.canUndo()) settings = .{ │ │298 + .identity = try arena.allocator().dupe(u8, repo_identity.identity), │ │299 + .name = repo.event.name, │ │300 + .description = repo.event.description, │ │301 + .access = repo.event.read_access, │ │302 + .hash_kind = opened.self_repo_opts.hash, │ │303 + }; │ │304 // tabs switch in-page, so every tab's data is read here │ │305 if (repo_kind == .xit and handle.canWrite()) { │ │306 undo_data = Undo.init(opened.self_repo_opts, arena, opened, session.haxy_moment, repo_identity.identity, undo_index, handle) catch |err| switch (err) {│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │307 error.OutOfMemory => return err, │ │297 - else => .{ .identity = repo_identity.identity, .handle = handle, .failure = @errorName(err) }, │ │308 + else => .{ .identity = try arena.allocator().dupe(u8, repo_identity.identity), .handle = handle, .failure = @errorName(err) },│ │309 }; │ │310 } │ │311 // a merge: route stands for the log of what the merge brought in │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────╮ │352 }; │ │353 }; │ │354 if (route == .repo_undo and undo_data == null) return error.NotFound;│ │355 + if (route == .repo_repo and settings == null) return error.NotFound; │ │356 if (undo_data) |*undo| undo.clear = undo_clear; │ │357 issues.repo_source = source; │ │358 patches.repo_source = source; │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────╮ │372 .discussions = discussions,│ │373 .events = events, │ │374 .undo = undo_data, │ │375 + .settings = settings, │ │376 .quit = Quit.init(), │ │377 }; │ │378 } │ ╰────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │457 var undo_view = try Undo.View.init(allocator, undo, session); │ │458 errdefer undo_view.deinit(allocator); │ │459 try stack.children.put(allocator, undo_view.getFocus().id, .{ .repo_undo = undo_view }); │ │460 + } │ │461 + │ │462 + if (data.settings) |*settings| { │ │463 + var settings_view = try Settings.View.init(allocator, settings, session); │ │464 + errdefer settings_view.deinit(allocator); │ │465 + try stack.children.put(allocator, settings_view.getFocus().id, .{ .repo_settings = settings_view });│ │466 } │ │467 │ │468 // the header shows new repo with a login, and new user without one │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯