mirror of
https://github.com/discourse/discourse.git
synced 2025-04-25 16:24:29 +08:00
FIX: Invalid route path for staff info warnings link (#19461)
This regressed in 4da2e3fef4102e0d3d2f24a4b0c54d4431755391
This commit is contained in:
parent
618fb5b34d
commit
5d2e2677c0
@ -39,8 +39,8 @@
|
||||
{{/if}}
|
||||
{{#if this.model.warnings_received_count}}
|
||||
<div>
|
||||
<LinkTo @route="userPrivateMessages.warnings" @model={{this.model}}>
|
||||
<span class="warnings-received">{{this.model.warnings_received_count}}</span>{{i18n "user.staff_counters.warnings_received"}}
|
||||
<LinkTo @route="userPrivateMessages.user.warnings" @model={{this.model}}>
|
||||
<span class="warnings-received">{{this.model.warnings_received_count}}</span> {{i18n "user.staff_counters.warnings_received"}}
|
||||
</LinkTo>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
@ -3,6 +3,11 @@
|
||||
module PageObjects
|
||||
module Pages
|
||||
class User < PageObjects::Pages::Base
|
||||
def visit(user)
|
||||
page.visit("/u/#{user.username}")
|
||||
self
|
||||
end
|
||||
|
||||
def find(selector)
|
||||
page.find(".user-content-wrapper #{selector}")
|
||||
end
|
||||
@ -14,6 +19,16 @@ module PageObjects
|
||||
def active_user_secondary_navigation
|
||||
find(".user-secondary-navigation li a.active")
|
||||
end
|
||||
|
||||
def has_warning_messages_path?(user)
|
||||
page.has_current_path?("/u/#{user.username}/messages/warnings")
|
||||
end
|
||||
|
||||
def click_staff_info_warnings_link(warnings_count: 0)
|
||||
staff_counters = page.find(".staff-counters")
|
||||
staff_counters.click_link("#{warnings_count} #{I18n.t("js.user.staff_counters.warnings_received")}")
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
24
spec/system/user_page/staff_info_spec.rb
Normal file
24
spec/system/user_page/staff_info_spec.rb
Normal file
@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe 'Viewing user staff info as an admin', type: :system, js: true do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
let(:user_page) { PageObjects::Pages::User.new }
|
||||
|
||||
before do
|
||||
sign_in(admin)
|
||||
end
|
||||
|
||||
context 'for warnings' do
|
||||
fab!(:topic) { Fabricate(:private_message_topic, user: admin, recipient: user) }
|
||||
fab!(:user_warning) { UserWarning.create!(user: user, created_by: admin, topic: topic) }
|
||||
|
||||
it "should display the right link to user's warnings with the right count in text" do
|
||||
user_page
|
||||
.visit(user)
|
||||
.click_staff_info_warnings_link(warnings_count: 1)
|
||||
|
||||
expect(user_page).to have_warning_messages_path(user)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user