╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──╮ │src/web.zig│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1260 ) !void { │ │1261 var author_arena = std.heap.ArenaAllocator.init(allocator); │ │1262 defer author_arena.deinit(); │ │1267 - const author = (try eventAuthor(io, allocator, &author_arena, request, host)) orelse return respondLoginRequired(request); │ │1263 + const request_author = (try eventAuthor(io, allocator, &author_arena, request, host)) orelse return respondLoginRequired(request);│ │1264 + const author = request_author.author; │ │1265 │ │1266 const body = try readFormBody(request, allocator); │ │1267 defer allocator.free(body); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1292 .extra_headers = &.{.{ .name = "location", .value = form_location }}, │ │1293 }); │ │1294 return; │ │1295 + } │ │1296 + │ │1297 + const draft_user_id = if (parts.thread_kind == .patch) request_author.user_id else null; │ │1298 + if (draft_user_id) |user_id| { │ │1299 + const remote = switch (host) { │ │1300 + .remote => |remote| remote, │ │1301 + .local => unreachable, │ │1302 + }; │ │1303 + const request_repo = (try requestRepoSource(io, allocator, host, parts.repo_base)) orelse return respondRemoveNotFound(request);│ │1304 + defer request_repo.deinit(allocator); │ │1305 + const repo_id = evt.parseEventId(std.fs.path.basename(request_repo.source.path)) catch return respondRemoveNotFound(request); │ │1306 + var admin_repo = try rp.Repo(.xit, evt.admin_repo_opts).open(io, allocator, .{ .path = remote.admin_repo_path }); │ │1307 + defer admin_repo.deinit(io, allocator); │ │1308 + const id = std.fmt.bytesToHex(parts.thread_id, .lower); │ │1309 + const repos_dir = try std.fs.path.join(allocator, &.{ std.fs.path.dirname(remote.admin_repo_path) orelse ".", "repos" }); │ │1310 + defer allocator.free(repos_dir); │ │1311 + const fork_path = try fork.forkPath(allocator, repos_dir, &id); │ │1312 + defer allocator.free(fork_path); │ │1313 + if (try pch.editDraft(.{}, io, allocator, &admin_repo, fork_path, .{ │ │1314 + .id = id, │ │1315 + .user_id = user_id, │ │1316 + .repo_id = repo_id, │ │1317 + .title = title, │ │1318 + .tags = tags, │ │1319 + .description = description, │ │1320 + .author = author, │ │1321 + .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │1322 + })) { │ │1323 + try request.respond("", .{ │ │1324 + .status = .see_other, │ │1325 + .extra_headers = &.{.{ .name = "location", .value = base }}, │ │1326 + }); │ │1327 + return; │ │1328 + } │ │1329 } │ │1330 │ │1331 const not_found = switch (parts.thread_kind) { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1374 ) !void { │ │1375 var author_arena = std.heap.ArenaAllocator.init(allocator); │ │1376 defer author_arena.deinit(); │ │1346 - const author = (try eventAuthor(io, allocator, &author_arena, request, host)) orelse return respondLoginRequired(request); │ │1377 + const author = ((try eventAuthor(io, allocator, &author_arena, request, host)) orelse return respondLoginRequired(request)).author;│ │1378 │ │1379 const body = try readFormBody(request, allocator); │ │1380 defer allocator.free(body); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯