╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │48 id: [event_id_size * 2]u8, │ │49 event: Event, │ │50 timestamp: u64 = 0, // not serialized, because it comes from the commit timestamp│ │51 + author_email: []const u8, // not serialized, because it goes in the commit author│ │52 │ │53 pub fn jsonStringify(self: EventWithId, jw: anytype) !void { │ │54 try jw.beginObject(); │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │72 const json_event = try std.json.parseFromSliceLeaky(JsonEvent, arena.allocator(), message, .{ .ignore_unknown_fields = true });│ │73 return .{ │ │74 .id = json_event.id, │ │75 + // unused when reading; the author lives in the commit │ │76 + .author_email = "", │ │77 .event = switch (json_event.kind) { │ │78 .user => .{ │ │79 .user = if (json_event.data) |value| │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │213 json.clearRetainingCapacity(); │ │214 try std.json.Stringify.value(event, .{ .whitespace = .indent_2 }, &json.writer); │ │215 if (json.written().len > max_event_size) return error.EventTooLarge; │ │213 - _ = try obj.writeCommit(repo_kind, repo_opts, state, io, allocator, .{ .author = "haxy <user@haxy>", .message = json.written(), .timestamp = event.timestamp, .parent_oids = parent_oids }, null, ref);│ │216 + const author = try std.fmt.allocPrint(allocator, "haxy <{s}>", .{event.author_email}); │ │217 + defer allocator.free(author); │ │218 + _ = try obj.writeCommit(repo_kind, repo_opts, state, io, allocator, .{ .author = author, .message = json.written(), .timestamp = event.timestamp, .parent_oids = parent_oids }, null, ref); │ │219 // later events parent on the ref's new tip │ │220 parent_oids = null; │ │221 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1037 var owner_user_id: [event_id_size]u8 = undefined; │ │1038 _ = try owner_id_cursor.readBytes(&owner_user_id); │ │1039 │ │1040 + const owner = (try User.readById(AdminDB, admin_repo_opts.hash, moment, &arena, &owner_user_id)) orelse unreachable;│ │1041 + │ │1042 var id_bytes: [event_id_size]u8 = undefined; │ │1043 io.random(&id_bytes); │ │1044 const event_id_hex = std.fmt.bytesToHex(id_bytes, .lower); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │1046 try consume(.xit, admin_repo_opts, io, allocator, &repo, events_ref, &[_]EventWithId{.{│ │1047 .id = event_id_hex, │ │1048 .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │1049 + .author_email = owner.email, │ │1050 .event = .{ .repo = .{ │ │1051 .user_id = &owner_user_id, │ │1052 .name = repo_name, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯