forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'feed-filter'

Browse files at this commit

202f347864cef5ff09262156f660ffe43afc4d00Ahmet Kaan GümüşParent: f84acfbfabf540
crates/izlek-core/src/board.rsmodified+16 -0
@@ -300,6 +300,22 @@ impl BoardView {
300 .retain(|card| card.tag.as_ref().is_some_and(|tag| tag.id == tag_id));300 .retain(|card| card.tag.as_ref().is_some_and(|tag| tag.id == tag_id));
301 }301 }
302 }302 }
303+
304+ /// Keeps only the cards carrying `assignee` — a member id — or, for the
305+ /// literal `none`, only the cards carrying nobody. `None` (no filter)
306+ /// leaves the board alone, riding the same narrowing pass as
307+ /// [`BoardView::searching`].
308+ pub fn assigned(&mut self, assignee: Option<&str>) {
309+ let Some(assignee) = assignee else {
310+ return;
311+ };
312+ for column in &mut self.columns {
313+ column.cards.retain(|card| match assignee {
314+ "none" => card.assignees.is_empty(),
315+ id => card.assignees.iter().any(|person| &person.id == id),
316+ });
317+ }
318+ }
303 }319 }
304 320
305 /// Folds text for search: Turkish letters collapse to their ASCII stems321 /// Folds text for search: Turkish letters collapse to their ASCII stems
crates/izlek-core/src/store/mod.rsmodified+0 -20
@@ -1367,26 +1367,6 @@ pub trait Store: BoardReads + DetailReads + 'static {
1367 cursor: Option<&FeedCursor>,1367 cursor: Option<&FeedCursor>,
1368 ) -> Result<u64>;1368 ) -> Result<u64>;
1369 1369
1370- /// Puts `user_id` on a task's watchers. Idempotent: watching twice is
1371- /// watching once.
1372- async fn watch_task(&self, task_id: &str, user_id: &str) -> Result<()>;
1373-
1374- /// Takes `user_id` off a task's watchers. Absent watch, absent row: no
1375- /// error.
1376- async fn unwatch_task(&self, task_id: &str, user_id: &str) -> Result<()>;
1377-
1378- /// The "what changed for me" feed: activity events on the tasks the user
1379- /// watches, plus events that name them (`subject_id` — an assignment
1380- /// outlives the watch it created), minus the user's own actions. Newest
1381- /// first, capped at `limit`.
1382- async fn feed_for_user(&self, user_id: &str, limit: u32) -> Result<Vec<ActivityLine>>;
1383-
1384- /// How many feed lines have landed since the user last read the feed.
1385- async fn count_feed_unseen(&self, user_id: &str) -> Result<u64>;
1386-
1387- /// Reads the feed to `at`: the unseen count resets, the history stays.
1388- async fn mark_feed_seen(&self, user_id: &str, at: OffsetDateTime) -> Result<()>;
1389-
1390 // -- who gets mailed ---------------------------------------------------1370 // -- who gets mailed ---------------------------------------------------
1391 1371
1392 /// The people a task points at. Viewers cannot be assigned, so none appear.1372 /// The people a task points at. Viewers cannot be assigned, so none appear.
crates/izlek-core/src/store/reconcile.rsmodified+5 -41
@@ -737,23 +737,6 @@ async fn copy_data(old_conn: &Connection, new_conn: &Connection, path: &str) ->
737 })?;737 })?;
738 }738 }
739 739
740- // Backfills the watches the feed reads: a watch for every task somebody
741- // created, was assigned, or commented on, including all history. This
742- // runs exactly once per database — the rebuild only happens on a schema
743- // mismatch — so watches removed by an unassign after the deploy stand,
744- // and the pass cannot fight the transactional auto-watch in the store's
745- // own writes: nothing is being served while the rebuild runs.
746- new_conn
747- .execute(
748- "INSERT OR IGNORE INTO task_watcher (task_id, user_id) \
749- SELECT t.id, t.created_by FROM task t WHERE t.created_by IS NOT NULL \
750- UNION SELECT task_id, user_id FROM task_assignee \
751- UNION SELECT task_id, author_id FROM comment",
752- (),
753- )
754- .await
755- .map_err(|e| StoreError::Backend(format!("seed watches: {e}")))?;
756-
757 new_conn740 new_conn
758 .execute("DETACH DATABASE old", ())741 .execute("DETACH DATABASE old", ())
759 .await742 .await
@@ -835,30 +818,11 @@ async fn verify(old_conn: &Connection, new_conn: &Connection) -> Result<()> {
835 for table in tables {818 for table in tables {
836 let old_count = count_rows(old_conn, table).await?;819 let old_count = count_rows(old_conn, table).await?;
837 let new_count = count_rows(new_conn, table).await?;820 let new_count = count_rows(new_conn, table).await?;
838- // task_watcher: the rebuild backfills watches from history — every821+ if old_count != new_count {
839- // task somebody created, was assigned, or commented on — so the new822+ return Err(StoreError::Backend(format!(
840- // count is that derived set (every old watch is in it by823+ "row count mismatch for {}: old {} new {}",
841- // construction), not the old count.824+ table, old_count, new_count
842- let expected = if table == "task_watcher" {825+ )));
843- Some(count_rows(new_conn, "(SELECT t.id, t.created_by AS user_id FROM task t WHERE t.created_by IS NOT NULL UNION SELECT task_id, user_id FROM task_assignee UNION SELECT task_id, author_id FROM comment)").await?)
844- } else {
845- None
846- };
847- match expected {
848- Some(want) if new_count != want => {
849- return Err(StoreError::Backend(format!(
850- "task_watcher count {} does not match the backfilled set {}",
851- new_count, want
852- )));
853- }
854- Some(_) => {}
855- None if old_count != new_count => {
856- return Err(StoreError::Backend(format!(
857- "row count mismatch for {}: old {} new {}",
858- table, old_count, new_count
859- )));
860- }
861- None => {}
862 }826 }
863 }827 }
864 828
crates/izlek-core/src/store/turso_store.rsmodified+1 -146
@@ -1964,13 +1964,6 @@ impl Store for TursoStore {
1964 ],1964 ],
1965 )1965 )
1966 .await?;1966 .await?;
1967- // The maker watches what they made: its changes concern them
1968- // until they say otherwise.
1969- tx.execute(
1970- "INSERT OR IGNORE INTO task_watcher (task_id, user_id) VALUES (?1, ?2)",
1971- params![id.clone(), new.created_by],
1972- )
1973- .await?;
1974 Ok::<_, turso::Error>(Ok((task_key, position)))1967 Ok::<_, turso::Error>(Ok((task_key, position)))
1975 }1968 }
1976 .await;1969 .await;
@@ -1997,7 +1990,7 @@ impl Store for TursoStore {
1997 };1990 };
1998 tx.commit().await.map_err(backend)?;1991 tx.commit().await.map_err(backend)?;
1999 1992
2000- // Task birth touches the board, the task page and the feed at once.1993+ // Task birth touches the board and the task page at once.
2001 let mut topics = vec![1994 let mut topics = vec![
2002 Topic::Board,1995 Topic::Board,
2003 Topic::Task(id.clone()),1996 Topic::Task(id.clone()),
@@ -2166,15 +2159,6 @@ impl Store for TursoStore {
2166 )2159 )
2167 .await2160 .await
2168 .map_err(backend)?;2161 .map_err(backend)?;
2169- // Being assigned is being concerned: the assignee watches the task
2170- // until an unassign takes the watch back off. Idempotent, so a
2171- // no-change assign leaves the watch exactly as it is.
2172- tx.execute(
2173- "INSERT OR IGNORE INTO task_watcher (task_id, user_id) VALUES (?1, ?2)",
2174- params![task_id, user_id],
2175- )
2176- .await
2177- .map_err(backend)?;
2178 // A no-change assign changes no facts, so the reminders stand as2162 // A no-change assign changes no facts, so the reminders stand as
2179 // they are.2163 // they are.
2180 let reminded = if n > 0 {2164 let reminded = if n > 0 {
@@ -2214,14 +2198,6 @@ impl Store for TursoStore {
2214 )2198 )
2215 .await2199 .await
2216 .map_err(backend)?;2200 .map_err(backend)?;
2217- // Leaving the task takes the watch back off: its changes stop
2218- // concerning the person who left.
2219- tx.execute(
2220- "DELETE FROM task_watcher WHERE task_id = ?1 AND user_id = ?2",
2221- params![task_id, user_id],
2222- )
2223- .await
2224- .map_err(backend)?;
2225 let reminded = if n > 0 {2201 let reminded = if n > 0 {
2226 match self.sync_task_reminders(&tx, task_id, OffsetDateTime::now_utc()).await {2202 match self.sync_task_reminders(&tx, task_id, OffsetDateTime::now_utc()).await {
2227 Ok(reminded) => reminded,2203 Ok(reminded) => reminded,
@@ -2425,11 +2401,6 @@ impl Store for TursoStore {
2425 ],2401 ],
2426 )2402 )
2427 .await?;2403 .await?;
2428- tx.execute(
2429- "INSERT OR IGNORE INTO task_watcher (task_id, user_id) VALUES (?1, ?2)",
2430- params![task_id, author_id],
2431- )
2432- .await?;
2433 Ok::<_, turso::Error>(())2404 Ok::<_, turso::Error>(())
2434 }2405 }
2435 .await;2406 .await;
@@ -4080,122 +4051,6 @@ impl Store for TursoStore {
4080 row.as_ref().map(count_of).unwrap_or(Ok(0))4051 row.as_ref().map(count_of).unwrap_or(Ok(0))
4081 }4052 }
4082 4053
4083- async fn watch_task(&self, task_id: &str, user_id: &str) -> Result<()> {
4084- let conn = self.conn.lock().await;
4085- conn.execute(
4086- "INSERT OR IGNORE INTO task_watcher (task_id, user_id) VALUES (?1, ?2)",
4087- params![task_id, user_id],
4088- )
4089- .await
4090- .map_err(backend)?;
4091- drop(conn);
4092- self.announce([Topic::Activity]);
4093- Ok(())
4094- }
4095-
4096- async fn unwatch_task(&self, task_id: &str, user_id: &str) -> Result<()> {
4097- let conn = self.conn.lock().await;
4098- conn.execute(
4099- "DELETE FROM task_watcher WHERE task_id = ?1 AND user_id = ?2",
4100- params![task_id, user_id],
4101- )
4102- .await
4103- .map_err(backend)?;
4104- drop(conn);
4105- self.announce([Topic::Activity]);
4106- Ok(())
4107- }
4108-
4109- async fn feed_for_user(&self, user_id: &str, limit: u32) -> Result<Vec<ActivityLine>> {
4110- const SELECT: &str = "SELECT a.id, a.task_id, t.title, u.display_name, a.kind, a.detail, \
4111- a.created_at, t.task_key FROM activity a \
4112- JOIN task t ON t.id = a.task_id \
4113- LEFT JOIN user u ON u.id = a.actor_id";
4114- // Two ways an event can concern somebody, unioned: it happened on a
4115- // task they watch, or it names them. An event arriving both ways is
4116- // one row — UNION, not UNION ALL — and a person's own actions are
4117- // nobody's news, not even their own (`IS NOT`, so the system's rows
4118- // with no actor still pass).
4119- let conn = self.conn.lock().await;
4120- let sql = format!(
4121- "{SELECT} JOIN task_watcher w ON w.task_id = a.task_id AND w.user_id = ?1 \
4122- WHERE a.actor_id IS NOT ?2 \
4123- UNION {SELECT} WHERE a.subject_id = ?3 AND a.actor_id IS NOT ?4 \
4124- ORDER BY created_at DESC, id DESC LIMIT ?5"
4125- );
4126- let mut rows = conn
4127- .query(
4128- &sql,
4129- params![user_id, user_id, user_id, user_id, i64::from(limit)],
4130- )
4131- .await
4132- .map_err(backend)?;
4133- let mut out = Vec::new();
4134- while let Some(row) = rows.next().await.map_err(backend)? {
4135- out.push(ActivityLine {
4136- id: text(&row, 0)?,
4137- task_id: opt_text(&row, 1)?,
4138- title: opt_text(&row, 2)?,
4139- actor_name: opt_text(&row, 3)?,
4140- kind: ActivityKind::parse(&text(&row, 4)?),
4141- detail: text(&row, 5)?,
4142- at: parse_stamp(&text(&row, 6)?)?,
4143- task_key: opt_text(&row, 7)?,
4144- });
4145- }
4146- Ok(out)
4147- }
4148-
4149- async fn count_feed_unseen(&self, user_id: &str) -> Result<u64> {
4150- const SELECT: &str = "SELECT a.id FROM activity a \
4151- JOIN task t ON t.id = a.task_id \
4152- LEFT JOIN user u ON u.id = a.actor_id";
4153- // Unseen is the same union as the feed, narrowed to rows that landed
4154- // after the reader's marker. A reader who has never visited has no
4155- // marker, and COALESCE with the empty string — which sorts before
4156- // every stamp — reads the whole feed as news.
4157- let conn = self.conn.lock().await;
4158- let sql = format!(
4159- "SELECT COUNT(*) FROM (\
4160- {SELECT} JOIN task_watcher w ON w.task_id = a.task_id AND w.user_id = ?1 \
4161- WHERE a.actor_id IS NOT ?2 \
4162- AND a.created_at > COALESCE((SELECT feed_seen_at FROM user WHERE id = ?3), '') \
4163- UNION \
4164- {SELECT} WHERE a.subject_id = ?4 AND a.actor_id IS NOT ?5 \
4165- AND a.created_at > COALESCE((SELECT feed_seen_at FROM user WHERE id = ?6), ''))"
4166- );
4167- let mut rows = conn
4168- .query(
4169- &sql,
4170- params![
4171- user_id, user_id, user_id, user_id, user_id, user_id,
4172- ],
4173- )
4174- .await
4175- .map_err(backend)?;
4176- let row = rows.next().await.map_err(backend)?;
4177- match row {
4178- Some(row) => {
4179- let n: i64 = row.get(0).map_err(backend)?;
4180- Ok(usize::try_from(n).unwrap_or(0) as u64)
4181- }
4182- None => Ok(0),
4183- }
4184- }
4185-
4186- async fn mark_feed_seen(&self, user_id: &str, at: OffsetDateTime) -> Result<()> {
4187- let conn = self.conn.lock().await;
4188- conn.execute(
4189- "UPDATE user SET feed_seen_at = ?1 WHERE id = ?2",
4190- params![stamp(at)?, user_id],
4191- )
4192- .await
4193- .map_err(backend)?;
4194- drop(conn);
4195- self.announce([Topic::Activity]);
4196- Ok(())
4197- }
4198-
4199 async fn count_activity_preceding(4054 async fn count_activity_preceding(
4200 &self,4055 &self,
4201 filter: &ActivityFilter,4056 filter: &ActivityFilter,
crates/izlek-core/tests/store.rsmodified+46 -206
@@ -9188,118 +9188,6 @@ async fn reset_asks_are_rate_limited_per_client_and_silenced_per_address() {
9188 let _ = std::fs::remove_dir_all(&dir);9188 let _ = std::fs::remove_dir_all(&dir);
9189 }9189 }
9190 9190
9191-/// Watches and the personal feed: creating, being assigned and commenting
9192-/// each start a watch; an unassign ends it. The feed carries events on
9193-/// watched tasks and events naming the reader, never the reader's own
9194-/// actions; the unseen marker counts what landed since the last read.
9195-#[tokio::test]
9196-async fn the_personal_feed_follows_watches_names_and_the_marker() {
9197- let (dir, store, workspace, admin) = shared().await;
9198- let grace = member(&store, &workspace, "grace@izlek.sh", "Grace").await;
9199- let now = OffsetDateTime::now_utc();
9200- let board = store.board(&workspace).await.unwrap().unwrap();
9201- let column_id = column_named(&store, &workspace, "Backlog").await;
9202- let task = store
9203- .create_task(NewTask {
9204- board_id: &board.id,
9205- column_id: &column_id,
9206- parent_id: None,
9207- title: "Feed me",
9208- description: "",
9209- deadline: None,
9210- clock_at: None,
9211- created_by: &admin,
9212- })
9213- .await
9214- .unwrap()
9215- .row
9216- .id;
9217-
9218- store.assign_task(&task, &grace).await.unwrap();
9219-
9220- // Creating started Ada's watch; the assignment starts Grace's. Nobody's
9221- // own actions are their own news: Ada's created line is Grace's news,
9222- // and Grace's feed shows it while Ada's stays empty.
9223- let grace_feed = store.feed_for_user(&grace, 50).await.unwrap();
9224- assert_eq!(grace_feed.len(), 1);
9225- assert_eq!(grace_feed[0].kind, ActivityKind::Created);
9226- assert_eq!(grace_feed[0].actor_name.as_deref(), Some("Ada"));
9227- assert!(store.feed_for_user(&admin, 50).await.unwrap().is_empty());
9228- assert_eq!(store.count_feed_unseen(&grace).await.unwrap(), 1);
9229-
9230- // Grace's own comment is her own action: it is Ada's news, not hers.
9231- store
9232- .add_comment(&task, &grace, "Looking at it now", now)
9233- .await
9234- .unwrap();
9235- // Her feed keeps the created line; her own comment never comes back.
9236- let grace_feed = store.feed_for_user(&grace, 50).await.unwrap();
9237- assert_eq!(grace_feed.len(), 1);
9238- assert_eq!(grace_feed[0].kind, ActivityKind::Created);
9239- let admin_feed = store.feed_for_user(&admin, 50).await.unwrap();
9240- assert_eq!(admin_feed.len(), 1);
9241- assert_eq!(admin_feed[0].kind, ActivityKind::Commented);
9242- assert_eq!(admin_feed[0].actor_name.as_deref(), Some("Grace"));
9243- assert_eq!(store.count_feed_unseen(&admin).await.unwrap(), 1);
9244-
9245- // Reading the feed is reading it: the marker resets, the history stays.
9246- store
9247- .mark_feed_seen(&admin, now + Duration::seconds(5))
9248- .await
9249- .unwrap();
9250- assert_eq!(store.count_feed_unseen(&admin).await.unwrap(), 0);
9251- assert_eq!(store.feed_for_user(&admin, 50).await.unwrap().len(), 1);
9252-
9253- // Grace reads the feed too: her marker takes the created line off her
9254- // unseen count, history included.
9255- store
9256- .mark_feed_seen(&grace, now + Duration::seconds(3))
9257- .await
9258- .unwrap();
9259- assert_eq!(store.count_feed_unseen(&grace).await.unwrap(), 0);
9260- assert_eq!(store.feed_for_user(&grace, 50).await.unwrap().len(), 1);
9261-
9262- // Ada's comment lands on a task Grace watches, after her marker: news.
9263- store
9264- .add_comment(
9265- &task,
9266- &admin,
9267- "Thanks — ship it",
9268- now + Duration::seconds(6),
9269- )
9270- .await
9271- .unwrap();
9272- assert_eq!(store.count_feed_unseen(&grace).await.unwrap(), 1);
9273- let grace_feed = store.feed_for_user(&grace, 50).await.unwrap();
9274- assert_eq!(grace_feed.len(), 2, "{grace_feed:?}");
9275- assert_eq!(grace_feed[0].kind, ActivityKind::Commented);
9276- assert_eq!(grace_feed[0].actor_name.as_deref(), Some("Ada"));
9277-
9278- // An unassign takes the watch back off: history on the task stops
9279- // concerning the person who left.
9280- store.unassign_task(&task, &grace).await.unwrap();
9281- assert!(store.feed_for_user(&grace, 50).await.unwrap().is_empty());
9282- assert_eq!(store.count_feed_unseen(&grace).await.unwrap(), 0);
9283-
9284- // An event that NAMES her concerns her with no watch at all — the
9285- // second way into the feed.
9286- store
9287- .record_activity(
9288- &task,
9289- Some(&admin),
9290- Some(&grace),
9291- &ActivityKind::Assigned,
9292- "Grace",
9293- now + Duration::seconds(7),
9294- )
9295- .await
9296- .unwrap();
9297- let grace_feed = store.feed_for_user(&grace, 50).await.unwrap();
9298- assert_eq!(grace_feed.len(), 1);
9299- assert_eq!(grace_feed[0].kind, ActivityKind::Assigned);
9300-
9301- let _ = std::fs::remove_dir_all(&dir);
9302-}
9303 #[tokio::test]9191 #[tokio::test]
9304 async fn a_delivered_reminder_writes_the_reminded_event() {9192 async fn a_delivered_reminder_writes_the_reminded_event() {
9305 let (dir, store, workspace, admin) = shared().await;9193 let (dir, store, workspace, admin) = shared().await;
@@ -9419,108 +9307,60 @@ async fn board_search_folds_turkish_case() {
9419 assert_eq!(card.id, is_plan);9307 assert_eq!(card.id, is_plan);
9420 }9308 }
9421 9309
9422-/// The watch backfill rides the reconcile rebuild: a database from before9310+/// The assignee narrowing keeps the cards a member is on and, for `none`,
9423-/// the feed opens with a watch for every task somebody created, was9311+/// exactly the cards nobody is on — the same pass the tag filter rides.
9424-/// assigned, or commented on — soft-deleted tasks included, history
9425-/// included. The pass can never run twice (it lives behind the fingerprint
9426-/// gate), so an unassign after the deploy keeps its watch off across
9427-/// restarts.
9428 #[tokio::test]9312 #[tokio::test]
9429-async fn reconcile_backfills_watches_from_history_exactly_once() {9313+async fn board_assigned_narrows_to_a_member_or_to_nobody() {
9430- let (dir, path) = live_shaped_database().await;9314+ let (scratch, workspace, admin) = workspace_with_admin().await;
9431-9315+ let mate = member(&scratch.store, &workspace, "grace@izlek.sh", "Grace").await;
9432- // A historical comment — the third watch-worthy fact — on a task that9316+ let assigned_task = add_task(
9433- // already carries creation and assignment history.9317+ &scratch.store,
9434- {9318+ &workspace,
9435- let db = turso::Builder::new_local(&path).build().await.unwrap();9319+ "Backlog",
9436- let conn = db.connect().unwrap();9320+ "Assigned work",
9437- conn.execute(9321+ None,
9438- "INSERT INTO comment (id, task_id, author_id, body, created_at) \9322+ &admin,
9439- VALUES ('CM1', 'T2', 'U1', 'on it', '2026-08-30T12:00:01Z')",9323+ )
9440- (),9324+ .await;
9441- )9325+ let loose_task = add_task(
9326+ &scratch.store,
9327+ &workspace,
9328+ "Backlog",
9329+ "Loose work",
9330+ None,
9331+ &admin,
9332+ )
9333+ .await;
9334+ scratch
9335+ .store
9336+ .assign_task(&assigned_task, &mate)
9442 .await9337 .await
9443 .unwrap();9338 .unwrap();
9444- }
9445 9339
9446- izlek_core::store::reconcile(9340+ let mut board = izlek_core::board::load(&scratch.store, &workspace)
9447- &path,9341+ .await
9448- izlek_core::store::ReconcileOptions {9342+ .unwrap()
9449- dry_run: false,9343+ .unwrap();
9450- yes: true,9344+ board.assigned(Some(&mate));
9451- auto: true,9345+ assert_eq!(board.task_count(), 1);
9452- },9346+ let card = board.columns.iter().flat_map(|c| &c.cards).next().unwrap();
9453- )9347+ assert_eq!(card.id, assigned_task);
9454- .await
9455- .expect("reconcile refused the backfill");
9456-
9457- // T1: created by U1, assigned to U2. T2: created U1, assigned U2,
9458- // commented U1. T3: created U1, assigned U2. T4 (soft-deleted): created
9459- // U1. Distinct (task, watcher) pairs: 2 + 2 + 2 + 1.
9460- assert_eq!(scalar(&path, "SELECT COUNT(*) FROM task_watcher").await, 7);
9461- assert_eq!(
9462- scalar(
9463- &path,
9464- "SELECT COUNT(*) FROM task_watcher WHERE user_id = 'U2'"
9465- )
9466- .await,
9467- 3,
9468- "the assignee watches every task they are on"
9469- );
9470- assert_eq!(
9471- scalar(
9472- &path,
9473- "SELECT COUNT(*) FROM task_watcher WHERE user_id = 'U1'"
9474- )
9475- .await,
9476- 4,
9477- "the creator watches every task they made, soft-deleted included"
9478- );
9479 9348
9480- // The deploy happens; THEN Deniz unassigns — here, the same write the9349+ let mut board = izlek_core::board::load(&scratch.store, &workspace)
9481- // store makes. The pass never re-runs (the shape matches now), so the
9482- // watch stays off across a restart and a second reconcile.
9483- {
9484- let db = turso::Builder::new_local(&path).build().await.unwrap();
9485- let conn = db.connect().unwrap();
9486- conn.execute(
9487- "DELETE FROM task_watcher WHERE task_id = 'T1' AND user_id = 'U2'",
9488- (),
9489- )
9490 .await9350 .await
9351+ .unwrap()
9491 .unwrap();9352 .unwrap();
9492- }9353+ board.assigned(Some("none"));
9493- izlek_core::store::reconcile(9354+ assert_eq!(board.task_count(), 1);
9494- &path,9355+ let card = board.columns.iter().flat_map(|c| &c.cards).next().unwrap();
9495- izlek_core::store::ReconcileOptions {9356+ assert_eq!(card.id, loose_task);
9496- dry_run: false,
9497- yes: true,
9498- auto: true,
9499- },
9500- )
9501- .await
9502- .unwrap();
9503- assert_eq!(
9504- scalar(
9505- &path,
9506- "SELECT COUNT(*) FROM task_watcher WHERE task_id = 'T1'"
9507- )
9508- .await,
9509- 1,
9510- "the unassigned watch was resurrected"
9511- );
9512- let _store = TursoStore::open(&path).await.unwrap();
9513- assert_eq!(
9514- scalar(
9515- &path,
9516- "SELECT COUNT(*) FROM task_watcher WHERE task_id = 'T1'"
9517- )
9518- .await,
9519- 1,
9520- "a restart resurrected the unassigned watch"
9521- );
9522 9357
9523- let _ = std::fs::remove_dir_all(&dir);9358+ let mut board = izlek_core::board::load(&scratch.store, &workspace)
9359+ .await
9360+ .unwrap()
9361+ .unwrap();
9362+ board.assigned(None);
9363+ assert_eq!(board.task_count(), 2);
9524 }9364 }
9525 9365
9526 // ---------------------------------------------------------------------------9366 // ---------------------------------------------------------------------------
crates/izlek-web/src/board.rsmodified+41 -1
@@ -235,6 +235,16 @@ fn valid_tag(tag: Option<&str>, tags: &[izlek_core::store::Tag]) -> Option<Strin
235 tag.and_then(|id| tags.iter().find(|t| t.id == id).map(|t| t.id.clone()))235 tag.and_then(|id| tags.iter().find(|t| t.id == id).map(|t| t.id.clone()))
236 }236 }
237 237
238+/// The assignee filter keeps a member id of this workspace or the literal
239+/// `none` — a stale or hand-edited query string falls back to all.
240+fn valid_assigned(assigned: Option<&str>, members: &[User]) -> Option<String> {
241+ match assigned {
242+ None | Some("") => None,
243+ Some("none") => Some("none".to_string()),
244+ Some(id) => members.iter().find(|m| m.id == id).map(|m| m.id.clone()),
245+ }
246+}
247+
238 /// The `?q=` search: the box's text trimmed, and an empty box is no search248 /// The `?q=` search: the box's text trimmed, and an empty box is no search
239 /// at all — clearing it restores the whole board.249 /// at all — clearing it restores the whole board.
240 fn searched(query: Option<&str>) -> Option<String> {250 fn searched(query: Option<&str>) -> Option<String> {
@@ -261,6 +271,7 @@ async fn board_columns(
261 cx: &Cx,271 cx: &Cx,
262 sort: String,272 sort: String,
263 tag_filter: Option<String>,273 tag_filter: Option<String>,
274+ assigned: Option<String>,
264 search: Option<String>,275 search: Option<String>,
265 default_tag_id: Option<&str>,276 default_tag_id: Option<&str>,
266 ) -> Result {277 ) -> Result {
@@ -288,6 +299,7 @@ async fn board_columns(
288 view_data.searching(needle);299 view_data.searching(needle);
289 }300 }
290 view_data.tagged(tag_filter.as_deref());301 view_data.tagged(tag_filter.as_deref());
302+ view_data.assigned(assigned.as_deref());
291 for column in &mut view_data.columns {303 for column in &mut view_data.columns {
292 column.column.name = crate::i18n::column_name(lang, &column.column.name);304 column.column.name = crate::i18n::column_name(lang, &column.column.name);
293 sort_column_cards(&mut column.cards, &sort);305 sort_column_cards(&mut column.cards, &sort);
@@ -609,6 +621,7 @@ struct BoardQuery {
609 confirm: Option<String>,621 confirm: Option<String>,
610 new: Option<String>,622 new: Option<String>,
611 tag: Option<String>,623 tag: Option<String>,
624+ assigned: Option<String>,
612 q: Option<String>,625 q: Option<String>,
613 }626 }
614 627
@@ -647,15 +660,21 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result {
647 let store = accounts(cx).store().clone();660 let store = accounts(cx).store().clone();
648 store.tags(&view_data.board.id).await?661 store.tags(&view_data.board.id).await?
649 };662 };
663+ let members = {
664+ let store = accounts(cx).store().clone();
665+ store.users(&user.workspace_id).await?
666+ };
650 // The whole filter pipeline narrows the board before anything counts or667 // The whole filter pipeline narrows the board before anything counts or
651 // renders it, so the chips, the columns and the empty state all describe668 // renders it, so the chips, the columns and the empty state all describe
652 // the same set.669 // the same set.
653 let search = searched(query.q.as_deref());670 let search = searched(query.q.as_deref());
654 let tag_filter = valid_tag(query.tag.as_deref(), &tags);671 let tag_filter = valid_tag(query.tag.as_deref(), &tags);
672+ let assigned_filter = valid_assigned(query.assigned.as_deref(), &members);
655 if let Some(needle) = &search {673 if let Some(needle) = &search {
656 view_data.searching(needle);674 view_data.searching(needle);
657 }675 }
658 view_data.tagged(tag_filter.as_deref());676 view_data.tagged(tag_filter.as_deref());
677+ view_data.assigned(assigned_filter.as_deref());
659 let today = OffsetDateTime::now_utc().date();678 let today = OffsetDateTime::now_utc().date();
660 let overdue = view_data.overdue_count(today);679 let overdue = view_data.overdue_count(today);
661 let blocked = view_data.blocked_count();680 let blocked = view_data.blocked_count();
@@ -709,6 +728,7 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result {
709 <form class="field-box field-box-sort" method="get" action="/">728 <form class="field-box field-box-sort" method="get" action="/">
710 <input type="hidden" name="sort" value=(sort.clone())>729 <input type="hidden" name="sort" value=(sort.clone())>
711 <input type="hidden" name="q" value=(search.as_deref().unwrap_or(""))>730 <input type="hidden" name="q" value=(search.as_deref().unwrap_or(""))>
731+ <input type="hidden" name="assigned" value=(assigned_filter.clone().unwrap_or_default())>
712 <span class="field-text">(t(lang, Key::Project))</span>732 <span class="field-text">(t(lang, Key::Project))</span>
713 <select class="status-select" name="tag" data-autosubmit="" data-search="">733 <select class="status-select" name="tag" data-autosubmit="" data-search="">
714 <option value="" selected=(tag_filter.is_none())>(t(lang, Key::AllTags))</option>734 <option value="" selected=(tag_filter.is_none())>(t(lang, Key::AllTags))</option>
@@ -722,9 +742,28 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result {
722 <path d="M4 6l4 4 4-4"></path>742 <path d="M4 6l4 4 4-4"></path>
723 </svg>743 </svg>
724 </form>744 </form>
745+ <form class="field-box field-box-sort" method="get" action="/">
746+ <input type="hidden" name="sort" value=(sort.clone())>
747+ <input type="hidden" name="tag" value=(tag_filter.clone().unwrap_or_default())>
748+ <input type="hidden" name="q" value=(search.as_deref().unwrap_or(""))>
749+ <span class="field-text">(t(lang, Key::Assignee))</span>
750+ <select class="status-select" name="assigned" data-autosubmit="" data-search="">
751+ <option value="" selected=(assigned_filter.is_none())>(t(lang, Key::All))</option>
752+ <option value="none" selected=(assigned_filter.as_deref() == Some("none"))>(t(lang, Key::Nobody))</option>
753+ for member in &members {
754+ <option value=(member.id.clone()) selected=(assigned_filter.as_deref() == Some(member.id.as_str()))>(member.display_name.clone())</option>
755+ }
756+ </select>
757+ <svg class="glyph" width="14" height="14" viewBox="0 0 16 16" fill="none"
758+ stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
759+ stroke-linejoin="round" aria-hidden="true">
760+ <path d="M4 6l4 4 4-4"></path>
761+ </svg>
762+ </form>
725 <form class="field-box field-box-sort" method="get" action="/">763 <form class="field-box field-box-sort" method="get" action="/">
726 <input type="hidden" name="tag" value=(tag_filter.clone().unwrap_or_default())>764 <input type="hidden" name="tag" value=(tag_filter.clone().unwrap_or_default())>
727 <input type="hidden" name="q" value=(search.as_deref().unwrap_or(""))>765 <input type="hidden" name="q" value=(search.as_deref().unwrap_or(""))>
766+ <input type="hidden" name="assigned" value=(assigned_filter.clone().unwrap_or_default())>
728 <span class="field-text">(t(lang, Key::Sort))</span>767 <span class="field-text">(t(lang, Key::Sort))</span>
729 <select class="status-select" name="sort" data-autosubmit="">768 <select class="status-select" name="sort" data-autosubmit="">
730 for key in SORT_KEYS {769 for key in SORT_KEYS {
@@ -740,6 +779,7 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result {
740 <form class="field-box field-box-search" method="get" action="/">779 <form class="field-box field-box-search" method="get" action="/">
741 <input type="hidden" name="sort" value=(sort.clone())>780 <input type="hidden" name="sort" value=(sort.clone())>
742 <input type="hidden" name="tag" value=(tag_filter.clone().unwrap_or_default())>781 <input type="hidden" name="tag" value=(tag_filter.clone().unwrap_or_default())>
782+ <input type="hidden" name="assigned" value=(assigned_filter.clone().unwrap_or_default())>
743 <span class="field-text">(t(lang, Key::Search))</span>783 <span class="field-text">(t(lang, Key::Search))</span>
744 <input class="dd-search" type="text" name="q" value=(search.as_deref().unwrap_or(""))>784 <input class="dd-search" type="text" name="q" value=(search.as_deref().unwrap_or(""))>
745 </form>785 </form>
@@ -755,7 +795,7 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result {
755 <div class="scaffold-note"><p>(t(lang, Key::NoMatches))</p></div>795 <div class="scaffold-note"><p>(t(lang, Key::NoMatches))</p></div>
756 } else {796 } else {
757 <div class="board-columns">797 <div class="board-columns">
758- (board_columns(cx, sort.clone(), tag_filter.clone(), search.clone(), default_tag_id).await?)798+ (board_columns(cx, sort.clone(), tag_filter.clone(), assigned_filter.clone(), search.clone(), default_tag_id).await?)
759 </div>799 </div>
760 }800 }
761 </main>801 </main>
crates/izlek-web/src/feed.rsdeleted+0 -113
@@ -1,113 +0,0 @@
1-//! "What changed for me": the events a signed-in person has a stake in.
2-//!
3-//! Every role gets it — a Viewer's feed is simply emptier, not hidden. Two
4-//! things put a line on someone's feed: it happened on a task they watch
5-//! (making a task, being assigned, commenting each start a watch; an
6-//! unassign ends it), or it names them. Nobody's own actions come back to
7-//! them — the store's feed query leaves those off. The watch and marker
8-//! mechanics live in the store (`feed_for_user`, `count_feed_unseen`,
9-//! `mark_feed_seen`); this page only reads and renders.
10-//!
11-//! Visiting is reading: the page marks the feed seen after fetching its
12-//! rows, so the badge on the next page anywhere — and on this one, which
13-//! renders after the mark — reads zero. New events announce on the live
14-//! channel like every other write, and the shell's refresh morph brings
15-//! both this page and the topbar badge back up to date.
16-
17-use time::OffsetDateTime;
18-use topcoat::Result;
19-use topcoat::context::Cx;
20-use topcoat::router::{error::not_found, page};
21-use topcoat::view::view;
22-
23-use crate::i18n::{Key, Lang, t};
24-use crate::server::{accounts, require_user};
25-
26-/// How many lines one page draws, the same cap the logs page reads by: a
27-/// read a person can finish, panned inside the shell, never a document
28-/// growing past the viewport.
29-const LIMIT: u32 = 50;
30-
31-/// One rendered feed line — the same anatomy as the Logs page's activity
32-/// rows (`log-row`: stamp · actor · sentence · subject), with the subject
33-/// as the one link. The strings are decided here so the template stays a
34-/// list of facts rather than a chain of lookups.
35-struct FeedRow {
36- key: String,
37- title: String,
38- href: String,
39- actor: String,
40- sentence: String,
41- when: String,
42-}
43-
44-/// The person's feed. `/feed`.
45-#[page("/feed")]
46-async fn feed_page(cx: &Cx) -> Result {
47- let user = match require_user(cx).await {
48- Ok(user) => user,
49- Err(_) => return Err(not_found().into()),
50- };
51- let lang = Lang::from_code(&user.language);
52- let store = accounts(cx).store().clone();
53- let lines = store.feed_for_user(&user.id, LIMIT).await?;
54- // The visit is the marker, taken after the rows are read: the badge on
55- // the next page anywhere reads zero, and this page's own topbar —
56- // rendered after the mark — agrees with it.
57- store
58- .mark_feed_seen(&user.id, OffsetDateTime::now_utc())
59- .await?;
60- let zone = izlek_core::detail::parse_zone(&user.timezone);
61-
62- let empty = lines.is_empty();
63- let rows: Vec<FeedRow> = lines
64- .iter()
65- .map(|line| FeedRow {
66- key: line.task_key.clone().unwrap_or_default(),
67- title: line.title.clone().unwrap_or_default(),
68- href: format!("/?task={}", line.task_id.as_deref().unwrap_or_default()),
69- actor: line
70- .actor_name
71- .clone()
72- .unwrap_or_else(|| t(lang, Key::TheSystem).to_string()),
73- sentence: crate::logs::activity_sentence(&line.kind, &line.detail, lang),
74- when: izlek_core::detail::moment_label_in(line.at, zone),
75- })
76- .collect();
77-
78- view! {
79- cx =>
80- <header class="topbar">
81- (crate::layout::mark(cx).await?)
82- (crate::layout::topbar_nav(cx, crate::layout::NavPage::Feed, user.role, lang).await?)
83- <div class="spacer"></div>
84- (crate::layout::user_menu(cx, &crate::detail::Me::from(&user), lang).await?)
85- </header>
86-
87- <main class="feed-shell">
88- <section class="panel">
89- <div class="panel-head">
90- <h2 class="panel-title">(t(lang, Key::NavFeed))</h2>
91- </div>
92- <div class="panel-body">
93- <div class="log-list">
94- for row in rows {
95- <div class="log-row">
96- <span class="log-stamp">(row.when)</span>
97- <span class="log-actor">(row.actor)</span>
98- <span class="log-line">(row.sentence)</span>
99- <a class="log-task" href=(row.href)>
100- <span class="log-key">(format!("({})", row.key))</span>
101- <span class="log-title">(row.title)</span>
102- </a>
103- </div>
104- }
105- </div>
106- if empty {
107- <p class="rules-quiet">(t(lang, Key::FeedEmpty))</p>
108- }
109- </div>
110- </section>
111- </main>
112- }
113-}
crates/izlek-web/src/i18n.rsmodified+6 -6
@@ -375,9 +375,9 @@ pub enum Key {
375 ResetLinkDead,375 ResetLinkDead,
376 ActResetRequested,376 ActResetRequested,
377 ActResetDone,377 ActResetDone,
378- NavFeed,378+ Assignee,
379 ActReminded,379 ActReminded,
380- FeedEmpty,380+ Nobody,
381 }381 }
382 382
383 /// The lone templated phrase — a name in the middle reads worse as two383 /// The lone templated phrase — a name in the middle reads worse as two
@@ -1075,10 +1075,10 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
1075 (ActResetDone, Tr) => "sıfırlama bağlantısıyla yeni parola aldı",1075 (ActResetDone, Tr) => "sıfırlama bağlantısıyla yeni parola aldı",
1076 (ActReminded, En) => "sent a reminder mail",1076 (ActReminded, En) => "sent a reminder mail",
1077 (ActReminded, Tr) => "hatırlatma gönderdi",1077 (ActReminded, Tr) => "hatırlatma gönderdi",
1078- (NavFeed, En) => "For me",1078+ (Assignee, En) => "Assignee",
1079- (NavFeed, Tr) => "Benim için",1079+ (Assignee, Tr) => "Atanan",
1080- (FeedEmpty, En) => "Nothing yet.",1080+ (Nobody, En) => "Nobody",
1081- (FeedEmpty, Tr) => "Henüz bir şey yok.",1081+ (Nobody, Tr) => "Kimse",
1082 }1082 }
1083 }1083 }
1084 1084
crates/izlek-web/src/layout.rsmodified+2 -20
@@ -137,7 +137,6 @@ pub async fn user_menu(cx: &Cx, me: &crate::detail::Me, lang: Lang) -> Result {
137 #[derive(Clone, Copy, PartialEq)]137 #[derive(Clone, Copy, PartialEq)]
138 pub enum NavPage {138 pub enum NavPage {
139 Board,139 Board,
140- Feed,
141 Rules,140 Rules,
142 Logs,141 Logs,
143 Tags,142 Tags,
@@ -145,9 +144,8 @@ pub enum NavPage {
145 }144 }
146 145
147 impl NavPage {146 impl NavPage {
148- const ALL: [Self; 6] = [147+ const ALL: [Self; 5] = [
149 Self::Board,148 Self::Board,
150- Self::Feed,
151 Self::Rules,149 Self::Rules,
152 Self::Logs,150 Self::Logs,
153 Self::Tags,151 Self::Tags,
@@ -157,7 +155,6 @@ impl NavPage {
157 fn href(self) -> &'static str {155 fn href(self) -> &'static str {
158 match self {156 match self {
159 Self::Board => "/",157 Self::Board => "/",
160- Self::Feed => "/feed",
161 Self::Rules => "/rules",158 Self::Rules => "/rules",
162 Self::Logs => "/logs",159 Self::Logs => "/logs",
163 Self::Tags => "/tags",160 Self::Tags => "/tags",
@@ -168,7 +165,6 @@ impl NavPage {
168 fn label(self) -> Key {165 fn label(self) -> Key {
169 match self {166 match self {
170 Self::Board => Key::NavBoard,167 Self::Board => Key::NavBoard,
171- Self::Feed => Key::NavFeed,
172 Self::Rules => Key::NavMailRules,168 Self::Rules => Key::NavMailRules,
173 Self::Logs => Key::NavLogs,169 Self::Logs => Key::NavLogs,
174 Self::Tags => Key::NavTags,170 Self::Tags => Key::NavTags,
@@ -179,19 +175,9 @@ impl NavPage {
179 175
180 /// The topbar's page nav, shared by every signed-in page: the pages with the176 /// The topbar's page nav, shared by every signed-in page: the pages with the
181 /// current one marked, the admin-only ones (rules, logs, tags) shown only to177 /// current one marked, the admin-only ones (rules, logs, tags) shown only to
182-/// roles that can administer. The feed link carries the unread count — how178+/// roles that can administer. Plain `<a>`s — the soft-nav forwarder swaps them
183-/// many lines have landed since the person last read their feed — as a chip
184-/// that disappears at zero. Plain `<a>`s — the soft-nav forwarder swaps them
185 /// like any same-origin link, so `data-hard` stays off.179 /// like any same-origin link, so `data-hard` stays off.
186 pub async fn topbar_nav(cx: &Cx, active: NavPage, role: izlek_core::Role, lang: Lang) -> Result {180 pub async fn topbar_nav(cx: &Cx, active: NavPage, role: izlek_core::Role, lang: Lang) -> Result {
187- let unread = match current_user(cx).await {
188- Ok(Some(me)) => crate::server::accounts(cx)
189- .store()
190- .count_feed_unseen(&me.id)
191- .await
192- .unwrap_or(0),
193- _ => 0,
194- };
195 view! {181 view! {
196 cx =>182 cx =>
197 <nav class="topbar-nav-links">183 <nav class="topbar-nav-links">
@@ -202,9 +188,6 @@ pub async fn topbar_nav(cx: &Cx, active: NavPage, role: izlek_core::Role, lang:
202 href=(page.href())188 href=(page.href())
203 >189 >
204 (t(lang, page.label()))190 (t(lang, page.label()))
205- if page == NavPage::Feed && unread > 0 {
206- <span class="feed-badge">(unread)</span>
207- }
208 </a>191 </a>
209 }192 }
210 }193 }
@@ -779,7 +762,6 @@ pub async fn live_script(cx: &Cx) -> Result {
779 if (path === '/tags') { return topic === 'tags' || topic === 'members'; } \762 if (path === '/tags') { return topic === 'tags' || topic === 'members'; } \
780 if (path === '/settings') { return topic === 'settings' || topic === 'members'; } \763 if (path === '/settings') { return topic === 'settings' || topic === 'members'; } \
781 if (path === '/people/') { return topic === 'members'; } \764 if (path === '/people/') { return topic === 'members'; } \
782- if (path === '/feed') { return true; } \
783 } \765 } \
784 try { \766 try { \
785 var src = new EventSource('/api/live'); \767 var src = new EventSource('/api/live'); \
crates/izlek-web/src/lib.rsmodified+0 -1
@@ -7,7 +7,6 @@ pub mod auth;
7 pub mod board;7 pub mod board;
8 pub mod detail;8 pub mod detail;
9 pub mod dropdown;9 pub mod dropdown;
10-pub mod feed;
11 pub mod files;10 pub mod files;
12 pub mod i18n;11 pub mod i18n;
13 pub mod layout;12 pub mod layout;
crates/izlek-web/tests/http.rsmodified+71 -37
@@ -9885,20 +9885,70 @@ async fn a_multi_file_picker_lands_every_part_as_its_own_attachment() {
9885 assert_eq!(txt_back.bytes, text);9885 assert_eq!(txt_back.bytes, text);
9886 }9886 }
9887 9887
9888-/// The feed page: a member sees the events that concern them (the task they9888+/// The board's assignee filter narrows to one member's cards, and `none`
9889-/// were assigned, named with the actor), the topbar badge counts what is9889+/// narrows to the cards nobody is on; a bogus id falls back to all.
9890-/// unread, and visiting the feed clears it. A viewer gets the page too —
9891-/// empty, not refused.
9892 #[tokio::test]9890 #[tokio::test]
9893-async fn the_feed_shows_each_person_their_stake() {9891+async fn the_board_assignee_filter_narrows_and_a_bogus_id_falls_back_to_all() {
9894 let app = App::open().await;9892 let app = App::open().await;
9895 let admin_cookie = admin(&app).await;9893 let admin_cookie = admin(&app).await;
9896- let member = invited(&app, &admin_cookie, "deniz@izlek.sh", "Deniz", Role::Member).await;9894+ invited(&app, &admin_cookie, "deniz@izlek.sh", "Deniz", Role::Member).await;
9897 let columns = columns_of(&app).await;9895 let columns = columns_of(&app).await;
9898- let task = a_task(&app, &admin_cookie, &columns[0], "Watch me").await;9896+ let assigned_task = a_task(&app, &admin_cookie, &columns[0], "Deniz work").await;
9899- let deniz_id = person_id(&app, &admin_cookie, &task, "Deniz").await;9897+ a_task(&app, &admin_cookie, &columns[0], "Loose work").await;
9898+ let deniz_id = person_id(&app, &admin_cookie, &assigned_task, "Deniz").await;
9899+ app.post(
9900+ "/api/assign",
9901+ Some(&admin_cookie),
9902+ &[("task_id", &assigned_task), ("user_id", &deniz_id)],
9903+ )
9904+ .await;
9900 9905
9901- // Ada assigns Deniz: the assignment names him and starts his watch.9906+ let filtered = String::from_utf8(
9907+ app.get(&format!("/?assigned={deniz_id}"), Some(&admin_cookie))
9908+ .await
9909+ .bytes,
9910+ )
9911+ .unwrap();
9912+ assert!(
9913+ filtered.contains("Deniz work"),
9914+ "the assigned card is gone: {filtered}"
9915+ );
9916+ assert!(
9917+ !filtered.contains("Loose work"),
9918+ "the unassigned card did not filter out: {filtered}"
9919+ );
9920+
9921+ let nobody = String::from_utf8(
9922+ app.get("/?assigned=none", Some(&admin_cookie)).await.bytes,
9923+ )
9924+ .unwrap();
9925+ assert!(
9926+ nobody.contains("Loose work"),
9927+ "the unassigned card is gone: {nobody}"
9928+ );
9929+ assert!(
9930+ !nobody.contains("Deniz work"),
9931+ "the assigned card did not filter out: {nobody}"
9932+ );
9933+
9934+ let everything =
9935+ String::from_utf8(app.get("/?assigned=bogus", Some(&admin_cookie)).await.bytes).unwrap();
9936+ assert!(
9937+ everything.contains("Deniz work") && everything.contains("Loose work"),
9938+ "a bogus assignee did not fall back to all: {everything}"
9939+ );
9940+}
9941+
9942+/// The other filter forms carry the active assignee in a hidden input, so
9943+/// switching the tag, the sort or the search keeps the assignee narrow.
9944+#[tokio::test]
9945+async fn the_board_filter_forms_preserve_the_assignee_filter() {
9946+ let app = App::open().await;
9947+ let admin_cookie = admin(&app).await;
9948+ invited(&app, &admin_cookie, "deniz@izlek.sh", "Deniz", Role::Member).await;
9949+ let columns = columns_of(&app).await;
9950+ let task = a_task(&app, &admin_cookie, &columns[0], "Deniz work").await;
9951+ let deniz_id = person_id(&app, &admin_cookie, &task, "Deniz").await;
9902 app.post(9952 app.post(
9903 "/api/assign",9953 "/api/assign",
9904 Some(&admin_cookie),9954 Some(&admin_cookie),
@@ -9906,34 +9956,18 @@ async fn the_feed_shows_each_person_their_stake() {
9906 )9956 )
9907 .await;9957 .await;
9908 9958
9909- // The badge rides every page's topbar while the news is unread...9959+ let page = String::from_utf8(
9910- let board = app.get("/", Some(&member)).await;9960+ app.get(&format!("/?assigned={deniz_id}"), Some(&admin_cookie))
9911- let board_html = String::from_utf8_lossy(&board.bytes);9961+ .await
9912- assert!(board_html.contains("feed-badge"), "{board_html}");9962+ .bytes,
9913- assert!(board_html.contains("href=\"/feed\""), "{board_html}");9963+ )
9914-9964+ .unwrap();
9915- // ...and the feed page names what happened, with the actor.9965+ assert_eq!(
9916- let feed = app.get("/feed", Some(&member)).await;9966+ page.matches(&format!(r#"name="assigned" value="{deniz_id}""#))
9917- assert_eq!(feed.status, StatusCode::OK);9967+ .count(),
9918- let feed_html = String::from_utf8_lossy(&feed.bytes);9968+ 3,
9919- assert!(feed_html.contains("Watch me"), "{feed_html}");9969+ "the tag, sort and search forms do not each carry the assignee: {page}"
9920- assert!(feed_html.contains("Ada Lovelace"), "{feed_html}");9970+ );
9921- assert!(feed_html.contains("assigned"), "{feed_html}");
9922-
9923- // Visiting was reading: the badge is gone on the next page.
9924- let board = app.get("/", Some(&member)).await;
9925- let board_html = String::from_utf8_lossy(&board.bytes);
9926- assert!(
9927- !board_html.contains("feed-badge"),
9928- "badge survived the read: {board_html}"
9929- );
9930-
9931- // A viewer's feed is empty, not hidden: every role gets the page.
9932- let viewer = invited(&app, &admin_cookie, "kim@izlek.sh", "Kim", Role::Viewer).await;
9933- let feed = app.get("/feed", Some(&viewer)).await;
9934- assert_eq!(feed.status, StatusCode::OK);
9935- let feed_html = String::from_utf8_lossy(&feed.bytes);
9936- assert!(feed_html.contains("Nothing yet."), "{feed_html}");
9937 }9971 }
9938 9972
9939 // The build stamp rides the html element of every render — the page a tab9973 // The build stamp rides the html element of every render — the page a tab
style/main.scssmodified+0 -62
@@ -4261,65 +4261,3 @@ input[type="radio"] {
4261 4261
4262 .auth-stage { padding: 0 16px 24px; }4262 .auth-stage { padding: 0 16px 24px; }
4263 }4263 }
4264-
4265-// == What changed for me (`feed.rs`) =========================================
4266-//
4267-// A topbar link with the unread chip, and one viewport-locked page. The rows
4268-// are the Logs page's own `log-list`/`log-row` anatomy — stamp · actor ·
4269-// sentence · subject, hairline separators — so there is one row idiom, not
4270-// two. Only the shell, the empty line and the badge are the feed's own.
4271-
4272-body:has(.feed-shell) {
4273- height: 100vh;
4274- height: 100dvh;
4275- overflow: hidden;
4276- display: flex;
4277- flex-direction: column;
4278-
4279- > * { flex: none; }
4280- > .feed-shell {
4281- flex: 1;
4282- min-height: 0;
4283- overflow-y: auto;
4284- scrollbar-width: none;
4285-
4286- &::-webkit-scrollbar { display: none; }
4287- }
4288-}
4289-
4290-.feed-shell {
4291- padding: 24px;
4292- display: flex;
4293- justify-content: center;
4294-
4295- .panel { width: min(860px, 100%); align-self: flex-start; }
4296-
4297- .log-row {
4298- padding: 10px 2px;
4299- // Narrow shells drop the subject under the sentence instead of
4300- // squeezing the sentence out of the row.
4301- flex-wrap: wrap;
4302- row-gap: 2px;
4303-
4304- &:last-child { border-bottom: none; }
4305- }
4306-
4307- .log-task {
4308- flex-shrink: 0;
4309- margin-left: auto;
4310- white-space: nowrap;
4311-
4312- .log-key { margin-right: 6px; }
4313- .log-title { font-weight: 600; }
4314- }
4315-}
4316-
4317-.feed-badge {
4318- margin-left: 6px;
4319- background: var(--accent);
4320- color: #fff;
4321- border-radius: 9px;
4322- padding: 1px 6px;
4323- font-size: 11px;
4324- font-variant-numeric: tabular-nums;
4325-}