diff --git a/app/views/application/_global_nav.slim b/app/views/application/_global_nav.slim index f608ccf7f98..4cf1a68fc1d 100644 --- a/app/views/application/_global_nav.slim +++ b/app/views/application/_global_nav.slim @@ -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 相談 diff --git a/app/views/talks/_tabs.html.slim b/app/views/talks/_tabs.html.slim index cecd0ca3d8f..ea5daf6d622 100644 --- a/app/views/talks/_tabs.html.slim +++ b/app/views/talks/_tabs.html.slim @@ -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 diff --git a/test/system/notification/talk_test.rb b/test/system/notification/talk_test.rb index b45e68022dc..51b89d2f6f7 100644 --- a/test/system/notification/talk_test.rb +++ b/test/system/notification/talk_test.rb @@ -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