UX: multiple drafts menu improvements (#31195)

This change includes the following updates:

- Rename view all to view all drafts
- Remove view all link from drop-down when all drafts are displayed in
the menu
- Different icon for draft topics and PMs (adds envelope for PMs)
- Disable drop-down when New Topic button is disabled (private
categories etc)
- Improve drafts drop-down loading (no longer disables the trigger btn
on click)
This commit is contained in:
David Battersby
2025-02-05 15:19:13 +04:00
committed by GitHub
parent bb12f8275d
commit 5f0c21d906
6 changed files with 107 additions and 18 deletions

View File

@ -64,5 +64,57 @@ describe "Drafts dropdown", type: :system do
expect(drafts_dropdown.draft_item_count).to eq(4)
expect(drafts_dropdown.other_drafts_count).to eq(1)
end
it "shows the view all drafts when there are other drafts to display" do
page.visit "/"
drafts_dropdown.open
expect(drafts_dropdown).to be_open
expect(drafts_dropdown).to have_view_all_link
end
it "does not show the view all drafts link when all drafts are displayed" do
Draft.where(user_id: user.id).order("created_at DESC").limit(2).destroy_all
page.visit "/"
drafts_dropdown.open
expect(drafts_dropdown).to be_open
expect(drafts_dropdown).to have_no_view_all_link
end
end
describe "with private category" do
fab!(:group)
fab!(:group_user) { Fabricate(:group_user, user: user, group: group) }
fab!(:category) { Fabricate(:private_category, group: group, permission_type: 3) }
fab!(:subcategory) do
Fabricate(
:private_category,
parent_category_id: category.id,
group: group,
permission_type: 1,
)
end
let(:category_page) { PageObjects::Pages::Category.new }
before do
SiteSetting.default_subcategory_on_read_only_category = false
Draft.set(
user,
Draft::NEW_TOPIC,
0,
{ title: "This is a test topic", reply: "Lorem ipsum dolor sit amet" }.to_json,
)
end
it "disables the drafts dropdown menu when new topic button is disabled" do
category_page.visit(category)
expect(category_page).to have_button("New Topic", disabled: true)
expect(drafts_dropdown).to be_disabled
end
end
end