Skip to content

Commit 2f69620

Browse files
authored
Merge pull request #2095 from opensource-workshop/2.23.0
Merge v1.23.0 into 2
2 parents f06cba6 + 2a73c0a commit 2f69620

File tree

15 files changed

+492
-393
lines changed

15 files changed

+492
-393
lines changed

.github/workflows/laravel_dusk_connect-cms-test-matrix-daily.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,38 @@ jobs:
134134
# https://stackoverflow.com/questions/76980975/chrome-driver-failing-in-laravel-dusk-failed-to-open-stream-http-request-fai
135135
# https://voicetechno-jp.secure-web.jp/ChromeDriverV115orNewer.html
136136
# https://github.com/browser-actions/setup-chrome (community)
137-
- name: Downgrade Chrome browser to v114
138-
uses: browser-actions/setup-chrome@latest
137+
# - name: Downgrade Chrome browser to v114
138+
# uses: browser-actions/setup-chrome@latest
139+
# with:
140+
# chrome-version: 1134343 # Last commit number for Chrome v114
141+
142+
# - name: Chrome bin-path Override
143+
# run: sudo ln -nfs `which chrome` /usr/bin/google-chrome
144+
145+
# - name: Downgrade Chrome driver to v114
146+
# run: php artisan dusk:chrome-driver 114
147+
148+
- name: Set env CHROME_VERSION
149+
run: |
150+
echo CHROME_VERSION=`/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1` >> $GITHUB_ENV
151+
152+
# https://github.com/browser-actions/setup-chrome (community)
153+
- name: Download Chrome and Chrome Driver(use Chrome Driver Only)
154+
uses: browser-actions/setup-chrome@v1
155+
id: setup-chrome
139156
with:
140-
chrome-version: 1134343 # Last commit number for Chrome v114
157+
chrome-version: ${{ env.CHROME_VERSION }}
158+
install-chromedriver: true
141159

142-
- name: Chrome bin-path Override
143-
run: sudo ln -nfs `which chrome` /usr/bin/google-chrome
160+
- name: Chrome Driver Copy
161+
run: sudo \cp -f ${{ steps.setup-chrome.outputs.chromedriver-path }} ./vendor/laravel/dusk/bin/chromedriver-linux
144162

145-
- name: Downgrade Chrome driver to v114
146-
run: php artisan dusk:chrome-driver 114
163+
- name: Chrome Driver Permission Denied 対応
164+
run: |
165+
sudo chmod +x ./vendor/laravel/dusk/bin/chromedriver-linux
147166
148167
- name: Start Chrome Driver
149-
run: ./vendor/laravel/dusk/bin/chromedriver-linux &
168+
run: ./vendor/laravel/dusk/bin/chromedriver-linux --port=9515 &
150169

151170
- name: Run Laravel Server
152171
run: php artisan serve &

app/Plugins/Manage/GroupManage/GroupManage.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use App\Enums\UserStatus;
66
use App\Models\Common\Group;
77
use App\Models\Common\GroupUser;
8+
use App\Models\Common\PageRole;
89
use App\Plugins\Manage\ManagePluginBase;
910
use App\User;
1011
use App\Utilities\String\StringUtils;
@@ -182,7 +183,17 @@ private function getSaveDisplaySequence($display_sequence, $id)
182183
*/
183184
public function delete($request, $id)
184185
{
185-
// カテゴリ削除
186+
// deleted_id, deleted_nameを自動セットするため、複数件削除する時はdestroy()を利用する。
187+
$page_role_ids = PageRole::where('group_id', $id)->pluck('id');
188+
$group_user_ids = GroupUser::where('group_id', $id)->pluck('id');
189+
190+
// ページ権限削除
191+
PageRole::destroy($page_role_ids);
192+
193+
// グループユーザー削除
194+
GroupUser::destroy($group_user_ids);
195+
196+
// グループ削除
186197
Group::find($id)->delete();
187198

188199
// 削除後は一覧画面へ

app/Plugins/User/Blogs/BlogsPlugin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,7 @@ public function rss($request, $page_id, $frame_id, $id = null)
14501450
$replaceTarget = array('<br>', '&nbsp;', '&emsp;', '&ensp;');
14511451
$description = str_replace($replaceTarget, '', $description);
14521452
}
1453+
$description = StringUtils::xmlspecialchars(strip_tags(html_entity_decode($description)));
14531454
$pub_date = date(DATE_RSS, strtotime($blogs_post->posted_at));
14541455
$content = StringUtils::xmlspecialchars(strip_tags(html_entity_decode($blogs_post->post_text)));
14551456
echo <<<EOD

app/Plugins/User/Faqs/FaqsPlugin.php

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -530,19 +530,33 @@ public function show($request, $page_id, $frame_id, $faqs_posts_id = null)
530530
$after_post = null;
531531
if ($faqs_post) {
532532
$before_post = FaqsPosts::where('faqs_id', $faqs_post->faqs_id)
533-
->where('posted_at', '<', $faqs_post->posted_at)
534-
->where(function ($query) {
535-
$query = $this->appendAuthWhere($query);
536-
})
537-
->orderBy('posted_at', 'desc')
538-
->first();
533+
->where(function ($query) use ($faqs_post) {
534+
$query->where('posted_at', '<', $faqs_post->posted_at)
535+
->orWhere(function ($subQuery) use ($faqs_post) {
536+
$subQuery->where('posted_at', '=', $faqs_post->posted_at)
537+
->where('id', '<', $faqs_post->id);
538+
});
539+
})
540+
->where(function ($query) {
541+
$query = $this->appendAuthWhere($query);
542+
})
543+
->orderBy('posted_at', 'desc')
544+
->orderBy('id', 'desc')
545+
->first();
539546
$after_post = FaqsPosts::where('faqs_id', $faqs_post->faqs_id)
540-
->where('posted_at', '>', $faqs_post->posted_at)
541-
->where(function ($query) {
542-
$query = $this->appendAuthWhere($query);
543-
})
544-
->orderBy('posted_at', 'asc')
545-
->first();
547+
->where(function ($query) use ($faqs_post) {
548+
$query->where('posted_at', '>', $faqs_post->posted_at)
549+
->orWhere(function ($subQuery) use ($faqs_post) {
550+
$subQuery->where('posted_at', '=', $faqs_post->posted_at)
551+
->where('id', '>', $faqs_post->id);
552+
});
553+
})
554+
->where(function ($query) {
555+
$query = $this->appendAuthWhere($query);
556+
})
557+
->orderBy('posted_at', 'asc')
558+
->orderBy('id', 'asc')
559+
->first();
546560
}
547561

548562
// 詳細画面を呼び出す。

app/Plugins/User/Reservations/ReservationsPlugin.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ public function saveBooking($request, $page_id, $frame_id, $booking_id = null)
849849
$validator_array['message']['rrule_until'] = '指定日';
850850
} else {
851851
// 指定の回数後 COUNT とみなす
852-
$validator_array['column']['rrule_count'] = ['required', 'numeric'];
852+
$validator_array['column']['rrule_count'] = ['required', 'numeric', 'min:1'];
853853
$validator_array['message']['rrule_count'] = '指定の回数後';
854854
}
855855

@@ -915,7 +915,14 @@ public function saveBooking($request, $page_id, $frame_id, $booking_id = null)
915915
}
916916
} else {
917917
// 指定の回数後 COUNT とみなす
918-
$rrule_setting['COUNT'] = (int) $request->rrule_count;
918+
// COUNT must be a positive integer (> 0) エラー対応. 0以下は1にrruleを仮設定して、入力チェックでエラーとする
919+
// (警告:ルールにUNTILまたはCOUNTの部分がない場合、無限ループになります)
920+
$rrule_count = (int) $request->rrule_count;
921+
if ($rrule_count >= 1) {
922+
$rrule_setting['COUNT'] = $rrule_count;
923+
} else {
924+
$rrule_setting['COUNT'] = 1;
925+
}
919926
}
920927

921928
$rrule = new RRule($rrule_setting);

app/Traits/ConnectRoleTrait.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use App\User;
1313
use App\Models\Common\Page;
1414
use App\Models\Common\PageRole;
15+
use App\Models\Core\UsersRoles;
1516

1617
trait ConnectRoleTrait
1718
{
@@ -229,6 +230,14 @@ public function choiceUserRolesOrPageRoles(User $user, ?Collection $page_roles):
229230
// $user_roles['base'] = ['role_reporter' => 1]; // ←ページ権限あれば上書き
230231
// $user_roles['manage'] = ['admin_system' => 1]; // ←ページ権限ではセットしてないので、そのまま
231232
$user_roles = $user->user_roles;
233+
if (is_null($user_roles)) {
234+
// ユーザーオブジェクトにロールデータを付与
235+
// app\Providers\ConnectEloquentUserProvider::judgmentLogin() よりコピー. 通常の画面ログインであれば、
236+
// judgmentLogin() でセットされているが、APIだとセットされていないため対応
237+
$users_roles = new UsersRoles();
238+
$user_roles = $users_roles->getUsersRoles($user->id);
239+
$user->user_roles = $user_roles;
240+
}
232241

233242
// 所属グループのページ権限取得
234243
$user_page_roles = $this->getUserPageRoles($user, $page_roles);

app/Utilities/String/StringUtils.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ public static function getNobrValue($value)
107107
*/
108108
public static function xmlspecialchars(string $string) :string
109109
{
110-
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE | ENT_XML1);
110+
$string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE | ENT_XML1);
111+
$string = str_replace('&', '&amp;', $string);
112+
return $string;
111113
}
112114

113115
// /**

0 commit comments

Comments
 (0)