ActivityPub-federated video streaming platform using P2P directly in your web browser
Add more filters to admin follows table
Chocobozzzcb5ce4cb1309
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.html b/client/src/app/+admin/follows/followers-list/followers-list.component.htmlindex 7d5711926b..6b5f3b4501 100644--- a/client/src/app/+admin/follows/followers-list/followers-list.component.html+++ b/client/src/app/+admin/follows/followers-list/followers-list.component.html@@ -13,10 +13,9 @@<ng-template pTemplate="header"><tr>- <th i18n style="width: 60px">ID</th><th i18n>Follower handle</th>- <th i18n>State</th>- <th i18n>Score</th>+ <th i18n pSortableColumn="state">State <p-sortIcon field="state"></p-sortIcon></th>+ <th i18n pSortableColumn="score">Score <p-sortIcon field="score"></p-sortIcon></th><th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th><th></th></tr>@@ -24,7 +23,6 @@<ng-template pTemplate="body" let-follow><tr>- <td>{{ follow.id }}</td><td><a [href]="follow.follower.url" target="_blank" rel="noopener noreferrer">{{ follow.follower.name + '@' + follow.follower.host }}</a></td><td *ngIf="follow.state === 'accepted'" i18n>Accepted</td>diff --git a/client/src/app/+admin/follows/following-list/following-list.component.html b/client/src/app/+admin/follows/following-list/following-list.component.htmlindex 5bc8fbc2d4..5a252eda9d 100644--- a/client/src/app/+admin/follows/following-list/following-list.component.html+++ b/client/src/app/+admin/follows/following-list/following-list.component.html@@ -15,18 +15,16 @@<ng-template pTemplate="header"><tr>- <th i18n style="width: 60px">ID</th><th i18n>Host</th>- <th i18n>State</th>+ <th i18n pSortableColumn="state">State <p-sortIcon field="state"></p-sortIcon></th><th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>- <th i18n>Redundancy allowed</th>+ <th i18n pSortableColumn="redundancyAllowed">Redundancy allowed <p-sortIcon field="redundancyAllowed"></p-sortIcon></th><th></th></tr></ng-template><ng-template pTemplate="body" let-follow><tr>- <td>{{ follow.id }}</td><td>{{ follow.following.host }}</td><td *ngIf="follow.state === 'accepted'" i18n>Accepted</td>diff --git a/server/initializers/constants.ts b/server/initializers/constants.tsindex eaad84bee1..a1538f3ca7 100644--- a/server/initializers/constants.ts+++ b/server/initializers/constants.ts@@ -49,8 +49,8 @@ const SORTABLE_COLUMNS = {VIDEO_COMMENT_THREADS: [ 'createdAt' ],VIDEO_RATES: [ 'createdAt' ],BLACKLISTS: [ 'id', 'name', 'duration', 'views', 'likes', 'dislikes', 'uuid', 'createdAt' ],- FOLLOWERS: [ 'createdAt' ],- FOLLOWING: [ 'createdAt' ],+ FOLLOWERS: [ 'createdAt', 'state', 'score' ],+ FOLLOWING: [ 'createdAt', 'redundancyAllowed', 'state' ],VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes', 'trending' ],diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.tsindex c3c4d61abd..c65b975d23 100644--- a/server/models/activitypub/actor-follow.ts+++ b/server/models/activitypub/actor-follow.ts@@ -23,7 +23,7 @@ import { logger } from '../../helpers/logger'import { getServerActor } from '../../helpers/utils'import { ACTOR_FOLLOW_SCORE, FOLLOW_STATES, SERVER_ACTOR_NAME } from '../../initializers/constants'import { ServerModel } from '../server/server'-import { createSafeIn, getSort } from '../utils'+import { createSafeIn, getSort, getFollowsSort } from '../utils'import { ActorModel, unusedActorAttributesForAPI } from './actor'import { VideoChannelModel } from '../video/video-channel'import { AccountModel } from '../account/account'@@ -324,7 +324,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {distinct: true,offset: start,limit: count,- order: getSort(sort),+ order: getFollowsSort(sort),where: followWhere,include: [{@@ -391,7 +391,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {distinct: true,offset: start,limit: count,- order: getSort(sort),+ order: getFollowsSort(sort),where: followWhere,include: [{diff --git a/server/models/utils.ts b/server/models/utils.tsindex ccdbcd1cf7..b53a52a053 100644--- a/server/models/utils.ts+++ b/server/models/utils.ts@@ -58,6 +58,19 @@ function getBlacklistSort (model: any, value: string, lastSort: OrderItem = [ 'ireturn [ firstSort, lastSort ]}+function getFollowsSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {+ const { direction, field } = buildDirectionAndField(value)++ if (field === 'redundancyAllowed') {+ return [+ [ 'ActorFollowing', 'Server', 'redundancyAllowed', direction ],+ lastSort+ ]+ }++ return getSort(value, lastSort)+}+function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) {const now = Date.now()const createdAtTime = model.createdAt.getTime()@@ -163,6 +176,7 @@ export {buildWhereIdOrUUID,isOutdated,parseAggregateResult,+ getFollowsSort,createSafeIn}