"Notify when" is offered and sent only where the instance has Reports
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
An instance before 2.0.0-beta.12 knows other values for notify and would refuse the new ones; the form asks for the reports route first. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
3 files changed
+13
-4
No files matched your search
+2
-1
@@ -19,7 +19,8 @@ For LLeMbas server 2.0.0-beta.12 (harness spec 3.8.0); an older instance works a
|
||||
report, and it is not among your chats.
|
||||
- **Notify when** on a scheduled task's form: *Every run* (the model writes a report every
|
||||
time, also when nothing was found), *When…* (only when your own words hold; "something needs
|
||||
my attention" to start from) or *Never* (runs are kept in the task's history only).
|
||||
my attention" to start from) or *Never* (runs are kept in the task's history only). Offered
|
||||
where the instance has Reports.
|
||||
- A task's runs show the run's own note -- what it found, or why it filed no report -- and a way
|
||||
to its report when it filed one. The run's working chat can still be opened from the run.
|
||||
|
||||
|
||||
@@ -795,6 +795,8 @@ data class EditState(
|
||||
/** Notify when (spec 3.8.0): `always`, `when` or `never`, and the person's words for `when` (empty: the default). */
|
||||
val notify: String = "when",
|
||||
val notifyWhen: String = "",
|
||||
/** Whether the instance has Reports (LLeMbas 2.0.0-beta.12): an older one is neither shown nor sent "notify when". */
|
||||
val reports: Boolean = false,
|
||||
)
|
||||
|
||||
class ScheduleEditViewModel(app: Application) : AndroidViewModel(app) {
|
||||
@@ -808,6 +810,12 @@ class ScheduleEditViewModel(app: Application) : AndroidViewModel(app) {
|
||||
if (started) return
|
||||
started = true
|
||||
editing = id
|
||||
// "Notify when" belongs to an instance that files reports; one that has no such route
|
||||
// would refuse the new values, so it is asked first.
|
||||
viewModelScope.launch {
|
||||
val has = runCatching { getApplication<Application>().api().reports(unread = true) }.isSuccess
|
||||
_state.update { it.copy(reports = has) }
|
||||
}
|
||||
if (id == null) return
|
||||
viewModelScope.launch {
|
||||
runCatching { getApplication<Application>().api().schedule(id) }.onSuccess { s ->
|
||||
@@ -849,7 +857,7 @@ class ScheduleEditViewModel(app: Application) : AndroidViewModel(app) {
|
||||
compiled,
|
||||
now.words.trim(),
|
||||
editing,
|
||||
notify = now.notify,
|
||||
notify = now.notify.takeIf { now.reports },
|
||||
notifyWhen = now.notifyWhen,
|
||||
)
|
||||
then(saved.id)
|
||||
@@ -939,7 +947,7 @@ fun ScheduleEditContent(
|
||||
if (state.unsupported) Text(stringResource(R.string.scheduled_unsupported), color = palette.inkMuted)
|
||||
state.error?.let { Text(it, color = palette.danger, style = MaterialTheme.typography.bodyMedium) }
|
||||
state.compiled?.let { Understood(it) }
|
||||
NotifyWhen(state.notify, state.notifyWhen, onNotify, onNotifyWhen)
|
||||
if (state.reports) NotifyWhen(state.notify, state.notifyWhen, onNotify, onNotifyWhen)
|
||||
Spacer(Modifier.height(24.dp))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -725,7 +725,7 @@ object Fakes {
|
||||
)
|
||||
|
||||
/** The form with "When…" chosen and the person's own words in it. */
|
||||
val editingNotify: EditState get() = editing.copy(notify = "when", notifyWhen = "a tender for storage opens or closes")
|
||||
val editingNotify: EditState get() = editing.copy(reports = true, notify = "when", notifyWhen = "a tender for storage opens or closes")
|
||||
|
||||
val editing = EditState(
|
||||
words = "Every weekday at 7:30, sum up the news about renewable energy in five points",
|
||||
|
||||
Reference in new issue
Block a user