1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Infinite scroll to list our subscriptions

This commit is contained in:
Chocobozzz 2018-08-24 10:31:56 +02:00
parent f37dc0dd14
commit aa55a4da42
10 changed files with 67 additions and 67 deletions

View file

@ -169,9 +169,6 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
static loadByActorAndTargetNameAndHostForAPI (actorId: number, targetName: string, targetHost: string, t?: Sequelize.Transaction) {
const actorFollowingPartInclude: IIncludeOptions = {
attributes: {
exclude: unusedActorAttributesForAPI
},
model: ActorModel,
required: true,
as: 'ActorFollowing',
@ -203,7 +200,12 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
actorId
},
include: [
actorFollowingPartInclude
actorFollowingPartInclude,
{
model: ActorModel,
required: true,
as: 'ActorFollower'
}
],
transaction: t
}

View file

@ -49,7 +49,8 @@ export const unusedActorAttributesForAPI = [
'outboxUrl',
'sharedInboxUrl',
'followersUrl',
'followingUrl'
'followingUrl',
'url'
]
@DefaultScope({
@ -322,45 +323,6 @@ export class ActorModel extends Model<ActorModel> {
})
}
static async getActorsFollowerSharedInboxUrls (actors: ActorModel[], t: Sequelize.Transaction) {
const query = {
// attribute: [],
where: {
id: {
[Sequelize.Op.in]: actors.map(a => a.id)
}
},
include: [
{
// attributes: [ ],
model: ActorFollowModel.unscoped(),
required: true,
as: 'ActorFollowers',
where: {
state: 'accepted'
},
include: [
{
attributes: [ 'sharedInboxUrl' ],
model: ActorModel.unscoped(),
as: 'ActorFollower',
required: true
}
]
}
],
transaction: t
}
const hash: { [ id: number ]: string[] } = {}
const res = await ActorModel.findAll(query)
for (const actor of res) {
hash[actor.id] = actor.ActorFollowers.map(follow => follow.ActorFollower.sharedInboxUrl)
}
return hash
}
toFormattedJSON () {
let avatar: Avatar = null
if (this.Avatar) {