╭ changed ──╮ │src/web.zig│ ╰───────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1114 else => unreachable, │ │1115 }; │ │1116 if (!valid) { │ │1117 - const list_name: []const u8 = switch (kind) { │ │1118 - .issue => "issues", │ │1119 - .patch => "patches", │ │1120 - .discuss => "discussions", │ │1121 - else => unreachable, │ │1122 - }; │ │1123 - const form_location = try allocator.print("{s}/{s}/new", .{ base, list_name }); │ │1117 + const form_location = try allocator.print("{s}/{s}/new", .{ base, threadListName(kind) }); │ │1118 defer allocator.free(form_location); │ │1119 if (!evt.titleValid(title)) { │ │1120 return respondThreadFormFailure(request, allocator, host, form_location, requiredTitleFeedback(kind, title, labels, description, target_branch, source_branch));│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1960 }, │ │1961 } │ │1962 │ │1969 - const id = std.fmt.bytesToHex(parts.id, .lower); │ │1970 - const location = try allocator.print("{s}/event:{s}/kind:{s}", .{ parts.repo_base, &id, @tagName(parts.kind) }); │ │1963 + // back to the thread a comment or attachment was on, or to the list a thread left │ │1964 + const location = if (parts.kind == parts.thread_kind) │ │1965 + try allocator.print("{s}/{s}", .{ parts.repo_base, threadListName(parts.thread_kind) }) │ │1966 + else │ │1967 + try allocator.print("{s}/{s}:{s}", .{ parts.repo_base, @tagName(parts.thread_kind), &std.fmt.bytesToHex(parts.thread_id, .lower) });│ │1968 defer allocator.free(location); │ │1969 try request.respond("", .{ │ │1970 .status = .see_other, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────╮ │1971 .keep_alive = false, │ │1972 .extra_headers = &.{.{ .name = "location", .value = location }},│ │1973 }); │ │1974 +} │ │1975 + │ │1976 +// the tab listing threads of `kind` │ │1977 +fn threadListName(kind: evt.EventKind) []const u8 { │ │1978 + return switch (kind) { │ │1979 + .issue => "issues", │ │1980 + .patch => "patches", │ │1981 + .discuss => "discussions", │ │1982 + else => unreachable, │ │1983 + }; │ │1984 } │ │1985 │ │1986 fn respondRemoveNotFound(request: *std.http.Server.Request) !void { │ ╰──────────────────────────────────────────────────────────────────────────────╯