mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
FEATURE: Always show full page "New Features" to admins (#28383)
We used to show New Features in a tab on the dashboard,
but this could get pushed down the page especially on
our hosting. In 043117ca13
we made a separate What's New page, so this commit removes
the dashboard tab and changes the admin notification to
send the admin to /admin/whats-new instead of the dashboard
tab.
This commit is contained in:
@ -164,7 +164,7 @@ RSpec.describe Admin::DashboardController do
|
||||
before { sign_in(admin) }
|
||||
|
||||
it "is empty by default" do
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
expect(response.status).to eq(200)
|
||||
json = response.parsed_body
|
||||
expect(json["new_features"]).to eq(nil)
|
||||
@ -172,7 +172,7 @@ RSpec.describe Admin::DashboardController do
|
||||
|
||||
it "fails gracefully for invalid JSON" do
|
||||
Discourse.redis.set("new_features", "INVALID JSON")
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
expect(response.status).to eq(200)
|
||||
json = response.parsed_body
|
||||
expect(json["new_features"]).to eq(nil)
|
||||
@ -181,7 +181,7 @@ RSpec.describe Admin::DashboardController do
|
||||
it "includes new features when available" do
|
||||
populate_new_features
|
||||
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
expect(response.status).to eq(200)
|
||||
json = response.parsed_body
|
||||
|
||||
@ -195,7 +195,7 @@ RSpec.describe Admin::DashboardController do
|
||||
populate_new_features
|
||||
DiscourseUpdates.mark_new_features_as_seen(admin.id)
|
||||
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
expect(response.status).to eq(200)
|
||||
json = response.parsed_body
|
||||
|
||||
@ -209,7 +209,7 @@ RSpec.describe Admin::DashboardController do
|
||||
|
||||
expect(DiscourseUpdates.get_last_viewed_feature_date(admin.id)).to eq(nil)
|
||||
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
expect(response.status).to eq(200)
|
||||
expect(DiscourseUpdates.get_last_viewed_feature_date(admin.id)).to be_within_one_second_of(
|
||||
date2,
|
||||
@ -218,7 +218,7 @@ RSpec.describe Admin::DashboardController do
|
||||
date2 = 10.minutes.ago
|
||||
populate_new_features(date1, date2)
|
||||
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
expect(response.status).to eq(200)
|
||||
expect(DiscourseUpdates.get_last_viewed_feature_date(admin.id)).to be_within_one_second_of(
|
||||
date2,
|
||||
@ -233,7 +233,7 @@ RSpec.describe Admin::DashboardController do
|
||||
expect(DiscourseUpdates.new_features_last_seen(admin.id)).to eq(nil)
|
||||
expect(DiscourseUpdates.has_unseen_features?(admin.id)).to eq(true)
|
||||
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
expect(DiscourseUpdates.new_features_last_seen(admin.id)).not_to eq(nil)
|
||||
@ -244,7 +244,7 @@ RSpec.describe Admin::DashboardController do
|
||||
end
|
||||
|
||||
it "doesn't error when there are no new features" do
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
end
|
||||
@ -255,7 +255,7 @@ RSpec.describe Admin::DashboardController do
|
||||
it "includes new features when available" do
|
||||
populate_new_features
|
||||
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
|
||||
json = response.parsed_body
|
||||
|
||||
@ -270,7 +270,7 @@ RSpec.describe Admin::DashboardController do
|
||||
|
||||
expect(DiscourseUpdates.get_last_viewed_feature_date(moderator.id)).to eq(nil)
|
||||
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
expect(response.status).to eq(200)
|
||||
expect(DiscourseUpdates.get_last_viewed_feature_date(moderator.id)).to eq(nil)
|
||||
end
|
||||
@ -280,7 +280,7 @@ RSpec.describe Admin::DashboardController do
|
||||
before { sign_in(user) }
|
||||
|
||||
it "denies access with a 404 response" do
|
||||
get "/admin/dashboard/whats-new.json"
|
||||
get "/admin/whats-new.json"
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response.parsed_body["errors"]).to include(I18n.t("not_found"))
|
||||
|
Reference in New Issue
Block a user