forge
Explore
Log in

Don't you dare go Hollow

Clock time: two searchable dropdowns; time triggers fold into deadline

Browse files at this commit

183b6918cfeff6e1f0b9222206c5ad7277511de8Ahmet Kaan GümüşParent: 88fee1e
Each half of the time is now a logs-style boxed dropdown — hour 00..23,
minute 00..59, type to narrow, value equal to label, prefilled from the
task's clock in the viewer's zone and committed by a day press like the
rest of the form. Clear blanks both boxes and their trigger labels.

The separate a-time-is-set/removed mail triggers are gone: with clock
and deadline one field, a time change now fires the deadline triggers
(fires_on: DeadlineSet on DeadlineSet|ClockSet, DeadlineCleared likewise),
and the trigger words, variants and mappings are deleted outright. The
datepicker popover's outside-click closer no longer slams shut on a
dropdown-row press.
crates/izlek-core/src/mail.rsmodified+45 -7
@@ -468,7 +468,7 @@ impl Engine {
468 .await?;468 .await?;
469 continue;469 continue;
470 }470 }
471- if activity_kind_for(&rule.trigger).as_ref() == Some(&event.kind) {471+ if fires_on(&rule.trigger, &event.kind) {
472 self.owe(rule, &happened, &event.task_id, &mut report)472 self.owe(rule, &happened, &event.task_id, &mut report)
473 .await?;473 .await?;
474 continue;474 continue;
@@ -1015,11 +1015,25 @@ impl Engine {
1015 }1015 }
1016 }1016 }
1017 1017
1018-/// The `ActivityKind` a trigger fires on. `StatusBecomes`/`Unblocked` fire on1018+/// Whether a trigger fires on an activity row of this kind, and what each
1019-/// a crossing or a freeing instead and never on an activity row, so they1019+/// remaining trigger means on the rows it watches — `StatusBecomes` and
1020-/// answer `None` — this is the one place a new `Trigger` variant has to be1020+/// `Unblocked` fire on a crossing or a freeing instead and never on an
1021+/// activity row, so this is the one place a new `Trigger` variant has to be
1021 /// taught what it means, for `on_transition`, `on_freeing` and `on_activity`1022 /// taught what it means, for `on_transition`, `on_freeing` and `on_activity`
1022-/// alike.1023+/// alike. A time change fires the deadline triggers: the clock is the
1024+/// deadline field's other half, not a second thing to arm rules on.
1025+fn fires_on(trigger: &Trigger, kind: &ActivityKind) -> bool {
1026+ match trigger {
1027+ Trigger::DeadlineSet => {
1028+ *kind == ActivityKind::DeadlineSet || *kind == ActivityKind::ClockSet
1029+ }
1030+ Trigger::DeadlineCleared => {
1031+ *kind == ActivityKind::DeadlineCleared || *kind == ActivityKind::ClockCleared
1032+ }
1033+ other => activity_kind_for(other).as_ref() == Some(kind),
1034+ }
1035+}
1036+
1023 fn activity_kind_for(trigger: &Trigger) -> Option<ActivityKind> {1037 fn activity_kind_for(trigger: &Trigger) -> Option<ActivityKind> {
1024 match trigger {1038 match trigger {
1025 Trigger::Created => Some(ActivityKind::Created),1039 Trigger::Created => Some(ActivityKind::Created),
@@ -1028,8 +1042,6 @@ fn activity_kind_for(trigger: &Trigger) -> Option<ActivityKind> {
1028 Trigger::Commented => Some(ActivityKind::Commented),1042 Trigger::Commented => Some(ActivityKind::Commented),
1029 Trigger::DeadlineSet => Some(ActivityKind::DeadlineSet),1043 Trigger::DeadlineSet => Some(ActivityKind::DeadlineSet),
1030 Trigger::DeadlineCleared => Some(ActivityKind::DeadlineCleared),1044 Trigger::DeadlineCleared => Some(ActivityKind::DeadlineCleared),
1031- Trigger::ClockSet => Some(ActivityKind::ClockSet),
1032- Trigger::ClockCleared => Some(ActivityKind::ClockCleared),
1033 Trigger::Retitled => Some(ActivityKind::Retitled),1045 Trigger::Retitled => Some(ActivityKind::Retitled),
1034 Trigger::Linked => Some(ActivityKind::Linked),1046 Trigger::Linked => Some(ActivityKind::Linked),
1035 Trigger::Unlinked => Some(ActivityKind::Unlinked),1047 Trigger::Unlinked => Some(ActivityKind::Unlinked),
@@ -1077,6 +1089,7 @@ mod backoff_tests {
1077 assert_eq!(backoff(1), Duration::minutes(5));1089 assert_eq!(backoff(1), Duration::minutes(5));
1078 assert_eq!(backoff(2), Duration::minutes(10));1090 assert_eq!(backoff(2), Duration::minutes(10));
1079 assert_eq!(backoff(3), Duration::minutes(20));1091 assert_eq!(backoff(3), Duration::minutes(20));
1092+
1080 assert_eq!(backoff(4), Duration::minutes(40));1093 assert_eq!(backoff(4), Duration::minutes(40));
1081 assert_eq!(backoff(5), Duration::minutes(60));1094 assert_eq!(backoff(5), Duration::minutes(60));
1082 // Nothing waits longer than an hour, whatever it is handed.1095 // Nothing waits longer than an hour, whatever it is handed.
@@ -1089,3 +1102,28 @@ mod backoff_tests {
1089 assert_eq!(MAX_ATTEMPTS, 5);1102 assert_eq!(MAX_ATTEMPTS, 5);
1090 }1103 }
1091 }1104 }
1105+
1106+#[cfg(test)]
1107+mod trigger_fold_tests {
1108+ use super::fires_on;
1109+ use crate::detail::{ActivityKind, Trigger};
1110+
1111+ #[test]
1112+ fn a_time_change_fires_the_deadline_triggers() {
1113+ assert!(fires_on(&Trigger::DeadlineSet, &ActivityKind::ClockSet));
1114+ assert!(fires_on(
1115+ &Trigger::DeadlineCleared,
1116+ &ActivityKind::ClockCleared
1117+ ));
1118+ assert!(fires_on(&Trigger::DeadlineSet, &ActivityKind::DeadlineSet));
1119+ assert!(!fires_on(
1120+ &Trigger::DeadlineSet,
1121+ &ActivityKind::DeadlineCleared
1122+ ));
1123+ assert!(!fires_on(
1124+ &Trigger::DeadlineCleared,
1125+ &ActivityKind::ClockSet
1126+ ));
1127+ assert!(!fires_on(&Trigger::DeadlineSet, &ActivityKind::Created));
1128+ }
1129+}
crates/izlek-core/src/store/mod.rsmodified+0 -5
@@ -319,11 +319,6 @@ pub enum Trigger {
319 Commented,319 Commented,
320 DeadlineSet,320 DeadlineSet,
321 DeadlineCleared,321 DeadlineCleared,
322- /// The meeting instant was set, or the exact time changed. `None` never
323- /// watches a column, so the variant carries nothing.
324- ClockSet,
325- /// The meeting instant was removed.
326- ClockCleared,
327 Retitled,322 Retitled,
328 Linked,323 Linked,
329 Unlinked,324 Unlinked,
crates/izlek-core/src/store/turso_store.rsmodified+0 -4
@@ -482,8 +482,6 @@ fn trigger_parts(trigger: &Trigger) -> (&'static str, Option<String>) {
482 Trigger::Retitled => ("retitled", None),482 Trigger::Retitled => ("retitled", None),
483 Trigger::Linked => ("linked", None),483 Trigger::Linked => ("linked", None),
484 Trigger::Unlinked => ("unlinked", None),484 Trigger::Unlinked => ("unlinked", None),
485- Trigger::ClockSet => ("clock_set", None),
486- Trigger::ClockCleared => ("clock_cleared", None),
487 Trigger::Deleted => ("deleted", None),485 Trigger::Deleted => ("deleted", None),
488 }486 }
489 }487 }
@@ -508,8 +506,6 @@ fn rule_from(row: &Row) -> Result<MailRule> {
508 ("commented", None) => Trigger::Commented,506 ("commented", None) => Trigger::Commented,
509 ("deadline_set", None) => Trigger::DeadlineSet,507 ("deadline_set", None) => Trigger::DeadlineSet,
510 ("deadline_cleared", None) => Trigger::DeadlineCleared,508 ("deadline_cleared", None) => Trigger::DeadlineCleared,
511- ("clock_set", None) => Trigger::ClockSet,
512- ("clock_cleared", None) => Trigger::ClockCleared,
513 ("retitled", None) => Trigger::Retitled,509 ("retitled", None) => Trigger::Retitled,
514 ("linked", None) => Trigger::Linked,510 ("linked", None) => Trigger::Linked,
515 ("unlinked", None) => Trigger::Unlinked,511 ("unlinked", None) => Trigger::Unlinked,
crates/izlek-core/tests/store.rsmodified+49 -0
@@ -6139,6 +6139,55 @@ async fn assigning_one_person_mails_that_person_not_every_assignee() {
6139 let _ = std::fs::remove_dir_all(&dir);6139 let _ = std::fs::remove_dir_all(&dir);
6140 }6140 }
6141 6141
6142+#[tokio::test]
6143+async fn a_time_change_fires_a_deadline_set_rule() {
6144+ let (dir, store, workspace, admin) = shared().await;
6145+ let mate = member(&store, &workspace, "emre@izlek.sh", "Emre").await;
6146+ let task = add_task(&store, &workspace, "Backlog", "Ship it", None, &admin).await;
6147+ let board = store.board(&workspace).await.unwrap().unwrap();
6148+ store
6149+ .create_mail_rule(
6150+ &board.id,
6151+ &Trigger::DeadlineSet,
6152+ "Moment moved",
6153+ Audience::Board,
6154+ OffsetDateTime::now_utc(),
6155+ false,
6156+ )
6157+ .await
6158+ .unwrap();
6159+
6160+ let mailer = Remembering::taking_everything();
6161+ let engine = Engine::new(store.clone(), mailer.clone(), "https://izlek.sh");
6162+ // Ada sets the time on her own card — a ClockSet activity, no deadline
6163+ // in sight — and the only person the board audience can mail is Emre,
6164+ // the board minus the actor.
6165+ let activity_id = store
6166+ .record_activity(
6167+ &task,
6168+ Some(&admin),
6169+ None,
6170+ &ActivityKind::ClockSet,
6171+ "2026-09-02T09:30:00+00:00",
6172+ OffsetDateTime::now_utc(),
6173+ )
6174+ .await
6175+ .unwrap();
6176+ let event = activity_event(&store, &activity_id).await;
6177+
6178+ let report = engine.on_activity(&event).await.unwrap();
6179+ assert_eq!(report.sent, 1, "the time change mails the board");
6180+ let sent = mailer.sent();
6181+ assert_eq!(sent.len(), 1);
6182+ assert_eq!(sent[0].to, "emre@izlek.sh");
6183+ assert!(
6184+ sent[0].body.contains("set the time to"),
6185+ "the body says the honest per-kind sentence: {}",
6186+ sent[0].body
6187+ );
6188+ let _ = std::fs::remove_dir_all(&dir);
6189+}
6190+
6142 #[tokio::test]6191 #[tokio::test]
6143 async fn an_unassignment_mails_the_person_removed_not_the_rest() {6192 async fn an_unassignment_mails_the_person_removed_not_the_rest() {
6144 let (dir, store, workspace, admin) = shared().await;6193 let (dir, store, workspace, admin) = shared().await;
crates/izlek-web/src/detail.rsmodified+29 -14
@@ -1330,12 +1330,7 @@ async fn deadline_control(
1330 }1330 }
1331 let toggle = format!("deadline-{}", task.id);1331 let toggle = format!("deadline-{}", task.id);
1332 let input_value = task.deadline_input();1332 let input_value = task.deadline_input();
1333- let hour_value = local1333+ let hm = local.map(|at| (at.hour(), at.minute()));
1334- .map(|at| format!("{:02}", at.hour()))
1335- .unwrap_or_default();
1336- let minute_value = local
1337- .map(|at| format!("{:02}", at.minute()))
1338- .unwrap_or_default();
1339 let change_aria = t(lang, Key::ChangeTheDeadline);1334 let change_aria = t(lang, Key::ChangeTheDeadline);
1340 let no_deadline = t(lang, Key::NoDeadline);1335 let no_deadline = t(lang, Key::NoDeadline);
1341 view! {1336 view! {
@@ -1352,9 +1347,19 @@ async fn deadline_control(
1352 <input type="hidden" name="task_id" value=(task.id.clone())>1347 <input type="hidden" name="task_id" value=(task.id.clone())>
1353 (datepicker_grid(cx, "deadline", &input_value, true, lang).await?)1348 (datepicker_grid(cx, "deadline", &input_value, true, lang).await?)
1354 <div class="datepick-time">1349 <div class="datepick-time">
1355- <input class="field-input" name="clock_hour" type="text" inputmode="numeric" maxlength="2" placeholder="HH" aria-label=(t(lang, Key::ClockHour)) value=(hour_value)>1350+ <select class="field-input" name="clock_hour" aria-label=(t(lang, Key::ClockHour)) data-search="">
1351+ <option value="">("--")</option>
1352+ for hour in 0u8..24 {
1353+ <option value=(format!("{hour:02}")) selected=(hm.map(|(h, _)| h) == Some(hour))>(format!("{hour:02}"))</option>
1354+ }
1355+ </select>
1356 <span class="datepick-colon">(":")</span>1356 <span class="datepick-colon">(":")</span>
1357- <input class="field-input" name="clock_minute" type="text" inputmode="numeric" maxlength="2" placeholder="MM" aria-label=(t(lang, Key::ClockMinute)) value=(minute_value)>1357+ <select class="field-input" name="clock_minute" aria-label=(t(lang, Key::ClockMinute)) data-search="">
1358+ <option value="">("--")</option>
1359+ for minute in 0u8..60 {
1360+ <option value=(format!("{minute:02}")) selected=(hm.map(|(_, m)| m) == Some(minute))>(format!("{minute:02}"))</option>
1361+ }
1362+ </select>
1358 </div>1363 </div>
1359 </form>1364 </form>
1360 (refused(cx, "save_task", lang).await?)1365 (refused(cx, "save_task", lang).await?)
@@ -1441,7 +1446,7 @@ pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result {
1441 var input = panel.querySelector('.datepick-input');\1446 var input = panel.querySelector('.datepick-input');\
1442 if (!input) {{ return; }}\1447 if (!input) {{ return; }}\
1443 input.value = ymd ? (ymd.y + '-' + pad(ymd.m) + '-' + pad(ymd.d)) : '';\1448 input.value = ymd ? (ymd.y + '-' + pad(ymd.m) + '-' + pad(ymd.d)) : '';\
1444- if (!ymd) {{ var hh = panel.querySelector('[name=clock_hour]'); if (hh) {{ hh.value = ''; }} var mm = panel.querySelector('[name=clock_minute]'); if (mm) {{ mm.value = ''; }} }}\1449+ if (!ymd) {{ ['clock_hour', 'clock_minute'].forEach(function (name) {{ var box = panel.querySelector('[name=' + name + ']'); if (!box) {{ return; }} box.value = ''; var trig = box.__ddTrigger; if (trig) {{ trig.textContent = box.options[0].textContent; trig.setAttribute('aria-expanded', 'false'); }} var drop = box.__ddPanel; if (drop) {{ drop.classList.remove('dd-open'); drop.querySelectorAll('.dd-option-selected').forEach(function (r) {{ r.classList.remove('dd-option-selected'); r.setAttribute('aria-selected', 'false'); }}); }} }}); }} \
1445 var pop = panel.closest('.datepick-pop');\1450 var pop = panel.closest('.datepick-pop');\
1446 var label = pop.querySelector('.datepick-label');\1451 var label = pop.querySelector('.datepick-label');\
1447 if (label) {{ label.textContent = ymd ? (MONTHS[ymd.m - 1].slice(0, 3) + ' ' + pad(ymd.d)) : label.dataset.empty; }}\1452 if (label) {{ label.textContent = ymd ? (MONTHS[ymd.m - 1].slice(0, 3) + ' ' + pad(ymd.d)) : label.dataset.empty; }}\
@@ -1483,7 +1488,7 @@ pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result {
1483 return;\1488 return;\
1484 }}\1489 }}\
1485 var openPop = document.querySelector('.datepick-pop > .edit-toggle:checked');\1490 var openPop = document.querySelector('.datepick-pop > .edit-toggle:checked');\
1486- if (openPop && !openPop.closest('.datepick-pop').contains(e.target)) {{ openPop.checked = false; }}\1491+ if (openPop && !openPop.closest('.datepick-pop').contains(e.target) && !e.target.closest('.dd-panel')) {{ openPop.checked = false; }} \
1487 }}, true);\1492 }}, true);\
1488 }})();"1493 }})();"
1489 );1494 );
@@ -2616,12 +2621,22 @@ pub async fn new_task_modal(cx: &Cx, columns: &[(String, String)], lang: Lang) -
2616 <div class="edit-form pop-panel datepick-panel">2621 <div class="edit-form pop-panel datepick-panel">
2617 (datepicker_grid(cx, "deadline", "", false, lang).await?)2622 (datepicker_grid(cx, "deadline", "", false, lang).await?)
2618 <div class="datepick-time">2623 <div class="datepick-time">
2619- <input class="field-input" name="clock_hour" type="text" inputmode="numeric" maxlength="2" placeholder="HH" aria-label=(t(lang, Key::ClockHour))>2624+ <select class="field-input" name="clock_hour" aria-label=(t(lang, Key::ClockHour)) data-search="">
2625+ <option value="">("--")</option>
2626+ for hour in 0u8..24 {
2627+ <option value=(format!("{hour:02}"))>(format!("{hour:02}"))</option>
2628+ }
2629+ </select>
2620 <span class="datepick-colon">(":")</span>2630 <span class="datepick-colon">(":")</span>
2621- <input class="field-input" name="clock_minute" type="text" inputmode="numeric" maxlength="2" placeholder="MM" aria-label=(t(lang, Key::ClockMinute))>2631+ <select class="field-input" name="clock_minute" aria-label=(t(lang, Key::ClockMinute)) data-search="">
2632+ <option value="">("--")</option>
2633+ for minute in 0u8..60 {
2634+ <option value=(format!("{minute:02}"))>(format!("{minute:02}"))</option>
2635+ }
2636+ </select>
2622 </div>2637 </div>
2623- </div>2638+ </div>
2624- </div>2639+ </div>
2625 </div>2640 </div>
2626 </div>2641 </div>
2627 <label class="field">2642 <label class="field">
crates/izlek-web/src/i18n.rsmodified+0 -12
@@ -227,8 +227,6 @@ pub enum Key {
227 TriggerCommented,227 TriggerCommented,
228 TriggerDeadlineSet,228 TriggerDeadlineSet,
229 TriggerDeadlineCleared,229 TriggerDeadlineCleared,
230- TriggerClockSet,
231- TriggerClockCleared,
232 TriggerRetitled,230 TriggerRetitled,
233 TriggerLinked,231 TriggerLinked,
234 TriggerUnlinked,232 TriggerUnlinked,
@@ -246,8 +244,6 @@ pub enum Key {
246 WhenCommentWritten,244 WhenCommentWritten,
247 WhenDeadlineSet,245 WhenDeadlineSet,
248 WhenDeadlineRemoved,246 WhenDeadlineRemoved,
249- WhenClockSet,
250- WhenClockCleared,
251 WhenTaskRenamed,247 WhenTaskRenamed,
252 WhenTaskLinked,248 WhenTaskLinked,
253 WhenTaskUnlinked,249 WhenTaskUnlinked,
@@ -763,10 +759,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
763 (TriggerDeadlineSet, Tr) => "bir son tarih belirlenir",759 (TriggerDeadlineSet, Tr) => "bir son tarih belirlenir",
764 (TriggerDeadlineCleared, En) => "a deadline is removed",760 (TriggerDeadlineCleared, En) => "a deadline is removed",
765 (TriggerDeadlineCleared, Tr) => "bir son tarih kaldırılır",761 (TriggerDeadlineCleared, Tr) => "bir son tarih kaldırılır",
766- (TriggerClockSet, En) => "a time is set",
767- (TriggerClockSet, Tr) => "bir saat belirlenir",
768- (TriggerClockCleared, En) => "a time is removed",
769- (TriggerClockCleared, Tr) => "bir saat kaldırılır",
770 (TriggerRetitled, En) => "a task is renamed",762 (TriggerRetitled, En) => "a task is renamed",
771 (TriggerRetitled, Tr) => "bir görev yeniden adlandırılır",763 (TriggerRetitled, Tr) => "bir görev yeniden adlandırılır",
772 (TriggerLinked, En) => "a task is linked",764 (TriggerLinked, En) => "a task is linked",
@@ -801,10 +793,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
801 (WhenDeadlineSet, Tr) => "Bir son tarih belirlendiğinde",793 (WhenDeadlineSet, Tr) => "Bir son tarih belirlendiğinde",
802 (WhenDeadlineRemoved, En) => "When a deadline is removed",794 (WhenDeadlineRemoved, En) => "When a deadline is removed",
803 (WhenDeadlineRemoved, Tr) => "Bir son tarih kaldırıldığında",795 (WhenDeadlineRemoved, Tr) => "Bir son tarih kaldırıldığında",
804- (WhenClockSet, En) => "When a time is set",
805- (WhenClockSet, Tr) => "Bir saat belirlendiğinde",
806- (WhenClockCleared, En) => "When a time is removed",
807- (WhenClockCleared, Tr) => "Bir saat kaldırıldığında",
808 (WhenTaskRenamed, En) => "When a task is renamed",796 (WhenTaskRenamed, En) => "When a task is renamed",
809 (WhenTaskRenamed, Tr) => "Bir görev yeniden adlandırıldığında",797 (WhenTaskRenamed, Tr) => "Bir görev yeniden adlandırıldığında",
810 (WhenTaskLinked, En) => "When a task is linked",798 (WhenTaskLinked, En) => "When a task is linked",
crates/izlek-web/src/rules.rsmodified+0 -16
@@ -121,8 +121,6 @@ fn trigger_of(kind: &str, column_id: Option<String>) -> Option<Trigger> {
121 ("commented", None) => Some(Trigger::Commented),121 ("commented", None) => Some(Trigger::Commented),
122 ("deadline_set", None) => Some(Trigger::DeadlineSet),122 ("deadline_set", None) => Some(Trigger::DeadlineSet),
123 ("deadline_cleared", None) => Some(Trigger::DeadlineCleared),123 ("deadline_cleared", None) => Some(Trigger::DeadlineCleared),
124- ("clock_set", None) => Some(Trigger::ClockSet),
125- ("clock_cleared", None) => Some(Trigger::ClockCleared),
126 ("retitled", None) => Some(Trigger::Retitled),124 ("retitled", None) => Some(Trigger::Retitled),
127 ("linked", None) => Some(Trigger::Linked),125 ("linked", None) => Some(Trigger::Linked),
128 ("unlinked", None) => Some(Trigger::Unlinked),126 ("unlinked", None) => Some(Trigger::Unlinked),
@@ -240,18 +238,6 @@ fn sentence_of(
240 "deadline_cleared".to_string(),238 "deadline_cleared".to_string(),
241 None,239 None,
242 ),240 ),
243- Trigger::ClockSet => (
244- t(lang, Key::WhenClockSet).to_string(),
245- None,
246- "clock_set".to_string(),
247- None,
248- ),
249- Trigger::ClockCleared => (
250- t(lang, Key::WhenClockCleared).to_string(),
251- None,
252- "clock_cleared".to_string(),
253- None,
254- ),
255 Trigger::Retitled => (241 Trigger::Retitled => (
256 t(lang, Key::WhenTaskRenamed).to_string(),242 t(lang, Key::WhenTaskRenamed).to_string(),
257 None,243 None,
@@ -710,8 +696,6 @@ async fn rule_form(
710 <option value="commented" selected=(trigger_kind == "commented")>(t(lang, Key::TriggerCommented))</option>696 <option value="commented" selected=(trigger_kind == "commented")>(t(lang, Key::TriggerCommented))</option>
711 <option value="deadline_set" selected=(trigger_kind == "deadline_set")>(t(lang, Key::TriggerDeadlineSet))</option>697 <option value="deadline_set" selected=(trigger_kind == "deadline_set")>(t(lang, Key::TriggerDeadlineSet))</option>
712 <option value="deadline_cleared" selected=(trigger_kind == "deadline_cleared")>(t(lang, Key::TriggerDeadlineCleared))</option>698 <option value="deadline_cleared" selected=(trigger_kind == "deadline_cleared")>(t(lang, Key::TriggerDeadlineCleared))</option>
713- <option value="clock_set" selected=(trigger_kind == "clock_set")>(t(lang, Key::TriggerClockSet))</option>
714- <option value="clock_cleared" selected=(trigger_kind == "clock_cleared")>(t(lang, Key::TriggerClockCleared))</option>
715 <option value="retitled" selected=(trigger_kind == "retitled")>(t(lang, Key::TriggerRetitled))</option>699 <option value="retitled" selected=(trigger_kind == "retitled")>(t(lang, Key::TriggerRetitled))</option>
716 <option value="linked" selected=(trigger_kind == "linked")>(t(lang, Key::TriggerLinked))</option>700 <option value="linked" selected=(trigger_kind == "linked")>(t(lang, Key::TriggerLinked))</option>
717 <option value="unlinked" selected=(trigger_kind == "unlinked")>(t(lang, Key::TriggerUnlinked))</option>701 <option value="unlinked" selected=(trigger_kind == "unlinked")>(t(lang, Key::TriggerUnlinked))</option>
crates/izlek-web/src/server.rsmodified+3 -1
@@ -95,8 +95,10 @@ impl Mail {
95 return;95 return;
96 };96 };
97 tokio::spawn(async move {97 tokio::spawn(async move {
98- let report = match store.event(&activity_id).await {98+ let ev = store.event(&activity_id).await;
99+ let report = match ev {
99 Ok(Some(izlek_core::store::Event::Happened(ev))) => {100 Ok(Some(izlek_core::store::Event::Happened(ev))) => {
101+ eprintln!("AFTER_ACTIVITY happened kind={:?}", ev.kind);
100 match engine.on_activity(&ev).await {102 match engine.on_activity(&ev).await {
101 Ok(_) => {103 Ok(_) => {
102 engine104 engine
crates/izlek-web/tests/browser/moment.mjsmodified+32 -8
@@ -99,12 +99,30 @@ const chipLabel = `${MONTHS[picked.month - 1]} ${pad(picked.day)} · 16:20`;
99 const fieldLabel = `${MONTHS[picked.month - 1]} ${pad(picked.day)} 16:20`;99 const fieldLabel = `${MONTHS[picked.month - 1]} ${pad(picked.day)} 16:20`;
100 100
101 101
102-// The time rides the same panel as two two-digit boxes — hour, colon,102+// The time rides the same panel as two house searchable dropdowns — hour
103-// minute — typed before the day press, so the one form post carries both.103+// and minute. Each is driven like a hand on it: click the trigger, type to
104-// Neither box autosubmits: a lone box is half a value.104+// filter, press the row through its own handler (the panel's scroll-close
105-await page.fill('.modal-new-task input[name="clock_hour"]', '16');105+// race makes a point-click flake). Neither select carries
106-await page.fill('.modal-new-task input[name="clock_minute"]', '20');106+// data-autosubmit: a lone pick is half a value, and the commit is the day
107-107+// press, which carries both.
108+for (const [name, value] of [
109+ ['clock_hour', '16'],
110+ ['clock_minute', '20'],
111+]) {
112+ const trigger = page.locator(
113+ `.modal-new-task select[name="${name}"] >> xpath=preceding-sibling::button[1]`,
114+ );
115+ await trigger.click({ timeout: 5000 });
116+ const menu = page.locator('.dd-panel.dd-open');
117+ await menu.locator('.dd-search').fill(value);
118+ const rowOn = await menu.locator('.dd-search').evaluate((el, want) => {
119+ const panel = el.closest('.dd-panel');
120+ const row = panel.querySelector(`.dd-option[data-value="${want}"]`);
121+ return !!row && !row.classList.contains('dd-option-hidden');
122+ }, value);
123+ if (!rowOn) failures.push(`typing '${value}' in the ${name} menu hid its row`);
124+ await menu.locator(`.dd-option[data-value="${value}"]`).evaluate((el) => el.click());
125+}
108 // Then the day press, whose pick() writes the hidden input in place — in126 // Then the day press, whose pick() writes the hidden input in place — in
109 // the modal nothing autosubmits, so the value is read in the same tick as127 // the modal nothing autosubmits, so the value is read in the same tick as
110 // the click, before anything can replace the panel.128 // the click, before anything can replace the panel.
@@ -122,10 +140,16 @@ if (!/^\d{4}-\d{2}-\d{2}$/.test(written.after)) {
122 failures.push(`the day pick never wrote the hidden input: '${written.after}'`);140 failures.push(`the day pick never wrote the hidden input: '${written.after}'`);
123 }141 }
124 const atSubmit = await page.evaluate(() => ({142 const atSubmit = await page.evaluate(() => ({
125- time: `${document.querySelector('.modal-new-task input[name="clock_hour"]')?.value}:${document.querySelector('.modal-new-task input[name="clock_minute"]')?.value}`,143+ hour: document.querySelector('.modal-new-task select[name="clock_hour"]')?.value,
144+ minute: document.querySelector('.modal-new-task select[name="clock_minute"]')?.value,
145+ dayInput: !!document.querySelector('.modal-new-task .datepick-input'),
146+ panel: !!document.querySelector('.modal-new-task .datepick-panel'),
147+ modal: !!document.querySelector('.modal-new-task'),
126 day: document.querySelector('.modal-new-task .datepick-input')?.value,148 day: document.querySelector('.modal-new-task .datepick-input')?.value,
127 }));149 }));
128-if (atSubmit.time !== '16:20') failures.push(`the time box read '${atSubmit.time}' at submit`);150+if (atSubmit.hour !== '16' || atSubmit.minute !== '20') {
151+ failures.push(`the boxes read '${atSubmit.hour}':${atSubmit.minute}' at submit`);
152+}
129 if (atSubmit.day !== written.after) failures.push(`the day box read '${atSubmit.day}' at submit`);153 if (atSubmit.day !== written.after) failures.push(`the day box read '${atSubmit.day}' at submit`);
130 // The board, where the new card must wear the moment. In the modal the154 // The board, where the new card must wear the moment. In the modal the
131 // grid carries data-autosubmit=false — the day pick only writes the155 // grid carries data-autosubmit=false — the day pick only writes the
crates/izlek-web/tests/http.rsmodified+66 -24
@@ -8290,8 +8290,8 @@ async fn a_clock_saved_on_a_task_renders_in_the_viewers_stored_timezone() {
8290 .await;8290 .await;
8291 let html = String::from_utf8_lossy(&page.bytes);8291 let html = String::from_utf8_lossy(&page.bytes);
8292 assert!(8292 assert!(
8293- html.contains(r#"aria-label="Hour" value="11""#)8293+ html.contains(r#"<option value="11" selected="">11</option>"#)
8294- && html.contains(r#"aria-label="Minute" value="00""#),8294+ && html.contains(r#"<option value="00" selected="">00</option>"#),
8295 "{html}"8295 "{html}"
8296 );8296 );
8297 assert!(html.contains(">Sep 02 11:00<"), "{html}");8297 assert!(html.contains(">Sep 02 11:00<"), "{html}");
@@ -8320,8 +8320,8 @@ async fn a_clock_saved_on_a_task_renders_in_the_viewers_stored_timezone() {
8320 .await;8320 .await;
8321 let html = String::from_utf8_lossy(&shifted.bytes);8321 let html = String::from_utf8_lossy(&shifted.bytes);
8322 assert!(8322 assert!(
8323- html.contains(r#"aria-label="Hour" value="14""#)8323+ html.contains(r#"<option value="14" selected="">14</option>"#)
8324- && html.contains(r#"aria-label="Minute" value="00""#),8324+ && html.contains(r#"<option value="00" selected="">00</option>"#),
8325 "{html}"8325 "{html}"
8326 );8326 );
8327 assert!(html.contains(">Sep 02 14:00<"), "{html}");8327 assert!(html.contains(">Sep 02 14:00<"), "{html}");
@@ -8913,19 +8913,26 @@ async fn the_reminder_knob_saves_renders_and_keeps_when_absent() {
8913 assert_eq!(workspace.reminder_minutes, 0);8913 assert_eq!(workspace.reminder_minutes, 0);
8914 }8914 }
8915 8915
8916+/// A time change is a `ClockSet` activity, and the `deadline_set` rule
8917+/// fires on it — the clock is the deadline field's other half, not a
8918+/// second trigger to arm. The rule's own words and the rules-page menu
8919+/// stay the deadline's.
8916 #[tokio::test]8920 #[tokio::test]
8917-async fn a_clock_rule_round_trips_and_renders_on_the_rules_page() {8921+async fn a_time_change_fires_the_deadline_rule_and_round_trips() {
8918- let app = App::open().await;8922+ let app = App::open_with_mail().await;
8919 let admin_cookie = admin(&app).await;8923 let admin_cookie = admin(&app).await;
8924+ let member = invited(&app, &admin_cookie, "deniz@izlek.sh", "Deniz", Role::Member).await;
8925+ let column = first_column(&app).await;
8926+ let task = a_task(&app, &admin_cookie, &column, "Ship it").await;
8920 8927
8921 let answer = app8928 let answer = app
8922 .post(8929 .post(
8923 "/api/create_rule",8930 "/api/create_rule",
8924 Some(&admin_cookie),8931 Some(&admin_cookie),
8925 &[8932 &[
8926- ("trigger", "clock_set"),8933+ ("trigger", "deadline_set"),
8927 ("column_id", ""),8934 ("column_id", ""),
8928- ("subject", "Meeting soon"),8935+ ("subject", "Moment moved"),
8929 ("audience", "board"),8936 ("audience", "board"),
8930 ],8937 ],
8931 )8938 )
@@ -8940,25 +8947,56 @@ async fn a_clock_rule_round_trips_and_renders_on_the_rules_page() {
8940 "{:?}",8947 "{:?}",
8941 answer.location8948 answer.location
8942 );8949 );
8943-
8944 let rules = app8950 let rules = app
8945 .post("/api/current_rules", Some(&admin_cookie), &[])8951 .post("/api/current_rules", Some(&admin_cookie), &[])
8946 .await;8952 .await;
8947 assert!(8953 assert!(
8948- rules.body.contains(r#""when":"When a time is set""#),8954+ rules.body.contains(r#""when":"When a deadline is set""#),
8949 "{}",8955 "{}",
8950 rules.body8956 rules.body
8951 );8957 );
8958+ let page = app.get("/rules", Some(&admin_cookie)).await;
8959+ let html = String::from_utf8_lossy(&page.bytes);
8960+ assert!(html.contains("When a deadline is set"), "{html}");
8961+
8962+ let day = app
8963+ .post(
8964+ "/api/save_task",
8965+ Some(&admin_cookie),
8966+ &[("task_id", &task), ("deadline", "2026-09-02")],
8967+ )
8968+ .await;
8952 assert!(8969 assert!(
8953- rules.body.contains(r#""subject":"Meeting soon""#),8970+ !day.location
8954- "{}",8971+ .as_deref()
8955- rules.body8972+ .unwrap_or_default()
8973+ .contains("refusal="),
8974+ "{:?}",
8975+ day.location
8956 );8976 );
8957 8977
8958- let page = app.get("/rules", Some(&admin_cookie)).await;8978+ // Deniz sets the time and nothing else — a `ClockSet` activity — and
8959- let html = String::from_utf8_lossy(&page.bytes);8979+ // the deadline rule owes the admin (the board audience excludes the
8960- assert!(html.contains("When a time is set"), "{html}");8980+ // actor) mail for it.
8961- assert!(html.contains(r#"<option value="clock_set""#), "{html}");8981+ let answer = app
8982+ .post(
8983+ "/api/save_task",
8984+ Some(&member),
8985+ &[("task_id", &task), ("clock_hour", "9"), ("clock_minute", "30")],
8986+ )
8987+ .await;
8988+ assert!(
8989+ !answer
8990+ .location
8991+ .as_deref()
8992+ .unwrap_or_default()
8993+ .contains("refusal="),
8994+ "{:?}",
8995+ answer.location
8996+ );
8997+ let rule = only_rule(&app, &admin_cookie).await;
8998+ let send = until_rule_send_to(&app, &rule, "ada@izlek.sh", 0).await;
8999+ assert_eq!(send.recipient, "ada@izlek.sh");
8962 }9000 }
8963 9001
8964 #[tokio::test]9002 #[tokio::test]
@@ -9023,11 +9061,10 @@ async fn the_datepicker_script_guards_a_panel_with_no_day_input() {
9023 html.contains("input.value = ymd ?"),9061 html.contains("input.value = ymd ?"),
9024 "the datepicker script lost the day write: {html}"9062 "the datepicker script lost the day write: {html}"
9025 );9063 );
9026- // The moment field's panel: the grid's hidden day input and the time
9027- // box ride the same form.
9028 assert!(9064 assert!(
9029- html.contains(r#"name="clock_hour""#) && html.contains(r#"name="clock_minute""#),9065+ html.contains(r#"name="clock_hour" aria-label="Hour" data-search=""#)
9030- "the moment boxes lost their names: {html}"9066+ && html.contains(r#"name="clock_minute" aria-label="Minute" data-search=""#),
9067+ "the moment combos lost their searchable chrome: {html}"
9031 );9068 );
9032 assert!(html.contains("datepick-input"), "{html}");9069 assert!(html.contains("datepick-input"), "{html}");
9033 }9070 }
@@ -9046,7 +9083,12 @@ async fn an_off_step_clock_renders_itself_not_a_rounded_step() {
9046 .post(9083 .post(
9047 "/api/save_task",9084 "/api/save_task",
9048 Some(&admin_cookie),9085 Some(&admin_cookie),
9049- &[("task_id", &task), ("deadline", "2026-09-02"), ("clock_hour", "11"), ("clock_minute", "23")],9086+ &[
9087+ ("task_id", &task),
9088+ ("deadline", "2026-09-02"),
9089+ ("clock_hour", "11"),
9090+ ("clock_minute", "23"),
9091+ ],
9050 )9092 )
9051 .await;9093 .await;
9052 assert!(9094 assert!(
@@ -9062,8 +9104,8 @@ async fn an_off_step_clock_renders_itself_not_a_rounded_step() {
9062 let page = app.get(&format!("/?task={task}"), Some(&admin_cookie)).await;9104 let page = app.get(&format!("/?task={task}"), Some(&admin_cookie)).await;
9063 let html = String::from_utf8_lossy(&page.bytes);9105 let html = String::from_utf8_lossy(&page.bytes);
9064 assert!(9106 assert!(
9065- html.contains(r#"aria-label="Hour" value="11""#)9107+ html.contains(r#"<option value="11" selected="">11</option>"#)
9066- && html.contains(r#"aria-label="Minute" value="23""#),9108+ && html.contains(r#"<option value="23" selected="">23</option>"#),
9067 "{html}"9109 "{html}"
9068 );9110 );
9069 assert!(html.contains(">Sep 02 11:23<"), "{html}");9111 assert!(html.contains(">Sep 02 11:23<"), "{html}");