Skip to content

Commit

Permalink
Merge pull request #8061 from fjordllc/feature/alert-for-unconfirmed-…
Browse files Browse the repository at this point in the history
…daily-report-comment

日報が確認OKされていない場合、メンターがコメントした時にアラートが出るように実装
  • Loading branch information
komagata authored Nov 7, 2024
2 parents cf95cfd + 02d7e9d commit 73713d6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/javascript/comments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,15 @@ export default {
}
},
postComment() {
if (this.commentableType === 'Report' && this.isRole('mentor')) {
const notChecked = !this.checkId
if (
notChecked &&
!window.confirm('日報を確認済みにしていませんがよろしいですか?')
) {
return
}
}
this.createComment()
if (this.isUnassignedAndUnchekedProduct) {
this.checkProduct(
Expand Down
12 changes: 12 additions & 0 deletions test/system/comments_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,16 @@ class CommentsTest < ApplicationSystemTestCase
end
assert_equal '.new-comment-file-input', find('textarea.a-text-input')['data-input']
end

test 'show confirm dialog if report is not confirmed' do
visit_with_auth "/reports/#{reports(:report2).id}", 'machida'
assert_text '確認OKにする'
within('.thread-comment-form__form') do
fill_in('new_comment[description]', with: 'comment test')
end
accept_confirm '日報を確認済みにしていませんがよろしいですか?' do
click_button 'コメントする'
end
assert_text 'comment test'
end
end

0 comments on commit 73713d6

Please sign in to comment.