mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
ef538428c9
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.
21 lines
673 B
JavaScript
21 lines
673 B
JavaScript
import Service, {inject as service} from '@ember/service';
|
|
|
|
export default class MentionUtilsService extends Service {
|
|
@service store;
|
|
|
|
async loadGroupedMentions(mentions) {
|
|
// Fetch mentions with the same source
|
|
const sources = mentions.mapBy('source').uniq();
|
|
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));
|
|
});
|
|
return mentions;
|
|
}
|
|
}
|