╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭───────────────────────────────────────────────────────────╮ │15 pub const Issue = @import("event/Issue.zig"); │ │16 pub const Comment = @import("event/Comment.zig"); │ │17 pub const Attachment = @import("event/Attachment.zig");│ │18 +pub const Assignment = @import("event/Assignment.zig");│ │19 pub const Patch = @import("event/Patch.zig"); │ │20 pub const PatchRev = @import("event/PatchRev.zig"); │ │21 │ ╰───────────────────────────────────────────────────────────╯ ╭──────────────────╮ │278 issue, │ │279 comment, │ │280 attach, │ │281 + assign, │ │282 patchrev,│ │283 patch, │ │284 }; │ ╰──────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │297 else => false, │ │298 }, │ │299 .repo => switch (kind) { │ │298 - .discuss, .issue, .comment, .attach, .patchrev, .patch => true, │ │300 + .discuss, .issue, .comment, .attach, .assign, .patchrev, .patch => true,│ │301 else => false, │ │302 }, │ │303 .fork => switch (kind) { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────╮ │328 issue: ?Issue, │ │329 comment: ?Comment, │ │330 attach: ?Attachment,│ │331 + assign: ?Assignment,│ │332 patchrev: ?PatchRev,│ │333 patch: ?Patch, │ │334 }; │ ╰─────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │456 .attach => .{ │ │457 .attach = if (json_event.data) |value| │ │458 try std.json.parseFromValueLeaky(Attachment, arena.allocator(), value, .{ .ignore_unknown_fields = true })│ │459 + else │ │460 + null, │ │461 + }, │ │462 + .assign => .{ │ │463 + .assign = if (json_event.data) |value| │ │464 + try std.json.parseFromValueLeaky(Assignment, arena.allocator(), value, .{ .ignore_unknown_fields = true })│ │465 else │ │466 null, │ │467 }, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────╮ │526 .issue => .{ .issue = null }, │ │527 .comment => .{ .comment = null }, │ │528 .attach => .{ .attach = null }, │ │529 + .assign => .{ .assign = null }, │ │530 .patchrev => .{ .patchrev = null },│ │531 .patch => .{ .patch = null }, │ │532 }; │ ╰────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1262 } else null; │ │1263 try Attachment.consume(DB, repo_opts.hash, haxy_moment, &current_event_id, record_maybe, &arena, &repo_event_oid); │ │1264 }, │ │1265 + .assign => |event_maybe| { │ │1266 + const record_maybe: ?Assignment.Record = if (event_maybe) |event| .{ │ │1267 + .event = event, │ │1268 + .author_email = authorEmail(commit_object.content.commit.metadata.author orelse ""), │ │1269 + .created_order = event_order, │ │1270 + .updated_order = event_order, │ │1271 + } else null; │ │1272 + try Assignment.consume(DB, repo_opts.hash, haxy_moment, &current_event_id, record_maybe, &arena, &repo_event_oid); │ │1273 + }, │ │1274 .patchrev => |event_maybe| { │ │1275 const record_maybe: ?PatchRev.Record = if (event_maybe) |event| blk: { │ │1276 const trees = try PatchRev.readTrees(repo_kind, repo_opts, read_state, io, allocator, &commit_object.content.commit.tree);│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────╮ │1673 } │ │1674 } │ │1675 │ │1657 -// a comment or attachment a write names under a thread │ │1676 +// a comment, attachment or assignment a write names under a thread│ │1677 pub const ThreadChild = union(enum) { │ │1678 comment: *const [event_id_size]u8, │ │1679 attach: *const [event_id_size]u8, │ ╰─────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │1680 + assign: *const [event_id_size]u8, │ │1681 }; │ │1682 │ │1683 // whether `thread_id` names a thread of `thread_kind` in the repo's events, and│ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1725 const attachment = (try readRecordSubset(Attachment, struct { event: struct { parent_id: [event_id_size * 2]u8 } }, DB, repo_opts.hash, moment, &arena, id)) orelse return false; │ │1726 return std.mem.eql(u8, &attachment.event.parent_id, &thread_id_hex); │ │1727 }, │ │1728 + // only an active assignment can be removed │ │1729 + .assign => |id| { │ │1730 + const assignment = (try readRecordSubset(Assignment, struct { removed: bool, event: struct { thread_id: [event_id_size * 2]u8 } }, DB, repo_opts.hash, moment, &arena, id)) orelse return false;│ │1731 + return !assignment.removed and std.mem.eql(u8, &assignment.event.thread_id, &thread_id_hex); │ │1732 + }, │ │1733 } │ │1734 } │ │1735 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯