fix: web UI routines tab shows all routines regardless of creating channel (#391)

Routines created via Telegram (or any WASM channel) were invisible in the
web UI because the routines list endpoint filtered by GATEWAY_USER_ID,
which didn't match the Telegram user's ID stored on the routine.

Add list_all_routines() to the RoutineStore trait (both libSQL and
PostgreSQL backends) and use it in the web dashboard handlers so all
routines are visible regardless of which channel created them.

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
Henry Park
2026-02-27 18:34:22 +00:00
committed by GitHub
co-authored by Claude Opus 4.6
parent ddd01a628c
commit a65b282066
6 changed files with 39 additions and 4 deletions
+21
View File
@@ -141,6 +141,27 @@ impl RoutineStore for LibSqlBackend {
Ok(routines)
}
async fn list_all_routines(&self) -> Result<Vec<Routine>, DatabaseError> {
let conn = self.connect().await?;
let mut rows = conn
.query(
&format!("SELECT {} FROM routines ORDER BY name", ROUTINE_COLUMNS),
(),
)
.await
.map_err(|e| DatabaseError::Query(e.to_string()))?;
let mut routines = Vec::new();
while let Some(row) = rows
.next()
.await
.map_err(|e| DatabaseError::Query(e.to_string()))?
{
routines.push(row_to_routine_libsql(&row)?);
}
Ok(routines)
}
async fn list_event_routines(&self) -> Result<Vec<Routine>, DatabaseError> {
let conn = self.connect().await?;
let mut rows = conn
+1
View File
@@ -247,6 +247,7 @@ pub trait RoutineStore: Send + Sync {
name: &str,
) -> Result<Option<Routine>, DatabaseError>;
async fn list_routines(&self, user_id: &str) -> Result<Vec<Routine>, DatabaseError>;
async fn list_all_routines(&self) -> Result<Vec<Routine>, DatabaseError>;
async fn list_event_routines(&self) -> Result<Vec<Routine>, DatabaseError>;
async fn list_due_cron_routines(&self) -> Result<Vec<Routine>, DatabaseError>;
async fn update_routine(&self, routine: &Routine) -> Result<(), DatabaseError>;
+4
View File
@@ -373,6 +373,10 @@ impl RoutineStore for PgBackend {
self.store.list_routines(user_id).await
}
async fn list_all_routines(&self) -> Result<Vec<Routine>, DatabaseError> {
self.store.list_all_routines().await
}
async fn list_event_routines(&self) -> Result<Vec<Routine>, DatabaseError> {
self.store.list_event_routines().await
}