╭ changed ───────────────╮ │src/event/Attachment.zig│ ╰────────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────╮ │121 io: std.Io, │ │122 allocator: std.mem.Allocator, │ │123 repo: *rp.Repo(repo_kind, repo_opts), │ │124 + parent_kind: evt.EventKind, │ │125 parent_id: *const [evt.event_id_size * 2]u8,│ │126 blob: evt.Blob, │ │127 author: evt.CommitAuthor, │ ╰─────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │130 if (blob.size == 0 or blob.size > max_size) return error.InvalidFields; │ │131 │ │132 const parent_id_bytes = evt.parseEventId(parent_id) catch return error.InvalidFields; │ │133 + if (!try evt.threadHolds(repo_kind, repo_opts, io, allocator, repo, parent_kind, &parent_id_bytes, null)) return error.ParentNotFound; │ │134 │ │133 - { │ │134 - const DB = evt.EventDB(repo_opts.hash); │ │135 - var event_db_maybe: ?evt.LocalEventDB(repo_opts.hash) = if (repo_kind == .git) try evt.LocalEventDB(repo_opts.hash).openReadOnly(io, allocator, repo.core.repo_dir) else null;│ │136 - defer if (event_db_maybe) |*event_db| event_db.deinit(io, allocator); │ │137 - const haxy_moment = (if (event_db_maybe) |*event_db| │ │138 - evt.currentMomentFromDb(repo_opts.hash, event_db.db) │ │139 - else if (repo_kind == .git) │ │140 - return error.ParentNotFound │ │141 - else │ │142 - evt.currentMoment(repo_opts, repo)) catch return error.ParentNotFound; │ │143 - if (!try parentExists(DB, repo_opts.hash, haxy_moment, &parent_id_bytes)) return error.ParentNotFound; │ │144 - } │ │145 - │ │135 var id_bytes: [evt.event_id_size]u8 = undefined; │ │136 io.random(&id_bytes); │ │137 const event_id = std.fmt.bytesToHex(id_bytes, .lower); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯