From aaf85916feaf4e9369781bd5047667f0d0938e13 Mon Sep 17 00:00:00 2001 From: maeda-seina Date: Tue, 1 Feb 2022 14:25:42 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E7=9B=B8=E8=AB=87=E9=83=A8=E5=B1=8B?= =?UTF-8?q?=E3=81=AE=E3=82=B0=E3=83=AD=E3=83=BC=E3=83=90=E3=83=AB=E3=83=8A?= =?UTF-8?q?=E3=83=93=E3=81=AB=E6=9C=AA=E8=BF=94=E4=BF=A1=E3=81=AE=E3=82=B3?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88=E6=95=B0=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=95=E3=81=9B=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/application/_global_nav.slim | 3 +++ 1 file changed, 3 insertions(+) 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 相談 From 2d849c1d889447684c53b6c5bea8e615a398cf2d Mon Sep 17 00:00:00 2001 From: maeda-seina Date: Sun, 6 Feb 2022 17:43:09 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/system/notification/talk_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/system/notification/talk_test.rb b/test/system/notification/talk_test.rb index b45e68022dc..e06bebe548c 100644 --- a/test/system/notification/talk_test.rb +++ b/test/system/notification/talk_test.rb @@ -65,4 +65,22 @@ class Notification::TalkTest < ApplicationSystemTestCase assert_text 'komagataさんからコメントが届きました。' end end + + test 'The number of unreplied comments is displayed in the global navigation of the talks room' do + visit_with_auth '/', 'komagata' + within(:css, "a[href='/talks']") do + assert_selector '.global-nav__item-count.a-notification-count.is-only-mentor', count: 1 + end + 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 'コメントする' + # refreshはブラウザをリロードするメソッド + refresh + within(:css, "a[href='/talks']") do + assert_no_selector '.global-nav__item-count.a-notification-count.is-only-mentor' + end + end end From bd13754edadab9b87edc95f2986bd5e484ac19b9 Mon Sep 17 00:00:00 2001 From: maeda-seina Date: Wed, 9 Feb 2022 21:13:06 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9C=AA=E8=BF=94=E4=BF=A1=E3=82=BF?= =?UTF-8?q?=E3=83=96=E3=81=AB=E3=82=82=E6=95=B0=E5=AD=97=E3=81=8C=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=95=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=20&=20=E3=83=86=E3=82=B9=E3=83=88=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/talks/_tabs.html.slim | 3 +++ test/system/notification/talk_test.rb | 23 +++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) 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 e06bebe548c..51b89d2f6f7 100644 --- a/test/system/notification/talk_test.rb +++ b/test/system/notification/talk_test.rb @@ -66,21 +66,28 @@ class Notification::TalkTest < ApplicationSystemTestCase end end - test 'The number of unreplied comments is displayed in the global navigation of the talks room' do - visit_with_auth '/', 'komagata' - within(:css, "a[href='/talks']") do - assert_selector '.global-nav__item-count.a-notification-count.is-only-mentor', count: 1 + 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 'コメントする' - # refreshはブラウザをリロードするメソッド - refresh - within(:css, "a[href='/talks']") do - assert_no_selector '.global-nav__item-count.a-notification-count.is-only-mentor' + + 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