aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/activitypub')
-rw-r--r--server/models/activitypub/actor-follow.ts28
-rw-r--r--server/models/activitypub/actor.ts3
2 files changed, 31 insertions, 0 deletions
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts
index 920c83d88..de5bb6f74 100644
--- a/server/models/activitypub/actor-follow.ts
+++ b/server/models/activitypub/actor-follow.ts
@@ -163,6 +163,34 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
163 return ActorFollowModel.findOne(query) 163 return ActorFollowModel.findOne(query)
164 } 164 }
165 165
166 static loadByFollowerInbox (url: string, t?: Sequelize.Transaction) {
167 const query = {
168 where: {
169 state: 'accepted'
170 },
171 include: [
172 {
173 model: ActorModel,
174 required: true,
175 as: 'ActorFollower',
176 where: {
177 [Sequelize.Op.or]: [
178 {
179 inboxUrl: url
180 },
181 {
182 sharedInboxUrl: url
183 }
184 ]
185 }
186 }
187 ],
188 transaction: t
189 } as any // FIXME: typings does not work
190
191 return ActorFollowModel.findOne(query)
192 }
193
166 static listFollowingForApi (id: number, start: number, count: number, sort: string) { 194 static listFollowingForApi (id: number, start: number, count: number, sort: string) {
167 const query = { 195 const query = {
168 distinct: true, 196 distinct: true,
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index 6c74aa61b..17f69f7a7 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -68,6 +68,9 @@ enum ScopeNames {
68 { 68 {
69 fields: [ 'preferredUsername', 'serverId' ], 69 fields: [ 'preferredUsername', 'serverId' ],
70 unique: true 70 unique: true
71 },
72 {
73 fields: [ 'inboxUrl', 'sharedInboxUrl' ]
71 } 74 }
72 ] 75 ]
73}) 76})