╭ changed ─────────────╮ │src/ui/Repo/Issues.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │1087 const description = try description_input.text(allocator); │ │1088 defer allocator.free(description); │ │1089 │ │1090 - // a title is required, and a too-long tag would fail consumption│ │1091 - // after the event is already committed │ │1092 - if (title.len == 0) return; │ │1093 - var tag_iter = evt.Issue.tagIterator(tags); │ │1094 - while (tag_iter.next()) |tag| { │ │1095 - if (tag.len > evt.Issue.tag_max_len) return; │ │1096 - } │ │1090 + if (!evt.Issue.fieldsValid(title, tags)) return; │ │1091 │ │1092 var id_bytes: [evt.event_id_size]u8 = undefined; │ │1093 io.random(&id_bytes); │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │1143 const description = try description_input.text(allocator); │ │1144 defer allocator.free(description); │ │1145 │ │1152 - // a title is required, and a too-long tag would fail consumption │ │1153 - // after the event is already committed │ │1154 - if (title.len == 0) return; │ │1155 - var tag_iter = evt.Issue.tagIterator(tags); │ │1156 - while (tag_iter.next()) |tag| { │ │1157 - if (tag.len > evt.Issue.tag_max_len) return; │ │1158 - } │ │1159 - │ │1160 - var updated = entry.issue; │ │1161 - updated.title = title; │ │1162 - updated.tags = tags; │ │1163 - updated.description = description; │ │1146 + if (!evt.Issue.fieldsValid(title, tags)) return; │ │1147 │ │1165 - const event = evt.EventWithId{ │ │1166 - .id = entry.id[0 .. evt.event_id_size * 2].*, │ │1167 - .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │1168 - .event = .{ .issue = updated }, │ │1169 - }; │ │1148 + var id_bytes: [evt.event_id_size]u8 = undefined; │ │1149 + _ = try std.fmt.hexToBytes(&id_bytes, entry.id[0 .. evt.event_id_size * 2]);│ │1150 │ │1151 switch (src.repo_kind) { │ │1152 inline else => |repo_kind| { │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1153 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, .{ .path = src.path }); │ │1154 defer any_repo.deinit(io, allocator); │ │1155 switch (any_repo) { │ │1176 - inline else => |*repo| try evt.commitAndConsume(repo_kind, repo.self_repo_opts, io, allocator, repo, evt.events_ref, &.{event}),│ │1156 + inline else => |*repo| try evt.Issue.update(repo_kind, repo.self_repo_opts, io, allocator, repo, &id_bytes, .{ .fields = .{ │ │1157 + .title = title, │ │1158 + .tags = tags, │ │1159 + .description = description, │ │1160 + } }), │ │1161 } │ │1162 }, │ │1163 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1164 │ │1181 - const route = ui.RoutablePage.repoIssuesRoute(self.data.identity, updated.status, "", entry.id) orelse return; │ │1165 + const route = ui.RoutablePage.repoIssuesRoute(self.data.identity, entry.issue.status, "", entry.id) orelse return;│ │1166 try self.session.navigate(route); │ │1167 } │ │1168 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │1176 const sel = self.detailed_index[index] orelse return; │ │1177 const entry = self.window(index).issues[sel]; │ │1178 │ │1195 - var updated = entry.issue; │ │1196 - updated.status = switch (entry.issue.status) { │ │1179 + const status: evt.Issue.Status = switch (entry.issue.status) {│ │1180 .open => .closed, │ │1181 .closed => .open, │ │1182 }; │ ╰────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │1183 │ │1201 - const event = evt.EventWithId{ │ │1202 - .id = entry.id[0 .. evt.event_id_size * 2].*, │ │1203 - .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │1204 - .event = .{ .issue = updated }, │ │1205 - }; │ │1184 + var id_bytes: [evt.event_id_size]u8 = undefined; │ │1185 + _ = try std.fmt.hexToBytes(&id_bytes, entry.id[0 .. evt.event_id_size * 2]);│ │1186 │ │1187 switch (src.repo_kind) { │ │1188 inline else => |repo_kind| { │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1189 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, .{ .path = src.path }); │ │1190 defer any_repo.deinit(io, allocator); │ │1191 switch (any_repo) { │ │1212 - inline else => |*repo| try evt.commitAndConsume(repo_kind, repo.self_repo_opts, io, allocator, repo, evt.events_ref, &.{event}), │ │1192 + inline else => |*repo| try evt.Issue.update(repo_kind, repo.self_repo_opts, io, allocator, repo, &id_bytes, .{ .status = status }),│ │1193 } │ │1194 }, │ │1195 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1196 │ │1217 - const route = ui.RoutablePage.repoIssuesRoute(self.data.identity, updated.status, "", entry.id) orelse return;│ │1197 + const route = ui.RoutablePage.repoIssuesRoute(self.data.identity, status, "", entry.id) orelse return; │ │1198 try self.session.navigate(route); │ │1199 } │ │1200 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯