feat(drive): remove all owner_id from {File,Folder}Dto
This commit is contained in:
@@ -40,11 +40,9 @@
|
||||
const entries = $derived(
|
||||
raw.map((it): ResourceEntry => {
|
||||
const isFile = it.resource_type === 'file';
|
||||
// §14 provenance — prefer `created_by` (who put the item
|
||||
// into the system) over the deprecated `owner_id`. Fall
|
||||
// back to `owner_id` for pre-D7 rows whose `created_by`
|
||||
// column wasn't backfilled.
|
||||
const ownerId = it.resource.created_by ?? it.resource.owner_id ?? null;
|
||||
// §14 provenance: `created_by` names who put the item into
|
||||
// the system (Files browser / Favorites / Shared semantic).
|
||||
const ownerId = it.resource.created_by ?? null;
|
||||
return {
|
||||
id: it.resource.id,
|
||||
name: it.resource.name,
|
||||
@@ -110,7 +108,7 @@
|
||||
});
|
||||
raw = reset ? page.items : [...raw, ...page.items];
|
||||
cursor = page.next_cursor;
|
||||
void owners.resolve(page.items.map((i) => i.resource.created_by ?? i.resource.owner_id));
|
||||
void owners.resolve(page.items.map((i) => i.resource.created_by));
|
||||
} catch (e) {
|
||||
console.error('favorites: load error', e);
|
||||
error = t('errors_loadFailed', 'Failed to load items');
|
||||
|
||||
@@ -41,7 +41,6 @@ function withOneFile() {
|
||||
mime_type: 'image/png',
|
||||
modified_at: 0,
|
||||
name: 'photo.png',
|
||||
owner_id: 'me',
|
||||
created_by: 'me',
|
||||
updated_by: 'me',
|
||||
folder_id: 'root',
|
||||
|
||||
@@ -1798,7 +1798,7 @@
|
||||
<span class="grid-meta__date">{relativeTimeAgo(folder.modified_at)}</span>
|
||||
</div>
|
||||
<div class="owner-cell">
|
||||
{ownerLabel(folder.created_by ?? folder.owner_id, session.user?.id ?? null)}
|
||||
{ownerLabel(folder.created_by, session.user?.id ?? null)}
|
||||
</div>
|
||||
<div class="type-cell">{t('files.file_types.folder', 'Folder')}</div>
|
||||
<div class="size-cell">—</div>
|
||||
@@ -1930,7 +1930,7 @@
|
||||
{#if file.size != null}<span class="grid-meta__size">{formatBytes(file.size)}</span>{/if}
|
||||
</div>
|
||||
<div class="owner-cell">
|
||||
{ownerLabel(file.created_by ?? file.owner_id, session.user?.id ?? null)}
|
||||
{ownerLabel(file.created_by, session.user?.id ?? null)}
|
||||
</div>
|
||||
<div class="type-cell">{typeLabel(file.category)}</div>
|
||||
<div class="size-cell">{file.size != null ? formatBytes(file.size) : ''}</div>
|
||||
|
||||
@@ -90,7 +90,6 @@ function fileItem(id: string, name: string) {
|
||||
mime_type: 'text/plain',
|
||||
modified_at: 0,
|
||||
name,
|
||||
owner_id: 'me',
|
||||
created_by: 'me',
|
||||
updated_by: 'me',
|
||||
folder_id: 'home',
|
||||
@@ -112,7 +111,6 @@ function folderItem(id: string, name: string) {
|
||||
is_root: false,
|
||||
modified_at: 0,
|
||||
name,
|
||||
owner_id: 'me',
|
||||
created_by: 'me',
|
||||
updated_by: 'me',
|
||||
parent_id: 'home',
|
||||
|
||||
@@ -34,7 +34,6 @@ function photo(id: string) {
|
||||
mime_type: 'image/jpeg',
|
||||
modified_at: 0,
|
||||
name: id + '.jpg',
|
||||
owner_id: 'me',
|
||||
created_by: 'me',
|
||||
updated_by: 'me',
|
||||
folder_id: 'home',
|
||||
|
||||
@@ -42,11 +42,10 @@
|
||||
const entries = $derived(
|
||||
raw.map((it): ResourceEntry => {
|
||||
const isFile = it.resource_type === 'file';
|
||||
// §14 provenance — Recent's mental model is "who touched
|
||||
// this recently", so `updated_by` (the last mutator) is
|
||||
// preferred over `created_by` (who put it in). Fall back
|
||||
// to `owner_id` for pre-D7 rows with no provenance.
|
||||
const ownerId = it.resource.updated_by ?? it.resource.owner_id ?? null;
|
||||
// §14 provenance: Recent's mental model is "who touched this
|
||||
// recently", so `updated_by` (the last mutator) is the right
|
||||
// signal — distinct from Favorites/Files which use `created_by`.
|
||||
const ownerId = it.resource.updated_by ?? null;
|
||||
return {
|
||||
id: it.resource.id,
|
||||
name: it.resource.name,
|
||||
@@ -122,7 +121,7 @@
|
||||
});
|
||||
raw = reset ? page.items : [...raw, ...page.items];
|
||||
cursor = page.next_cursor;
|
||||
void owners.resolve(page.items.map((i) => i.resource.updated_by ?? i.resource.owner_id));
|
||||
void owners.resolve(page.items.map((i) => i.resource.updated_by));
|
||||
} catch (e) {
|
||||
console.error('recent: load error', e);
|
||||
error = t('errors_loadFailed', 'Failed to load items');
|
||||
|
||||
@@ -45,7 +45,6 @@ function withOneFile() {
|
||||
mime_type: 'text/plain',
|
||||
modified_at: 0,
|
||||
name: 'notes.txt',
|
||||
owner_id: 'me',
|
||||
created_by: 'me',
|
||||
updated_by: 'me',
|
||||
folder_id: 'root',
|
||||
|
||||
@@ -46,7 +46,6 @@ function grantItem() {
|
||||
is_root: false,
|
||||
modified_at: 0,
|
||||
name: 'Docs',
|
||||
owner_id: 'me',
|
||||
created_by: 'me',
|
||||
updated_by: 'me',
|
||||
parent_id: null,
|
||||
|
||||
Reference in New Issue
Block a user