Skip to content

Commit

Permalink
Fix missing return values in streaming (mastodon#26233)
Browse files Browse the repository at this point in the history
  • Loading branch information
renchap authored and ClearlyClaire committed Jul 31, 2023
1 parent 2eb1a5b commit 2fc6117
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions streaming/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ const startWorker = async (workerId) => {
}

// If the payload already contains the `filtered` property, it means
// that filtering has been applied on the ruby on rails side, as
// that filtering has been applied on the ruby on rails side, as
// such, we don't need to construct or apply the filters in streaming:
if (Object.prototype.hasOwnProperty.call(payload, "filtered")) {
transmit(event, payload);
Expand Down Expand Up @@ -796,12 +796,12 @@ const startWorker = async (workerId) => {
const filter_results = Object.values(req.cachedFilters).reduce((results, cachedFilter) => {
// Check the filter hasn't expired before applying:
if (cachedFilter.expires_at !== null && cachedFilter.expires_at < now) {
return;
return results;
}

// Just in-case JSDOM fails to find textContent in searchableContent
if (!searchableTextContent) {
return;
return results;
}

const keyword_matches = searchableTextContent.match(cachedFilter.regexp);
Expand All @@ -816,6 +816,8 @@ const startWorker = async (workerId) => {
status_matches: null
});
}

return results;
}, []);

// Send the payload + the FilterResults as the `filtered` property
Expand Down

0 comments on commit 2fc6117

Please sign in to comment.