]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/account/user.ts
Add next to stats github ci
[github/Chocobozzz/PeerTube.git] / server / models / account / user.ts
index 8e437c3be929f8fe6c1f85d140ab8e404ee71ef7..c1f22b76aaad87c4195416c0096d6e1ffacd80fe 100644 (file)
@@ -28,7 +28,7 @@ import {
   MUserFormattable,
   MUserNotifSettingChannelDefault,
   MUserWithNotificationSetting,
-  MVideoFullLight
+  MVideoWithRights
 } from '@server/types/models'
 import { hasUserRight, USER_ROLE_LABELS } from '../../../shared/core-utils/users'
 import { AbuseState, MyUser, UserRight, VideoPlaylistType, VideoPrivacy } from '../../../shared/models'
@@ -564,17 +564,17 @@ export class UserModel extends Model {
   static loadByUsername (username: string): Promise<MUserDefault> {
     const query = {
       where: {
-        username: { [Op.iLike]: username }
+        username
       }
     }
 
     return UserModel.findOne(query)
   }
 
-  static loadForMeAPI (username: string): Promise<MUserNotifSettingChannelDefault> {
+  static loadForMeAPI (id: number): Promise<MUserNotifSettingChannelDefault> {
     const query = {
       where: {
-        username: { [Op.iLike]: username }
+        id
       }
     }
 
@@ -794,12 +794,14 @@ export class UserModel extends Model {
     const totalDailyActiveUsers = await getActiveUsers(1)
     const totalWeeklyActiveUsers = await getActiveUsers(7)
     const totalMonthlyActiveUsers = await getActiveUsers(30)
+    const totalHalfYearActiveUsers = await getActiveUsers(180)
 
     return {
       totalUsers,
       totalDailyActiveUsers,
       totalWeeklyActiveUsers,
-      totalMonthlyActiveUsers
+      totalMonthlyActiveUsers,
+      totalHalfYearActiveUsers
     }
   }
 
@@ -817,7 +819,7 @@ export class UserModel extends Model {
                     .then(u => u.map(u => u.username))
   }
 
-  canGetVideo (video: MVideoFullLight) {
+  canGetVideo (video: MVideoWithRights) {
     const videoUserId = video.VideoChannel.Account.userId
 
     if (video.isBlacklisted()) {