Skip to content

Commit

Permalink
Merge pull request #6441 from fjordllc/main
Browse files Browse the repository at this point in the history
Release 2023-05-04 08:08:45
  • Loading branch information
komagata committed May 8, 2023
2 parents 872c9ef + e892fda commit 82886ec
Show file tree
Hide file tree
Showing 74 changed files with 828 additions and 211 deletions.
1 change: 1 addition & 0 deletions .cloudbuild/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ steps:
path: /cloudsql
env:
- RAILS_ENV=production
- DISABLE_DATABASE_ENVIRONMENT_CHECK=1
- DB_HOST=/cloudsql/$_CLOUD_SQL_HOST
- DB_NAME=$_DB_NAME
- DB_PASS=$_DB_PASS
Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def index
.page(params[:page])
@products_grouped_by_elapsed_days = @products.group_by { |product| product.elapsed_days >= 7 ? 7 : product.elapsed_days }
@products = @products.joins(:user).where(users: { company_id: params[:company_id] }) if params[:company_id]
@products = @products.where(user_id: params[:user_id]) if params[:user_id].present?
end

def show
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def update

def destroy
@event.destroy
redirect_to events_path, notice: 'イベントを削除しました。'
redirect_to events_path, notice: '特別イベントを削除しました。'
end

private
Expand Down Expand Up @@ -73,9 +73,9 @@ def set_wip
def notice_message(event)
case params[:action]
when 'create'
event.wip? ? 'イベントをWIPとして保存しました。' : 'イベントを作成しました。'
event.wip? ? '特別イベントをWIPとして保存しました。' : '特別イベントを作成しました。'
when 'update'
event.wip? ? 'イベントをWIPとして保存しました。' : 'イベントを更新しました。'
event.wip? ? '特別イベントをWIPとして保存しました。' : '特別イベントを更新しました。'
end
end

Expand All @@ -88,6 +88,6 @@ def copy_event(new_event)
new_event.description = event.description
new_event.job_hunting = event.job_hunting

flash.now[:notice] = 'イベントをコピーしました。'
flash.now[:notice] = '特別イベントをコピーしました。'
end
end
7 changes: 2 additions & 5 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,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_for_current_user = regular_events_comming_soon.select { |event| event.participated_by?(current_user) }
@today_regular_events, @tomorrow_regular_events = RegularEvent.comming_soon_events(current_user)

cookies_ids&.each do |id|
@regular_events_comming_soon_for_current_user.delete_if do |event|
event.id == id.to_i
end
RegularEvent.remove_event([@today_regular_events, @tomorrow_regular_events], id)
end
end

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def update
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_another_mentor_assigned_as_checker
notice_product_update if @product.checker_id.present?
else
render :edit
Expand Down Expand Up @@ -128,11 +128,11 @@ def notice_message(product, action_name)
end
end

def notice_another_mentor_assined_as_checker
def notice_another_mentor_assigned_as_checker
@checker_id = @product.checker_id
return unless @checker_id && admin_or_mentor_login? && (@checker_id != current_user.id) && !@product.wip?

NotificationFacade.assigned_as_checker(@product, User.find(@checker_id))
ActivityDelivery.with(product: @product, receiver: User.find(@checker_id)).notify(:assigned_as_checker)
end

def notice_product_update
Expand Down
19 changes: 19 additions & 0 deletions app/controllers/scheduler/daily/send_message_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

class Scheduler::Daily::SendMessageController < SchedulerController
def show
User.mark_message_as_sent_for_hibernated_student
sent_student_followup_message
head :ok
end

private

def sent_student_followup_message
User.students.find_each do |student|
next unless student.followup_message_target?

User.create_followup_comment(student)
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def notify_to_mentors(user)
end

def notify_to_chat(user)
ChatNotifier.message "#{user.name}さんが新たなメンバーとしてJOINしました🎉\r#{url_for(user)}"
ChatNotifier.message "#{user.login_name}さんが新たなメンバーとしてJOINしました🎉\r#{url_for(user)}"
end

def user_params
Expand Down
8 changes: 0 additions & 8 deletions app/helpers/home_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ def today_or_tommorow(event)
end
end

def event_date(event)
if event.holding_today?
Date.current
elsif event.holding_tomorrow?
Date.tomorrow
end
end

def anchor_to_required_field(attribute)
{
avatar_attached: 'form-user-avatar',
Expand Down
8 changes: 0 additions & 8 deletions app/helpers/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ def user_tab_attrs(name)
end
end

def user_tr_attrs(user)
if user.active?
{ class: 'active' }
else
{ class: 'inactive' }
end
end

def user_github_url(user)
"https://github.com/#{user.github_account}"
end
Expand Down
68 changes: 68 additions & 0 deletions app/javascript/components/user-products.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<template lang="pug">
.card-list.a-card
.card-header.is-sm
h2.card-header__title
| 提出物
.card-list__items(v-if='products && products.length > 0')
product(
v-for='product in products',
:key='product.id',
:product='product',
:current-user-id='currentUserId',
:is-mentor='isMentor')
.card-body(v-else)
.card__description
.o-empty-message
.o-empty-message__icon
i.fa-regular.fa-sad-tear
.o-empty-message__text
| 提出物はまだありません。
</template>
<script>
import Product from '../product.vue'
export default {
name: 'UserProducts',
components: {
product: Product
},
props: {
userId: { type: Number, default: null },
isMentor: { type: Boolean, required: true },
currentUserId: { type: String, required: true }
},
data() {
return {
products: null
}
},
computed: {
newParams() {
const params = new URL(location.href).searchParams
if (this.userId) {
params.set('user_id', this.userId)
}
return params
},
productsAPI() {
const params = this.newParams
return `/api/products.json?${params}`
}
},
created() {
this.getProducts()
},
methods: {
async getProducts() {
const response = await fetch(this.productsAPI, {
method: 'GET',
headers: { 'X-Requested-With': 'XMLHttpRequest' },
credentials: 'same-origin',
redirect: 'manual'
}).catch((error) => console.warn(error))
const json = await response.json().catch((error) => console.warn(error))
this.products = json.products
}
}
}
</script>
3 changes: 0 additions & 3 deletions app/javascript/components/user-recent-reports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ export default {
}
return params
},
newURL() {
return `${location.pathname}?${this.newParams}`
},
reportsAPI() {
const params = this.newParams
return `/api/reports.json?${params}`
Expand Down
11 changes: 6 additions & 5 deletions app/javascript/components/users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
.page-content.is-users
.users__items
.row(v-if='!loaded')
.loading
.fa-solid.fa-spinner.fa-pulse
| ロード中
loadingUsersListPlaceholder(v-for='num in itemCount', :key='num')
div(v-else-if='users.length !== 0')
.user-list(v-show='!showSearchedUsers')
nav.pagination(v-if='totalPages > 1')
Expand Down Expand Up @@ -50,12 +48,14 @@
import User from './user.vue'
import Pager from '../pager.vue'
import Debounce from '../debounce.js'
import LoadingUsersListPlaceholder from '../loading-users-list-placeholder.vue'
export default {
name: 'Users',
components: {
user: User,
pager: Pager
pager: Pager,
loadingUsersListPlaceholder: LoadingUsersListPlaceholder
},
data() {
return {
Expand All @@ -69,7 +69,8 @@ export default {
searchUsersWord: '',
showSearchedUsers: false,
searchedUsers: [],
loaded: false
loaded: false,
itemCount: 12
}
},
computed: {
Expand Down
39 changes: 39 additions & 0 deletions app/javascript/loading-users-list-placeholder.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template lang="pug">
.col-xxl-3.col-xl-4.col-lg-4.col-md-6.col-xs-12
.users-item
.users-item__inner.a-card
.users-item__header
.users-item__header-inner
.users-item__header-start
.users-item__icon
.users-item__user-icon-image.a-user-icon.a-placeholder
.users-item__header-end
.card-list-item__rows
.card-list-item__row
.card-list-item-title.a-placeholder
.card-list-item__row
.card-list-item-meta
.card-list-item-meta__items
.card-list-item-meta__item.a-placeholder
.card-list-item-meta__item.a-placeholder
.sns-links
.sns-links__items.is-button-group.a-placeholder
.users-item__body
.users-item__description.a-short-text.a-placeholder
.users-item__tags
.tag-links
.tag-links__items
.tag-links__item.a-placeholder
.tag-links__item.a-placeholder
.completed-practices-progress
.completed-practices-progress__bar-container
.completed-practices-progress__bar.a-placeholder
.completed-practices-progress__number.a-placeholder
.card-footer
.card-main-actions
.card-main-actions__items
.card-main-actions__item
.following
.following__summary
.a-button.is-secondary.is-sm.is-block.a-placeholder
</template>
2 changes: 2 additions & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import QuestionPage from '../components/question-page.vue'
import QuestionEdit from '../components/question-edit.vue'
import SadReports from '../components/sad_reports.vue'
import AdminPractices from '../components/admin-practices.vue'
import UserProducts from '../components/user-products.vue'

import '../stylesheets/application'

Expand All @@ -112,6 +113,7 @@ mounter.addComponent(QuestionPage)
mounter.addComponent(QuestionEdit)
mounter.addComponent(SadReports)
mounter.addComponent(AdminPractices)
mounter.addComponent(UserProducts)
mounter.mount()

// Support component names relative to this directory:
Expand Down
7 changes: 4 additions & 3 deletions app/javascript/product.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="pug">
.card-list-item.has-assigned(:class='product.wip ? "is-wip" : ""')
.card-list-item__inner
.card-list-item__user
.card-list-item__user(v-if='displayUserIcon')
a.card-list-item__user-link(:href='product.user.url')
span(:class='["a-user-role", roleClass]')
img.card-list-item__user-icon.a-user-icon(
Expand All @@ -26,7 +26,7 @@
.card-list-item-meta__items
.card-list-item-meta__item
a.a-user-name(:href='product.user.url')
| {{ product.user.login_name }}
| {{ product.user.long_name }}
.card-list-item__row
.card-list-item-meta
.card-list-item-meta__items
Expand Down Expand Up @@ -121,7 +121,8 @@ export default {
props: {
product: { type: Object, required: true },
isMentor: { type: Boolean, required: true },
currentUserId: { type: String, required: true }
currentUserId: { type: String, required: true },
displayUserIcon: { type: Boolean }
},
computed: {
roleClass() {
Expand Down
9 changes: 6 additions & 3 deletions app/javascript/products.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ div(:class='contentClassName')(v-else)
:key='product.id',
:product='product',
:currentUserId='currentUserId',
:isMentor='isMentor')
:isMentor='isMentor',
:display-user-icon='displayUserIcon')
template(v-for='product_n_days_passed in productsGroupedByElapsedDays') <!-- product_n_days_passedはn日経過の提出物 -->
.a-card(:class='cardClassName')(
v-if='!isDashboard || (isDashboard && product_n_days_passed.elapsed_days >= 5)')
Expand Down Expand Up @@ -74,7 +75,8 @@ div(:class='contentClassName')(v-else)
:key='product.id',
:product='product',
:currentUserId='currentUserId',
:isMentor='isMentor')
:isMentor='isMentor',
:display-user-icon='displayUserIcon')
unconfirmed-links-open-button(
v-if='isMentor && selectedTab != "all" && !isDashboard',
:label='`${unconfirmedLinksName}の提出物を一括で開く`')
Expand Down Expand Up @@ -106,7 +108,8 @@ export default {
selectedTab: { type: String, required: true },
isMentor: { type: Boolean, required: true },
currentUserId: { type: String, required: true },
checkerId: { type: String, required: false, default: null }
checkerId: { type: String, required: false, default: null },
displayUserIcon: { type: Boolean, default: true }
},
data() {
return {
Expand Down
Loading

0 comments on commit 82886ec

Please sign in to comment.