When updating (remote) user avatar/banner, clear usageHint for the previous drivefile, if any
This commit is contained in:
parent
4aeb0d95cc
commit
913de651db
1 changed files with 5 additions and 0 deletions
|
@ -10,6 +10,7 @@ import {
|
||||||
Followings,
|
Followings,
|
||||||
UserProfiles,
|
UserProfiles,
|
||||||
UserPublickeys,
|
UserPublickeys,
|
||||||
|
DriveFiles,
|
||||||
} from "@/models/index.js";
|
} from "@/models/index.js";
|
||||||
import type { IRemoteUser, CacheableUser } from "@/models/entities/user.js";
|
import type { IRemoteUser, CacheableUser } from "@/models/entities/user.js";
|
||||||
import { User } from "@/models/entities/user.js";
|
import { User } from "@/models/entities/user.js";
|
||||||
|
@ -561,10 +562,14 @@ export async function updatePerson(
|
||||||
} as Partial<User>;
|
} as Partial<User>;
|
||||||
|
|
||||||
if (avatar) {
|
if (avatar) {
|
||||||
|
if (user?.avatarId)
|
||||||
|
await DriveFiles.update(user.avatarId, {usageHint: null});
|
||||||
updates.avatarId = avatar.id;
|
updates.avatarId = avatar.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (banner) {
|
if (banner) {
|
||||||
|
if (user?.bannerId)
|
||||||
|
await DriveFiles.update(user.bannerId, {usageHint: null});
|
||||||
updates.bannerId = banner.id;
|
updates.bannerId = banner.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue