Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

相談部屋のグローバルナビに未返信のコメント数を表示させるようにした #4104

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/views/application/_global_nav.slim
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,7 @@ nav.global-nav
= link_to talks_link, class: "global-nav-links__link #{current_link(/talk/)}" do
.global-nav-links__link-icon
i.fas.fa-comment-alt-smile
- if admin_or_mentor_login? && Talk.unreplied.count.positive?
.global-nav__item-count.a-notification-count.is-only-mentor
= Talk.unreplied.count
.global-nav-links__link-label 相談
3 changes: 3 additions & 0 deletions app/views/talks/_tabs.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
li.page-tabs__item
= link_to talks_unreplied_index_path, class: "page-tabs__item-link #{current_link(/^talks-unreplied-index/)}" do
| 未返信
- if admin_or_mentor_login? && Talk.unreplied.count.positive?
.page-tabs__item-count.a-notification-count
= Talk.unreplied.count
25 changes: 25 additions & 0 deletions test/system/notification/talk_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,29 @@ class Notification::TalkTest < ApplicationSystemTestCase
assert_text 'komagataさんからコメントが届きました。'
end
end

test 'The number of unreplied comments is displayed in the global navigation and unreplied tab of the talks room' do
visit_with_auth '/talks/unreplied', 'komagata'
within(:css, '.global-nav') do
within(:css, "a[href='/talks']") do
assert_selector '.global-nav__item-count.a-notification-count.is-only-mentor', count: 1
end
end
assert_selector '.page-tabs__item-count.a-notification-count', count: 1

talk_id = users(:with_hyphen).talk.id
visit_with_auth "/talks/#{talk_id}", 'komagata'
within('.thread-comment-form__form') do
fill_in('new_comment[description]', with: 'test')
end
click_button 'コメントする'

visit '/talks/unreplied'
within(:css, '.global-nav') do
within(:css, "a[href='/talks'") do
assert_no_selector '.global-nav__item-count.a-notification-count.is-only-mentor'
end
end
assert_no_selector '.page-tabs__item-count.a-notification-count'
end
end