fix(SharedWithMe): remove group by size, not relevant and not implemented on server side

This commit is contained in:
Edouard Vanbelle
2026-06-01 09:00:03 +02:00
parent 287365fed9
commit de1574f583
@@ -13,7 +13,7 @@
import { ui } from '../../app/ui.js'; import { ui } from '../../app/ui.js';
import { ResourceListComponent } from '../../components/resourceList.js'; import { ResourceListComponent } from '../../components/resourceList.js';
import { createUserVignette } from '../../components/userVignette.js'; import { createUserVignette } from '../../components/userVignette.js';
import { normalizeDateBucket, sizeBucket } from '../../core/formatters.js'; import { normalizeDateBucket } from '../../core/formatters.js';
import { i18n } from '../../core/i18n.js'; import { i18n } from '../../core/i18n.js';
import * as viewPrefs from '../../core/viewPrefs.js'; import * as viewPrefs from '../../core/viewPrefs.js';
import { batchToolbar } from '../../features/files/batchToolbar.js'; import { batchToolbar } from '../../features/files/batchToolbar.js';
@@ -105,23 +105,14 @@ const GROUP_BY_DEFS = [
return labels[key] ?? key; return labels[key] ?? key;
} }
}, },
{ // NOTE: there is no "Size" group-by here. The backend
key: 'size', // (`grant_handler::list_incoming_resources` at line ~354) rejects
get label() { // `sort_by=size` with a 400 — only `granted_at | granted_by | name |
return i18n.t('groupby.size', 'Size'); // type` are valid for the incoming endpoint. A `size` entry used to
}, // live here and silently produced 400s on every selection. If you
icon: 'fas fa-layer-group', // need it back, also add the matching branch in
orderBy: 'size', // `pg_acl_engine::list_incoming_resources_paged` and widen the
// keyFn: the key IS the bucket label returned by sizeBucket(), so no // handler's allowlist.
// separate labelFn is needed (same pattern as shareDate).
// Folders have no size — sizeBucket(-1) returns the "Folders" label.
keyFn: (item) => {
if (!('mime_type' in item)) return sizeBucket(-1);
const r = /** @type {Record<string,number>} */ (/** @type {unknown} */ (item));
return sizeBucket(r.size ?? 0);
}
// No labelFn: keyFn already returns the human-readable label.
},
{ {
key: 'shareDate', key: 'shareDate',
get label() { get label() {