fix(frontend,backend): storage categories keep one hue in both themes, trash counted in the total, undo keeps the list, larger touch targets
This commit is contained in:
1 parent
06ae3e928f
commit
580927da0a
11 files changed
+112
-47
No files matched your search
@@ -276,6 +276,7 @@ class TrashItemView(BaseModel):
|
||||
file_size: int | None
|
||||
trashed_at: datetime
|
||||
purge_at: datetime
|
||||
refs: int
|
||||
refetchable: bool
|
||||
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ ORDER BY file_size DESC NULLS LAST, storage_key
|
||||
_TRASH_REFS = """
|
||||
SELECT * FROM (
|
||||
SELECT evicted_key AS storage_key, chat_id, message_id, kind, ttl_seconds,
|
||||
count(*) OVER (PARTITION BY evicted_key) AS refs,
|
||||
row_number() OVER (PARTITION BY evicted_key ORDER BY id) AS n
|
||||
FROM media
|
||||
WHERE account_id = $1 AND evicted_key = ANY($2::text[])
|
||||
@@ -185,12 +186,15 @@ async def list_trash(pool: asyncpg.Pool, account_id: int) -> list[TrashItemView]
|
||||
)
|
||||
messages = await _messages(pool, account_id, refs)
|
||||
alive: dict[str, bool] = defaultdict(bool)
|
||||
counts: dict[str, int] = {}
|
||||
for ref, message in zip(refs, messages, strict=True):
|
||||
alive[ref["storage_key"]] |= _alive(ref, message)
|
||||
counts[ref["storage_key"]] = ref["refs"]
|
||||
return [
|
||||
TrashItemView(
|
||||
**dict(row),
|
||||
purge_at=row["trashed_at"] + RETENTION,
|
||||
refs=counts.get(row["storage_key"], 0),
|
||||
refetchable=alive.get(row["storage_key"], True),
|
||||
)
|
||||
for row in rows
|
||||
|
||||
Reference in new issue
Block a user