diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/activitypub/actor.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index ed7fcfe27..707f140af 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts | |||
@@ -13,7 +13,7 @@ import { | |||
13 | isActorPublicKeyValid | 13 | isActorPublicKeyValid |
14 | } from '../../helpers/custom-validators/activitypub/actor' | 14 | } from '../../helpers/custom-validators/activitypub/actor' |
15 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' | 15 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' |
16 | import { ACTIVITY_PUB_ACTOR_TYPES, CONFIG, CONSTRAINTS_FIELDS } from '../../initializers' | 16 | import { ACTIVITY_PUB, ACTIVITY_PUB_ACTOR_TYPES, CONFIG, CONSTRAINTS_FIELDS } from '../../initializers' |
17 | import { AccountModel } from '../account/account' | 17 | import { AccountModel } from '../account/account' |
18 | import { AvatarModel } from '../avatar/avatar' | 18 | import { AvatarModel } from '../avatar/avatar' |
19 | import { ServerModel } from '../server/server' | 19 | import { ServerModel } from '../server/server' |
@@ -375,4 +375,15 @@ export class ActorModel extends Model<ActorModel> { | |||
375 | 375 | ||
376 | return CONFIG.WEBSERVER.URL + this.Avatar.getWebserverPath() | 376 | return CONFIG.WEBSERVER.URL + this.Avatar.getWebserverPath() |
377 | } | 377 | } |
378 | |||
379 | isOutdated () { | ||
380 | if (this.isOwned()) return false | ||
381 | |||
382 | const now = Date.now() | ||
383 | const createdAtTime = this.createdAt.getTime() | ||
384 | const updatedAtTime = this.updatedAt.getTime() | ||
385 | |||
386 | return (now - createdAtTime) > ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL && | ||
387 | (now - updatedAtTime) > ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL | ||
388 | } | ||
378 | } | 389 | } |