From a7d3ee133158aa53be87e7350d5000bdca3540fc Mon Sep 17 00:00:00 2001 From: komagata Date: Sat, 5 Jun 2021 01:15:24 +0900 Subject: [PATCH 1/8] =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=AE=E4=B8=8A=E6=9B=B8?= =?UTF-8?q?=E3=81=8D=E3=82=92=E8=BE=9E=E3=82=81=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/question.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/app/javascript/question.vue b/app/javascript/question.vue index 37f3759e8c3..1f6ece75eb2 100644 --- a/app/javascript/question.vue +++ b/app/javascript/question.vue @@ -59,7 +59,6 @@ export default { }) .then((question) => { this.question = question - this.currentUser = question.user }) .catch((error) => { console.warn('Failed to parsing', error) From 2d78297f8741b85c8a83095bc360871bf0320d70 Mon Sep 17 00:00:00 2001 From: komagata Date: Sun, 28 Nov 2021 07:06:31 +0900 Subject: [PATCH 2/8] =?UTF-8?q?=E9=87=8D=E8=A4=87=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=9Fwelcome=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/home/index.html.slim | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim index 7e392930fbd..5e070103591 100644 --- a/app/views/home/index.html.slim +++ b/app/views/home/index.html.slim @@ -18,8 +18,6 @@ header.page-header .page-notices = render partial: 'event', collection: @events_coming_soon, as: :event .container.is-xxl - - if !Learning.find_by(user_id: current_user) && current_user.student_or_trainee? - = render 'welcome_message' .columns .row .col-xs-12.col-xl-6.col-xxl-6 From 2bbc5d0b5877396c47b74bb7acdb8214acebcd52 Mon Sep 17 00:00:00 2001 From: komagata Date: Mon, 20 Dec 2021 12:30:09 +0900 Subject: [PATCH 3/8] =?UTF-8?q?2=E6=99=82=E9=96=93=E4=BB=A5=E4=B8=8A?= =?UTF-8?q?=E3=81=8B=E3=81=8B=E3=82=8Bdata=20migration=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20211208002045_convert_report_emotion_null_to_soso.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/db/data/20211208002045_convert_report_emotion_null_to_soso.rb b/db/data/20211208002045_convert_report_emotion_null_to_soso.rb index ecad8b9572d..c7016160a6c 100644 --- a/db/data/20211208002045_convert_report_emotion_null_to_soso.rb +++ b/db/data/20211208002045_convert_report_emotion_null_to_soso.rb @@ -2,10 +2,7 @@ class ConvertReportEmotionNullToSoso < ActiveRecord::Migration[6.1] def up - Report.where(emotion: nil).find_each do |report| - report.emotion = Report.emotions[:soso] - report.save!(validate: false) - end + Report.where(emotion: nil).update_all(emotion: Report.emotions[:soso]) # rubocop:disable Rails/SkipsModelValidations end def down From 880b784952aae7dd1c9a61e765e28beb7ee8a3d8 Mon Sep 17 00:00:00 2001 From: komagata Date: Mon, 20 Dec 2021 17:09:46 +0900 Subject: [PATCH 4/8] =?UTF-8?q?token=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/skylight.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/skylight.yml b/config/skylight.yml index ceb855f18f7..dd57e854df0 100644 --- a/config/skylight.yml +++ b/config/skylight.yml @@ -1,3 +1,3 @@ --- # The authentication token for the application. -authentication: <%= ENV['SKYLIGHT_TOKEN'] %> +authentication: "ktNXoOV2Ep9X9le12c60bHwbtO1RV67WrKcLICfcES4" From 908585ac1ba52f9e7385df4c77a28897a908081a Mon Sep 17 00:00:00 2001 From: komagata Date: Wed, 22 Dec 2021 02:44:08 +0900 Subject: [PATCH 5/8] =?UTF-8?q?skylight=E3=81=AE=E5=8B=95=E4=BD=9C?= =?UTF-8?q?=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E7=94=A8=E3=81=AE=E7=92=B0?= =?UTF-8?q?=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cloudbuild.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index b568d665280..e61699e2493 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -82,6 +82,7 @@ steps: - '--set-env-vars=ROLLBAR_CLIENT_TOKEN=$_ROLLBAR_CLIENT_TOKEN' - '--set-env-vars=APPSIGNAL_PUSH_API_KEY=$_APPSIGNAL_PUSH_API_KEY' - '--set-env-vars=SKYLIGHT_TOKEN=$_SKYLIGHT_TOKEN' + - '--set-env-vars=RUST_LOG=$_RUST_LOG' - '--set-env-vars=$_ENVS' - >- --labels=managed-by=gcp-cloud-build-deploy-cloud-run,commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID,$_LABELS @@ -119,6 +120,7 @@ substitutions: _ROLLBAR_CLIENT_TOKEN: _ _APPSIGNAL_PUSH_API_KEY: _ _SKYLIGHT_TOKEN: _ + _RUST_LOG: _ tags: - gcp-cloud-build-deploy-cloud-run - gcp-cloud-build-deploy-cloud-run-managed From 14859f0a2932842e61e1027c35e687cac1aeb856 Mon Sep 17 00:00:00 2001 From: komagata Date: Sun, 26 Dec 2021 11:23:41 +0900 Subject: [PATCH 6/8] =?UTF-8?q?WIP=E3=81=AE=E6=8F=90=E5=87=BA=E7=89=A9?= =?UTF-8?q?=E3=82=92=E9=9D=9E=E8=A1=A8=E7=A4=BA=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed: #3866 --- app/controllers/reports_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index b0e5b5543cb..55ea072dfa8 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -17,7 +17,7 @@ class ReportsController < ApplicationController def index; end def show - @products = @report.user.products.order(published_at: :DESC) + @products = @report.user.products.not_wip.order(published_at: :desc) footprint! respond_to do |format| format.html From fd9db048d49a868d3b583bbfe8e8c7d7e2cdfd63 Mon Sep 17 00:00:00 2001 From: komagata Date: Tue, 8 Feb 2022 11:47:15 +0900 Subject: [PATCH 7/8] =?UTF-8?q?=E6=AD=A3=E6=9C=88=E3=82=AD=E3=83=A3?= =?UTF-8?q?=E3=83=B3=E3=83=9A=E3=83=BC=E3=83=B3=E3=81=AE=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/index.html.slim | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/welcome/index.html.slim b/app/views/welcome/index.html.slim index ba5a6ab5c1f..52be776c21c 100644 --- a/app/views/welcome/index.html.slim +++ b/app/views/welcome/index.html.slim @@ -4,7 +4,6 @@ = render 'welcome/main_visual' .welcome-sections - = render 'welcome/campaign' = render 'welcome/about' = render 'welcome/pricing' = render 'welcome/tutorials' From 8297878fd609b668e996731fdbe941f0386dcc01 Mon Sep 17 00:00:00 2001 From: komagata Date: Fri, 11 Feb 2022 02:16:10 +0900 Subject: [PATCH 8/8] =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=82=BF=E3=83=BC?= =?UTF-8?q?=E4=BB=A5=E5=A4=96=E3=81=8C=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=81=A8=E3=81=8D=E3=81=AB=E6=8B=85=E5=BD=93?= =?UTF-8?q?=E8=80=85=E3=81=AB=E3=81=AA=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix: #4146 --- app/models/comment/after_create_callback.rb | 4 +- app/models/product.rb | 1 + test/system/product/checker_test.rb | 61 +++++++++++++++++++++ test/system/products_test.rb | 42 -------------- 4 files changed, 65 insertions(+), 43 deletions(-) create mode 100644 test/system/product/checker_test.rb diff --git a/app/models/comment/after_create_callback.rb b/app/models/comment/after_create_callback.rb index b260055b532..2ccf9524bd3 100644 --- a/app/models/comment/after_create_callback.rb +++ b/app/models/comment/after_create_callback.rb @@ -75,8 +75,10 @@ def create_watch(comment) end def create_checker_id(comment) + return nil unless comment.user.mentor? + product = comment.commentable - product.checker_id = comment.sender.id if product.checker_id.blank? + product.checker_id = comment.sender.id unless product.checker_id? end def delete_product_cache(product_id) diff --git a/app/models/product.rb b/app/models/product.rb index 71134c713fe..5b887566d56 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -14,6 +14,7 @@ class Product < ApplicationRecord belongs_to :practice belongs_to :user, touch: true + belongs_to :checker, class_name: 'Product', optional: true alias sender user after_create ProductCallbacks.new diff --git a/test/system/product/checker_test.rb b/test/system/product/checker_test.rb new file mode 100644 index 00000000000..72a227df953 --- /dev/null +++ b/test/system/product/checker_test.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +require 'application_system_test_case' + +class Product::CheckerTest < ApplicationSystemTestCase + test 'be person on charge at comment on product of there are not person on charge' do + visit_with_auth '/products/unchecked?target=unchecked_no_replied', 'machida' + def assigned_product_count + text[/自分の担当 ((\d+))/, 1].to_i + end + + before_comment = assigned_product_count + + [ + '担当者がいない提出物の場合、担当者になる', + '自分が担当者の場合、担当者のまま' + ].each do |comment| + visit "/products/#{products(:product1).id}" + post_comment(comment) + + visit '/products/unchecked?target=unchecked_no_replied' + assert_equal before_comment + 1, assigned_product_count + end + end + + test 'be not person on charge at comment on product of there are person on charge' do + visit_with_auth '/products/unchecked?target=unchecked_no_replied', 'komagata' + product = find('.thread-list-item', match: :first) + product.click_button '担当する' + show_product_path = product.find_link(href: /products/)[:href] + logout + + visit_with_auth '/products/unchecked?target=unchecked_no_replied', 'machida' + + def assigned_product_count + text[/自分の担当 ((\d+))/, 1].to_i + end + + before_comment = assigned_product_count + + visit show_product_path + post_comment('担当者がいる提出物の場合、担当者にならない') + + visit '/products/unchecked?target=unchecked_no_replied' + assert_equal before_comment, assigned_product_count + end + + test 'when student comment to a product, they are not in charge' do + old_product = products(:product8) + + visit_with_auth product_url(old_product), 'kimura' + + within first('#comments.loaded', wait: 10) do + fill_in 'new_comment[description]', with: 'edit test' + click_button 'コメントする' + end + + assert_text 'コメントを投稿しました' + assert_nil Product.find(old_product.id).checker_id + end +end diff --git a/test/system/products_test.rb b/test/system/products_test.rb index 7201e52356f..e5d508ce76f 100644 --- a/test/system/products_test.rb +++ b/test/system/products_test.rb @@ -313,48 +313,6 @@ class ProductsTest < ApplicationSystemTestCase assert_not page.has_css?('.pagination') end - test 'be person on charge at comment on product of there are not person on charge' do - visit_with_auth '/products/unchecked?target=unchecked_no_replied', 'machida' - def assigned_product_count - text[/自分の担当 ((\d+))/, 1].to_i - end - - before_comment = assigned_product_count - - [ - '担当者がいない提出物の場合、担当者になる', - '自分が担当者の場合、担当者のまま' - ].each do |comment| - visit "/products/#{products(:product1).id}" - post_comment(comment) - - visit '/products/unchecked?target=unchecked_no_replied' - assert_equal before_comment + 1, assigned_product_count - end - end - - test 'be not person on charge at comment on product of there are person on charge' do - visit_with_auth '/products/unchecked?target=unchecked_no_replied', 'komagata' - product = find('.thread-list-item', match: :first) - product.click_button '担当する' - show_product_path = product.find_link(href: /products/)[:href] - logout - - visit_with_auth '/products/unchecked?target=unchecked_no_replied', 'machida' - - def assigned_product_count - text[/自分の担当 ((\d+))/, 1].to_i - end - - before_comment = assigned_product_count - - visit show_product_path - post_comment('担当者がいる提出物の場合、担当者にならない') - - visit '/products/unchecked?target=unchecked_no_replied' - assert_equal before_comment, assigned_product_count - end - test 'show user full_name next to user login_name' do visit_with_auth "/products/#{products(:product1).id}", 'kimura' assert_text 'yamada (Yamada Taro)'