server: always use user id for calcDriveUsageOf

This commit is contained in:
Johann150 2022-12-23 13:38:29 +01:00
parent 79ddbafd0d
commit 61a2db49df
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
3 changed files with 2 additions and 3 deletions

View file

@ -35,7 +35,6 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, user) => {
const instance = await fetchMeta(true);
// Calculate drive usage
const usage = await DriveFiles.calcDriveUsageOf(user.id);
return {

View file

@ -177,7 +177,7 @@ export default define(meta, paramDef, async (ps, me) => {
driveFilesCount: DriveFiles.createQueryBuilder('file')
.where('file.userId = :userId', { userId: user.id })
.getCount(),
driveUsage: DriveFiles.calcDriveUsageOf(user),
driveUsage: DriveFiles.calcDriveUsageOf(user.id),
});
result.followingCount = result.localFollowingCount + result.remoteFollowingCount;

View file

@ -372,7 +372,7 @@ export async function addFile({
//#region Check drive usage
if (user && !isLink) {
const usage = await DriveFiles.calcDriveUsageOf(user);
const usage = await DriveFiles.calcDriveUsageOf(user.id);
const instance = await fetchMeta();
const driveCapacity = 1024 * 1024 * (Users.isLocalUser(user) ? instance.localDriveCapacityMb : instance.remoteDriveCapacityMb);