Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fixed missing incoming recommendations #21317

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ghost/core/core/server/models/mention.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Mention = ghostBookshelf.Model.extend({
deleted: false,
verified: false
},
enforcedFilters() {
defaultFilters() {
return 'deleted:false';
}
}, {
Expand Down
6 changes: 4 additions & 2 deletions ghost/recommendations/src/IncomingRecommendationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ export class IncomingRecommendationService {
}

async #updateIncomingRecommendations() {
// Note: we also recheck recommendations that were not verified (verification could have failed)
const filter = this.#getMentionFilter();
// We refresh all incoming recommendations, including:
// - recommendations that were not verified, as the verification could have failed
// - recommendations that were deleted previously. Implementation note: given that we have `deleted:false` as default filter in the Mention model, we need to override it here
const filter = this.#getMentionFilter() + '+deleted:[true,false]';
await this.#mentionsApi.refreshMentions({filter, limit: 100});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ describe('IncomingRecommendationService', function () {
await service.init();
clock.tick(1000 * 60 * 60 * 24);
assert(refreshMentions.calledOnce);
assert(refreshMentions.calledWith({
filter: `source:~$'/.well-known/recommendations.json'+deleted:[true,false]`,
limit: 100
}));
} finally {
process.env.NODE_ENV = saved;
}
Expand Down
1 change: 0 additions & 1 deletion ghost/webmentions/lib/Mention.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ module.exports = class Mention {
// When an earlier mention is deleted, but then it gets verified again, we need to undelete it
if (this.#deleted) {
this.#deleted = false;
this.events.push(MentionCreatedEvent.create({mention: this}));
}
}

Expand Down
Loading