diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-10 17:27:49 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (patch) | |
tree | e57173bcd0590d939c28952a29258fd02a281e35 /server/models/account | |
parent | 38fa2065831b5f55be0d7f30f19a62c967397208 (diff) | |
download | PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.gz PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.zst PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.zip |
Make it compile at least
Diffstat (limited to 'server/models/account')
-rw-r--r-- | server/models/account/account-interface.ts | 4 | ||||
-rw-r--r-- | server/models/account/account.ts | 17 |
2 files changed, 12 insertions, 9 deletions
diff --git a/server/models/account/account-interface.ts b/server/models/account/account-interface.ts index 2ef3e2246..a662eb992 100644 --- a/server/models/account/account-interface.ts +++ b/server/models/account/account-interface.ts | |||
@@ -13,8 +13,8 @@ export namespace AccountMethods { | |||
13 | export type LoadAccountByPodAndUUID = (uuid: string, podId: number, transaction: Sequelize.Transaction) => Bluebird<AccountInstance> | 13 | export type LoadAccountByPodAndUUID = (uuid: string, podId: number, transaction: Sequelize.Transaction) => Bluebird<AccountInstance> |
14 | export type LoadLocalAccountByName = (name: string) => Bluebird<AccountInstance> | 14 | export type LoadLocalAccountByName = (name: string) => Bluebird<AccountInstance> |
15 | export type ListOwned = () => Bluebird<AccountInstance[]> | 15 | export type ListOwned = () => Bluebird<AccountInstance[]> |
16 | export type ListFollowerUrlsForApi = (name: string, start: number, count: number) => Promise< ResultList<string> > | 16 | export type ListFollowerUrlsForApi = (name: string, start: number, count?: number) => Promise< ResultList<string> > |
17 | export type ListFollowingUrlsForApi = (name: string, start: number, count: number) => Promise< ResultList<string> > | 17 | export type ListFollowingUrlsForApi = (name: string, start: number, count?: number) => Promise< ResultList<string> > |
18 | 18 | ||
19 | export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor | 19 | export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor |
20 | export type IsOwned = (this: AccountInstance) => boolean | 20 | export type IsOwned = (this: AccountInstance) => boolean |
diff --git a/server/models/account/account.ts b/server/models/account/account.ts index 00c0aefd4..a79e13880 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts | |||
@@ -268,14 +268,15 @@ function afterDestroy (account: AccountInstance) { | |||
268 | uuid: account.uuid | 268 | uuid: account.uuid |
269 | } | 269 | } |
270 | 270 | ||
271 | return removeVideoAccountToFriends(removeVideoAccountToFriendsParams) | 271 | // FIXME: remove account in followers |
272 | // return removeVideoAccountToFriends(removeVideoAccountToFriendsParams) | ||
272 | } | 273 | } |
273 | 274 | ||
274 | return undefined | 275 | return undefined |
275 | } | 276 | } |
276 | 277 | ||
277 | toActivityPubObject = function (this: AccountInstance) { | 278 | toActivityPubObject = function (this: AccountInstance) { |
278 | const type = this.podId ? 'Application' : 'Person' | 279 | const type = this.podId ? 'Application' as 'Application' : 'Person' as 'Person' |
279 | 280 | ||
280 | const json = { | 281 | const json = { |
281 | type, | 282 | type, |
@@ -346,11 +347,11 @@ listOwned = function () { | |||
346 | return Account.findAll(query) | 347 | return Account.findAll(query) |
347 | } | 348 | } |
348 | 349 | ||
349 | listFollowerUrlsForApi = function (name: string, start: number, count: number) { | 350 | listFollowerUrlsForApi = function (name: string, start: number, count?: number) { |
350 | return createListFollowForApiQuery('followers', name, start, count) | 351 | return createListFollowForApiQuery('followers', name, start, count) |
351 | } | 352 | } |
352 | 353 | ||
353 | listFollowingUrlsForApi = function (name: string, start: number, count: number) { | 354 | listFollowingUrlsForApi = function (name: string, start: number, count?: number) { |
354 | return createListFollowForApiQuery('following', name, start, count) | 355 | return createListFollowForApiQuery('following', name, start, count) |
355 | } | 356 | } |
356 | 357 | ||
@@ -405,7 +406,7 @@ loadAccountByPodAndUUID = function (uuid: string, podId: number, transaction: Se | |||
405 | 406 | ||
406 | // ------------------------------ UTILS ------------------------------ | 407 | // ------------------------------ UTILS ------------------------------ |
407 | 408 | ||
408 | async function createListFollowForApiQuery (type: 'followers' | 'following', name: string, start: number, count: number) { | 409 | async function createListFollowForApiQuery (type: 'followers' | 'following', name: string, start: number, count?: number) { |
409 | let firstJoin: string | 410 | let firstJoin: string |
410 | let secondJoin: string | 411 | let secondJoin: string |
411 | 412 | ||
@@ -421,11 +422,13 @@ async function createListFollowForApiQuery (type: 'followers' | 'following', nam | |||
421 | const tasks: Promise<any>[] = [] | 422 | const tasks: Promise<any>[] = [] |
422 | 423 | ||
423 | for (const selection of selections) { | 424 | for (const selection of selections) { |
424 | const query = 'SELECT ' + selection + ' FROM "Account" ' + | 425 | let query = 'SELECT ' + selection + ' FROM "Account" ' + |
425 | 'INNER JOIN "AccountFollower" ON "AccountFollower"."' + firstJoin + '" = "Account"."id" ' + | 426 | 'INNER JOIN "AccountFollower" ON "AccountFollower"."' + firstJoin + '" = "Account"."id" ' + |
426 | 'INNER JOIN "Account" AS "Followers" ON "Followers"."id" = "AccountFollower"."' + secondJoin + '" ' + | 427 | 'INNER JOIN "Account" AS "Followers" ON "Followers"."id" = "AccountFollower"."' + secondJoin + '" ' + |
427 | 'WHERE "Account"."name" = \'$name\' ' + | 428 | 'WHERE "Account"."name" = \'$name\' ' + |
428 | 'LIMIT ' + start + ', ' + count | 429 | 'LIMIT ' + start |
430 | |||
431 | if (count !== undefined) query += ', ' + count | ||
429 | 432 | ||
430 | const options = { | 433 | const options = { |
431 | bind: { name }, | 434 | bind: { name }, |