╭ changed ────────────╮ │src/event/Comment.zig│ ╰─────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │11 // what the db stores: the event's data plus the commit-derived fields │ │12 pub const Record = struct { │ │13 event: Self, │ │14 - deleted: bool = false, │ │14 + removed: bool = false, │ │15 author_email: ?[]const u8 = null, │ │16 created_ts: u64 = 0, // the commit timestamp of the event that first created this comment│ │17 }; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │62 record │ │63 else blk: { │ │64 var record = existing_record_maybe orelse return error.EventNotFound;│ │65 - record.deleted = true; │ │65 + record.removed = true; │ │66 break :blk record; │ │67 }; │ │68 │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │86 const comment_cursor = try event_id_to_comment.putCursor(comment_key); │ │87 const comment = try DB.HashMap(.read_write).init(comment_cursor); │ │88 try evt.upsert(Record, DB, hash_kind, comment, record_to_write); │ │89 - try evt.indexEvent(DB, hash_kind, haxy_moment, event_id, .comment, record_to_write.created_ts); │ │89 + try evt.indexEvent(DB, hash_kind, haxy_moment, event_id, .comment, record_to_write.created_ts, record_to_write.removed);│ │90 │ │91 if (existing_cursor_maybe == null) { │ │92 const comment_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, id_set_key)); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 94 try comment_id_set.put(&evt.orderKeyDesc(record_to_write.created_ts, event_id)); │ │ 95 } │ │ 96 │ │ 97 - // tombstones stay in the thread so their replies remain connected │ │ 97 + // removed comments stay in the thread so their replies remain connected │ │ 98 const thread_order_key = evt.orderKey(record_to_write.created_ts, event_id); │ │ 99 const thread_comments_cursor = try thread_id_to_comment_id_set.putCursor(hash.hashInt(hash_kind, &record_to_write.event.thread_id));│ │100 const thread_comments = try DB.SortedSet(.read_write).init(thread_comments_cursor); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │164 evt.currentMoment(repo_opts, repo)) catch return error.NotFound; │ │165 const comment = (try readById(DB, repo_opts.hash, moment, &arena, comment_id)) orelse return error.NotFound;│ │166 if (!std.mem.eql(u8, &comment.event.thread_id, thread_id)) return error.NotFound; │ │167 + if (comment.removed) return error.NotFound; │ │168 │ │169 var updated = comment.event; │ │170 updated.body = body; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯