FEATURE: Allow admins to force refresh "What's new?" (#29911)

Sometimes changes to "What's new?" feed items are made or the feed items are
removed altogether, and the polling interval to check for new features is 1 day.

This is quite long, so this commit introduces a "Check for updates"
button for admins to click on the "What's new?" page which will bust
the cache for the feed and check again at the new features endpoint.
This is limited to 5 times per minute to avoid rapid sending of
requests.
This commit is contained in:
Martin Brennan
2024-11-27 09:40:55 +10:00
committed by GitHub
parent b9f183e2c3
commit 2ef9d6ac47
9 changed files with 142 additions and 48 deletions

View File

@ -308,6 +308,14 @@ RSpec.describe DiscourseUpdates do
expect(result[0]["title"]).to eq("Bells")
expect(result[1]["title"]).to eq("Whistles")
end
it "correctly refetches features if force_refresh is used" do
DiscourseUpdates.expects(:update_new_features).once
result = DiscourseUpdates.new_features
expect(result.length).to eq(3)
result = DiscourseUpdates.new_features(force_refresh: true)
expect(result.length).to eq(3)
end
end
describe "#get_last_viewed_feature_date" do