X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fuser%2Fuser-notification.ts;h=04c5513a9b92b500496994ed5b822c6887575be9;hb=f0ab2aed3d98240c53e952ada2d2a1d18a5ba23f;hp=f7f9ac867c5e240abe7e6fb6f7df3b28039e30e0;hpb=7d9ba5c08999c6482f0bc5e0c09c6f55b7724090;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/user/user-notification.ts b/server/models/user/user-notification.ts index f7f9ac867..04c5513a9 100644 --- a/server/models/user/user-notification.ts +++ b/server/models/user/user-notification.ts @@ -1,6 +1,8 @@ import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize' import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' +import { uuidToShort } from '@server/helpers/uuid' import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user' +import { AttributesOnly } from '@shared/core-utils' import { UserNotification, UserNotificationType } from '../../../shared' import { isBooleanValid } from '../../helpers/custom-validators/misc' import { isUserNotificationTypeValid } from '../../helpers/custom-validators/user-notifications' @@ -286,7 +288,7 @@ function buildAccountInclude (required: boolean, withActor = false) { } ] as (ModelIndexesOptions & { where?: WhereOptions })[] }) -export class UserNotificationModel extends Model { +export class UserNotificationModel extends Model>> { @AllowNull(false) @Default(null) @@ -614,6 +616,7 @@ export class UserNotificationModel extends Model { return { id: video.id, uuid: video.uuid, + shortUUID: uuidToShort(video.uuid), name: video.name } } @@ -627,6 +630,7 @@ export class UserNotificationModel extends Model { ? { id: abuse.VideoCommentAbuse.VideoComment.Video.id, name: abuse.VideoCommentAbuse.VideoComment.Video.name, + shortUUID: uuidToShort(abuse.VideoCommentAbuse.VideoComment.Video.uuid), uuid: abuse.VideoCommentAbuse.VideoComment.Video.uuid } : undefined