╭ changed ─────────╮ │src/event/Repo.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │ 8 description: []const u8, │ │ 9 read_access: Access = .private, │ │10 write_access: Access = .private, │ │11 +// the least role that may write in each tab, null turns the tab off │ │12 +discuss_role: ?Role = .read, │ │13 +issue_role: ?Role = .read, │ │14 +patch_role: ?Role = null, │ │15 │ │16 // what the db stores: the event's data plus the commit-derived fields│ │17 pub const Record = struct { │ ╰──────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │50 │ │51 pub const name_max_len = 32; │ │52 │ │53 +// the role a kind's tab needs for a write, or null when the tab is off or the │ │54 +// kind has no tab │ │55 +pub fn threadRole(self: Self, kind: evt.EventKind) ?Role { │ │56 + return switch (kind) { │ │57 + .discuss => self.discuss_role, │ │58 + .issue => self.issue_role, │ │59 + .patch => self.patch_role, │ │60 + else => null, │ │61 + }; │ │62 +} │ │63 + │ │64 // the role `user_id_maybe` holds in the repo, or null when they hold none: its│ │65 // creator owns it, and anyone else gets the higher of the base role and their │ │66 // grant. `user_moment` is the owner's, which holds the grants. a null user is │ ╰───────────────────────────────────────────────────────────────────────────────────╯