mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 13:08:40 +08:00
Currently the /u/username/activity/assigns list sorts by topic bump date for assignments, whereas the user menu for assigns list sorts by read/unread and then the created_at date for the notification. The latter doesn't make much sense, most of the time when you are working on assignments the ones you are working on now which are being bumped somewhat frequently are the ones you want to see first, not in created_at order. This commit keeps the unread assignments at the top of the list, but sorts the rest by topic bump date.
41 lines
1.2 KiB
Ruby
Vendored
41 lines
1.2 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
RSpec.describe "Assign | User Menu" do
|
|
fab!(:admin)
|
|
|
|
let(:user_menu) { PageObjects::Components::UserMenu.new }
|
|
|
|
before do
|
|
SiteSetting.assign_enabled = true
|
|
sign_in(admin)
|
|
end
|
|
|
|
describe "Assign tab ordering" do
|
|
fab!(:newest_topic) { Fabricate(:topic, bumped_at: 1.hour.ago) }
|
|
fab!(:middle_topic) { Fabricate(:topic, bumped_at: 2.hours.ago) }
|
|
fab!(:oldest_topic) { Fabricate(:topic, bumped_at: 3.hours.ago) }
|
|
|
|
fab!(:older_unread_assign) do
|
|
Fabricate(:assignment_notification, user: admin, topic: oldest_topic)
|
|
end
|
|
|
|
fab!(:newer_read_assign) do
|
|
Fabricate(:assignment_notification, user: admin, topic: newest_topic, read: true)
|
|
end
|
|
|
|
fab!(:middle_unread_group_assign) do
|
|
Fabricate(:assignment_notification, user: admin, topic: middle_topic, group: true)
|
|
end
|
|
|
|
it "keeps unread items first and orders them by topic bump date" do
|
|
visit "/"
|
|
user_menu.open
|
|
user_menu.click_assignments_tab
|
|
expect(user_menu).to have_assignments_in_order(
|
|
[middle_unread_group_assign, older_unread_assign, newer_read_assign].map do
|
|
it.topic.fancy_title
|
|
end,
|
|
)
|
|
end
|
|
end
|
|
end
|