aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/activitypub/actor.ts13
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'
15import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 15import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
16import { ACTIVITY_PUB_ACTOR_TYPES, CONFIG, CONSTRAINTS_FIELDS } from '../../initializers' 16import { ACTIVITY_PUB, ACTIVITY_PUB_ACTOR_TYPES, CONFIG, CONSTRAINTS_FIELDS } from '../../initializers'
17import { AccountModel } from '../account/account' 17import { AccountModel } from '../account/account'
18import { AvatarModel } from '../avatar/avatar' 18import { AvatarModel } from '../avatar/avatar'
19import { ServerModel } from '../server/server' 19import { 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}