0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed broken empty state in mentions admin url (#16419)

fixes https://github.com/TryGhost/Team/issues/2734

With WebMentions flag on, navigating to `/ghost/#/mentions` on Admin when there are no mentions gives a 400 error page instead of the intended empty state.
This commit is contained in:
Rishabh Garg 2023-03-16 21:19:56 +05:30 committed by GitHub
parent 7f223b56dd
commit ef538428c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,12 @@ export default class MentionUtilsService extends Service {
async loadGroupedMentions(mentions) {
// Fetch mentions with the same source
const sources = mentions.mapBy('source').uniq();
const sourceMentions = await this.store.query('mention', {filter: `source:[${sources.map(s => `'${s}'`).join(',')}]`});
let filter;
if (sources.length > 0) {
filter = `source:[${sources.map(s => `'${s}'`).join(',')}]`;
}
const sourceMentions = await this.store.query('mention', {filter});
mentions.forEach((mention) => {
mention.set('mentions', sourceMentions.filterBy('source', mention.source));
});