diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-11 16:16:27 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-11 16:16:27 +0200 |
commit | 85c20aaeb90ef0e0f44c377e62c323fde275cdde (patch) | |
tree | 79d09e1b6f1746398c2ea4f0279ac54fa2be96dd /server/models/actor/actor-follow.ts | |
parent | 823c34c07fc0df81110098ee1032e9d3ed70b662 (diff) | |
download | PeerTube-85c20aaeb90ef0e0f44c377e62c323fde275cdde.tar.gz PeerTube-85c20aaeb90ef0e0f44c377e62c323fde275cdde.tar.zst PeerTube-85c20aaeb90ef0e0f44c377e62c323fde275cdde.zip |
Set actor preferred name case insensitive
Diffstat (limited to 'server/models/actor/actor-follow.ts')
-rw-r--r-- | server/models/actor/actor-follow.ts | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/server/models/actor/actor-follow.ts b/server/models/actor/actor-follow.ts index 32e5d78b0..0f199d208 100644 --- a/server/models/actor/actor-follow.ts +++ b/server/models/actor/actor-follow.ts | |||
@@ -37,8 +37,8 @@ import { logger } from '../../helpers/logger' | |||
37 | import { ACTOR_FOLLOW_SCORE, CONSTRAINTS_FIELDS, FOLLOW_STATES, SERVER_ACTOR_NAME, SORTABLE_COLUMNS } from '../../initializers/constants' | 37 | import { ACTOR_FOLLOW_SCORE, CONSTRAINTS_FIELDS, FOLLOW_STATES, SERVER_ACTOR_NAME, SORTABLE_COLUMNS } from '../../initializers/constants' |
38 | import { AccountModel } from '../account/account' | 38 | import { AccountModel } from '../account/account' |
39 | import { ServerModel } from '../server/server' | 39 | import { ServerModel } from '../server/server' |
40 | import { doesExist } from '../shared/query' | ||
41 | import { buildSQLAttributes, createSafeIn, getSort, searchAttribute, throwIfNotValid } from '../shared' | 40 | import { buildSQLAttributes, createSafeIn, getSort, searchAttribute, throwIfNotValid } from '../shared' |
41 | import { doesExist } from '../shared/query' | ||
42 | import { VideoChannelModel } from '../video/video-channel' | 42 | import { VideoChannelModel } from '../video/video-channel' |
43 | import { ActorModel, unusedActorAttributesForAPI } from './actor' | 43 | import { ActorModel, unusedActorAttributesForAPI } from './actor' |
44 | import { InstanceListFollowersQueryBuilder, ListFollowersOptions } from './sql/instance-list-followers-query-builder' | 44 | import { InstanceListFollowersQueryBuilder, ListFollowersOptions } from './sql/instance-list-followers-query-builder' |
@@ -265,9 +265,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo | |||
265 | model: ActorModel, | 265 | model: ActorModel, |
266 | required: true, | 266 | required: true, |
267 | as: 'ActorFollowing', | 267 | as: 'ActorFollowing', |
268 | where: { | 268 | where: ActorModel.wherePreferredUsername(targetName), |
269 | preferredUsername: targetName | ||
270 | }, | ||
271 | include: [ | 269 | include: [ |
272 | { | 270 | { |
273 | model: VideoChannelModel.unscoped(), | 271 | model: VideoChannelModel.unscoped(), |
@@ -313,24 +311,16 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo | |||
313 | if (t.host) { | 311 | if (t.host) { |
314 | return { | 312 | return { |
315 | [Op.and]: [ | 313 | [Op.and]: [ |
316 | { | 314 | ActorModel.wherePreferredUsername(t.name, '$preferredUsername$'), |
317 | $preferredUsername$: t.name | 315 | { $host$: t.host } |
318 | }, | ||
319 | { | ||
320 | $host$: t.host | ||
321 | } | ||
322 | ] | 316 | ] |
323 | } | 317 | } |
324 | } | 318 | } |
325 | 319 | ||
326 | return { | 320 | return { |
327 | [Op.and]: [ | 321 | [Op.and]: [ |
328 | { | 322 | ActorModel.wherePreferredUsername(t.name, '$preferredUsername$'), |
329 | $preferredUsername$: t.name | 323 | { $serverId$: null } |
330 | }, | ||
331 | { | ||
332 | $serverId$: null | ||
333 | } | ||
334 | ] | 324 | ] |
335 | } | 325 | } |
336 | }) | 326 | }) |