<div
class="results-filter-button" (click)="isSearchFilterCollapsed = !isSearchFilterCollapsed" role="button"
- [attr.aria-expanded]="isSearchFilterCollapsed" aria-controls="collapseBasic"
+ [attr.aria-expanded]="!isSearchFilterCollapsed" aria-controls="collapseBasic"
>
<span class="icon icon-filter"></span>
<ng-container i18n>Filters</ng-container>
</div>
<div class="results-filter" [collapse]="isSearchFilterCollapsed">
- <my-search-filters [advancedSearch]="advancedSearch" (filtered)="onFiltered($event)"></my-search-filters>
+ <my-search-filters [advancedSearch]="advancedSearch" (filtered)="onFiltered()"></my-search-filters>
</div>
</div>
// ---------------------------------------------------------------------------
-const LAST_MIGRATION_VERSION = 230
+const LAST_MIGRATION_VERSION = 235
// ---------------------------------------------------------------------------
--- /dev/null
+import * as Sequelize from 'sequelize'
+import { createClient } from 'redis'
+import { CONFIG } from '../constants'
+import { JobQueue } from '../../lib/job-queue'
+import { initDatabaseModels } from '../database'
+
+async function up (utils: {
+ transaction: Sequelize.Transaction
+ queryInterface: Sequelize.QueryInterface
+ sequelize: Sequelize.Sequelize
+}): Promise<any> {
+ await utils.sequelize.query('DROP INDEX IF EXISTS video_id_privacy_state_wait_transcoding;')
+ await utils.sequelize.query('DROP INDEX IF EXISTS video_name;')
+
+ for (let i = 0; i < 5; i++) {
+ const query = 'DELETE FROM "videoFile" WHERE id IN ' +
+ '(SELECT id FROM (SELECT MIN(id) AS id, "videoId", "resolution", "fps" ' +
+ 'FROM "videoFile" GROUP BY "videoId", "resolution", "fps" HAVING COUNT(*) > 1) t)'
+ await utils.sequelize.query(query)
+ }
+
+ for (let i = 0; i < 5; i++) {
+ const query = 'DELETE FROM "actor" WHERE id IN ' +
+ '(SELECT id FROM (SELECT MIN(id) AS id, "uuid" ' +
+ 'FROM "actor" GROUP BY "uuid" HAVING COUNT(*) > 1) t)'
+ await utils.sequelize.query(query)
+ }
+
+ for (let i = 0; i < 5; i++) {
+ const query = 'DELETE FROM "account" WHERE id IN ' +
+ '(SELECT id FROM (SELECT MIN(id) AS id, "actorId" ' +
+ 'FROM "account" GROUP BY "actorId" HAVING COUNT(*) > 1) t)'
+ await utils.sequelize.query(query)
+ }
+}
+
+function down (options) {
+ throw new Error('Not implemented.')
+}
+
+export { up, down }
{
fields: [ 'videoId', 'accountId' ],
unique: true
+ },
+ {
+ fields: [ 'videoId' ]
+ },
+ {
+ fields: [ 'accountId' ]
+ },
+ {
+ fields: [ 'videoId', 'type' ]
}
]
})
]
})
@Table({
- tableName: 'account'
+ tableName: 'account',
+ indexes: [
+ {
+ fields: [ 'actorId' ],
+ unique: true
+ },
+ {
+ fields: [ 'applicationId' ]
+ },
+ {
+ fields: [ 'userId' ]
+ }
+ ]
})
export class AccountModel extends Model<AccountModel> {
tableName: 'actor',
indexes: [
{
- fields: [ 'url' ]
+ fields: [ 'url' ],
+ unique: true
},
{
fields: [ 'preferredUsername', 'serverId' ],
},
{
fields: [ 'avatarId' ]
+ },
+ {
+ fields: [ 'uuid' ],
+ unique: true
+ },
+ {
+ fields: [ 'followersUrl' ]
}
]
})
indexes: [
{
fields: [ 'accountId' ]
+ },
+ {
+ fields: [ 'actorId' ]
}
]
})
{
fields: [ 'url' ],
unique: true
+ },
+ {
+ fields: [ 'accountId' ]
}
]
})
},
{
fields: [ 'infoHash' ]
+ },
+ {
+ fields: [ 'videoId', 'resolution', 'fps' ],
+ unique: true
}
]
})
const indexes: Sequelize.DefineIndexesOptions[] = [
buildTrigramSearchIndex('video_name_trigram', 'name'),
+ { fields: [ 'createdAt' ] },
+ { fields: [ 'publishedAt' ] },
+ { fields: [ 'duration' ] },
+ { fields: [ 'category' ] },
+ { fields: [ 'licence' ] },
+ { fields: [ 'nsfw' ] },
+ { fields: [ 'language' ] },
+ { fields: [ 'waitTranscoding' ] },
+ { fields: [ 'state' ] },
+ { fields: [ 'remote' ] },
+ { fields: [ 'views' ] },
+ { fields: [ 'likes' ] },
+ { fields: [ 'channelId' ] },
{
- fields: [ 'createdAt' ]
- },
- {
- fields: [ 'duration' ]
- },
- {
- fields: [ 'views' ]
- },
- {
- fields: [ 'likes' ]
- },
- {
- fields: [ 'uuid' ]
- },
- {
- fields: [ 'channelId' ]
- },
- {
- fields: [ 'id', 'privacy', 'state', 'waitTranscoding' ]
+ fields: [ 'uuid' ],
+ unique: true
},
{
fields: [ 'url'],
),
[ Sequelize.Op.in ]: Sequelize.literal(
'(' +
- 'SELECT "videoShare"."videoId" AS "id" FROM "videoShare" ' +
- 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' +
- 'WHERE "actorFollow"."actorId" = ' + actorIdNumber +
- ' UNION ' +
- 'SELECT "video"."id" AS "id" FROM "video" ' +
- 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' +
- 'INNER JOIN "account" ON "account"."id" = "videoChannel"."accountId" ' +
- 'INNER JOIN "actor" ON "account"."actorId" = "actor"."id" ' +
- 'LEFT JOIN "actorFollow" ON "actorFollow"."targetActorId" = "actor"."id" ' +
- 'WHERE "actor"."serverId" IS NULL OR "actorFollow"."actorId" = ' + actorIdNumber +
+ 'SELECT "videoShare"."videoId" AS "id" FROM "videoShare" ' +
+ 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' +
+ 'WHERE "actorFollow"."actorId" = ' + actorIdNumber +
+ ' UNION ' +
+ 'SELECT "video"."id" AS "id" FROM "video" ' +
+ 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' +
+ 'INNER JOIN "account" ON "account"."id" = "videoChannel"."accountId" ' +
+ 'INNER JOIN "actor" ON "account"."actorId" = "actor"."id" ' +
+ 'WHERE "actor"."serverId" IS NULL OR ' +
+ '"actor"."id" IN (SELECT "targetActorId" FROM "actorFollow" WHERE "actorId" = 1)' + // Subquery for optimization
')'
)
},