Side A adds a focused, well-tested feature (pool-scoped voting) with clear intent, threading pool state through queries, hrefs, and post-success JS in a way that matches its commit message. Side B's 'url refactor' bundles two unrelated things—a debatable regression that squashes readable /r/{short}/{slug} URLs into a single ambiguous /r/{short}{slug} segment, plus an unrelated large YouTube URL-normalization module and url::Url hashing test suite—making it a messy, scope-creeping commit whose net value is unclear despite its size.
constitution · epochs · watch · epoch 3
c_c6f5afec1d36 (tommy-mor) vs c_45dfa34511fe (tommy-mor)
download prompt · raw event · cmp_9adff7de128455
council reasoning
A adds a complete, user-facing capability: optional pool-scoped /vote pair picking, next-pair constrained to siblings, UI entry point, and pool threaded through post-success morph—real product behavior with targeted call-site wiring. B’s valuable core (YouTube/query URL identity normalization and room_route helpers) is lasting, but much of the diff is mechanical route/path churn collapsing /r/{short}/{slug} into one segment across handlers, tests, and fixtures, so overall lasting value is lower than A’s focused feature.
Side A delivers a complete user-facing capability: `/vote?pool=` can automatically select child-item pairs, keeps pool context through vote submission and next-pair navigation, and adds a "vote on children" entry point, with corresponding query handling and navigation updates. Side B mostly refactors room URL handling into shared helpers and adds URL normalization utilities (including YouTube canonicalization), which improves maintainability and consistency but is primarily structural compared with A's end-to-end feature addition.
sides
A — c_c6f5afec1d36 (tommy-mor)
message
[5350388a] Add pool-scoped voting: /vote?pool=<parent> picks pairs from children. - /vote now accepts an optional `pool` param (parent item path). When provided without left/right, it picks the first unvoted pair from the pool's children. When provided alongside left/right, it constrains "next pair" navigation to siblings within the pool. - "vote on children" button appears on item pages with ≥2 children, linking to /vote?pool=<item>. - Pool is threaded through VoteComparePost → success JS so in-page morph after voting keeps the pool context for next-pair navigation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
diff preview
diff --git a/server/src/api/ui_html.rs b/server/src/api/ui_html.rs
index 5faa642451d69555cb391974beb0ad22c9355c8c..b79efdb4d52bd445a67f38cbfd61d3507d2b3014 100644
--- a/server/src/api/ui_html.rs
+++ b/server/src/api/ui_html.rs
@@ -193,6 +193,7 @@ async fn dispatch_ui_action(
ratio_right,
explanation,
next,
+ pool,
form_action,
} => {
if form_action != "/ui" {
@@ -239,6 +240,9 @@ async fn dispatch_ui_action(
.into_response();
}
};
+ let pool_id = pool.as_deref().and_then(|p| {
+ crate::path_types::ItemId::parse(p.trim()).map(|i| i.normalized_storage())
+ });
let mut rl = ratio_left.trim().parse::<i32>().unwrap_or(0).max(0);
let mut rr = ratio_right.trim().parse::<i32>().unwrap_or(0).max(0);
if rl == 0 && rr == 0 {
@@ -294,6 +298,7 @@ async fn dispatch_ui_action(
&thread_tag,
&left_id,
&right_id,
+ pool_id.as_ref(),
pid.as_str(),
post_index,
)
diff --git a/server/src/html/garden/pin.rs b/server/src/html/garden/pin.rs
index 5865cfdbc06aeb6555c97380e25591fae6b3d125..1820d7fe7ee167ecbf5ad5124f23b2ab92ffb01f 100644
--- a/server/src/html/garden/pin.rs
+++ b/server/src/html/garden/pin.rs
@@ -79,7 +79,7 @@ pub(super) fn ont_pin_vote_controls(
}
}
} @else {
- a class="ont-vote-compare-btn" href=(vote_compare_href(nav, pi, ¤t, None)) title="Compare and vote" {
+ a class="ont-vote-compare-btn" href=(vote_compare_href(nav, pi, ¤t, None, None)) title="Compare and vote" {
span class="ont-vote-glyph" aria-hidden="true" { "⚖" }
span { "vote" }
}
@@ -121,7 +121,7 @@ pub(super) fn child_row_pin_or_vote(
if nv == 1 { "" } else { "s" },
);
@let aria = format!("Vote; {} pairwise {}", nv, if nv == 1 { "vote" } else { "votes" });
- a class="ont-garden-vote-ico" href=(vote_compare_href(nav, pi, row_item, None)) title=(tip) aria-label=(aria) {
+ a class="ont-garden-vote-ico" href=(vote_compare_href(nav, pi, row_item, None, None)) title=(tip) aria-label=(aria) {
span class="ont-garden-vote-glyph" aria-hidden="true" { "⚖" }
span class="ont-garden-vote-count" { (format!("{}", nv)) }
}
diff --git a/server/src/html/garden/render.rs b/server/src/html/garden/render.rs
index 5c3986ca36902f6c9019a4b5590f0b3b9d2cb4ff..bd8cbce059ee789de6e8dc9b6f69f54beee2f994 100644
--- a/server/src/html/garden/render.rs
+++ b/server/src/html/garden/render.rs
@@ -29,6 +29,7 @@ use super::{
item::{child_depth_from_uri, item_code_label, item_display_path, item_href},
item_page::{build_item_page_view_model, sibling_nav_markup},
pin::{child_row_pin_or_vote, ont_pin_vote_controls, pinned_item_from_jar},
+ vote::vote_pool_href,
};
pub(super) async fn render_scope_view(
@@ -186,12 +187,21 @@ pub(super) async fn render_scope_view(
}
section class="ont-tab-panel ont-tab-panel-children" {
+ @let total_children = model.child_rankings.component_rankings
+ .iter().map(|c| c.ranked.len()).sum::<usize>()
+ + model.child_rankings.unranked_items.len();
h3 {
"ranked child groups"
@if model.child_depth > 1 {
" "
span class="muted" { (format!("(depth {})", model.child_depth)) }
}
+ @if total_children >= 2 {
+ " "
+ a class="ont-vote-children-btn" href=(vote_pool_href(&nav, &model.item)) {
+ "vote on children"
+ }
+ }
}
@if model.child_rankings.component_rankings.is_empty() {
p class="muted" { "no voted pairs yet in this scope" }
diff --git a/server/src/html/garden/tests.rs b/server/src/html/garden/tests.rs
index 6900a6795bcde866a176722149d6378e5127b4c3..c2036fca7752aef63d260e36cfe9649f63b5c550 100644
--- a/server/src/html/garden/tests.rs
+++ b/server/src/html/garden/tests.rs
@@ -105,7 +105,7 @@ fn suggest_next_vote_pair_prefers_unvoted_sibling_pair() {
let content = content_for_garden_view(&reduced, &ScopeId::Public);
let a = ItemId::parse("~/topic/a").unwrap().normalized_storage();
let b = ItemId::parse("~/topic/b").unwrap().normalized_storage();
- let next = suggest_next_vote_pair(content, &a, &b).expect("next sibling pair");
+ let next = suggest_next_vote_pair(content, &a, &b, None).expect("next sibling pair");
assert_ne!(
canonical_edge_items(&next.0, &next.1),
canonical_edge_items(&a, &b)
diff --git a/server/src/html/garden/vote.rs b/server/src/html/garden/vote.rs
index 1d7fc8aa7436bfa9c1186dfd940a8d751ab7e088..2682cfcbd2f834b56459a02831aa225cffe67c58 100644
--- a/server/src/html/garden/vote.rs
+++ b/server/src/html/garden/vote.rs
@@ -211,14 +211,15 @@ pub(crate) async fn vote_compare_post_success_js(
_thread_tag: &str,
left: &ItemId,
right: &ItemId,
+ pool: Option<&ItemId>,
_post_id: &str,
_post_idx: Option<usize>,
) -> String {
let reduced = state.reduced.read().await;
let content = content_for_garden_view(&reduced, &nav.scope());
let edge_history = vote_edge_history_markup(content, left, right);
- let next_pair = suggest_next_vote_pair(content, left, right);
- let nav_markup = vote_compare_nav_markup(nav, next_pair.as_ref());
+ let next_pair = suggest_next_vote_pair(content, left, right, pool);
+ let nav_markup = vote_compare_nav_markup(nav, next_pair.as_ref(), pool);
drop(reduced);
JsBuilder::new()
.morph_inner_selector("#vote-edge-history-region", edge_history)
@@ -231,27 +232,39 @@ pub(super) fn vote_compare_href(
left: &ItemId,
right: &ItemId,
thread_override: Option<&str>,
+ pool: Option<&ItemId>,
) -> String {
let left_q = urlencoding::encode(left.as_str());
let right_q = urlencoding::encode(right.as_str());
- let base = format!(
+ let mut base = format!(
"{}/vote?left={}&right={}",
nav.room_path_prefix_for_vote_compare(),
left_q,
right_q
);
if let Some(t) = thread_override.filter(|s| !s.is_empty()) {
- format!("{}&thread={}", base, urlencoding::encode(t))
- } else {
- base
+ base = format!("{}&thread={}", base, urlencoding::encode(t));
+ }
+ if let Some(p) = pool {
+ base = format!("{}&pool={}", base, urlencoding::encode(p.as_str()));
}
+ base
+}
+
+pub(super) fn vote_pool_href(nav: &ThreadNav, pool_item_str: &str) -> String {
+ format!(
+ "{}/vote?pool={}",
+ nav.room_path_prefix_for_vote_compare(),
+ urlencoding::encode(pool_item_str)
+ )
}
fn vote_compare_nav_markup(
nav: &ThreadNav,
next_pair: Option<&(ItemId, ItemId)>,
+ pool: Option<&ItemId>,
) -> maud::Markup {
- let next_pair_href = next_pair.map(|(nl, nr)| vote_compare_href(nav, nl, nr, None));
+ let next_pair_href = next_pair.map(|(nl, nr)| vote_compare_href(nav, nl, nr, None, pool));
html! {
div class="vote-compare-nav" {
@if let Some(href) = &next_pair_href {
@@ -267,8 +280,15 @@ pub(super) fn suggest_next_vote_pair(
content: &ContentState,
current_left: &ItemId,
current_right: &ItemId,
+ pool_parent: Option<&ItemId>,
) -> Option<(ItemId, ItemId)> {
- let pool: Vec<ItemId> = if current_left.parent().as_ref().map(|p| p.as_str())
+ let pool: Vec<ItemId> = if let Some(parent) = pool_parent {
+ content
+ .item_children
+ .get(parent)
+ .map(|s| s.iter().cloned().collect())
+ .unwrap_or_default()
+ } else if current_left.parent().as_ref().map(|p| p.as_str())
== current_right.parent().as_ref().map(|p| p.as_str())
{
current_left
@@ -322,10 +342,14 @@ pub(super) fn vote_compare_item_card(
}
#[derive(Debug, Deserialize)]
pub struct VoteCompareQuery {
- pub left: String,
- pub right: String,
+ #[serde(default)]
+ pub left: Option<String>,
+ #[serde(default)]
+ pub right: Option<String>,
#[serde(default)]
pub thread: Option<String>,
+ #[serde(default)]
+ pub pool: Option<String>,
}
/// Public pairwise vote UI — `/vote?left=&right=&thread=`.
@@ -376,17 +400,53 @@ async fn vote_compare_inner(
jar: CookieJar,
uri: Uri,
) -> axum::response::Response {
- let left = match ItemId::parse(q.left.trim()) {
- Some(i) => i.normalized_storage(),
- None => return (StatusCode::NOT_FOUND, "bad left item").into_response(),
+ let pool_id: Option<ItemId> = match q.pool.as_deref() {
+ Some(p) => match ItemId::parse(p.trim()) {
+ Some(i) => Some(i.normalized_storage()),
+ None => return (StatusCode::BAD_REQUEST, "bad pool item").into_response(),
+ },
+ None => None,
};
- let right = match ItemId::parse(q.right.trim()) {
- Some(i) => i.normalized_storage(),
- None => return (StatusCode::NOT_FOUND, "bad right item").into_response(),
+
+ let (left, right) = match (q.left.as_deref(), q.right.as_deref()) {
+ (Some(l), Some(r)) => {
+ let left = match ItemId::parse(l.trim()) {
+ Some(i) => i.normalized_storage(),
+ None => return (StatusCode::NOT_FOUND, "bad left item").into_response(),
+ };
+ let right = match ItemId::parse(r.trim()) {
+ Some(i) => i.normalized_storage(),
+ None => return (StatusCode::NOT_FOUND, "bad right item").into_response(),
+ };
+ if left == right {
+ return (StatusCode::BAD_REQUEST, "items must differ").into_response();
+ }
+ (left, right)
+ }
+ (None, None) => {
+ let Some(pool) = pool_id.as_ref() else {
+ return (StatusCode::BAD_REQUEST, "provide left+right or pool").into_response();
+ };
+ let reduced = state.reduced.read().await;
+ let content = content_for_garden_view(&reduced, &nav.scope());
+ let children: Vec<ItemId> = content
+ .item_children
+ .get(pool)
+ .map(|s| s.iter().cloned().collect())
+ .unwrap_or_default();
+ if children.len() < 2 {
+ drop(reduced);
+ return (StatusCode::BAD_REQUEST, "pool has fewer than 2 children to compare").into_response();
+ }
+ let pair = suggest_next_pair_in_pool(&content.ranking_group, &children, None);
+ drop(reduced);
+ match pair {
+ Some(p) => p,
+ None => return (StatusCode::BAD_REQUEST, "no pairs available in pool").into_response(),
+ }
+ }
+ _ => return (StatusCode::BAD_REQUEST, "provide both left and right, or just pool").into_response(),
};
- if left == right {
- return (StatusCode::BAD_REQUEST, "items must differ").into_response();
- }
let reduced = state.reduced.read().await;
let content = content_for_garden_view(&reduced, &nav.scope());
@@ -409,7 +469,7 @@ async fn vote_compare_inner(
let left_body = content.item_bodies.get(&left).cloned();
let right_body = content.item_bodies.get(&right).cloned();
let item_bodies_for_cards = content.item_bodies.
… preview truncated; 1,501 characters omittedB — c_45dfa34511fe (tommy-mor)
message
[5ca518f6] url refactor
diff preview
diff --git a/Cargo.lock b/Cargo.lock
index 67a09a3b54f778fa7e857fdd589c3ed9c92e1322..ad7e4fe6d4ba2f2b033916194c1ef1ed873f1d46 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1757,6 +1757,7 @@ name = "slug-types"
version = "0.1.0"
dependencies = [
"serde",
+ "url",
]
[[package]]
@@ -2272,6 +2273,7 @@ dependencies = [
"idna",
"percent-encoding",
"serde",
+ "serde_derive",
]
[[package]]
diff --git a/server/src/api/ui_html.rs b/server/src/api/ui_html.rs
index 606f7d6f97a4428efb90d1e0d544934c861fc4c5..cd3e0f0afd972d9ad9e7e4b92c5fa4c22bb8f620 100644
--- a/server/src/api/ui_html.rs
+++ b/server/src/api/ui_html.rs
@@ -270,10 +270,10 @@ fn post_redirect_location(room: &str, thread_tag: &str) -> String {
format!("/t/{tag}")
} else {
let room = room.trim();
- let Some((a, b)) = room.split_once('/') else {
+ let Some(seg) = slug_types::room_route_segment(room) else {
return "/".to_string();
};
- format!("/r/{a}/{b}/t/{tag}")
+ format!("/r/{seg}/t/{tag}")
}
}
diff --git a/server/src/api/write_actor.rs b/server/src/api/write_actor.rs
index cb78d2f3f95b1bc163c1fb064d1d5f657e18000f..f9c3b8bd3fbf8fcb9c035e1a1572fef0b08fa8a9 100644
--- a/server/src/api/write_actor.rs
+++ b/server/src/api/write_actor.rs
@@ -19,13 +19,15 @@ use crate::{
use super::auth::{issue_token_for_user, verify_token};
use super::helpers::{now_ms, resolve_item};
use super::validate::{normalize_room_and_thread, validate_ingest_document};
-use slug_types::RpcResult;
+use slug_types::{room_route_segment, RpcResult, ROOM_SHORT_ID_LEN};
fn gen_short_id() -> String {
use rand::Rng;
const ALPHABET: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyz";
let mut rng = rand::thread_rng();
- (0..7).map(|_| ALPHABET[rng.gen_range(0..ALPHABET.len())] as char).collect()
+ (0..ROOM_SHORT_ID_LEN)
+ .map(|_| ALPHABET[rng.gen_range(0..ALPHABET.len())] as char)
+ .collect()
}
fn parse_capability(s: &str) -> Result<crate::events::ThreadCapability, String> {
@@ -55,8 +57,8 @@ async fn broadcast_web_refresh(state: &AppState, room_key: &str, thread_id: &str
let feed_id = if room_key == "public" { "thread-feed" } else { "room-thread-feed" };
let thread_url = if room_key == "public" {
format!("/t/{thread_id}")
- } else if let Some((short, slug)) = room_key.split_once('/') {
- format!("/r/{short}/{slug}/t/{thread_id}")
+ } else if let Some(seg) = room_route_segment(room_key) {
+ format!("/r/{seg}/t/{thread_id}")
} else {
format!("/t/{thread_id}")
};
@@ -78,8 +80,8 @@ async fn broadcast_web_refresh(state: &AppState, room_key: &str, thread_id: &str
let js = builder.build();
let mut path_prefixes = vec![if room_key == "public" {
"/".to_string()
- } else if let Some((short, slug)) = room_key.split_once('/') {
- format!("/r/{short}/{slug}")
+ } else if let Some(seg) = room_route_segment(room_key) {
+ format!("/r/{seg}")
} else {
"/".to_string()
}];
diff --git a/server/src/html/forum/nav.rs b/server/src/html/forum/nav.rs
index 0ee33d91160fc5542817b5e3e9ab4fee1d0e600f..48fe11e46731670874ff8b6b05baa6f09ae0b7e4 100644
--- a/server/src/html/forum/nav.rs
+++ b/server/src/html/forum/nav.rs
@@ -1,7 +1,8 @@
use crate::canonical_path::canonicalize_item;
use crate::reducer::ScopeId;
+use slug_types::room_route_segment;
-/// URL helpers for public `/t/…` and private room threads `/r/{short}/{slug}/t/…`.
+/// URL helpers for public `/t/…` and private room threads `/r/{short}{slug}/t/…`.
#[derive(Clone)]
pub struct ThreadNav {
pub room_wire: String,
@@ -22,18 +23,15 @@ impl ThreadNav {
}
}
- /// `room_id` wire form `shortid/slug`.
+ /// `room_id` wire form `shortid/slug` (HTTP uses [`slug_types::room_route_segment`]).
pub(crate) fn from_room_id(room_id: &str) -> Option<Self> {
- let (short, slug) = room_id.split_once('/')?;
- if short.is_empty() || slug.is_empty() {
- return None;
- }
+ let room_seg = room_route_segment(room_id)?;
Some(Self {
room_wire: room_id.to_string(),
scope: ScopeId::Room(room_id.to_string()),
- room_path: format!("/r/{short}/{slug}"),
- thread_path_prefix: format!("/r/{short}/{slug}/t"),
- garden_path_prefix: format!("/r/{short}/{slug}/~"),
+ room_path: format!("/r/{room_seg}"),
+ thread_path_prefix: format!("/r/{room_seg}/t"),
+ garden_path_prefix: format!("/r/{room_seg}/~"),
})
}
diff --git a/server/src/html/forum/post_single.rs b/server/src/html/forum/post_single.rs
index c316f8f836df9d4ef9c05ebd9e54f699540e6d72..473747b3da3d4d7a54b5e0c63165d2533df643e1 100644
--- a/server/src/html/forum/post_single.rs
+++ b/server/src/html/forum/post_single.rs
@@ -93,12 +93,14 @@ pub async fn thread_post_view(
pub async fn room_thread_post_view(
State(state): State<AppState>,
- Path((room_short, room_slug, tag, index_str)): Path<(String, String, String, String)>,
+ Path((room_key, tag, index_str)): Path<(String, String, String)>,
headers: HeaderMap,
jar: CookieJar,
uri: Uri,
) -> impl IntoResponse {
- let room_id = format!("{room_short}/{room_slug}");
+ let Some(room_id) = slug_types::room_id_from_route_segment(&room_key) else {
+ return (StatusCode::NOT_FOUND, "bad room path").into_response();
+ };
let reduced = state.reduced.read().await;
let user = optional_principal(&headers, &jar, &reduced);
if !user_can_view_room(&reduced, &room_id, user.as_deref()) {
diff --git a/server/src/html/forum/views.rs b/server/src/html/forum/views.rs
index be5df1745ef580891a167c23c3dd6c06f804f295..1ec421f84335cbfe7f9db775b73a8ed24b197174 100644
--- a/server/src/html/forum/views.rs
+++ b/server/src/html/forum/views.rs
@@ -183,16 +183,18 @@ pub async fn thread_view(
thread_view_inner(state, tag, q, ThreadNav::public(), headers, jar, uri).await
}
-/// Room thread — `/r/:short/:slug/t/:tag`
+/// Room thread — `/r/:room_key/t/:tag` (`room_key` = `{short}{slug}`).
pub async fn room_thread_view(
State(state): State<AppState>,
- Path((room_short, room_slug, tag)): Path<(String, String, String)>,
+ Path((room_key, tag)): Path<(String, String)>,
Query(q): Query<ThreadViewQuery>,
headers: HeaderMap,
jar: CookieJar,
uri: Uri,
) -> impl IntoResponse {
- let room_id = format!("{room_short}/{room_slug}");
+ let Some(room_id) = slug_types::room_id_from_route_segment(&room_key) else {
+ return (StatusCode::NOT_FOUND, "bad room path").into_response();
+ };
let reduced = state.reduced.read().await;
let user = optional_principal(&headers, &jar, &reduced);
if !user_can_view_room(&reduced, &room_id, user.as_deref()) {
@@ -226,15 +228,17 @@ pub(super) fn room_not_found_page(jar: &CookieJar, uri: &Uri) -> impl IntoRespon
(StatusCode::NOT_FOUND, Html(page.into_string()))
}
-/// Private room index — `/r/:short/:slug`
+/// Private room index — `/r/:room_key`
pub async fn room_page(
State(state): State<AppState>,
- Path((room_short, room_slug)): Path<(String, String)>,
+ Path(room_key): Path<String>,
headers: HeaderMap,
jar: CookieJar,
uri: Uri,
) -> impl IntoResponse {
- let room_id = format!("{room_short}/{room_slug}");
+ let Some(room_id) = slug_types::room_id_from_route_segment(&room_key) else {
+ return (StatusCode::NOT_FOUND, "room not found").into_response();
+ };
let now = now_ms();
let reduced = state.reduced.read().await;
if !reduced.rooms.contains(&room_id) {
@@ -266,7 +270,10 @@ pub async fn room_page(
let audit_cli = format!("npx slugsocial private {room_id} audit");
drop(reduced);
- let slug_display = room_slug.as_str();
+ let slug_display = room_id
+ .split_once('/')
+ .map(|(_, slug)| slug)
+ .unwrap_or(room_id.as_str());
let page = layout(
&format!("room {slug_display} — slug.social"),
"view-thread",
diff --git a/server/src/html/garden.rs b/server/src/html/garden.rs
index 423f23fd8c9ad7b7f454d6ea7a9a7607a4c9c5b9..e615dd356bcf634232d85610c0a26235ead125fd 100644
--- a/server/src/html/garden.rs
+++ b/server/src/html/garden.rs
@@ -309,12 +309,14 @@ pub async fn external_ontology_path(
pub async fn room_garden_index(
State(state): State<AppState>,
- Path((room_short, room_slug)): Path<(String, String)>,
+ Path(room_key): Path<String>,
headers: HeaderMap,
jar: CookieJar,
uri: Uri,
) -> impl IntoResponse {
- let room_id = format!("{room_short}/{room_slug}");
+ let Some(room_id) = slug_types::room_id_from_route_segment(&room_key) else {
+ return (StatusCode::NOT_FOUND, "bad room path").into_response();
+ };
let Some(nav) = ThreadNav::from_room_id(&room_id) else {
return (StatusCode::NOT_FOUND, "bad room path").into_response();
};
@@ -341,12 +343,14 @@ pub async fn room_garden_index(
pub async fn room_external_garden_index(
State(state): State<AppState>,
- Path((room_short, room_slug)): Path<(String, String)>,
+ Path(room_key): Path<String>,
headers: HeaderMap,
jar: CookieJar,
uri: Uri,
) -> impl IntoResponse {
- let room_id = format!("{room_short}/{room_slug}");
+ let Some(room_id) = slug_types::room_id_from_route_segment(&room_key) else {
+ return (StatusCode::NOT_FOUND, "bad room path").into_response();
+ };
let Some(nav) = ThreadNav::from_room_id(&room_id) else {
return (StatusCode::NOT_FOUND, "bad room path").into_response();
};
@@ -416,12 +420,14 @@ pub async fn room_external_garden_index(
pub async fn room_external_ontology_path(
State(state): State<AppState>,
- Path((room_short, room_slug, path)): Path<(String, String, String)>,
+ Path((room_key, path)): Path<(String, String)>,
headers: HeaderMap,
jar: CookieJar,
uri: Uri,
) -> impl IntoResponse {
- let room_id = format!("{room_short}/{room_slug}");
+ let Some(room_id) = slug_types::room_id_from_route_segment(&room_key) else {
+ return (StatusCode::NOT_FOUND, "bad room path").into_response();
+ };
let Some(nav) = ThreadNav::from_room_id(&room_id) else {
return (StatusCode::NOT_FOUND, "bad room path").into_response();
};
@@ -442,12 +448,14 @@ pub async fn room_external_ontology_path(
pub async fn room_ontology_path(
State(state): State<AppState>,
- Path((room_short, room_slug, path)): Path<(String, String, String)>,
+ Path((room_key, path)): Path<(String, String)>,
headers: HeaderMap,
jar: CookieJar,
uri: Uri,
) -> impl IntoResponse {
- let room_id = format!("{room_short}/{room_slug}");
+ let Some(room_id) = slug_types::room_id_from_route_segment(&room_key) else {
+ return (StatusCode::NOT_FOUND, "bad room path").into_response();
+ };
let Some(nav) = ThreadNav::from_room_id(&room_id) else {
return (StatusCode::NOT_FOUND, "bad room path").into_response();
};
diff --git a/server/src/html/search.rs b/server/src/html/search.rs
index 43e6ebf36cf0fe72c96f0f9d850bea51ac094c43..f01732f7edb32c68fcc10c39545c8f56476adb27 100644
--- a/server/src/html/search.rs
+++ b/server/src/html/search.rs
@@ -351,8 +351,8 @@ fn render_search_results(results: &SearchResults, query: &str) -> Markup {
ul class="search-posts" {
@for r in &results.posts {
@let (post_href, post_label) = if let Some((room, tag)) = r.thread.split_once("/#") {
- if let Some((short, slug)) = room.split_once('/') {
- (format!("/r/{short}/{slug}/t/{tag}"), format!("{room}/#{tag}"))
+ if let Some(seg) = slug_types::room_route_segment(room) {
+
… preview truncated; 35,812 characters omittedHardlinks — judgments / attempts / prompt
judgments
attempts
Prompt text is loaded only by the download route.