╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──╮ │src/web.zig│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1288 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, source.localInitOpts()); │ │1289 defer any_repo.deinit(io, allocator); │ │1290 switch (any_repo) { │ │1272 - inline else => |*repo| _ = evt.Attachment.create(host.event(), repo_kind, repo.self_repo_opts, io, allocator, repo, &parent_id_hex, blob, author) catch |err| switch (err) { │ │1291 + inline else => |*repo| _ = evt.Attachment.create(host.event(), repo_kind, repo.self_repo_opts, io, allocator, repo, parts.kind, &parent_id_hex, blob, author) catch |err| switch (err) {│ │1292 error.ParentNotFound => return respondAttachmentParentNotFound(request), │ │1293 else => return err, │ │1294 }, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1340 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, source.localInitOpts()); │ │1341 defer any_repo.deinit(io, allocator); │ │1342 switch (any_repo) { │ │1324 - inline else => |*repo| try evt.Comment.update(host.event(), repo_kind, repo.self_repo_opts, io, allocator, repo, &thread_id, &comment_id, body, author), │ │1343 + inline else => |*repo| try evt.Comment.update(host.event(), repo_kind, repo.self_repo_opts, io, allocator, repo, parts.thread_kind, &thread_id, &comment_id, body, author),│ │1344 } │ │1345 }, │ │1346 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1371 ) !void { │ │1372 var author_arena = std.heap.ArenaAllocator.init(allocator); │ │1373 defer author_arena.deinit(); │ │1355 - const actor = (try authorizeWrite(io, allocator, &author_arena, request, host, parts.repo_base, .read)) orelse return; │ │1374 + const actor = (try authorizeWrite(io, allocator, &author_arena, request, host, parts.repo_base, .read, parts.thread_kind)) orelse return;│ │1375 const author = actor.author; │ │1376 // edits only reach here for a comment │ │1377 const comment_id = parts.comment_id orelse unreachable; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────╮ │1443 const RemoveParts = struct { │ │1444 repo_base: []const u8, │ │1445 kind: evt.EventKind, │ │1446 + // the thread the removed event is, or belongs to│ │1447 + thread_kind: evt.EventKind, │ │1448 + thread_id: [evt.event_id_size]u8, │ │1449 id: [evt.event_id_size]u8, │ │1450 }; │ │1451 │ ╰───────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────╮ │1456 return .{ │ │1457 .repo_base = parent.repo_base,│ │1458 .kind = .attach, │ │1459 + .thread_kind = parent.kind, │ │1460 + .thread_id = parent.id_bytes, │ │1461 .id = attachment.id, │ │1462 }; │ │1463 } │ ╰────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │1464 if (commentBaseParts(host, base)) |thread| return .{ │ │1465 .repo_base = thread.repo_base, │ │1466 .kind = if (thread.comment_id != null) .comment else thread.thread_kind,│ │1467 + .thread_kind = thread.thread_kind, │ │1468 + .thread_id = thread.thread_id, │ │1469 .id = thread.comment_id orelse thread.thread_id, │ │1470 }; │ │1471 return null; │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1483 │ │1484 var author_arena = std.heap.ArenaAllocator.init(allocator); │ │1485 defer author_arena.deinit(); │ │1460 - const actor = (try authorizeWrite(io, allocator, &author_arena, request, host, parts.repo_base, .read)) orelse return; │ │1486 + const actor = (try authorizeWrite(io, allocator, &author_arena, request, host, parts.repo_base, .read, parts.thread_kind)) orelse return;│ │1487 const author = actor.author; │ │1488 │ │1489 const request_repo = (try requestRepoSource(io, allocator, host, parts.repo_base)) orelse return respondRemoveNotFound(request); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1523 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, source.localInitOpts()); │ │1524 defer any_repo.deinit(io, allocator); │ │1525 switch (any_repo) { │ │1500 - inline else => |*repo| evt.remove(host.event(), .repo, repo_kind, repo.self_repo_opts, io, allocator, repo, &parts.id, parts.kind, author) catch |err| switch (err) { │ │1526 + inline else => |*repo| evt.removeInThread(host.event(), repo_kind, repo.self_repo_opts, io, allocator, repo, parts.thread_kind, &parts.thread_id, parts.kind, &parts.id, author) catch |err| switch (err) {│ │1527 error.EventNotFound => return respondRemoveNotFound(request), │ │1528 else => |e| return e, │ │1529 }, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1595 │ │1596 var author_arena = std.heap.ArenaAllocator.init(allocator); │ │1597 defer author_arena.deinit(); │ │1572 - const actor = (try authorizeWrite(io, allocator, &author_arena, request, host, parts.repo_base, .read)) orelse return; │ │1598 + const actor = (try authorizeWrite(io, allocator, &author_arena, request, host, parts.repo_base, .read, parts.thread_kind)) orelse return;│ │1599 const author = actor.author; │ │1600 { │ │1601 const request_repo = (try requestRepoSource(io, allocator, host, parts.repo_base)) orelse return respondRemoveNotFound(request); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1638 ) !void { │ │1639 var author_arena = std.heap.ArenaAllocator.init(allocator); │ │1640 defer author_arena.deinit(); │ │1615 - const actor = (try authorizeWrite(io, allocator, &author_arena, request, host, parts.repo_base, .read)) orelse return; │ │1641 + const actor = (try authorizeWrite(io, allocator, &author_arena, request, host, parts.repo_base, .read, parts.thread_kind)) orelse return;│ │1642 const author = actor.author; │ │1643 │ │1644 const body = try readFormBody(request, allocator); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯