From 2a608d617a8a20012e84f91632ec6821fcd12431 Mon Sep 17 00:00:00 2001 From: Koji Ishimoto Date: Fri, 3 Feb 2023 15:15:35 +0900 Subject: [PATCH 01/41] =?UTF-8?q?package.json=E3=81=AElint:eslint=E3=81=A8?= =?UTF-8?q?lint:prettier=E3=81=AE=E5=AF=BE=E8=B1=A1=E3=81=ABjsx=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 37e6d95d059..e303f228440 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "scripts": { "lint": "run-p lint:*", - "lint:eslint": "eslint 'app/javascript/**/*.{js,vue}' --max-warnings=0", - "lint:prettier": "prettier app/javascript/**/*.{js,vue} --check" + "lint:eslint": "eslint 'app/javascript/**/*.{js,jsx,vue}' --max-warnings=0", + "lint:prettier": "prettier app/javascript/**/*.{js,jsx,vue} --check" }, "dependencies": { "@babel/preset-react": "^7.18.6", From 19b0351c3521ef325c57f28e9d51e91d2f626ed5 Mon Sep 17 00:00:00 2001 From: Koji Ishimoto Date: Fri, 3 Feb 2023 15:21:36 +0900 Subject: [PATCH 02/41] =?UTF-8?q?prettier=E3=81=AB=E3=82=88=E3=82=8B?= =?UTF-8?q?=E8=AD=A6=E5=91=8A=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/AdminCompanies.jsx | 26 ++++-- app/javascript/components/AdminCourses.jsx | 6 +- app/javascript/components/Bookmarks.jsx | 26 +++--- app/javascript/components/Categories.jsx | 14 ++- app/javascript/components/Events.jsx | 88 ++++++++++--------- .../components/LoadingListPlaceholder.jsx | 4 +- app/javascript/components/Pagination.jsx | 29 +++--- 7 files changed, 98 insertions(+), 95 deletions(-) diff --git a/app/javascript/components/AdminCompanies.jsx b/app/javascript/components/AdminCompanies.jsx index 8de4c8b469f..b2a9a662256 100644 --- a/app/javascript/components/AdminCompanies.jsx +++ b/app/javascript/components/AdminCompanies.jsx @@ -14,7 +14,10 @@ export default function AdminCompanies() { setPage(page) }, [page]) - const { data, error } = useSWR(`/api/admin/companies.json?page=${page}&per=${per}`, fetcher) + const { data, error } = useSWR( + `/api/admin/companies.json?page=${page}&per=${per}`, + fetcher + ) if (error) return <>An error has occurred. if (!data) return <>Loading... @@ -30,7 +33,7 @@ export default function AdminCompanies() { per={per} neighbours={neighbours} page={page} - onChange={e => handlePaginate(e.page)} + onChange={(e) => handlePaginate(e.page)} />
@@ -56,13 +59,13 @@ export default function AdminCompanies() { per={per} neighbours={neighbours} page={page} - onChange={e => handlePaginate(e.page)} + onChange={(e) => handlePaginate(e.page)} /> ) } -const AdminCompany = ({company}) => { +const AdminCompany = ({ company }) => { const url = `/companies/${company.id}` const editUrl = `/admin/companies/${company.id}/edit` @@ -76,17 +79,26 @@ const AdminCompany = ({company}) => { diff --git a/app/javascript/components/AdminCourses.jsx b/app/javascript/components/AdminCourses.jsx index 5190d9c5b3f..d522a0fb43f 100644 --- a/app/javascript/components/AdminCourses.jsx +++ b/app/javascript/components/AdminCourses.jsx @@ -51,16 +51,14 @@ function AdminCourse(props) {
  • + className="a-button is-sm is-secondary is-icon is-block">
  • + className="a-button is-sm is-secondary is-icon is-block">
  • diff --git a/app/javascript/components/Bookmarks.jsx b/app/javascript/components/Bookmarks.jsx index d3eb0d60e89..b04c8b9ad9b 100644 --- a/app/javascript/components/Bookmarks.jsx +++ b/app/javascript/components/Bookmarks.jsx @@ -2,15 +2,15 @@ import React, { useState, useEffect } from 'react' import useSWR, { useSWRConfig } from 'swr' import fetcher from '../fetcher' import Bootcamp from '../bootcamp' -import UserIcon from './UserIcon'; +import UserIcon from './UserIcon' export default function Bookmarks() { - const [editable, setEditable] = useState(false); + const [editable, setEditable] = useState(false) const { data, error } = useSWR(`/api/bookmarks.json`, fetcher) if (error) return <>エラーが発生しました。 if (!data) return <>ロード中… - if (data.totalPages === 0){ + if (data.totalPages === 0) { return } else { return ( @@ -89,10 +89,7 @@ const Bookmark = ({ bookmark, editable, setEditable }) => {
    {bookmark.modelName === 'Talk' ? (
    - +
    ) : (
    {bookmark.modelNameI18n}
    @@ -101,13 +98,15 @@ const Bookmark = ({ bookmark, editable, setEditable }) => { - {bookmark.modelName !== 'Talk' && + {bookmark.modelName !== 'Talk' && (
    @@ -117,7 +116,9 @@ const Bookmark = ({ bookmark, editable, setEditable }) => {
    - } + )}
    {editable && ( @@ -143,8 +144,7 @@ const DeleteButton = ({ id, afterDelete }) => {
    afterDelete(id)} - > + onClick={() => afterDelete(id)}> 削除
    diff --git a/app/javascript/components/Categories.jsx b/app/javascript/components/Categories.jsx index 3a96c911092..87b1dac9c70 100644 --- a/app/javascript/components/Categories.jsx +++ b/app/javascript/components/Categories.jsx @@ -20,12 +20,7 @@ const Categories = () => {
    {data.map((category) => { - return ( - - ) + return })}
    {company.website} - + - + - +
    @@ -59,13 +54,14 @@ const Category = ({ category }) => {
  • + className="a-button is-sm is-secondary is-icon spec-edit">
  • -
  • diff --git a/app/javascript/components/Events.jsx b/app/javascript/components/Events.jsx index 12b8923e8b2..52fec9ab859 100644 --- a/app/javascript/components/Events.jsx +++ b/app/javascript/components/Events.jsx @@ -43,14 +43,12 @@ export default function Events() { per={per} neighbours={neighbours} page={page} - onChange={e => handlePaginate(e.page)} + onChange={(e) => handlePaginate(e.page)} /> )}
      {data.events.map((event) => { - return ( - - ) + return })}
    {data.total_pages > 1 && ( @@ -59,7 +57,7 @@ export default function Events() { per={per} neighbours={neighbours} page={page} - onChange={e => handlePaginate(e.page)} + onChange={(e) => handlePaginate(e.page)} /> )}
    @@ -72,57 +70,67 @@ function Event({ event }) {
  • - +
    -
    -
    -
    - {event.wip ? ( -
    - WIP -
    - ) : event.ended && ( -
    - 終了 -
    - )} +
    +
    +
    + {event.wip ? ( +
    + WIP +
    + ) : ( + event.ended && ( +
    + 終了 +
    + ) + )}

    -

    - +
    -
    diff --git a/app/javascript/components/LoadingListPlaceholder.jsx b/app/javascript/components/LoadingListPlaceholder.jsx index f9f300dc080..45d47278d0d 100644 --- a/app/javascript/components/LoadingListPlaceholder.jsx +++ b/app/javascript/components/LoadingListPlaceholder.jsx @@ -5,9 +5,7 @@ export default function LoadingListPlaceholder() { return (
    {[...Array(itemCount)].map((_, index) => { - return ( - - ) + return })}
    ) diff --git a/app/javascript/components/Pagination.jsx b/app/javascript/components/Pagination.jsx index bfb524460f2..e52e3b86172 100644 --- a/app/javascript/components/Pagination.jsx +++ b/app/javascript/components/Pagination.jsx @@ -28,7 +28,7 @@ const Pagination = (props) => { // 初回レンダリング時はスキップし、変数を更新する if (isFirstRender.current) { isFirstRender.current = false - return; + return } props.onChange({ page: page }) @@ -40,15 +40,11 @@ const Pagination = (props) => {
      - {numbers[0] > 1 && ( - - )} - {numbers.map(i => { + {numbers[0] > 1 && } + {numbers.map((i) => { return })} - {numbers[numbers.length - 1] < totalPage && ( - - )} + {numbers[numbers.length - 1] < totalPage && }
    @@ -64,8 +60,7 @@ const First = ({ setPage, page }) => {
  • @@ -78,9 +73,8 @@ const Prev = ({ page, setPage }) => { return (
  • @@ -92,8 +86,7 @@ const Number = ({ page, setPage, i }) => {
  • @@ -107,8 +100,7 @@ const Next = ({ page, setPage, totalPage }) => {
  • @@ -122,8 +114,7 @@ const Last = ({ page, setPage, totalPage }) => {
  • From 0f4326905f290d6554c9a920ec4c7c8f19d7a940 Mon Sep 17 00:00:00 2001 From: Koji Ishimoto Date: Fri, 3 Feb 2023 15:23:23 +0900 Subject: [PATCH 03/41] =?UTF-8?q?eslint=E3=81=AB=E3=82=88=E3=82=8B?= =?UTF-8?q?=E8=AD=A6=E5=91=8A=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/AdminCompanies.jsx | 8 ++++---- app/javascript/components/Bookmarks.jsx | 6 +++--- app/javascript/components/Categories.jsx | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/javascript/components/AdminCompanies.jsx b/app/javascript/components/AdminCompanies.jsx index b2a9a662256..617737f4b69 100644 --- a/app/javascript/components/AdminCompanies.jsx +++ b/app/javascript/components/AdminCompanies.jsx @@ -7,7 +7,7 @@ import Pagination from './Pagination' export default function AdminCompanies() { const per = 20 const neighbours = 4 - const defaultPage = parseInt(queryString.parse(location.search)['page']) || 1 + const defaultPage = parseInt(queryString.parse(location.search).page) || 1 const [page, setPage] = useState(defaultPage) useEffect(() => { @@ -78,7 +78,7 @@ const AdminCompany = ({ company }) => { {company.website} - + { - + { - + { ) } -const Bookmark = ({ bookmark, editable, setEditable }) => { +const Bookmark = ({ bookmark, editable, _setEditable }) => { const date = bookmark.reported_on || bookmark.created_at const createdAt = Bootcamp.iso8601ToFullTime(date) const { mutate } = useSWRConfig() const afterDelete = (id) => { Bootcamp.delete(`/api/bookmarks/${id}.json`) - .then((response) => { + .then((_response) => { mutate('/api/bookmarks.json') }) .catch((error) => { diff --git a/app/javascript/components/Categories.jsx b/app/javascript/components/Categories.jsx index 87b1dac9c70..f1ac1f05433 100644 --- a/app/javascript/components/Categories.jsx +++ b/app/javascript/components/Categories.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react' +import React from 'react' import useSWR, { useSWRConfig } from 'swr' import fetcher from '../fetcher' import Bootcamp from '../bootcamp' @@ -34,7 +34,7 @@ const Category = ({ category }) => { const destroy = (id) => { if (window.confirm('本当によろしいですか?')) { Bootcamp.delete(`/api/categories/${id}`) - .then((response) => { + .then((_response) => { mutate('/api/categories.json') }) .catch((error) => { From cf92a2c2749f1b6a7ba59a39d5ddf63282de7184 Mon Sep 17 00:00:00 2001 From: futa4095 Date: Fri, 10 Feb 2023 22:51:03 +0900 Subject: [PATCH 04/41] =?UTF-8?q?=E7=A0=94=E4=BF=AE=E7=94=9F=E3=81=8C?= =?UTF-8?q?=E6=8F=90=E5=87=BA=E7=89=A9=E3=82=92=E6=8F=90=E5=87=BA=E3=81=97?= =?UTF-8?q?=E3=81=9F=E6=99=82=E3=81=AE=E3=82=A2=E3=83=89=E3=83=90=E3=82=A4?= =?UTF-8?q?=E3=82=B6=E3=83=BC=E3=81=B8=E3=81=AE=E9=80=9A=E7=9F=A5=E3=82=92?= =?UTF-8?q?newspaper=E5=8C=96=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/products_controller.rb | 1 + app/models/product_callbacks.rb | 13 +------------ app/models/product_notifier.rb | 25 +++++++++++++++++++++++++ config/initializers/newspaper.rb | 4 ++++ 4 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 app/models/product_notifier.rb diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 8118ba2bf3e..3a9dcd53b43 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -54,6 +54,7 @@ def update set_wip update_published_at if @product.update(product_params) + Newspaper.publish(:product_update, @product) redirect_to @product, notice: notice_message(@product, :update) notice_another_mentor_assined_as_checker notice_product_update if @product.checker_id.present? diff --git a/app/models/product_callbacks.rb b/app/models/product_callbacks.rb index 74d452a20a3..42e942ef12d 100644 --- a/app/models/product_callbacks.rb +++ b/app/models/product_callbacks.rb @@ -20,10 +20,7 @@ def after_save(product) unless product.wip notify_watching_mentors product - if product.user.trainee? && product.user.company - notify_advisers product - create_advisers_watch product - end + create_advisers_watch product if product.user.trainee? && product.user.company end Cache.delete_unchecked_product_count @@ -67,14 +64,6 @@ def notify_watching_mentors(product) ) end - def notify_advisers(product) - send_notification( - product: product, - receivers: product.user.company.advisers, - message: "#{product.user.login_name}さんが#{product.title}を提出しました。" - ) - end - def update_learning_status(product) previous_learning = Learning.find_or_initialize_by( user_id: product.user.id, diff --git a/app/models/product_notifier.rb b/app/models/product_notifier.rb new file mode 100644 index 00000000000..6007c929798 --- /dev/null +++ b/app/models/product_notifier.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class ProductNotifier + def call(product) + return if product.wip + + notify_advisers product if product.user.trainee? && product.user.company + end + + private + + def notify_advisers(product) + send_notification( + product: product, + receivers: product.user.company.advisers, + message: "#{product.user.login_name}さんが#{product.title}を提出しました。" + ) + end + + def send_notification(product:, receivers:, message:) + receivers.each do |receiver| + NotificationFacade.submitted(product, receiver, message) + end + end +end diff --git a/config/initializers/newspaper.rb b/config/initializers/newspaper.rb index 7c65747254d..e31740ace81 100644 --- a/config/initializers/newspaper.rb +++ b/config/initializers/newspaper.rb @@ -38,4 +38,8 @@ page_notifier = PageNotifier.new Newspaper.subscribe(:page_create, page_notifier) Newspaper.subscribe(:page_update, page_notifier) + + product_notifier = ProductNotifier.new + Newspaper.subscribe(:product_create, product_notifier) + Newspaper.subscribe(:product_update, product_notifier) end From dd9294071e22e8ee1cf3d34a0e2fe3c548e45477 Mon Sep 17 00:00:00 2001 From: djkazunoko Date: Fri, 17 Feb 2023 11:37:33 +0900 Subject: [PATCH 05/41] =?UTF-8?q?=E3=83=9A=E3=83=BC=E3=82=B8=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E3=82=92=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E4=BD=9C=E6=88=90=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/pages/new.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pages/new.html.slim b/app/views/pages/new.html.slim index 6d3d5abc14b..cd7ed8e4259 100644 --- a/app/views/pages/new.html.slim +++ b/app/views/pages/new.html.slim @@ -1,4 +1,4 @@ -- title 'ページ作成' +- title 'ドキュメント作成' header.page-header .container From 8d5061bb6b058c94f30c8df6cab7044fef047124 Mon Sep 17 00:00:00 2001 From: djkazunoko Date: Sat, 18 Feb 2023 15:50:52 +0900 Subject: [PATCH 06/41] =?UTF-8?q?=E9=80=80=E4=BC=9A=E6=89=8B=E7=B6=9A?= =?UTF-8?q?=E3=81=8D=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AE=E3=82=BF=E3=82=A4?= =?UTF-8?q?=E3=83=88=E3=83=AB=E3=81=8B=E3=82=89=E3=80=8C=E4=BC=91=E4=BC=9A?= =?UTF-8?q?=E3=80=8D=E3=82=92=E5=A4=96=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/retirement/new.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/retirement/new.html.slim b/app/views/retirement/new.html.slim index ab106317dbd..35f1945c303 100644 --- a/app/views/retirement/new.html.slim +++ b/app/views/retirement/new.html.slim @@ -1,4 +1,4 @@ -- title '退会・休会手続き' +- title '退会手続き' header.page-header .container From 3909f49ffd361f8cf10e152fed537cd91f3ad127 Mon Sep 17 00:00:00 2001 From: tominaga Date: Wed, 1 Feb 2023 14:49:08 +0900 Subject: [PATCH 07/41] =?UTF-8?q?=E4=BB=8A=E6=97=A5=E3=81=8B=E6=98=8E?= =?UTF-8?q?=E6=97=A5=E9=96=8B=E5=82=AC=E3=81=AE=E5=AE=9A=E6=9C=9F=E3=82=A4?= =?UTF-8?q?=E3=83=99=E3=83=B3=E3=83=88=E3=82=92=E3=83=80=E3=83=83=E3=82=B7?= =?UTF-8?q?=E3=83=A5=E3=83=9C=E3=83=BC=E3=83=89=E3=81=AB=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=95=E3=81=9B=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/home_controller.rb | 14 ++++++++++++++ app/helpers/home_helper.rb | 12 ++++++++++-- app/models/event.rb | 8 ++++++++ app/models/regular_event.rb | 5 +++++ app/views/home/_regular_event.html.slim | 18 ++++++++++++++++++ app/views/home/index.html.slim | 4 ++++ 6 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 app/views/home/_regular_event.html.slim diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 800f87b4ab8..205cb0fcab0 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -7,6 +7,7 @@ def index if current_user display_dashboard display_events_on_dashboard + display_regular_events_on_dashboard display_welcome_message_for_adviser set_required_fields render aciton: :index @@ -61,6 +62,19 @@ def display_events_on_dashboard @events_coming_soon_except_job_hunting = @events_coming_soon.where.not(job_hunting: true) end + def display_regular_events_on_dashboard + cookies_ids = JSON.parse(cookies[:confirmed_event_ids]) if cookies[:confirmed_event_ids] + @regular_events_comming_soon = RegularEvent.today_events + RegularEvent.tomorrow_events + + if cookies_ids + cookies_ids.each do |id| + @regular_events_comming_soon.delete_if do |event| + event.id == id.to_i + end + end + end + end + def display_welcome_message_for_adviser @welcome_message_first_time = cookies[:confirmed_welcome_message] end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb index c124232869d..e6c0f933606 100644 --- a/app/helpers/home_helper.rb +++ b/app/helpers/home_helper.rb @@ -2,13 +2,21 @@ module HomeHelper def today_or_tommorow(event) - if event.start_at.to_date.today? + if event.event_day? '今日' - elsif event.start_at.to_date == Date.tomorrow + elsif event.tomorrow_event? '明日' end end + def event_date(event) + if event.event_day? + Date.today + elsif event.tomorrow_event? + Date.tomorrow + end + end + def anchor_to_required_field(attribute) { avatar_attached: 'form-user-avatar', diff --git a/app/models/event.rb b/app/models/event.rb index 3bda692b053..d4f15cbf90c 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -107,6 +107,14 @@ def send_notification(receiver) NotificationFacade.moved_up_event_waiting_user(self, receiver) end + def event_day? + start_at.to_date.today? + end + + def tomorrow_event? + start_at.to_date == Date.tomorrow + end + private def end_at_be_greater_than_start_at diff --git a/app/models/regular_event.rb b/app/models/regular_event.rb index e80c322c655..5735e6d1f4e 100644 --- a/app/models/regular_event.rb +++ b/app/models/regular_event.rb @@ -137,6 +137,11 @@ def watched_by?(user) end class << self + def today_events + holding_events = RegularEvent.holding + holding_events.select(&:event_day?) + end + def tomorrow_events holding_events = RegularEvent.holding holding_events.select(&:tomorrow_event?) diff --git a/app/views/home/_regular_event.html.slim b/app/views/home/_regular_event.html.slim new file mode 100644 index 00000000000..ef3d0f2934f --- /dev/null +++ b/app/views/home/_regular_event.html.slim @@ -0,0 +1,18 @@ +.page-notices__item(data-event-id="#{regular_event.id}") + .a-page-notice.page-notice + .container.is-lg + .a-page-notice__inner.has-close + .a-page-notice__inner-start + p + = link_to regular_event, itemprop: 'url', class: 'has-badge' do + span.a-badge.is-primary.is-sm + | 定期イベント + = today_or_tommorow(regular_event) + = l event_date(regular_event), format: :md + | は 「 + span.a-page-notice__label + = regular_event.title + | 」 が開催されます + .a-page-notice__inner-end + .a-page-notice__close.js-close-event + i.fal.fa-times diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim index 327f39a43fb..26fe6db1858 100644 --- a/app/views/home/index.html.slim +++ b/app/views/home/index.html.slim @@ -11,6 +11,10 @@ #events_on_dashboard.confirmed_event .page-notices = render partial: 'event', collection: @events_coming_soon_except_job_hunting, as: :event + - if @regular_events_comming_soon.present? + #events_on_dashboard.confirmed_event + .page-notices + = render partial: 'regular_event', collection: @regular_events_comming_soon, as: :regular_event - if current_user.adviser? = render 'adviser_dashboard' From 80d2c726dabcd4adc7c251203f6373f406eeef78 Mon Sep 17 00:00:00 2001 From: tominaga Date: Wed, 1 Feb 2023 14:50:15 +0900 Subject: [PATCH 08/41] =?UTF-8?q?=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=AE=E6=97=A5=E4=BB=98=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=81=A7=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/home/_event.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/home/_event.html.slim b/app/views/home/_event.html.slim index 636fc8dfc19..141455a87f8 100644 --- a/app/views/home/_event.html.slim +++ b/app/views/home/_event.html.slim @@ -8,7 +8,7 @@ span.a-badge.is-primary.is-sm | イベント = today_or_tommorow(event) - = l event.start_at.to_date, format: :md + = l event.start_at.to_date, format: :md | は 「 span.a-page-notice__label = event.title From ba9b221eed63524d83a893f636ac0c9b6576b208 Mon Sep 17 00:00:00 2001 From: tominaga Date: Fri, 3 Feb 2023 12:35:44 +0900 Subject: [PATCH 09/41] =?UTF-8?q?=E8=87=AA=E5=88=86=E3=81=8C=E5=8F=82?= =?UTF-8?q?=E5=8A=A0=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E5=AE=9A=E6=9C=9F?= =?UTF-8?q?=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E3=81=AE=E3=81=BF=E3=83=80?= =?UTF-8?q?=E3=83=83=E3=82=B7=E3=83=A5=E3=83=9C=E3=83=BC=E3=83=89=E3=81=AB?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=95=E3=81=9B=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/home_controller.rb | 5 +++-- app/models/regular_event.rb | 4 ++++ db/fixtures/regular_event_participations.yml | 8 ++++++++ db/fixtures/regular_event_repeat_rules.yml | 12 ++++++++++- db/fixtures/regular_events.yml | 20 ++++++++++++++++++- .../fixtures/regular_event_participations.yml | 8 ++++++++ test/fixtures/regular_event_repeat_rules.yml | 12 ++++++++++- test/fixtures/regular_events.yml | 20 ++++++++++++++++++- test/system/home_test.rb | 15 ++++++++++++++ test/system/regular_events_test.rb | 2 +- 10 files changed, 99 insertions(+), 7 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 205cb0fcab0..c7991f8c8e6 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -64,8 +64,9 @@ def display_events_on_dashboard def display_regular_events_on_dashboard cookies_ids = JSON.parse(cookies[:confirmed_event_ids]) if cookies[:confirmed_event_ids] - @regular_events_comming_soon = RegularEvent.today_events + RegularEvent.tomorrow_events - + regular_events_comming_soon = RegularEvent.today_events + RegularEvent.tomorrow_events + @regular_events_comming_soon = regular_events_comming_soon.select { |event| event.participated_by?(current_user) } + if cookies_ids cookies_ids.each do |id| @regular_events_comming_soon.delete_if do |event| diff --git a/app/models/regular_event.rb b/app/models/regular_event.rb index 5735e6d1f4e..3cfd110f391 100644 --- a/app/models/regular_event.rb +++ b/app/models/regular_event.rb @@ -136,6 +136,10 @@ def watched_by?(user) watches.exists?(user_id: user.id) end + def participated_by?(user) + regular_event_participations.find_by(user_id: user.id).present? + end + class << self def today_events holding_events = RegularEvent.holding diff --git a/db/fixtures/regular_event_participations.yml b/db/fixtures/regular_event_participations.yml index c993552761d..ba27fe680c4 100644 --- a/db/fixtures/regular_event_participations.yml +++ b/db/fixtures/regular_event_participations.yml @@ -1,3 +1,11 @@ regular_event_participation1: user: hatsuno regular_event: regular_event1 + +regular_event_participation2: + user: kimura + regular_event: regular_event8 + +regular_event_participation3: + user: kimura + regular_event: regular_event9 diff --git a/db/fixtures/regular_event_repeat_rules.yml b/db/fixtures/regular_event_repeat_rules.yml index 33c67417ceb..9de659268d9 100644 --- a/db/fixtures/regular_event_repeat_rules.yml +++ b/db/fixtures/regular_event_repeat_rules.yml @@ -33,7 +33,17 @@ regular_event_repeat_rule7: day_of_the_week: 3 regular_event: regular_event7 -<% (8..26).each do |i| %> +regular_event_repeat_rule8: + frequency: 0 + day_of_the_week: <%= Date.today.wday %> + regular_event: regular_event8 + +regular_event_repeat_rule9: + frequency: 0 + day_of_the_week: <%= Date.tomorrow.wday %> + regular_event: regular_event9 + +<% (10..26).each do |i| %> regular_event_repeat_rule<%= i %>: frequency: 0 day_of_the_week: 0 diff --git a/db/fixtures/regular_events.yml b/db/fixtures/regular_events.yml index a4582e2cc2e..3c036104261 100644 --- a/db/fixtures/regular_events.yml +++ b/db/fixtures/regular_events.yml @@ -64,7 +64,25 @@ regular_event7: end_at: <%= Time.zone.local(2020, 1, 1, 22, 0, 0) %> user: komagata -<% (8..26).each do |i| %> +regular_event8: + title: ダッシュボード表示確認用テスト定期イベント(当日用) + description: ダッシュボード表示確認用テスト定期イベント(当日用) + finished: false + hold_national_holiday: true + start_at: <%= Time.zone.local(2020, 1, 1, 21, 58, 0) %> + end_at: <%= Time.zone.local(2020, 1, 1, 23, 59, 0) %> + user: komagata + +regular_event9: + title: ダッシュボード表示確認用テスト定期イベント(翌日用) + description: ダッシュボード表示確認用テスト定期イベント(翌日用) + finished: false + hold_national_holiday: true + start_at: <%= Time.zone.local(2020, 1, 1, 21, 0, 0) %> + end_at: <%= Time.zone.local(2020, 1, 1, 22, 0, 0) %> + user: komagata + +<% (10..26).each do |i| %> regular_event<%= i %>: title: 定期イベント<%= i %> description: <%= i %>番目の定期イベントです。 diff --git a/test/fixtures/regular_event_participations.yml b/test/fixtures/regular_event_participations.yml index c993552761d..ba27fe680c4 100644 --- a/test/fixtures/regular_event_participations.yml +++ b/test/fixtures/regular_event_participations.yml @@ -1,3 +1,11 @@ regular_event_participation1: user: hatsuno regular_event: regular_event1 + +regular_event_participation2: + user: kimura + regular_event: regular_event8 + +regular_event_participation3: + user: kimura + regular_event: regular_event9 diff --git a/test/fixtures/regular_event_repeat_rules.yml b/test/fixtures/regular_event_repeat_rules.yml index 7bf89698cfb..bed6eef45d7 100644 --- a/test/fixtures/regular_event_repeat_rules.yml +++ b/test/fixtures/regular_event_repeat_rules.yml @@ -33,7 +33,17 @@ regular_event_repeat_rule7: day_of_the_week: 3 regular_event: regular_event7 -<% (8..26).each do |i| %> +regular_event_repeat_rule8: + frequency: 0 + day_of_the_week: 1 + regular_event: regular_event8 + +regular_event_repeat_rule9: + frequency: 0 + day_of_the_week: 2 + regular_event: regular_event9 + +<% (10..26).each do |i| %> regular_event_repeat_rule<%= i %>: frequency: 0 day_of_the_week: 0 diff --git a/test/fixtures/regular_events.yml b/test/fixtures/regular_events.yml index a4582e2cc2e..bb8163cc0b8 100644 --- a/test/fixtures/regular_events.yml +++ b/test/fixtures/regular_events.yml @@ -64,7 +64,25 @@ regular_event7: end_at: <%= Time.zone.local(2020, 1, 1, 22, 0, 0) %> user: komagata -<% (8..26).each do |i| %> +regular_event8: + title: ダッシュボード表示確認用テスト定期イベント(当日用) + description: ダッシュボード表示確認用テスト定期イベント(当日用) + finished: false + hold_national_holiday: true + start_at: <%= Time.zone.local(2020, 1, 1, 21, 0, 0) %> + end_at: <%= Time.zone.local(2020, 1, 1, 22, 0, 0) %> + user: komagata + +regular_event9: + title: ダッシュボード表示確認用テスト定期イベント(翌日用) + description: ダッシュボード表示確認用テスト定期イベント(翌日用) + finished: false + hold_national_holiday: true + start_at: <%= Time.zone.local(2020, 1, 1, 21, 0, 0) %> + end_at: <%= Time.zone.local(2020, 1, 1, 22, 0, 0) %> + user: komagata + +<% (10..26).each do |i| %> regular_event<%= i %>: title: 定期イベント<%= i %> description: <%= i %>番目の定期イベントです。 diff --git a/test/system/home_test.rb b/test/system/home_test.rb index 5b79a39f06e..b681f9e1b87 100644 --- a/test/system/home_test.rb +++ b/test/system/home_test.rb @@ -223,6 +223,21 @@ class HomeTest < ApplicationSystemTestCase end end + test 'show regular events on dashbord for only event participant' do + travel_to Time.zone.local(2023, 1, 30, 10, 0, 0) do + visit_with_auth '/', 'kimura' + assert_text 'ダッシュボード表示確認用テスト定期イベント(当日用)' + assert_text 'ダッシュボード表示確認用テスト定期イベント(翌日用)' + first('.js-close-event').click + assert_no_text 'ダッシュボード表示確認用テスト定期イベント(当日用)' + logout + + visit_with_auth '/', 'komagata' + assert_no_text 'ダッシュボード表示確認用テスト定期イベント(当日用)' + assert_no_text 'ダッシュボード表示確認用テスト定期イベント(翌日用)' + end + end + test 'show grass hide button for graduates' do visit_with_auth '/', 'kimura' assert_not has_button? '非表示' diff --git a/test/system/regular_events_test.rb b/test/system/regular_events_test.rb index 4bd1fc95998..ca1f0fa1eef 100644 --- a/test/system/regular_events_test.rb +++ b/test/system/regular_events_test.rb @@ -164,7 +164,7 @@ class RegularEventsTest < ApplicationSystemTestCase test 'show listing not finished regular events' do visit_with_auth regular_events_path(target: 'not_finished'), 'kimura' - assert_selector '.card-list-item', count: 7 + assert_selector '.card-list-item', count: 9 end test 'show listing all regular events' do From bc649b94e943154c2bf43d2318a0b9d1532eced9 Mon Sep 17 00:00:00 2001 From: tominaga Date: Fri, 3 Feb 2023 12:36:43 +0900 Subject: [PATCH 10/41] =?UTF-8?q?=E3=83=A2=E3=83=87=E3=83=AB=E3=81=AE?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/models/event_test.rb | 22 ++++++++++++++++++++++ test/models/regular_event_test.rb | 9 +++++++++ 2 files changed, 31 insertions(+) diff --git a/test/models/event_test.rb b/test/models/event_test.rb index 8ebde3e8b31..0f7129e100e 100644 --- a/test/models/event_test.rb +++ b/test/models/event_test.rb @@ -85,6 +85,28 @@ class EventTest < ActiveSupport::TestCase assert Notification.where(user: user, sender: event.user, link: "/events/#{event.id}").exists? end + test '#event_day?' do + event = events(:event1) + travel_to Time.zone.local(2019, 12, 20, 0, 0, 0) do + assert event.event_day? + end + + travel_to Time.zone.local(2019, 12, 21, 0, 0, 0) do + assert_not event.event_day? + end + end + + test '#tomorrow_event?' do + event = events(:event1) + travel_to Time.zone.local(2019, 12, 19, 0, 0, 0) do + assert event.tomorrow_event? + end + + travel_to Time.zone.local(2019, 12, 20, 0, 0, 0) do + assert_not event.tomorrow_event? + end + end + test 'should be invalid when start_at >= end_at' do event = events(:event1) event.end_at = event.start_at - 1.hour diff --git a/test/models/regular_event_test.rb b/test/models/regular_event_test.rb index c79502186b3..f0b62ce85af 100644 --- a/test/models/regular_event_test.rb +++ b/test/models/regular_event_test.rb @@ -75,4 +75,13 @@ class RegularEventTest < ActiveSupport::TestCase watch.save assert regular_event.watched_by?(user) end + + test 'participated_by?' do + regular_event = regular_events(:regular_event1) + user = users(:hatsuno) + assert regular_event.participated_by?(user) + + user = users(:komagata) + assert_not regular_event.participated_by?(user) + end end From e718c40c4f3909d30adc99c289230641390ce863 Mon Sep 17 00:00:00 2001 From: tominaga Date: Fri, 3 Feb 2023 18:31:17 +0900 Subject: [PATCH 11/41] =?UTF-8?q?cookie=E3=81=AB=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=AD=E3=83=BC=E3=82=92=E3=82=A4=E3=83=99?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=81=AE=E7=A8=AE=E9=A1=9E=E3=81=94=E3=81=A8?= =?UTF-8?q?=E3=81=AB=E6=8C=87=E5=AE=9A=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/home_controller.rb | 2 +- app/javascript/incoming-events.js | 24 +++++++++++++++--------- app/views/home/_event.html.slim | 2 +- app/views/home/_regular_event.html.slim | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index c7991f8c8e6..a9ea9d7e6f2 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -63,7 +63,7 @@ def display_events_on_dashboard end def display_regular_events_on_dashboard - cookies_ids = JSON.parse(cookies[:confirmed_event_ids]) if cookies[:confirmed_event_ids] + cookies_ids = JSON.parse(cookies[:confirmed_regular_event_ids]) if cookies[:confirmed_regular_event_ids] regular_events_comming_soon = RegularEvent.today_events + RegularEvent.tomorrow_events @regular_events_comming_soon = regular_events_comming_soon.select { |event| event.participated_by?(current_user) } diff --git a/app/javascript/incoming-events.js b/app/javascript/incoming-events.js index e27dc1929f6..38c5008e233 100644 --- a/app/javascript/incoming-events.js +++ b/app/javascript/incoming-events.js @@ -5,24 +5,30 @@ document.addEventListener('DOMContentLoaded', () => { events.forEach((event) => { const eventId = event.getAttribute('data-event-id') + const eventType = event.getAttribute('data-event-type') const button = event.querySelector('.js-close-event') + const key = { + Event: 'confirmed_event_ids=', + RegularEvent: 'confirmed_regular_event_ids=' + }[eventType] button.addEventListener('click', () => { document - .querySelector(`.page-notices__item[data-event-id="${eventId}"]`) + .querySelector(`.page-notices__item[data-event-id="${eventId}"][data-event-type="${eventType}"]`) .remove() if ( document.cookie .split('; ') - .find((row) => row.startsWith('confirmed_event_ids')) === undefined + .find((row) => row.startsWith(key)) === undefined ) { - saveCookie([eventId]) + saveCookie(key, [eventId]) } else { const latestCookie = document.cookie .split('; ') - .find((row) => row.startsWith('confirmed_event_ids')) - saveCookie(updateEventIds(latestCookie, eventId)) + .find((row) => row.startsWith(key)) + const eventIds = updateEventIds(key, latestCookie, eventId) + saveCookie(key, eventIds) } const eventCount = document.querySelectorAll( @@ -34,17 +40,17 @@ document.addEventListener('DOMContentLoaded', () => { }) }) - function saveCookie(eventIds) { + function saveCookie(key, eventIds) { const secondsFor30days = 2592000 document.cookie = - 'confirmed_event_ids=' + + key + JSON.stringify(eventIds) + ';max-age=' + secondsFor30days } - function updateEventIds(latestCookie, eventId) { - const unnecessaryCharacters = 20 + function updateEventIds(key, latestCookie, eventId) { + const unnecessaryCharacters = key.length const latestEventIds = latestCookie.substr(unnecessaryCharacters) const updatedEventIds = JSON.parse(latestEventIds) updatedEventIds.push(eventId) diff --git a/app/views/home/_event.html.slim b/app/views/home/_event.html.slim index 141455a87f8..575f32cb87c 100644 --- a/app/views/home/_event.html.slim +++ b/app/views/home/_event.html.slim @@ -1,4 +1,4 @@ -.page-notices__item(data-event-id="#{event.id}") +.page-notices__item(data-event-id="#{event.id}" data-event-type="#{event.class}") .a-page-notice.page-notice .container.is-lg .a-page-notice__inner.has-close diff --git a/app/views/home/_regular_event.html.slim b/app/views/home/_regular_event.html.slim index ef3d0f2934f..8f1c46bbe08 100644 --- a/app/views/home/_regular_event.html.slim +++ b/app/views/home/_regular_event.html.slim @@ -1,4 +1,4 @@ -.page-notices__item(data-event-id="#{regular_event.id}") +.page-notices__item(data-event-id="#{regular_event.id}" data-event-type="#{regular_event.class}") .a-page-notice.page-notice .container.is-lg .a-page-notice__inner.has-close From 2203f4b635ec158457b6c4ded79c1bfc7c0955cf Mon Sep 17 00:00:00 2001 From: tominaga Date: Fri, 3 Feb 2023 19:12:23 +0900 Subject: [PATCH 12/41] =?UTF-8?q?Date.current=E3=82=92=E4=BD=BF=E3=81=86?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/home_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb index e6c0f933606..e911287e508 100644 --- a/app/helpers/home_helper.rb +++ b/app/helpers/home_helper.rb @@ -11,7 +11,7 @@ def today_or_tommorow(event) def event_date(event) if event.event_day? - Date.today + Date.current elsif event.tomorrow_event? Date.tomorrow end From c02ebc5aee01b932dfa7bb6edd1e8227a5a66498 Mon Sep 17 00:00:00 2001 From: tominaga Date: Sat, 4 Feb 2023 10:51:43 +0900 Subject: [PATCH 13/41] =?UTF-8?q?&.=E3=82=92=E4=BD=BF=E3=81=86=E3=82=88?= =?UTF-8?q?=E3=81=86=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/home_controller.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index a9ea9d7e6f2..42dc2304197 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -67,11 +67,9 @@ def display_regular_events_on_dashboard regular_events_comming_soon = RegularEvent.today_events + RegularEvent.tomorrow_events @regular_events_comming_soon = regular_events_comming_soon.select { |event| event.participated_by?(current_user) } - if cookies_ids - cookies_ids.each do |id| - @regular_events_comming_soon.delete_if do |event| - event.id == id.to_i - end + cookies_ids&.each do |id| + @regular_events_comming_soon.delete_if do |event| + event.id == id.to_i end end end From 8200c94d370c5e65a3310f23954670a88515b212 Mon Sep 17 00:00:00 2001 From: tominaga Date: Sat, 4 Feb 2023 11:29:45 +0900 Subject: [PATCH 14/41] =?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=8C=E5=8F=82=E5=8A=A0?= =?UTF-8?q?=E3=81=99=E3=82=8B=E8=BF=91=E6=97=A5=E9=96=8B=E5=82=AC=E5=AE=9A?= =?UTF-8?q?=E6=9C=9F=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E3=81=AE=E5=A4=89?= =?UTF-8?q?=E6=95=B0=E5=90=8D=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/home_controller.rb | 4 ++-- app/views/home/index.html.slim | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 42dc2304197..e6e61594c79 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -65,10 +65,10 @@ def display_events_on_dashboard def display_regular_events_on_dashboard cookies_ids = JSON.parse(cookies[:confirmed_regular_event_ids]) if cookies[:confirmed_regular_event_ids] regular_events_comming_soon = RegularEvent.today_events + RegularEvent.tomorrow_events - @regular_events_comming_soon = regular_events_comming_soon.select { |event| event.participated_by?(current_user) } + @regular_events_comming_soon_for_current_user = regular_events_comming_soon.select { |event| event.participated_by?(current_user) } cookies_ids&.each do |id| - @regular_events_comming_soon.delete_if do |event| + @regular_events_comming_soon_for_current_user.delete_if do |event| event.id == id.to_i end end diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim index 26fe6db1858..a76141a3c20 100644 --- a/app/views/home/index.html.slim +++ b/app/views/home/index.html.slim @@ -11,10 +11,10 @@ #events_on_dashboard.confirmed_event .page-notices = render partial: 'event', collection: @events_coming_soon_except_job_hunting, as: :event - - if @regular_events_comming_soon.present? + - if @regular_events_comming_soon_for_current_user.present? #events_on_dashboard.confirmed_event .page-notices - = render partial: 'regular_event', collection: @regular_events_comming_soon, as: :regular_event + = render partial: 'regular_event', collection: @regular_events_comming_soon_for_current_user, as: :regular_event - if current_user.adviser? = render 'adviser_dashboard' From 28c858a517bad372905831f85884e1fb2139b335 Mon Sep 17 00:00:00 2001 From: tominaga Date: Sat, 4 Feb 2023 12:01:56 +0900 Subject: [PATCH 15/41] =?UTF-8?q?=E5=AE=9A=E6=9C=9F=E3=82=A4=E3=83=99?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=83=86=E3=82=B9=E3=83=88=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E3=81=AE=E9=96=8B=E5=A7=8B=E6=99=82=E9=96=93=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/fixtures/regular_events.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/fixtures/regular_events.yml b/db/fixtures/regular_events.yml index 3c036104261..33a9a60a7ed 100644 --- a/db/fixtures/regular_events.yml +++ b/db/fixtures/regular_events.yml @@ -69,7 +69,7 @@ regular_event8: description: ダッシュボード表示確認用テスト定期イベント(当日用) finished: false hold_national_holiday: true - start_at: <%= Time.zone.local(2020, 1, 1, 21, 58, 0) %> + start_at: <%= Time.zone.local(2020, 1, 1, 23, 58, 0) %> end_at: <%= Time.zone.local(2020, 1, 1, 23, 59, 0) %> user: komagata From 75053852c6b8f52584f0f32301ae6e9d82605f22 Mon Sep 17 00:00:00 2001 From: tominaga Date: Sat, 4 Feb 2023 12:19:37 +0900 Subject: [PATCH 16/41] =?UTF-8?q?=E3=83=87=E3=82=B3=E3=83=AC=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E3=83=BC=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/decorators/regular_event_decorator_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/decorators/regular_event_decorator_test.rb b/test/decorators/regular_event_decorator_test.rb index 8b0660793ea..1f3a7fc1031 100644 --- a/test/decorators/regular_event_decorator_test.rb +++ b/test/decorators/regular_event_decorator_test.rb @@ -8,7 +8,7 @@ class RegularEventDecoratorTest < ActiveSupport::TestCase def setup ActiveDecorator::ViewContext.push(controller.view_context) @regular_event = ActiveDecorator::Decorator.instance.decorate(regular_events(:regular_event1)) - @finished_regular_event = ActiveDecorator::Decorator.instance.decorate(regular_events(:regular_event8)) + @finished_regular_event = ActiveDecorator::Decorator.instance.decorate(regular_events(:regular_event10)) end test '#holding_cycles' do From 5f6dc0740daf8b168d939293fc1f1697bcda60d7 Mon Sep 17 00:00:00 2001 From: tominaga Date: Sat, 4 Feb 2023 12:47:35 +0900 Subject: [PATCH 17/41] =?UTF-8?q?prettier=E3=81=AE=E8=AD=A6=E5=91=8A?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/incoming-events.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/app/javascript/incoming-events.js b/app/javascript/incoming-events.js index 38c5008e233..c1503841e71 100644 --- a/app/javascript/incoming-events.js +++ b/app/javascript/incoming-events.js @@ -8,19 +8,20 @@ document.addEventListener('DOMContentLoaded', () => { const eventType = event.getAttribute('data-event-type') const button = event.querySelector('.js-close-event') const key = { - Event: 'confirmed_event_ids=', - RegularEvent: 'confirmed_regular_event_ids=' - }[eventType] + Event: 'confirmed_event_ids=', + RegularEvent: 'confirmed_regular_event_ids=' + }[eventType] button.addEventListener('click', () => { document - .querySelector(`.page-notices__item[data-event-id="${eventId}"][data-event-type="${eventType}"]`) + .querySelector( + `.page-notices__item[data-event-id="${eventId}"][data-event-type="${eventType}"]` + ) .remove() if ( - document.cookie - .split('; ') - .find((row) => row.startsWith(key)) === undefined + document.cookie.split('; ').find((row) => row.startsWith(key)) === + undefined ) { saveCookie(key, [eventId]) } else { @@ -43,10 +44,7 @@ document.addEventListener('DOMContentLoaded', () => { function saveCookie(key, eventIds) { const secondsFor30days = 2592000 document.cookie = - key + - JSON.stringify(eventIds) + - ';max-age=' + - secondsFor30days + key + JSON.stringify(eventIds) + ';max-age=' + secondsFor30days } function updateEventIds(key, latestCookie, eventId) { From 2c495ee11cafc0b8e7d6af6470cfd37c76f88147 Mon Sep 17 00:00:00 2001 From: teppei machida Date: Wed, 15 Feb 2023 22:56:17 +0900 Subject: [PATCH 18/41] =?UTF-8?q?=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=80=81=E5=AE=9A=E6=9C=9F=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=AEpage-notice=20=E3=81=AB=E3=83=87=E3=82=B6=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=82=92=E5=85=A5=E3=82=8C=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/blocks/page/_page-notices.sass | 2 ++ .../stylesheets/atoms/_a-page-notice.sass | 12 ++++++++---- app/views/home/_event.html.slim | 4 ++-- app/views/home/_regular_event.html.slim | 4 ++-- app/views/home/index.html.slim | 17 +++++++---------- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/assets/stylesheets/application/blocks/page/_page-notices.sass b/app/assets/stylesheets/application/blocks/page/_page-notices.sass index 26623667158..2cac330a6e8 100644 --- a/app/assets/stylesheets/application/blocks/page/_page-notices.sass +++ b/app/assets/stylesheets/application/blocks/page/_page-notices.sass @@ -3,5 +3,7 @@ background-color: $success .page-notices__item + .a-badge + min-width: 5rem &:not(:first-child) border-top: dashed 1px rgba(white, .2) diff --git a/app/assets/stylesheets/atoms/_a-page-notice.sass b/app/assets/stylesheets/atoms/_a-page-notice.sass index a79ae784b7a..0c9bdbeb44c 100644 --- a/app/assets/stylesheets/atoms/_a-page-notice.sass +++ b/app/assets/stylesheets/atoms/_a-page-notice.sass @@ -22,6 +22,7 @@ &.has-close position: relative display: flex + text-align: left p +text-block(1em 1.5, $reversal-text) +media-breakpoint-up(md) @@ -35,16 +36,20 @@ text-decoration: none +media-breakpoint-down(sm) display: block - position: relative - padding-left: 4rem .a-badge margin-right: .75rem background-color: rgba(black, .4) border: none +media-breakpoint-down(sm) - +position(absolute, left 0, top 0) .a-page-notice__label +hover-link-reversal + +media-breakpoint-up(md) + max-width: 17.5rem + overflow: hidden + text-overflow: ellipsis + display: inline-block + white-space: nowrap + vertical-align: bottom .a-page-notice__inner-start flex: 1 @@ -58,7 +63,6 @@ font-size: 1.5rem opacity: .6 transition: all .2s ease-out - margin-left: .5rem transform: translateX(1rem) +margin(vertical, -.75rem) &:hover diff --git a/app/views/home/_event.html.slim b/app/views/home/_event.html.slim index 575f32cb87c..bc6ae7cea55 100644 --- a/app/views/home/_event.html.slim +++ b/app/views/home/_event.html.slim @@ -1,11 +1,11 @@ .page-notices__item(data-event-id="#{event.id}" data-event-type="#{event.class}") .a-page-notice.page-notice - .container.is-lg + .container.is-md .a-page-notice__inner.has-close .a-page-notice__inner-start p = link_to event, itemprop: 'url', class: 'has-badge' do - span.a-badge.is-primary.is-sm + span.a-badge.is-primary.is-xs | イベント = today_or_tommorow(event) = l event.start_at.to_date, format: :md diff --git a/app/views/home/_regular_event.html.slim b/app/views/home/_regular_event.html.slim index 8f1c46bbe08..ed57d6b4141 100644 --- a/app/views/home/_regular_event.html.slim +++ b/app/views/home/_regular_event.html.slim @@ -1,11 +1,11 @@ .page-notices__item(data-event-id="#{regular_event.id}" data-event-type="#{regular_event.class}") .a-page-notice.page-notice - .container.is-lg + .container.is-md .a-page-notice__inner.has-close .a-page-notice__inner-start p = link_to regular_event, itemprop: 'url', class: 'has-badge' do - span.a-badge.is-primary.is-sm + span.a-badge.is-primary.is-xs | 定期イベント = today_or_tommorow(regular_event) = l event_date(regular_event), format: :md diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim index a76141a3c20..add9b1b1415 100644 --- a/app/views/home/index.html.slim +++ b/app/views/home/index.html.slim @@ -3,18 +3,15 @@ = render 'page_tabs', user: current_user .page-body.is-dash-board - - if @events_coming_soon.present? && current_user.job_seeker + - if @events_coming_soon.present? || @regular_events_comming_soon_for_current_user.present? #events_on_dashboard.confirmed_event .page-notices - = render partial: 'event', collection: @events_coming_soon, as: :event - - if @events_coming_soon_except_job_hunting.present? && !current_user.job_seeker - #events_on_dashboard.confirmed_event - .page-notices - = render partial: 'event', collection: @events_coming_soon_except_job_hunting, as: :event - - if @regular_events_comming_soon_for_current_user.present? - #events_on_dashboard.confirmed_event - .page-notices - = render partial: 'regular_event', collection: @regular_events_comming_soon_for_current_user, as: :regular_event + - if @events_coming_soon.present? && current_user.job_seeker + = render partial: 'event', collection: @events_coming_soon, as: :event + - if @events_coming_soon_except_job_hunting.present? && !current_user.job_seeker + = render partial: 'event', collection: @events_coming_soon_except_job_hunting, as: :event + - if @regular_events_comming_soon_for_current_user.present? + = render partial: 'regular_event', collection: @regular_events_comming_soon_for_current_user, as: :regular_event - if current_user.adviser? = render 'adviser_dashboard' From 13ad335458109c35268239d5eb9eb015c9f53ce6 Mon Sep 17 00:00:00 2001 From: tominaga Date: Fri, 17 Feb 2023 19:58:55 +0900 Subject: [PATCH 19/41] =?UTF-8?q?Date.current=E3=82=92=E4=BD=BF=E3=81=86?= =?UTF-8?q?=E3=82=88=E3=81=86=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/fixtures/regular_event_repeat_rules.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/fixtures/regular_event_repeat_rules.yml b/db/fixtures/regular_event_repeat_rules.yml index 9de659268d9..060381f72a2 100644 --- a/db/fixtures/regular_event_repeat_rules.yml +++ b/db/fixtures/regular_event_repeat_rules.yml @@ -35,7 +35,7 @@ regular_event_repeat_rule7: regular_event_repeat_rule8: frequency: 0 - day_of_the_week: <%= Date.today.wday %> + day_of_the_week: <%= Date.current.wday %> regular_event: regular_event8 regular_event_repeat_rule9: From 6f5463e9b5dde64b8c2e4928180ade5087ddd069 Mon Sep 17 00:00:00 2001 From: tominaga Date: Tue, 21 Feb 2023 23:32:35 +0900 Subject: [PATCH 20/41] =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89?= =?UTF-8?q?=E5=90=8D=E3=82=92holding=5Ftoday=3F=E3=81=A8holding=5Ftomorrow?= =?UTF-8?q?=3F=E3=81=AB=E3=81=9D=E3=82=8C=E3=81=9E=E3=82=8C=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/decorators/regular_event_decorator.rb | 2 +- app/helpers/home_helper.rb | 8 ++++---- app/models/event.rb | 4 ++-- app/models/regular_event.rb | 8 ++++---- test/models/event_test.rb | 12 ++++++------ test/models/regular_event_test.rb | 6 +++--- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/decorators/regular_event_decorator.rb b/app/decorators/regular_event_decorator.rb index 3c4af0595c0..966a749a0a5 100644 --- a/app/decorators/regular_event_decorator.rb +++ b/app/decorators/regular_event_decorator.rb @@ -12,7 +12,7 @@ def holding_cycles def next_holding_date if finished '開催終了' - elsif event_day? + elsif holding_today? '本日開催' else "次回の開催日は #{l next_event_date} です" diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb index e911287e508..24bdf0ed74d 100644 --- a/app/helpers/home_helper.rb +++ b/app/helpers/home_helper.rb @@ -2,17 +2,17 @@ module HomeHelper def today_or_tommorow(event) - if event.event_day? + if event.holding_today? '今日' - elsif event.tomorrow_event? + elsif event.holding_tomorrow? '明日' end end def event_date(event) - if event.event_day? + if event.holding_today? Date.current - elsif event.tomorrow_event? + elsif event.holding_tomorrow? Date.tomorrow end end diff --git a/app/models/event.rb b/app/models/event.rb index d4f15cbf90c..5d77062857d 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -107,11 +107,11 @@ def send_notification(receiver) NotificationFacade.moved_up_event_waiting_user(self, receiver) end - def event_day? + def holding_today? start_at.to_date.today? end - def tomorrow_event? + def holding_tomorrow? start_at.to_date == Date.tomorrow end diff --git a/app/models/regular_event.rb b/app/models/regular_event.rb index 3cfd110f391..ca6e5c5ca60 100644 --- a/app/models/regular_event.rb +++ b/app/models/regular_event.rb @@ -68,7 +68,7 @@ def organizers users.with_attached_avatar.order('organizers.created_at') end - def event_day? + def holding_today? now = Time.current event_day = regular_event_repeat_rules.map do |repeat_rule| if repeat_rule.frequency.zero? @@ -116,7 +116,7 @@ def next_specific_day_of_the_week(repeat_rule) 0.days.ago.next_occurring(day_of_the_week_symbol).to_date end - def tomorrow_event? + def holding_tomorrow? tomorrow = Time.current.next_day regular_event_repeat_rules.map do |repeat_rule| if repeat_rule.frequency.zero? @@ -143,12 +143,12 @@ def participated_by?(user) class << self def today_events holding_events = RegularEvent.holding - holding_events.select(&:event_day?) + holding_events.select(&:holding_today?) end def tomorrow_events holding_events = RegularEvent.holding - holding_events.select(&:tomorrow_event?) + holding_events.select(&:holding_tomorrow?) end end diff --git a/test/models/event_test.rb b/test/models/event_test.rb index 0f7129e100e..5d94e74c815 100644 --- a/test/models/event_test.rb +++ b/test/models/event_test.rb @@ -85,25 +85,25 @@ class EventTest < ActiveSupport::TestCase assert Notification.where(user: user, sender: event.user, link: "/events/#{event.id}").exists? end - test '#event_day?' do + test '#holding_today?' do event = events(:event1) travel_to Time.zone.local(2019, 12, 20, 0, 0, 0) do - assert event.event_day? + assert event.holding_today? end travel_to Time.zone.local(2019, 12, 21, 0, 0, 0) do - assert_not event.event_day? + assert_not event.holding_today? end end - test '#tomorrow_event?' do + test '#holding_tomorrow?' do event = events(:event1) travel_to Time.zone.local(2019, 12, 19, 0, 0, 0) do - assert event.tomorrow_event? + assert event.holding_tomorrow? end travel_to Time.zone.local(2019, 12, 20, 0, 0, 0) do - assert_not event.tomorrow_event? + assert_not event.holding_tomorrow? end end diff --git a/test/models/regular_event_test.rb b/test/models/regular_event_test.rb index f0b62ce85af..b8ebe8d9451 100644 --- a/test/models/regular_event_test.rb +++ b/test/models/regular_event_test.rb @@ -15,14 +15,14 @@ class RegularEventTest < ActiveSupport::TestCase assert regular_event.invalid? end - test '#event_day?' do + test '#holding_today?' do regular_event = regular_events(:regular_event1) travel_to Time.zone.local(2022, 6, 5, 0, 0, 0) do - assert_equal true, regular_event.event_day? + assert regular_event.holding_today? end travel_to Time.zone.local(2022, 6, 1, 0, 0, 0) do - assert_equal false, regular_event.event_day? + assert_not regular_event.holding_today? end end From 9c2d641ebff166c1fe6b3a8d572a71bda54fd481 Mon Sep 17 00:00:00 2001 From: tominaga Date: Tue, 21 Feb 2023 23:48:23 +0900 Subject: [PATCH 21/41] =?UTF-8?q?RegularEvent#holding=5Ftomorrow=3F?= =?UTF-8?q?=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/models/regular_event_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/models/regular_event_test.rb b/test/models/regular_event_test.rb index b8ebe8d9451..4a6958740d7 100644 --- a/test/models/regular_event_test.rb +++ b/test/models/regular_event_test.rb @@ -58,6 +58,17 @@ class RegularEventTest < ActiveSupport::TestCase end end + test '#holding_tomorrow?' do + regular_event = regular_events(:regular_event1) + travel_to Time.zone.local(2023, 2, 25, 0, 0, 0) do + assert regular_event.holding_tomorrow? + end + + travel_to Time.zone.local(2023, 2, 26, 0, 0, 0) do + assert_not regular_event.holding_tomorrow? + end + end + test '#cancel_participation' do regular_event = regular_events(:regular_event1) participant = regular_event_participations(:regular_event_participation1).user From 39532fee6ba30b462df5a8947a9da3360fe0cc67 Mon Sep 17 00:00:00 2001 From: maimux2x Date: Tue, 14 Feb 2023 00:06:19 +0900 Subject: [PATCH 22/41] =?UTF-8?q?=E6=97=A5=E5=A0=B1=E4=B8=80=E8=A6=A7?= =?UTF-8?q?=E3=81=AE=E6=8A=95=E7=A8=BF=E8=80=85=E5=90=8D=E3=81=AE=E3=82=AB?= =?UTF-8?q?=E3=83=83=E3=82=B3=E5=86=85=E3=82=92=E5=90=8D=E5=89=8D=E3=81=A7?= =?UTF-8?q?=E3=81=AF=E3=81=AA=E3=81=8F=E3=80=8C=E5=90=8D=E5=89=8D=EF=BC=88?= =?UTF-8?q?=E3=82=AB=E3=83=8A=EF=BC=89=E3=80=8D=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/decorators/user_decorator.rb | 2 +- test/decorators/user_decorator_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index eb938e4aade..601a8525cb8 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -83,7 +83,7 @@ def title end def long_name - "#{login_name} (#{name})" + "#{name} (#{name_kana})" end def enrollment_period diff --git a/test/decorators/user_decorator_test.rb b/test/decorators/user_decorator_test.rb index 107d1e3076d..06a7d4355b6 100644 --- a/test/decorators/user_decorator_test.rb +++ b/test/decorators/user_decorator_test.rb @@ -28,7 +28,7 @@ def setup end test '#long_name' do - assert_equal 'hajime (Hajime Tayo)', @student_user.long_name + assert_equal 'Hajime Tayo (ハジメ タヨ)', @student_user.long_name end test '#enrollment_period' do From b880ec482f2766761bcec052aade2a49dff86168 Mon Sep 17 00:00:00 2001 From: maimux2x Date: Thu, 23 Feb 2023 15:22:23 +0900 Subject: [PATCH 23/41] =?UTF-8?q?=E5=90=8D=E5=89=8D=E3=81=AE=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E6=96=B9=E6=B3=95=E3=81=AE=E4=BF=AE=E6=AD=A3=E3=81=AB?= =?UTF-8?q?=E3=82=88=E3=81=A3=E3=81=A6=E8=90=BD=E3=81=A1=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=83=86=E3=82=B9=E3=83=88=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/system/announcements_test.rb | 9 +++++--- test/system/bookmark/talks_test.rb | 7 +++--- test/system/bookmarks_test.rb | 6 ++++-- test/system/events_test.rb | 11 ++++++---- test/system/home_test.rb | 3 ++- test/system/mentor/home_test.rb | 4 ++-- test/system/products_test.rb | 9 +++++--- test/system/talks_test.rb | 34 ++++++++++++++++++++++-------- 8 files changed, 56 insertions(+), 27 deletions(-) diff --git a/test/system/announcements_test.rb b/test/system/announcements_test.rb index 88b70212bd3..116a10277e2 100644 --- a/test/system/announcements_test.rb +++ b/test/system/announcements_test.rb @@ -211,9 +211,12 @@ class AnnouncementsTest < ApplicationSystemTestCase end end - test 'show user full_name next to user login_name' do - visit_with_auth "/announcements/#{announcements(:announcement1).id}", 'kimura' - assert_text 'komagata (Komagata Masaki)' + test 'show user name_kana next to user name' do + announcement = announcements(:announcement1) + user = announcement.user + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) + visit_with_auth "/announcements/#{announcement.id}", 'kimura' + assert_text decorated_user.long_name end test 'show comment count' do diff --git a/test/system/bookmark/talks_test.rb b/test/system/bookmark/talks_test.rb index 1cad6c452a1..c585c55da7a 100644 --- a/test/system/bookmark/talks_test.rb +++ b/test/system/bookmark/talks_test.rb @@ -6,11 +6,12 @@ class Bookmark::TalkTest < ApplicationSystemTestCase setup do @talk = talks(:talk1) @user = @talk.user + @decorated_user = ActiveDecorator::Decorator.instance.decorate(@user) end test 'show talk bookmark on lists' do visit_with_auth '/current_user/bookmarks', 'komagata' - assert_text "#{@user.login_name} (#{@user.name}) さんの相談部屋" + assert_text "#{@decorated_user.long_name} さんの相談部屋" end test 'show active button when bookmarked talk' do @@ -32,7 +33,7 @@ class Bookmark::TalkTest < ApplicationSystemTestCase assert_no_selector '#bookmark-button.is-inactive' visit '/current_user/bookmarks' - assert_text "#{@user.login_name} (#{@user.name}) さんの相談部屋" + assert_text "#{@decorated_user.long_name} さんの相談部屋" end test 'unbookmark talk' do @@ -43,7 +44,7 @@ class Bookmark::TalkTest < ApplicationSystemTestCase assert_no_selector '#bookmark-button.is-active' visit '/current_user/bookmarks' - assert_no_text "#{@user.login_name} (#{@user.name}) さんの相談部屋" + assert_no_text "#{@decorated_user.long_name} さんの相談部屋" end test 'hide bookmark button when mentor login' do diff --git a/test/system/bookmarks_test.rb b/test/system/bookmarks_test.rb index c6c0cf0c830..eef3b6d4cc4 100644 --- a/test/system/bookmarks_test.rb +++ b/test/system/bookmarks_test.rb @@ -93,14 +93,16 @@ class BookmarksTest < ApplicationSystemTestCase end test 'delete bookmark from bookmarks' do + user = @report.user + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth report_path(@report), 'komagata' assert_text 'Bookmark中' visit current_user_bookmarks_path - assert_text 'komagata (Komagata Masaki) さんの相談部屋' + assert_text "#{decorated_user.long_name} さんの相談部屋" find(:css, '#spec-edit-mode').set(true) assert_selector '.card-list-item__option' first('#bookmark-button').click - assert_no_text 'komagata (Komagata Masaki) さんの相談部屋' + assert_no_text "#{decorated_user.long_name} さんの相談部屋" visit report_path(@report) assert_text 'Bookmark' end diff --git a/test/system/events_test.rb b/test/system/events_test.rb index 6d1ceae6030..ad3368b8822 100644 --- a/test/system/events_test.rb +++ b/test/system/events_test.rb @@ -359,14 +359,17 @@ class EventsTest < ApplicationSystemTestCase assert_text 'Watch中' end - test 'show user full_name next to user login_name' do - visit_with_auth event_path(events(:event2)), 'kimura' - assert_text 'komagata (Komagata Masaki)' + test 'show user name_kana next to user name' do + event = events(:event2) + user = event.user + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) + visit_with_auth event_path(event), 'kimura' + assert_text decorated_user.long_name end test 'show user full name on list page' do visit_with_auth '/events', 'kimura' - assert_text 'komagata (Komagata Masaki)' + assert_text 'Komagata Masaki (コマガタ マサキ)' end test 'show pagination' do diff --git a/test/system/home_test.rb b/test/system/home_test.rb index 5b79a39f06e..3266e5c5415 100644 --- a/test/system/home_test.rb +++ b/test/system/home_test.rb @@ -307,7 +307,8 @@ class HomeTest < ApplicationSystemTestCase find_link pages(:page1).title assert_text I18n.l pages(:page1).created_at, format: :long user = talks(:talk1).user - find_link "#{user.login_name} (#{user.name}) さんの相談部屋" + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) + find_link "#{decorated_user.long_name} さんの相談部屋" reports.each do |report| find_link reports(report).title assert_text I18n.l reports(report).reported_on, format: :long diff --git a/test/system/mentor/home_test.rb b/test/system/mentor/home_test.rb index 3310f02d8bd..6d67c7fd32d 100644 --- a/test/system/mentor/home_test.rb +++ b/test/system/mentor/home_test.rb @@ -6,8 +6,8 @@ class Mentor::HomeTest < ApplicationSystemTestCase test 'GET /mentor' do visit_with_auth '/mentor', 'komagata' assert_equal 'メンターページ | FBC', title - assert_no_text 'jobseeker (就活 のぞむ)' - assert_text 'muryou (Muryou Nosuke)' + assert_no_text '就活 のぞむ (シュウカツ ノゾム)' + assert_text 'Muryou Nosuke (ムリョウ ノスケ)' end test 'accessed by non-mentor users' do diff --git a/test/system/products_test.rb b/test/system/products_test.rb index cff3d1f9fbf..cfcbba8b85e 100644 --- a/test/system/products_test.rb +++ b/test/system/products_test.rb @@ -391,9 +391,12 @@ class ProductsTest < ApplicationSystemTestCase assert_not page.has_css?('.pagination') end - test 'show user full_name next to user login_name' do - visit_with_auth "/products/#{products(:product1).id}", 'kimura' - assert_text 'mentormentaro (メンタ 麺太郎)' + test 'show user name_kana next to name' do + product = products(:product1) + visit_with_auth "/products/#{product.id}", 'kimura' + user = product.user + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) + assert_text decorated_user.long_name end test 'notice accessibility to open products on products index' do diff --git a/test/system/talks_test.rb b/test/system/talks_test.rb index 5bb5307a2c0..0f77d18b0dd 100644 --- a/test/system/talks_test.rb +++ b/test/system/talks_test.rb @@ -40,6 +40,7 @@ class TalksTest < ApplicationSystemTestCase test 'a talk room is shown up on unreplied tab when users except admin comments there' do user = users(:kimura) + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth "/talks/#{user.talk.id}", 'kimura' within('.thread-comment-form__form') do fill_in('new_comment[description]', with: 'test') @@ -51,18 +52,21 @@ class TalksTest < ApplicationSystemTestCase logout visit_with_auth '/talks', 'komagata' find('.page-tabs__item-link', text: '未返信').click - assert_text "#{user.login_name} (#{user.name}) さんの相談部屋" + assert_text "#{decorated_user.long_name} さんの相談部屋" end test 'admin can access user talk page from talks page' do talks(:talk7).update!(updated_at: Time.current) # user: kimura + user = users(:kimura) + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth '/talks', 'komagata' - click_link 'kimura (Kimura Tadasi) さんの相談部屋' + click_link "#{decorated_user.long_name} さんの相談部屋" assert_selector '.page-header__title', text: 'kimura' end test 'a talk room is removed from unreplied tab when admin comments there' do user = users(:with_hyphen) + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth "/talks/#{user.talk.id}", 'komagata' within('.thread-comment-form__form') do fill_in('new_comment[description]', with: 'test') @@ -72,43 +76,55 @@ class TalksTest < ApplicationSystemTestCase click_button 'コメントする' visit '/talks' find('.page-tabs__item-link', text: '未返信').click - assert_no_text "#{user.login_name} (#{user.name}) さんの相談部屋" + assert_no_text "#{decorated_user.long_name} さんの相談部屋" end test 'a list of current students is displayed' do + user = users(:hajime) + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth '/talks?target=student_and_trainee', 'komagata' find('#talks.loaded', wait: 10) - assert_text 'hajime (Hajime Tayo) さんの相談部屋' + assert_text "#{decorated_user.long_name} さんの相談部屋" end test 'a list of graduates is displayed' do + user = users(:sotugyou) + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth '/talks?target=graduate', 'komagata' find('#talks.loaded', wait: 10) - assert_text 'sotugyou (卒業 太郎) さんの相談部屋' + assert_text "#{decorated_user.long_name} さんの相談部屋" end test 'a list of advisers is displayed' do + user = users(:advijirou) + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth '/talks?target=adviser', 'komagata' find('#talks.loaded', wait: 10) - assert_text 'advijirou (アドバイ 次郎) さんの相談部屋' + assert_text "#{decorated_user.long_name} さんの相談部屋" end test 'a list of mentors is displayed' do + user = users(:machida) + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth '/talks?target=mentor', 'komagata' find('#talks.loaded', wait: 10) - assert_text 'machida (Machida Teppei) さんの相談部屋' + assert_text "#{decorated_user.long_name} さんの相談部屋" end test 'a list of trainees is displayed' do + user = users(:kensyu) + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth '/talks?target=trainee', 'komagata' find('#talks.loaded', wait: 10) - assert_text 'kensyu (Kensyu Seiko) さんの相談部屋' + assert_text "#{decorated_user.long_name} さんの相談部屋" end test 'a list of retire users is displayed' do + user = users(:yameo) + decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth '/talks?target=retired', 'komagata' find('#talks.loaded', wait: 10) - assert_text 'yameo (辞目 辞目夫) さんの相談部屋' + assert_text "#{decorated_user.long_name} さんの相談部屋" end test 'both public and private information is displayed' do From ec9742be153189a15325005a3152cd7dbb55ab7e Mon Sep 17 00:00:00 2001 From: maimux2x Date: Thu, 23 Feb 2023 15:40:19 +0900 Subject: [PATCH 24/41] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=83=87?= =?UTF-8?q?=E3=83=BC=E3=82=BF=E3=81=AE=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=81=BF?= =?UTF-8?q?=E6=96=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/system/talks_test.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/system/talks_test.rb b/test/system/talks_test.rb index 0f77d18b0dd..0551010d7d2 100644 --- a/test/system/talks_test.rb +++ b/test/system/talks_test.rb @@ -56,8 +56,9 @@ class TalksTest < ApplicationSystemTestCase end test 'admin can access user talk page from talks page' do - talks(:talk7).update!(updated_at: Time.current) # user: kimura - user = users(:kimura) + talk = talks(:talk7) + talk.update!(updated_at: Time.current) + user = talk.user decorated_user = ActiveDecorator::Decorator.instance.decorate(user) visit_with_auth '/talks', 'komagata' click_link "#{decorated_user.long_name} さんの相談部屋" From 4690fc2896f1d4a70bb30fb73e02da0fd79c4716 Mon Sep 17 00:00:00 2001 From: lef237 Date: Fri, 24 Feb 2023 18:42:38 +0900 Subject: [PATCH 25/41] =?UTF-8?q?=E3=83=9A=E3=83=BC=E3=82=B8=E3=83=8D?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=AE=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=88=86=E5=B2=90=E3=81=AE=E6=BC=8F=E3=82=8C=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E3=81=97=E3=81=9F=EF=BC=88show=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=A7=E3=83=9A=E3=83=BC=E3=82=B8=E3=83=8D=E3=83=BC=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/Reports.jsx | 6 +++--- app/views/reports/show.html.slim | 4 ++-- app/views/talks/show.html.slim | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/javascript/components/Reports.jsx b/app/javascript/components/Reports.jsx index cd69196995b..fe8c13e63bb 100644 --- a/app/javascript/components/Reports.jsx +++ b/app/javascript/components/Reports.jsx @@ -8,7 +8,7 @@ import Pagination from './Pagination' import PracticeFilterDropdown from './PracticeFilterDropdown' import UnconfirmedLink from './UnconfirmedLink' -export default function Reports({ all = false, userId = '', practices = false, unchecked = false, displayUserIcon = true, companyId = '', practiceId = '' }) { +export default function Reports({ all = false, userId = '', practices = false, unchecked = false, displayUserIcon = true, companyId = '', practiceId = '', displayPagination = true }) { const per = 20 const neighbours = 4 const defaultPage = parseInt(queryString.parse(location.search).page) || 1 @@ -73,7 +73,7 @@ export default function Reports({ all = false, userId = '', practices = false, u /> )}
    - {data.totalPages > 1 && ( + {data.totalPages > 1 && displayPagination && ( )} - {data.totalPages > 1 && ( + {data.totalPages > 1 && displayPagination && ( Date: Fri, 24 Feb 2023 20:05:23 +0000 Subject: [PATCH 26/41] Bump omniauth and omniauth-github Bumps [omniauth](https://github.com/omniauth/omniauth) and [omniauth-github](https://github.com/intridea/omniauth-github). These dependencies needed to be updated together. Updates `omniauth` from 1.9.2 to 2.1.1 - [Release notes](https://github.com/omniauth/omniauth/releases) - [Commits](https://github.com/omniauth/omniauth/compare/v1.9.2...v2.1.1) Updates `omniauth-github` from 1.4.0 to 2.0.1 - [Release notes](https://github.com/intridea/omniauth-github/releases) - [Commits](https://github.com/intridea/omniauth-github/compare/v1.4.0...v2.0.1) --- updated-dependencies: - dependency-name: omniauth dependency-type: direct:production - dependency-name: omniauth-github dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Gemfile | 4 ++-- Gemfile.lock | 27 +++++++++++++++------------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 0f78e315b39..26209bccf5d 100644 --- a/Gemfile +++ b/Gemfile @@ -41,8 +41,8 @@ gem 'net-pop', require: false gem 'net-smtp', require: false # TODO: Remove it if you use rails 7.0.1 gem 'newspaper' gem 'oauth2' -gem 'omniauth', '~> 1.9.2' -gem 'omniauth-github', '~> 1.4.0' +gem 'omniauth', '~> 2.1.1' +gem 'omniauth-github', '~> 2.0.1' gem 'pg' gem 'postmark-rails' gem 'rack-cors', require: 'rack/cors' diff --git a/Gemfile.lock b/Gemfile.lock index 76ca93f9a27..db689a78e14 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -147,10 +147,10 @@ GEM discord-notifier (1.0.3) erubi (1.11.0) execjs (2.8.1) - faraday (2.6.0) + faraday (2.7.4) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.1) + faraday-net_http (3.0.2) ffi (1.15.5) globalid (1.0.1) activesupport (>= 5.0) @@ -206,7 +206,7 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (2.6.2) - jwt (2.5.0) + jwt (2.7.0) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -281,15 +281,16 @@ GEM rack (>= 1.2, < 4) snaky_hash (~> 2.0) version_gem (~> 1.1) - omniauth (1.9.2) + omniauth (2.1.1) hashie (>= 3.4.6) - rack (>= 1.6.2, < 3) - omniauth-github (1.4.0) - omniauth (~> 1.5) - omniauth-oauth2 (>= 1.4.0, < 2.0) - omniauth-oauth2 (1.7.3) + rack (>= 2.2.3) + rack-protection + omniauth-github (2.0.1) + omniauth (~> 2.0) + omniauth-oauth2 (~> 1.8) + omniauth-oauth2 (1.8.0) oauth2 (>= 1.4, < 3) - omniauth (>= 1.9, < 3) + omniauth (~> 2.0) os (1.1.4) parallel (1.22.1) parser (3.1.2.1) @@ -321,6 +322,8 @@ GEM rack (>= 1.1, < 2.3) rack-mini-profiler (2.3.4) rack (>= 1.2.0) + rack-protection (3.0.5) + rack rack-proxy (0.7.4) rack rack-test (2.0.2) @@ -566,8 +569,8 @@ DEPENDENCIES net-smtp newspaper oauth2 - omniauth (~> 1.9.2) - omniauth-github (~> 1.4.0) + omniauth (~> 2.1.1) + omniauth-github (~> 2.0.1) pg postmark-rails pry-byebug From 3a4b4686190d1239937fee3ff37ea9d6eb6e16cc Mon Sep 17 00:00:00 2001 From: lef237 Date: Sat, 25 Feb 2023 20:21:08 +0900 Subject: [PATCH 27/41] =?UTF-8?q?=E5=85=A5=E4=BC=9A=E8=80=85=E3=81=AE?= =?UTF-8?q?=E3=82=B9=E3=82=B3=E3=83=BC=E3=83=97=E3=82=92=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin/campaigns_controller.rb | 1 + app/views/admin/campaigns/index.html.slim | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/campaigns_controller.rb b/app/controllers/admin/campaigns_controller.rb index 9bd6856bc14..8b4c20de02e 100644 --- a/app/controllers/admin/campaigns_controller.rb +++ b/app/controllers/admin/campaigns_controller.rb @@ -23,6 +23,7 @@ def create def index @campaigns = Campaign.order(end_at: :desc) + @normal_students = User.where(admin: false, mentor: false, adviser: false, trainee: false) @retired_students = User.retired_students end diff --git a/app/views/admin/campaigns/index.html.slim b/app/views/admin/campaigns/index.html.slim index 280b07ba521..02b52541acf 100644 --- a/app/views/admin/campaigns/index.html.slim +++ b/app/views/admin/campaigns/index.html.slim @@ -60,7 +60,7 @@ header.page-header td.admin-table__item-value.is-text-align-right | #{l campaign.end_at} td.admin-table__item-value.is-text-align-right - = students_joined_by_campaign = User.students.where(created_at: campaign.start_at..campaign.end_at).count + = students_joined_by_campaign = @normal_students.where(created_at: campaign.start_at..campaign.end_at).count td.admin-table__item-value.is-text-align-right - retired_students_joined_by_campaign = @retired_students.where(created_at: campaign.start_at..campaign.end_at).count - continued_students = students_joined_by_campaign - retired_students_joined_by_campaign From 0a35ec81525e78836472147acce3edf25910e3e1 Mon Sep 17 00:00:00 2001 From: lef237 Date: Sat, 25 Feb 2023 20:38:48 +0900 Subject: [PATCH 28/41] =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E3=82=92?= =?UTF-8?q?=E8=AA=AD=E3=81=BF=E3=82=84=E3=81=99=E3=81=8F=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin/campaigns_controller.rb | 1 + app/views/admin/campaigns/index.html.slim | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/campaigns_controller.rb b/app/controllers/admin/campaigns_controller.rb index 8b4c20de02e..8bbf93799e7 100644 --- a/app/controllers/admin/campaigns_controller.rb +++ b/app/controllers/admin/campaigns_controller.rb @@ -24,6 +24,7 @@ def create def index @campaigns = Campaign.order(end_at: :desc) @normal_students = User.where(admin: false, mentor: false, adviser: false, trainee: false) + @continued_students = User.where(admin: false, mentor: false, adviser: false, trainee: false, retired_on: nil) @retired_students = User.retired_students end diff --git a/app/views/admin/campaigns/index.html.slim b/app/views/admin/campaigns/index.html.slim index 02b52541acf..56ca613e8a2 100644 --- a/app/views/admin/campaigns/index.html.slim +++ b/app/views/admin/campaigns/index.html.slim @@ -62,11 +62,9 @@ header.page-header td.admin-table__item-value.is-text-align-right = students_joined_by_campaign = @normal_students.where(created_at: campaign.start_at..campaign.end_at).count td.admin-table__item-value.is-text-align-right - - retired_students_joined_by_campaign = @retired_students.where(created_at: campaign.start_at..campaign.end_at).count - - continued_students = students_joined_by_campaign - retired_students_joined_by_campaign - = continued_students + = continued_students_joined_by_campaign = @continued_students.where(created_at: campaign.start_at..campaign.end_at).count td.admin-table__item-value.is-text-align-right - = retired_students_joined_by_campaign + = students_joined_by_campaign - continued_students_joined_by_campaign td.admin-table__item-value.is-text-align-center ul.is-inline-buttons li From d4aefb21bc3ec48876391be29aee78dd8c727181 Mon Sep 17 00:00:00 2001 From: lef237 Date: Sat, 25 Feb 2023 20:41:11 +0900 Subject: [PATCH 29/41] =?UTF-8?q?=E4=BD=99=E8=A8=88=E3=81=AA=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=82=92=E5=89=8A=E9=99=A4=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin/campaigns_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/admin/campaigns_controller.rb b/app/controllers/admin/campaigns_controller.rb index 8bbf93799e7..6ae6b03c36e 100644 --- a/app/controllers/admin/campaigns_controller.rb +++ b/app/controllers/admin/campaigns_controller.rb @@ -25,7 +25,6 @@ def index @campaigns = Campaign.order(end_at: :desc) @normal_students = User.where(admin: false, mentor: false, adviser: false, trainee: false) @continued_students = User.where(admin: false, mentor: false, adviser: false, trainee: false, retired_on: nil) - @retired_students = User.retired_students end def edit; end From 38cf062475d9d84ea2205586b87ded867ac0c0a4 Mon Sep 17 00:00:00 2001 From: maimux2x Date: Sun, 26 Feb 2023 11:08:35 +0900 Subject: [PATCH 30/41] =?UTF-8?q?prettier=E3=81=AE=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=81=A7CI=E3=81=8C=E9=80=9A=E3=82=89=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=81=9F=E3=82=81=E3=80=81=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E3=81=8C=E7=99=BA=E7=94=9F=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/CommentUserIcon.jsx | 6 ++- app/javascript/components/Products.jsx | 10 ++-- app/javascript/components/Report.jsx | 4 +- app/javascript/components/Reports.jsx | 52 +++++++++++++------ 4 files changed, 45 insertions(+), 27 deletions(-) diff --git a/app/javascript/components/CommentUserIcon.jsx b/app/javascript/components/CommentUserIcon.jsx index 130297fde13..0d85f350ee6 100644 --- a/app/javascript/components/CommentUserIcon.jsx +++ b/app/javascript/components/CommentUserIcon.jsx @@ -1,8 +1,10 @@ import React from 'react' -export default function CommentUserIcon({comment}) { +export default function CommentUserIcon({ comment }) { return ( - + ) diff --git a/app/javascript/components/Products.jsx b/app/javascript/components/Products.jsx index 57489aab41f..a5fb3d1fe16 100644 --- a/app/javascript/components/Products.jsx +++ b/app/javascript/components/Products.jsx @@ -17,7 +17,7 @@ export default function Products({ title, selectedTab }) { setPage(page) }, [page]) - const unconfirmedLinksName= (() => { + const unconfirmedLinksName = (() => { return { all: '全ての提出物を一覧で開く', unchecked: '未完了の提出物を一覧で開く', @@ -27,10 +27,10 @@ export default function Products({ title, selectedTab }) { })() const url = (() => { - if (selectedTab === 'all') return ''; - if (selectedTab === 'unassigned') return '/unassigned'; - if (selectedTab === 'unchecked') return '/unchecked'; - if (selectedTab === 'self_assigned') return '/self_assigned'; + if (selectedTab === 'all') return '' + if (selectedTab === 'unassigned') return '/unassigned' + if (selectedTab === 'unchecked') return '/unchecked' + if (selectedTab === 'self_assigned') return '/self_assigned' })() const { data, error } = useSWR(`/api/products${url}?page=${page}`, fetcher) diff --git a/app/javascript/components/Report.jsx b/app/javascript/components/Report.jsx index 12894e632b4..00c047375bd 100644 --- a/app/javascript/components/Report.jsx +++ b/app/javascript/components/Report.jsx @@ -5,9 +5,7 @@ export default function Report({ report, currentUserId, displayUserIcon }) { return (
    - {displayUserIcon && ( - - )} + {displayUserIcon && }
    diff --git a/app/javascript/components/Reports.jsx b/app/javascript/components/Reports.jsx index fe8c13e63bb..1db25c9ddde 100644 --- a/app/javascript/components/Reports.jsx +++ b/app/javascript/components/Reports.jsx @@ -8,7 +8,16 @@ import Pagination from './Pagination' import PracticeFilterDropdown from './PracticeFilterDropdown' import UnconfirmedLink from './UnconfirmedLink' -export default function Reports({ all = false, userId = '', practices = false, unchecked = false, displayUserIcon = true, companyId = '', practiceId = '', displayPagination = true }) { +export default function Reports({ + all = false, + userId = '', + practices = false, + unchecked = false, + displayUserIcon = true, + companyId = '', + practiceId = '', + displayPagination = true +}) { const per = 20 const neighbours = 4 const defaultPage = parseInt(queryString.parse(location.search).page) || 1 @@ -25,18 +34,18 @@ export default function Reports({ all = false, userId = '', practices = false, u const { data, error } = useSWR( practices - ? `/api/reports.json?user_id=${userId}&page=${page}&practice_id=${userPracticeId}` - : unchecked - ? `/api/reports/unchecked.json?page=${page}&user_id=${userId}` - : userId !== '' - ? `/api/reports.json?page=${page}&user_id=${userId}` - : practiceId !== '' - ? `/api/reports.json?page=${page}&practice_id=${practiceId}` - : companyId !== '' - ? `/api/reports.json?page=${page}&company_id=${companyId}` - : all === true - ? `/api/reports.json?page=${page}&practice_id=${userPracticeId}` - : console.log('data_fetched!'), + ? `/api/reports.json?user_id=${userId}&page=${page}&practice_id=${userPracticeId}` + : unchecked + ? `/api/reports/unchecked.json?page=${page}&user_id=${userId}` + : userId !== '' + ? `/api/reports.json?page=${page}&user_id=${userId}` + : practiceId !== '' + ? `/api/reports.json?page=${page}&practice_id=${practiceId}` + : companyId !== '' + ? `/api/reports.json?page=${page}&company_id=${companyId}` + : all === true + ? `/api/reports.json?page=${page}&practice_id=${userPracticeId}` + : console.log('data_fetched!'), fetcher ) @@ -119,10 +128,19 @@ const NoReports = ({ unchecked }) => { return (
    - {unchecked - ? <>

    未チェックの日報はありません

    - : <>

    '日報はまだありません。'

    - } + {unchecked ? ( + <> + +

    + 未チェックの日報はありません +

    + + ) : ( + <> + +

    '日報はまだありません。'

    + + )}
    ) From e26b1eff95d3b29222ef5985d9f14d0e3f7be75e Mon Sep 17 00:00:00 2001 From: OdenTakashi Date: Sat, 21 Jan 2023 16:32:43 +0900 Subject: [PATCH 31/41] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=95=E3=83=AA?= =?UTF-8?q?=E3=82=AF=E3=83=88=E3=81=AE=E8=A7=A3=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/decorators/user_decorator.rb | 2 ++ test/decorators/user_decorator_test.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index eb938e4aade..f1f4241e316 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -9,6 +9,7 @@ def roles roles = [] roles << :retired if retired_on? + roles << :hibernationed if hibernated_at? roles << :admin if admin? roles << :mentor if mentor? roles << :adviser if adviser? @@ -39,6 +40,7 @@ def roles_to_s roles = [ { role: '退会ユーザー', value: retired_on? }, + { role: '休会ユーザー', value: hibernated_at? }, { role: '管理者', value: admin }, { role: 'メンター', value: mentor }, { role: 'アドバイザー', value: adviser }, diff --git a/test/decorators/user_decorator_test.rb b/test/decorators/user_decorator_test.rb index 107d1e3076d..a3249cb7438 100644 --- a/test/decorators/user_decorator_test.rb +++ b/test/decorators/user_decorator_test.rb @@ -15,6 +15,7 @@ def setup @mentor_user = ActiveDecorator::Decorator.instance.decorate(users(:mentormentaro)) @trainee_user = ActiveDecorator::Decorator.instance.decorate(users(:kensyu)) @retired_user = ActiveDecorator::Decorator.instance.decorate(users(:taikai)) + @hibernationed_user = ActiveDecorator::Decorator.instance.decorate(users(:kyuukai)) end test '#staff_roles' do @@ -49,5 +50,6 @@ def setup assert_equal 'メンター', @mentor_user.roles_to_s assert_equal '研修生', @trainee_user.roles_to_s assert_equal '退会ユーザー', @retired_user.roles_to_s + assert_equal '休会ユーザー', @hibernationed_user.roles_to_s end end From dee6abf470a3a435ab28d885feda05103dd4b9f8 Mon Sep 17 00:00:00 2001 From: OdenTakashi Date: Tue, 31 Jan 2023 15:56:49 +0900 Subject: [PATCH 32/41] =?UTF-8?q?rubocop=E3=81=8C=E9=80=9A=E3=82=89?= =?UTF-8?q?=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F=E3=81=9F=E3=82=81role?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/decorators/user_decorator.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index f1f4241e316..dc65ae336f6 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -6,15 +6,17 @@ def twitter_url end def roles - roles = [] - - roles << :retired if retired_on? - roles << :hibernationed if hibernated_at? - roles << :admin if admin? - roles << :mentor if mentor? - roles << :adviser if adviser? - roles << :graduate if graduated_on? - roles << :trainee if trainee? + role_list = [ + { role: 'retired', value: retired? }, + { role: 'hibernated', value: hibernated? }, + { role: 'admin', value: admin }, + { role: 'mentor', value: mentor }, + { role: 'adviser', value: adviser }, + { role: 'graduate', value: graduated? }, + { role: 'trainee', value: trainee } + ] + roles = role_list.find_all { |v| v[:value] } + .map { |v| v[:role] } roles << :student if roles.empty? roles From 0a55a6c72a747becb2c211db86900a40a9d5fa01 Mon Sep 17 00:00:00 2001 From: OdenTakashi Date: Tue, 31 Jan 2023 16:31:44 +0900 Subject: [PATCH 33/41] =?UTF-8?q?=E3=83=A2=E3=83=87=E3=83=AB=E3=81=A7?= =?UTF-8?q?=E5=AE=9A=E7=BE=A9=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84=E3=82=8B?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=AB=E7=BD=AE=E3=81=8D?= =?UTF-8?q?=E6=8F=9B=E3=81=88=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/decorators/user_decorator.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index dc65ae336f6..cf7ad14a319 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -8,7 +8,7 @@ def twitter_url def roles role_list = [ { role: 'retired', value: retired? }, - { role: 'hibernated', value: hibernated? }, + { role: 'hibernationed', value: hibernated? }, { role: 'admin', value: admin }, { role: 'mentor', value: mentor }, { role: 'adviser', value: adviser }, @@ -41,12 +41,12 @@ def roles_to_s return '' if roles.empty? roles = [ - { role: '退会ユーザー', value: retired_on? }, - { role: '休会ユーザー', value: hibernated_at? }, + { role: '退会ユーザー', value: retired? }, + { role: '休会ユーザー', value: hibernated? }, { role: '管理者', value: admin }, { role: 'メンター', value: mentor }, { role: 'アドバイザー', value: adviser }, - { role: '卒業生', value: graduated_on? }, + { role: '卒業生', value: graduated? }, { role: '研修生', value: trainee } ] roles.find_all { |v| v[:value] } From c0f24e5e33485c2b898ccba9991c5448e3b2ca16 Mon Sep 17 00:00:00 2001 From: OdenTakashi Date: Mon, 27 Feb 2023 14:49:59 +0900 Subject: [PATCH 34/41] =?UTF-8?q?boolean=E3=82=92=E8=BF=94=E3=81=99?= =?UTF-8?q?=E3=81=93=E3=81=A8=E3=81=8C=E3=82=8F=E3=81=8B=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/decorators/user_decorator.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index cf7ad14a319..cf26f3dc39f 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -9,11 +9,11 @@ def roles role_list = [ { role: 'retired', value: retired? }, { role: 'hibernationed', value: hibernated? }, - { role: 'admin', value: admin }, - { role: 'mentor', value: mentor }, - { role: 'adviser', value: adviser }, + { role: 'admin', value: admin? }, + { role: 'mentor', value: mentor? }, + { role: 'adviser', value: adviser? }, { role: 'graduate', value: graduated? }, - { role: 'trainee', value: trainee } + { role: 'trainee', value: trainee? } ] roles = role_list.find_all { |v| v[:value] } .map { |v| v[:role] } @@ -28,9 +28,9 @@ def primary_role def staff_roles staff_roles = [ - { role: '管理者', value: admin }, - { role: 'メンター', value: mentor }, - { role: 'アドバイザー', value: adviser } + { role: '管理者', value: admin? }, + { role: 'メンター', value: mentor? }, + { role: 'アドバイザー', value: adviser? } ] staff_roles.find_all { |v| v[:value] } .map { |v| v[:role] } @@ -43,11 +43,11 @@ def roles_to_s roles = [ { role: '退会ユーザー', value: retired? }, { role: '休会ユーザー', value: hibernated? }, - { role: '管理者', value: admin }, - { role: 'メンター', value: mentor }, - { role: 'アドバイザー', value: adviser }, + { role: '管理者', value: admin? }, + { role: 'メンター', value: mentor? }, + { role: 'アドバイザー', value: adviser? }, { role: '卒業生', value: graduated? }, - { role: '研修生', value: trainee } + { role: '研修生', value: trainee? } ] roles.find_all { |v| v[:value] } .map { |v| v[:role] } From 45a37a58a61fbd6c7b9f067e84dc1af8e7eca8d8 Mon Sep 17 00:00:00 2001 From: maimux2x Date: Sun, 26 Feb 2023 10:23:53 +0900 Subject: [PATCH 35/41] =?UTF-8?q?Question=E4=BD=9C=E6=88=90=E6=99=82?= =?UTF-8?q?=E3=81=AEmentor=E3=81=B8=E3=81=AEWatch=E4=BD=9C=E6=88=90?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=82=92newspaper=E3=81=AB=E7=BD=AE=E3=81=8D?= =?UTF-8?q?=E6=8F=9B=E3=81=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/questions_controller.rb | 1 + app/controllers/questions_controller.rb | 3 ++- .../creating_mentors_watch_for_question.rb | 20 +++++++++++++++++++ app/models/question_callbacks.rb | 18 ----------------- config/initializers/newspaper.rb | 2 ++ 5 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 app/models/creating_mentors_watch_for_question.rb diff --git a/app/controllers/api/questions_controller.rb b/app/controllers/api/questions_controller.rb index 6c030174534..4ffa090a7a2 100644 --- a/app/controllers/api/questions_controller.rb +++ b/app/controllers/api/questions_controller.rb @@ -31,6 +31,7 @@ def show def update question = Question.find(params[:id]) if question.update(question_params) + Newspaper.publish(:question_create, question) unless question.watched? head :ok else head :bad_request diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index 6c26c33e584..d7f384cf9dd 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -4,7 +4,7 @@ class QuestionsController < ApplicationController include Rails.application.routes.url_helpers before_action :set_question, only: %i[show destroy] before_action :set_categories, only: %i[new show create] - before_action :set_watch, only: %i[show] + before_action :set_watch, only: %i[show create] QuestionsProperty = Struct.new(:title, :empty_message) @@ -55,6 +55,7 @@ def create @question.user = current_user @question.wip = params[:commit] == 'WIP' if @question.save + Newspaper.publish(:question_create, @question) unless @question.wip redirect_to @question, notice: notice_message(@question) else render :new diff --git a/app/models/creating_mentors_watch_for_question.rb b/app/models/creating_mentors_watch_for_question.rb new file mode 100644 index 00000000000..d478cee3a2c --- /dev/null +++ b/app/models/creating_mentors_watch_for_question.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class CreatingMentorsWatchForQuestion + def call(question) + watch_question_records = watch_records(question) + Watch.insert_all(watch_question_records) # rubocop:disable Rails/SkipsModelValidations + end + + def watch_records(question) + User.mentor.map do |mentor| + { + watchable_type: 'Question', + watchable_id: question.id, + created_at: Time.current, + updated_at: Time.current, + user_id: mentor.id + } + end + end +end diff --git a/app/models/question_callbacks.rb b/app/models/question_callbacks.rb index 5f8ad6952f1..8053f6710d9 100644 --- a/app/models/question_callbacks.rb +++ b/app/models/question_callbacks.rb @@ -5,7 +5,6 @@ def after_save(question) return unless question.saved_change_to_attribute?(:published_at, from: nil) send_notification_to_mentors(question) - create_mentors_watch(question) notify_to_chat(question) Cache.delete_not_solved_question_count end @@ -33,21 +32,4 @@ def send_notification_to_mentors(question) def delete_notification(question) Notification.where(link: "/questions/#{question.id}").destroy_all end - - def create_mentors_watch(question) - watch_question_records = watch_records(question) - Watch.insert_all(watch_question_records) # rubocop:disable Rails/SkipsModelValidations - end - - def watch_records(question) - User.mentor.map do |mentor| - { - watchable_type: 'Question', - watchable_id: question.id, - created_at: Time.current, - updated_at: Time.current, - user_id: mentor.id - } - end - end end diff --git a/config/initializers/newspaper.rb b/config/initializers/newspaper.rb index e31740ace81..310ae236514 100644 --- a/config/initializers/newspaper.rb +++ b/config/initializers/newspaper.rb @@ -42,4 +42,6 @@ product_notifier = ProductNotifier.new Newspaper.subscribe(:product_create, product_notifier) Newspaper.subscribe(:product_update, product_notifier) + + Newspaper.subscribe(:question_create, CreatingMentorsWatchForQuestion.new) end From d611012d5298000a2f341fe1dc25637dbac3530f Mon Sep 17 00:00:00 2001 From: maimux2x Date: Thu, 9 Feb 2023 23:07:45 +0900 Subject: [PATCH 36/41] =?UTF-8?q?=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E3=81=84=E3=81=9F=E3=81=A0=E3=81=84=E3=81=9F=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit controllerに書いていた条件分岐をcreating_mentors_watch_for_question.rb側へ移行 --- app/controllers/api/questions_controller.rb | 2 +- app/controllers/questions_controller.rb | 2 +- app/models/creating_mentors_watch_for_question.rb | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/questions_controller.rb b/app/controllers/api/questions_controller.rb index 4ffa090a7a2..60c52d48616 100644 --- a/app/controllers/api/questions_controller.rb +++ b/app/controllers/api/questions_controller.rb @@ -31,7 +31,7 @@ def show def update question = Question.find(params[:id]) if question.update(question_params) - Newspaper.publish(:question_create, question) unless question.watched? + Newspaper.publish(:question_create, question) head :ok else head :bad_request diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index d7f384cf9dd..89d159b2e09 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -55,7 +55,7 @@ def create @question.user = current_user @question.wip = params[:commit] == 'WIP' if @question.save - Newspaper.publish(:question_create, @question) unless @question.wip + Newspaper.publish(:question_create, @question) redirect_to @question, notice: notice_message(@question) else render :new diff --git a/app/models/creating_mentors_watch_for_question.rb b/app/models/creating_mentors_watch_for_question.rb index d478cee3a2c..4e2fa7be6d4 100644 --- a/app/models/creating_mentors_watch_for_question.rb +++ b/app/models/creating_mentors_watch_for_question.rb @@ -2,6 +2,7 @@ class CreatingMentorsWatchForQuestion def call(question) + return if question.wip? || question.watched? watch_question_records = watch_records(question) Watch.insert_all(watch_question_records) # rubocop:disable Rails/SkipsModelValidations end From 438ad943f368b330ae78299fe4d3bb7fd7f9d050 Mon Sep 17 00:00:00 2001 From: maimux2x Date: Fri, 10 Feb 2023 00:00:14 +0900 Subject: [PATCH 37/41] =?UTF-8?q?rubocop=E3=81=AE=E6=8C=87=E6=91=98?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ガード節の後に空行を追加 --- app/models/creating_mentors_watch_for_question.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/creating_mentors_watch_for_question.rb b/app/models/creating_mentors_watch_for_question.rb index 4e2fa7be6d4..42731ff16f1 100644 --- a/app/models/creating_mentors_watch_for_question.rb +++ b/app/models/creating_mentors_watch_for_question.rb @@ -3,6 +3,7 @@ class CreatingMentorsWatchForQuestion def call(question) return if question.wip? || question.watched? + watch_question_records = watch_records(question) Watch.insert_all(watch_question_records) # rubocop:disable Rails/SkipsModelValidations end From 9c947eff3e2cd224348a301a204aef535b1fafe3 Mon Sep 17 00:00:00 2001 From: maimux2x Date: Sun, 26 Feb 2023 10:25:22 +0900 Subject: [PATCH 38/41] =?UTF-8?q?create=E3=81=A8update=E3=81=A7newspaper?= =?UTF-8?q?=E3=81=AE=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=97=E3=82=92=E5=88=86?= =?UTF-8?q?=E3=81=91=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/questions_controller.rb | 2 +- app/controllers/questions_controller.rb | 2 +- config/initializers/newspaper.rb | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/questions_controller.rb b/app/controllers/api/questions_controller.rb index 60c52d48616..ff4c91d071d 100644 --- a/app/controllers/api/questions_controller.rb +++ b/app/controllers/api/questions_controller.rb @@ -31,7 +31,7 @@ def show def update question = Question.find(params[:id]) if question.update(question_params) - Newspaper.publish(:question_create, question) + Newspaper.publish(:question_update, question) head :ok else head :bad_request diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index 89d159b2e09..fdbca686578 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -4,7 +4,7 @@ class QuestionsController < ApplicationController include Rails.application.routes.url_helpers before_action :set_question, only: %i[show destroy] before_action :set_categories, only: %i[new show create] - before_action :set_watch, only: %i[show create] + before_action :set_watch, only: %i[show] QuestionsProperty = Struct.new(:title, :empty_message) diff --git a/config/initializers/newspaper.rb b/config/initializers/newspaper.rb index 310ae236514..96e9236598e 100644 --- a/config/initializers/newspaper.rb +++ b/config/initializers/newspaper.rb @@ -39,9 +39,15 @@ Newspaper.subscribe(:page_create, page_notifier) Newspaper.subscribe(:page_update, page_notifier) +<<<<<<< HEAD product_notifier = ProductNotifier.new Newspaper.subscribe(:product_create, product_notifier) Newspaper.subscribe(:product_update, product_notifier) Newspaper.subscribe(:question_create, CreatingMentorsWatchForQuestion.new) +======= + creating_mentors_watch_for_question = CreatingMentorsWatchForQuestion.new + Newspaper.subscribe(:question_create, creating_mentors_watch_for_question) + Newspaper.subscribe(:question_update, creating_mentors_watch_for_question) +>>>>>>> 7792e7778 (createとupdateでnewspaperの呼び出しを分けた) end From bfede30633a85a13bd0d5430edd6e036d1127d97 Mon Sep 17 00:00:00 2001 From: maimux2x Date: Sun, 26 Feb 2023 10:27:05 +0900 Subject: [PATCH 39/41] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=A8=E3=82=AF=E3=83=A9=E3=82=B9=E5=90=8D=E3=82=92CreatingM?= =?UTF-8?q?entorsWatchForQueestion=E3=81=8B=E3=82=89MentorsWatchForQuestio?= =?UTF-8?q?nCreator=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...or_question.rb => mentors_watch_for_question_creator.rb} | 2 +- config/initializers/newspaper.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) rename app/models/{creating_mentors_watch_for_question.rb => mentors_watch_for_question_creator.rb} (93%) diff --git a/app/models/creating_mentors_watch_for_question.rb b/app/models/mentors_watch_for_question_creator.rb similarity index 93% rename from app/models/creating_mentors_watch_for_question.rb rename to app/models/mentors_watch_for_question_creator.rb index 42731ff16f1..f4adfd2daa0 100644 --- a/app/models/creating_mentors_watch_for_question.rb +++ b/app/models/mentors_watch_for_question_creator.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreatingMentorsWatchForQuestion +class MentorsWatchForQuestionCreator def call(question) return if question.wip? || question.watched? diff --git a/config/initializers/newspaper.rb b/config/initializers/newspaper.rb index 96e9236598e..b875460d656 100644 --- a/config/initializers/newspaper.rb +++ b/config/initializers/newspaper.rb @@ -39,6 +39,7 @@ Newspaper.subscribe(:page_create, page_notifier) Newspaper.subscribe(:page_update, page_notifier) +<<<<<<< HEAD <<<<<<< HEAD product_notifier = ProductNotifier.new Newspaper.subscribe(:product_create, product_notifier) @@ -50,4 +51,9 @@ Newspaper.subscribe(:question_create, creating_mentors_watch_for_question) Newspaper.subscribe(:question_update, creating_mentors_watch_for_question) >>>>>>> 7792e7778 (createとupdateでnewspaperの呼び出しを分けた) +======= + mentors_watch_for_question_creator = MentorsWatchForQuestionCreator.new + Newspaper.subscribe(:question_create, mentors_watch_for_question_creator) + Newspaper.subscribe(:question_update, mentors_watch_for_question_creator) +>>>>>>> dd2eaab4c (ファイルとクラス名をCreatingMentorsWatchForQueestionからMentorsWatchForQuestionCreatorに修正した) end From ccb8925a230c39dff865ab4dd8bd0df73eed5355 Mon Sep 17 00:00:00 2001 From: maimux2x Date: Sun, 26 Feb 2023 10:31:23 +0900 Subject: [PATCH 40/41] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=95=E3=83=AA?= =?UTF-8?q?=E3=82=AF=E3=83=88=E3=81=AE=E8=A7=A3=E6=B6=88=E9=96=93=E9=81=95?= =?UTF-8?q?=E3=81=84=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/initializers/newspaper.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/config/initializers/newspaper.rb b/config/initializers/newspaper.rb index b875460d656..217a4be8e3f 100644 --- a/config/initializers/newspaper.rb +++ b/config/initializers/newspaper.rb @@ -39,21 +39,11 @@ Newspaper.subscribe(:page_create, page_notifier) Newspaper.subscribe(:page_update, page_notifier) -<<<<<<< HEAD -<<<<<<< HEAD product_notifier = ProductNotifier.new Newspaper.subscribe(:product_create, product_notifier) Newspaper.subscribe(:product_update, product_notifier) - Newspaper.subscribe(:question_create, CreatingMentorsWatchForQuestion.new) -======= - creating_mentors_watch_for_question = CreatingMentorsWatchForQuestion.new - Newspaper.subscribe(:question_create, creating_mentors_watch_for_question) - Newspaper.subscribe(:question_update, creating_mentors_watch_for_question) ->>>>>>> 7792e7778 (createとupdateでnewspaperの呼び出しを分けた) -======= mentors_watch_for_question_creator = MentorsWatchForQuestionCreator.new Newspaper.subscribe(:question_create, mentors_watch_for_question_creator) Newspaper.subscribe(:question_update, mentors_watch_for_question_creator) ->>>>>>> dd2eaab4c (ファイルとクラス名をCreatingMentorsWatchForQueestionからMentorsWatchForQuestionCreatorに修正した) end From 0914317b1a359f82249c2d10876c2bff0ade82ed Mon Sep 17 00:00:00 2001 From: teppei machida Date: Wed, 1 Mar 2023 17:19:43 +0900 Subject: [PATCH 41/41] =?UTF-8?q?=E8=B3=AA=E5=95=8F=E5=80=8B=E5=88=A5?= =?UTF-8?q?=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AEDOM=E6=A7=8B=E9=80=A0?= =?UTF-8?q?=E3=81=AB=E9=87=8D=E8=A4=87=E3=81=8C=E3=81=82=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/components/question-page.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/components/question-page.vue b/app/javascript/components/question-page.vue index b144ff6504a..9c8fc54b5c0 100644 --- a/app/javascript/components/question-page.vue +++ b/app/javascript/components/question-page.vue @@ -1,8 +1,8 @@