mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-24 03:59:08 -05:00
Merge branch '6.x.x' into update-user-privacy
This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE.
|
||||
*
|
||||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
||||
* The details is bundled with this project in the file LICENSE.txt.
|
||||
*
|
||||
* @project UNIT3D Community Edition
|
||||
*
|
||||
* @author Roardom <roardom@protonmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use App\Enums\UserGroups;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Group;
|
||||
use App\Models\User;
|
||||
use App\Models\UserNotification;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class NotificationSettingController extends Controller
|
||||
{
|
||||
/**
|
||||
* Update user notification settings.
|
||||
*/
|
||||
public function update(Request $request, User $user): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
\abort_unless($request->user()->id === $user->id, 403);
|
||||
|
||||
$notification = $user->notification;
|
||||
|
||||
if ($notification === null) {
|
||||
$notification = new UserNotification();
|
||||
$notification->setDefaultValues();
|
||||
$notification->user_id = $user->id;
|
||||
}
|
||||
|
||||
$validGroups = Group::query()
|
||||
->where('is_modo', '=', '0')
|
||||
->where('is_admin', '=', '0')
|
||||
->where('id', '!=', UserGroups::VALIDATING)
|
||||
->where('id', '!=', UserGroups::PRUNED)
|
||||
->where('id', '!=', UserGroups::BANNED)
|
||||
->where('id', '!=', UserGroups::DISABLED)
|
||||
->pluck('id');
|
||||
|
||||
$request->validate([
|
||||
'show_account_follow' => 'required|boolean',
|
||||
'show_account_unfollow' => 'required|boolean',
|
||||
'show_following_upload' => 'required|boolean',
|
||||
'show_bon_gift' => 'required|boolean',
|
||||
'show_subscription_forum' => 'required|boolean',
|
||||
'show_subscription_topic' => 'required|boolean',
|
||||
'show_request_comment' => 'required|boolean',
|
||||
'show_request_bounty' => 'required|boolean',
|
||||
'show_request_fill' => 'required|boolean',
|
||||
'show_request_fill_approve' => 'required|boolean',
|
||||
'show_request_fill_reject' => 'required|boolean',
|
||||
'show_request_claim' => 'required|boolean',
|
||||
'show_request_unclaim' => 'required|boolean',
|
||||
'show_torrent_comment' => 'required|boolean',
|
||||
'show_torrent_thank' => 'required|boolean',
|
||||
'show_torrent_tip' => 'required|boolean',
|
||||
'show_mention_torrent_comment' => 'required|boolean',
|
||||
'show_mention_request_comment' => 'required|boolean',
|
||||
'show_mention_article_comment' => 'required|boolean',
|
||||
'show_mention_forum_post' => 'required|boolean',
|
||||
'show_forum_topic' => 'required|boolean',
|
||||
'json_account_groups' => 'array',
|
||||
'json_account_groups.*' => Rule::in($validGroups),
|
||||
'json_bon_groups' => 'array',
|
||||
'json_bon_groups.*' => Rule::in($validGroups),
|
||||
'json_following_groups' => 'array',
|
||||
'json_following_groups.*' => Rule::in($validGroups),
|
||||
'json_forum_groups' => 'array',
|
||||
'json_forum_groups.*' => Rule::in($validGroups),
|
||||
'json_request_groups' => 'array',
|
||||
'json_request_groups.*' => Rule::in($validGroups),
|
||||
'json_subscription_groups' => 'array',
|
||||
'json_subscription_groups.*' => Rule::in($validGroups),
|
||||
'json_torrent_groups' => 'array',
|
||||
'json_torrent_groups.*' => Rule::in($validGroups),
|
||||
'json_mention_groups' => 'array',
|
||||
'json_mention_groups.*' => Rule::in($validGroups),
|
||||
'block_notifications' => 'required|boolean',
|
||||
]);
|
||||
|
||||
$notification->show_account_follow = $request->show_account_follow;
|
||||
$notification->show_account_unfollow = $request->show_account_unfollow;
|
||||
$notification->show_following_upload = $request->show_following_upload;
|
||||
$notification->show_bon_gift = $request->show_bon_gift;
|
||||
$notification->show_subscription_forum = $request->show_subscription_forum;
|
||||
$notification->show_subscription_topic = $request->show_subscription_topic;
|
||||
$notification->show_request_comment = $request->show_request_comment;
|
||||
$notification->show_request_bounty = $request->show_request_bounty;
|
||||
$notification->show_request_fill = $request->show_request_fill;
|
||||
$notification->show_request_fill_approve = $request->show_request_fill_approve;
|
||||
$notification->show_request_fill_reject = $request->show_request_fill_reject;
|
||||
$notification->show_request_claim = $request->show_request_claim;
|
||||
$notification->show_request_unclaim = $request->show_request_unclaim;
|
||||
$notification->show_torrent_comment = $request->show_torrent_comment;
|
||||
$notification->show_torrent_thank = $request->show_torrent_thank;
|
||||
$notification->show_torrent_tip = $request->show_torrent_tip;
|
||||
$notification->show_mention_torrent_comment = $request->show_mention_torrent_comment;
|
||||
$notification->show_mention_request_comment = $request->show_mention_request_comment;
|
||||
$notification->show_mention_article_comment = $request->show_mention_article_comment;
|
||||
$notification->show_mention_forum_post = $request->show_mention_forum_post;
|
||||
$notification->show_forum_topic = $request->show_forum_topic;
|
||||
$notification->json_account_groups = \array_map('intval', $request->json_account_groups ?? []);
|
||||
$notification->json_bon_groups = \array_map('intval', $request->json_bon_groups ?? []);
|
||||
$notification->json_following_groups = \array_map('intval', $request->json_following_groups ?? []);
|
||||
$notification->json_forum_groups = \array_map('intval', $request->json_forum_groups ?? []);
|
||||
$notification->json_request_groups = \array_map('intval', $request->json_request_groups ?? []);
|
||||
$notification->json_subscription_groups = \array_map('intval', $request->json_subscription_groups ?? []);
|
||||
$notification->json_torrent_groups = \array_map('intval', $request->json_torrent_groups ?? []);
|
||||
$notification->json_mention_groups = \array_map('intval', $request->json_mention_groups ?? []);
|
||||
$notification->save();
|
||||
|
||||
$user->block_notifications = $request->block_notifications;
|
||||
$user->save();
|
||||
|
||||
return \to_route('users.notification_settings.edit', ['user' => $user])
|
||||
->withSuccess('Your notification settings have been successfully saved.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit user notification settings.
|
||||
*/
|
||||
public function edit(Request $request, User $user): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
{
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$groups = Group::query()
|
||||
->where('is_modo', '=', '0')
|
||||
->where('is_admin', '=', '0')
|
||||
->where('id', '!=', UserGroups::VALIDATING)
|
||||
->where('id', '!=', UserGroups::PRUNED)
|
||||
->where('id', '!=', UserGroups::BANNED)
|
||||
->where('id', '!=', UserGroups::DISABLED)
|
||||
->latest('level')
|
||||
->get();
|
||||
|
||||
return \view('user.notification_setting.edit', ['user' => $user, 'groups'=> $groups]);
|
||||
}
|
||||
}
|
||||
Executable → Regular
-295
@@ -21,7 +21,6 @@ use App\Models\Invite;
|
||||
use App\Models\Torrent;
|
||||
use App\Models\TorrentRequest;
|
||||
use App\Models\User;
|
||||
use App\Models\UserNotification;
|
||||
use App\Models\UserPrivacy;
|
||||
use App\Models\Warning;
|
||||
use App\Rules\EmailBlacklist;
|
||||
@@ -341,38 +340,6 @@ class UserController extends Controller
|
||||
->withSuccess('Your Email Was Updated Successfully!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Change User Notification Setting.
|
||||
*/
|
||||
public function disableNotifications(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$user->block_notifications = 1;
|
||||
$user->save();
|
||||
|
||||
return \to_route('users.show', ['username' => $user->username])
|
||||
->withSuccess('You Have Disabled Notifications!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Change User Notification Setting.
|
||||
*/
|
||||
public function enableNotifications(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$user->block_notifications = 0;
|
||||
$user->save();
|
||||
|
||||
return \to_route('users.show', ['username' => $user->username])
|
||||
->withSuccess('You Have Enabled Notifications!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Change User PID.
|
||||
*
|
||||
@@ -393,268 +360,6 @@ class UserController extends Controller
|
||||
->withSuccess('Your PID Was Changed Successfully!');
|
||||
}
|
||||
|
||||
/**
|
||||
* User Account Notification Change.
|
||||
*/
|
||||
protected function changeAccountNotification(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$notification = $user->notification;
|
||||
if (! $notification) {
|
||||
$notification = new UserNotification();
|
||||
$notification->setDefaultValues();
|
||||
$notification->user_id = $user->id;
|
||||
}
|
||||
|
||||
$approved = $request->input('approved');
|
||||
$groups = Group::all();
|
||||
$tomerge = [];
|
||||
foreach ($groups as $group) {
|
||||
$tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0;
|
||||
}
|
||||
|
||||
$notification->json_account_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]);
|
||||
$notification->show_account_follow = ($request->input('show_account_follow') && $request->input('show_account_follow') == 1 ? 1 : 0);
|
||||
$notification->show_account_unfollow = ($request->input('show_account_unfollow') && $request->input('show_account_unfollow') == 1 ? 1 : 0);
|
||||
$notification->save();
|
||||
|
||||
return \to_route('user_notification', ['username' => $user->username, 'hash' => '#account'])
|
||||
->withSuccess('Your Account Notification Settings Have Been Saved!');
|
||||
}
|
||||
|
||||
/**
|
||||
* User Following Notification Change.
|
||||
*/
|
||||
protected function changeFollowingNotification(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$notification = $user->notification;
|
||||
if (! $notification) {
|
||||
$notification = new UserNotification();
|
||||
$notification->setDefaultValues();
|
||||
$notification->user_id = $user->id;
|
||||
}
|
||||
|
||||
$approved = $request->input('approved');
|
||||
$groups = Group::all();
|
||||
$tomerge = [];
|
||||
foreach ($groups as $group) {
|
||||
$tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0;
|
||||
}
|
||||
|
||||
$notification->json_following_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]);
|
||||
$notification->show_following_upload = ($request->input('show_following_upload') && $request->input('show_following_upload') == 1 ? 1 : 0);
|
||||
$notification->save();
|
||||
|
||||
return \to_route('user_notification', ['username' => $user->username, 'hash' => '#following'])
|
||||
->withSuccess('Your Followed User Notification Settings Have Been Saved!');
|
||||
}
|
||||
|
||||
/**
|
||||
* User BON Notification Change.
|
||||
*/
|
||||
protected function changeBonNotification(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$notification = $user->notification;
|
||||
if (! $notification) {
|
||||
$notification = new UserNotification();
|
||||
$notification->setDefaultValues();
|
||||
$notification->user_id = $user->id;
|
||||
}
|
||||
|
||||
$approved = $request->input('approved');
|
||||
$groups = Group::all();
|
||||
$tomerge = [];
|
||||
foreach ($groups as $group) {
|
||||
$tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0;
|
||||
}
|
||||
|
||||
$notification->json_bon_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]);
|
||||
$notification->show_bon_gift = ($request->input('show_bon_gift') && $request->input('show_bon_gift') == 1 ? 1 : 0);
|
||||
$notification->save();
|
||||
|
||||
return \to_route('user_notification', ['username' => $user->username, 'hash' => '#bon'])
|
||||
->withSuccess('Your BON Notification Settings Have Been Saved!');
|
||||
}
|
||||
|
||||
/**
|
||||
* User Subscription Notification Change.
|
||||
*/
|
||||
protected function changeSubscriptionNotification(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$notification = $user->notification;
|
||||
if (! $notification) {
|
||||
$notification = new UserNotification();
|
||||
$notification->setDefaultValues();
|
||||
$notification->user_id = $user->id;
|
||||
}
|
||||
|
||||
$approved = $request->input('approved');
|
||||
$groups = Group::all();
|
||||
$tomerge = [];
|
||||
foreach ($groups as $group) {
|
||||
$tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0;
|
||||
}
|
||||
|
||||
$notification->json_subscription_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]);
|
||||
$notification->show_subscription_forum = ($request->input('show_subscription_forum') && $request->input('show_subscription_forum') == 1 ? 1 : 0);
|
||||
$notification->show_subscription_topic = ($request->input('show_subscription_topic') && $request->input('show_subscription_topic') == 1 ? 1 : 0);
|
||||
$notification->save();
|
||||
|
||||
return \to_route('user_notification', ['username' => $user->username, 'hash' => '#subscription'])
|
||||
->withSuccess('Your Subscription Notification Settings Have Been Saved!');
|
||||
}
|
||||
|
||||
/**
|
||||
* User Request Notification Change.
|
||||
*/
|
||||
protected function changeRequestNotification(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$notification = $user->notification;
|
||||
if (! $notification) {
|
||||
$notification = new UserNotification();
|
||||
$notification->setDefaultValues();
|
||||
$notification->user_id = $user->id;
|
||||
}
|
||||
|
||||
$approved = $request->input('approved');
|
||||
$groups = Group::all();
|
||||
$tomerge = [];
|
||||
foreach ($groups as $group) {
|
||||
$tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0;
|
||||
}
|
||||
|
||||
$notification->json_request_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]);
|
||||
$notification->show_request_comment = ($request->input('show_request_comment') && $request->input('show_request_comment') == 1 ? 1 : 0);
|
||||
$notification->show_request_bounty = ($request->input('show_request_bounty') && $request->input('show_request_bounty') == 1 ? 1 : 0);
|
||||
$notification->show_request_fill = ($request->input('show_request_fill') && $request->input('show_request_fill') == 1 ? 1 : 0);
|
||||
$notification->show_request_fill_approve = ($request->input('show_request_fill_approve') && $request->input('show_request_fill_approve') == 1 ? 1 : 0);
|
||||
$notification->show_request_fill_reject = ($request->input('show_request_fill_reject') && $request->input('show_request_fill_reject') == 1 ? 1 : 0);
|
||||
$notification->show_request_claim = ($request->input('show_request_claim') && $request->input('show_request_claim') == 1 ? 1 : 0);
|
||||
$notification->show_request_unclaim = ($request->input('show_request_unclaim') && $request->input('show_request_unclaim') == 1 ? 1 : 0);
|
||||
$notification->save();
|
||||
|
||||
return \to_route('user_notification', ['username' => $user->username, 'hash' => '#request'])
|
||||
->withSuccess('Your Request Notification Settings Have Been Saved!');
|
||||
}
|
||||
|
||||
/**
|
||||
* User Torrent Notification Change.
|
||||
*/
|
||||
protected function changeTorrentNotification(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$notification = $user->notification;
|
||||
if (! $notification) {
|
||||
$notification = new UserNotification();
|
||||
$notification->setDefaultValues();
|
||||
$notification->user_id = $user->id;
|
||||
}
|
||||
|
||||
$approved = $request->input('approved');
|
||||
$groups = Group::all();
|
||||
$tomerge = [];
|
||||
foreach ($groups as $group) {
|
||||
$tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0;
|
||||
}
|
||||
|
||||
$notification->json_torrent_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]);
|
||||
$notification->show_torrent_comment = ($request->input('show_torrent_comment') && $request->input('show_torrent_comment') == 1 ? 1 : 0);
|
||||
$notification->show_torrent_thank = ($request->input('show_torrent_thank') && $request->input('show_torrent_thank') == 1 ? 1 : 0);
|
||||
$notification->show_torrent_tip = ($request->input('show_torrent_tip') && $request->input('show_torrent_tip') == 1 ? 1 : 0);
|
||||
$notification->save();
|
||||
|
||||
return \to_route('user_notification', ['username' => $user->username, 'hash' => '#torrent'])
|
||||
->withSuccess('Your Torrent Notification Settings Have Been Saved!');
|
||||
}
|
||||
|
||||
/**
|
||||
* User Mention Notification Change.
|
||||
*/
|
||||
protected function changeMentionNotification(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$notification = $user->notification;
|
||||
if (! $notification) {
|
||||
$notification = new UserNotification();
|
||||
$notification->setDefaultValues();
|
||||
$notification->user_id = $user->id;
|
||||
}
|
||||
|
||||
$approved = $request->input('approved');
|
||||
$groups = Group::all();
|
||||
$tomerge = [];
|
||||
foreach ($groups as $group) {
|
||||
$tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0;
|
||||
}
|
||||
|
||||
$notification->json_mention_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]);
|
||||
$notification->show_mention_torrent_comment = ($request->input('show_mention_torrent_comment') && $request->input('show_mention_torrent_comment') == 1 ? 1 : 0);
|
||||
$notification->show_mention_request_comment = ($request->input('show_mention_request_comment') && $request->input('show_mention_request_comment') == 1 ? 1 : 0);
|
||||
$notification->show_mention_article_comment = ($request->input('show_mention_article_comment') && $request->input('show_mention_article_comment') == 1 ? 1 : 0);
|
||||
$notification->show_mention_forum_post = ($request->input('show_mention_forum_post') && $request->input('show_mention_forum_post') == 1 ? 1 : 0);
|
||||
|
||||
$notification->save();
|
||||
|
||||
return \to_route('user_notification', ['username' => $user->username, 'hash' => '#mention'])
|
||||
->withSuccess('Your @Mention Notification Settings Have Been Saved!');
|
||||
}
|
||||
|
||||
/**
|
||||
* User Forum Notification Change.
|
||||
*/
|
||||
protected function changeForumNotification(Request $request, string $username): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$user = User::where('username', '=', $username)->firstOrFail();
|
||||
|
||||
\abort_unless($request->user()->id == $user->id, 403);
|
||||
|
||||
$notification = $user->notification;
|
||||
if (! $notification) {
|
||||
$notification = new UserNotification();
|
||||
$notification->setDefaultValues();
|
||||
$notification->user_id = $user->id;
|
||||
}
|
||||
|
||||
$approved = $request->input('approved');
|
||||
$groups = Group::all();
|
||||
$tomerge = [];
|
||||
foreach ($groups as $group) {
|
||||
$tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0;
|
||||
}
|
||||
|
||||
$notification->json_forum_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]);
|
||||
$notification->show_forum_topic = ($request->input('show_forum_topic') && $request->input('show_forum_topic') == 1 ? 1 : 0);
|
||||
$notification->save();
|
||||
|
||||
return \to_route('user_notification', ['username' => $user->username, 'hash' => '#forum'])
|
||||
->withSuccess('Your Forum Notification Settings Have Been Saved!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Change User RID.
|
||||
*/
|
||||
|
||||
+2
-6
@@ -549,12 +549,8 @@ class User extends Authenticatable
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($target->notification && $target->notification->$targetGroup && \is_array($target->notification->$targetGroup['default_groups'])) {
|
||||
if (\array_key_exists($sender->group->id, $target->notification->$targetGroup['default_groups'])) {
|
||||
return $target->notification->$targetGroup['default_groups'][$sender->group->id] == 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
if (\is_array($target->notification?->$targetGroup)) {
|
||||
return ! \in_array($sender->group->id, $target->notification->$targetGroup, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -59,7 +59,7 @@ class UserNotification extends Model
|
||||
*/
|
||||
public function getExpectedGroupsAttribute(): array
|
||||
{
|
||||
return ['default_groups' => ['1' => 0]];
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\UserGroups;
|
||||
use App\Models\Group;
|
||||
use App\Models\UserNotification;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class () extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$allowedGroups = Group::query()
|
||||
->where('is_modo', '=', '0')
|
||||
->where('is_admin', '=', '0')
|
||||
->where('id', '!=', UserGroups::VALIDATING)
|
||||
->where('id', '!=', UserGroups::PRUNED)
|
||||
->where('id', '!=', UserGroups::BANNED)
|
||||
->where('id', '!=', UserGroups::DISABLED)
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
//
|
||||
// Input format looks like:
|
||||
// {
|
||||
// "default_groups": {
|
||||
// "1": 0,
|
||||
// "2": 1,
|
||||
// "3": 0,
|
||||
// "4": 1,
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Output format looks like:
|
||||
// [
|
||||
// 1,
|
||||
// 3,
|
||||
// ]
|
||||
//
|
||||
|
||||
$migrate = fn ($groups) => array_keys(array_filter(
|
||||
$groups,
|
||||
fn ($groupId, $acceptsNotifications) => !$acceptsNotifications && \in_array($groupId, $allowedGroups),
|
||||
ARRAY_FILTER_USE_BOTH
|
||||
));
|
||||
|
||||
foreach (UserNotification::all() as $user_notification) {
|
||||
$user_notification->json_account_groups = $migrate($user_notification->json_account_groups['default_groups']);
|
||||
$user_notification->json_bon_groups = $migrate($user_notification->json_bon_groups['default_groups']);
|
||||
$user_notification->json_mention_groups = $migrate($user_notification->json_mention_groups['default_groups']);
|
||||
$user_notification->json_request_groups = $migrate($user_notification->json_request_groups['default_groups']);
|
||||
$user_notification->json_torrent_groups = $migrate($user_notification->json_torrent_groups['default_groups']);
|
||||
$user_notification->json_forum_groups = $migrate($user_notification->json_forum_groups['default_groups']);
|
||||
$user_notification->json_following_groups = $migrate($user_notification->json_following_groups['default_groups']);
|
||||
$user_notification->json_subscription_groups = $migrate($user_notification->json_subscription_groups['default_groups']);
|
||||
$user_notification->save();
|
||||
}
|
||||
}
|
||||
};
|
||||
Executable → Regular
+31
-9
@@ -28,26 +28,48 @@
|
||||
{{ __('user.edit-profile') }}
|
||||
</a>
|
||||
</li>
|
||||
@if(auth()->user()->block_notifications)
|
||||
@if(auth()->user()->hidden)
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ route('notification_enable', ['username' => $user->username]) }}"
|
||||
action="{{ route('user_visible', ['username' => $user->username]) }}"
|
||||
style="display: contents;"
|
||||
>
|
||||
@csrf
|
||||
<button type="submit" class="nav-tab__link">
|
||||
{{ __('user.enable-notifications') }}
|
||||
{{ __('user.become-visible') }}
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ route('notification_disable', ['username' => $user->username]) }}"
|
||||
action="{{ route('user_hidden', ['username' => $user->username]) }}"
|
||||
style="display: contents;"
|
||||
>
|
||||
>
|
||||
@csrf
|
||||
<button type="submit" class="nav-tab__link">
|
||||
{{ __('user.disable-notifications') }}
|
||||
{{ __('user.become-hidden') }}
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
@if(auth()->user()->private_profile)
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ route('user_public', ['username' => $user->username]) }}"
|
||||
style="display: contents;"
|
||||
>
|
||||
@csrf
|
||||
<button type="submit" class="nav-tab__link">
|
||||
{{ __('user.go-public') }}
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ route('user_private', ['username' => $user->username]) }}"
|
||||
style="display: contents;">
|
||||
@csrf
|
||||
<button type="submit" class="nav-tab__link">
|
||||
{{ __('user.go-private') }}
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
@@ -119,10 +141,10 @@
|
||||
{{ __('user.privacy') }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="{{ Route::is('user_notification') ? 'nav-tab--active' : 'nav-tavV2' }}">
|
||||
<li class="{{ Route::is('users.notification_settings.edit') ? 'nav-tab--active' : 'nav-tavV2' }}">
|
||||
<a
|
||||
class="{{ Route::is('user_notification') ? 'nav-tab--active__link' : 'nav-tab__link' }}"
|
||||
href="{{ route('user_notification', ['username' => $user->username]) }}"
|
||||
class="{{ Route::is('users.notification_settings.edit') ? 'nav-tab--active__link' : 'nav-tab__link' }}"
|
||||
href="{{ route('users.notification_settings.edit', ['user' => $user]) }}"
|
||||
>
|
||||
{{ __('user.notification') }}
|
||||
</a>
|
||||
|
||||
@@ -0,0 +1,498 @@
|
||||
@extends('layout.default')
|
||||
|
||||
@section('title')
|
||||
<title>{{ $user->username }} - {{ __('user.notification') }} - {{ __('common.members') }} - {{ config('other.title') }}
|
||||
</title>
|
||||
@endsection
|
||||
|
||||
@section('breadcrumbs')
|
||||
<li class="breadcrumbV2">
|
||||
<a href="{{ route('users.show', ['username' => $user->username]) }}" class="breadcrumb__link">
|
||||
{{ $user->username }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumbV2">
|
||||
<a href="{{ route('user_settings', ['username' => $user->username]) }}" class="breadcrumb__link">
|
||||
{{ __('user.settings') }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb--active">
|
||||
{{ __('user.notification') }}
|
||||
</li>
|
||||
@endsection
|
||||
|
||||
@section('nav-tabs')
|
||||
@include('user.buttons.user')
|
||||
@endsection
|
||||
|
||||
@section('main')
|
||||
<section class="panelV2">
|
||||
<h2 class="panel__heading">{{ __('user.notification') }}</h2>
|
||||
<div class="panel__body">
|
||||
<form
|
||||
class="form"
|
||||
method="POST"
|
||||
action="{{ route('users.notification_settings.update', ['user' => $user]) }}"
|
||||
enctype="multipart/form-data"
|
||||
>
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('user.follow') }}</legend>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_account_follow" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_account_follow"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_account_follow)
|
||||
/>
|
||||
{{ __('user.account-notification-follow') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_account_unfollow" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_account_unfollow"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_account_unfollow)
|
||||
/>
|
||||
{{ __('user.account-notification-unfollow') }}
|
||||
</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('bon.bon') }}</legend>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_bon_gift" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_bon_gift"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_bon_gift)
|
||||
/>
|
||||
{{ __('user.bon-notification-gift') }}
|
||||
</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('user.followers') }}</legend>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_following_upload" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_following_upload"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_following_upload)
|
||||
/>
|
||||
{{ __('user.following-notification-upload') }}
|
||||
</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('forum.forums') }}</legend>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_forum_topic" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_forum_topic"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_forum_topic)
|
||||
/>
|
||||
{{ __('user.forum-notification-topic') }}
|
||||
</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('request.requests') }}</legend>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_request_fill" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_request_fill"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_request_fill)
|
||||
/>
|
||||
{{ __('user.request-notification-fill') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_request_fill_approve" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_request_fill_approve"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_request_fill_approve)
|
||||
/>
|
||||
{{ __('user.request-notification-fill-approve') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_request_fill_reject" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_request_fill_reject"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_request_fill_reject)
|
||||
/>
|
||||
{{ __('user.request-notification-fill-reject') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_request_claim" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_request_claim"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_request_claim)
|
||||
/>
|
||||
{{ __('user.request-notification-claim') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_request_unclaim" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_request_unclaim"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_request_unclaim)
|
||||
/>
|
||||
{{ __('user.request-notification-unclaim') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_request_comment" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_request_comment"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_request_comment)
|
||||
/>
|
||||
{{ __('user.request-notification-comment') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_request_bounty" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_request_bounty"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_request_bounty)
|
||||
/>
|
||||
{{ __('user.request-notification-bounty') }}
|
||||
</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('common.subscriptions') }}</legend>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_subscription_topic" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_subscription_topic"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_subscription_topic)
|
||||
/>
|
||||
{{ __('user.subscription-notification-topic') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_subscription_forum" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_subscription_forum"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_subscription_forum)
|
||||
/>
|
||||
{{ __('user.subscription-notification-forum') }}
|
||||
</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('torrent.torrents') }}</legend>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_torrent_comment" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_torrent_comment"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_torrent_comment)
|
||||
/>
|
||||
{{ __('user.torrent-notification-comment') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_torrent_thank" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_torrent_thank"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_torrent_thank)
|
||||
/>
|
||||
{{ __('user.torrent-notification-thank') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_torrent_tip" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_torrent_tip"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_torrent_tip)
|
||||
/>
|
||||
{{ __('user.torrent-notification-tip') }}
|
||||
</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">Mentions</legend>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_mention_article_comment" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_mention_article_comment"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_mention_article_comment)
|
||||
/>
|
||||
{{ __('user.mention-notification-article-comment') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_mention_request_comment" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_mention_request_comment"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_mention_request_comment)
|
||||
/>
|
||||
{{ __('user.mention-notification-request-comment') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_mention_torrent_comment" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_mention_torrent_comment"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_mention_torrent_comment)
|
||||
/>
|
||||
{{ __('user.mention-notification-torrent-comment') }}
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="show_mention_forum_post" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="show_mention_forum_post"
|
||||
value="1"
|
||||
@checked($user->notification === null || $user->notification?->show_mention_forum_post)
|
||||
/>
|
||||
{{ __('user.mention-notification-forum-post') }}
|
||||
</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<h3>Block all notifications from the selected groups.</h3>
|
||||
<div class="form__group--short-horizontal">
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('user.follow') }}</legend>
|
||||
@foreach($groups as $group)
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="json_account_groups[]"
|
||||
value="{{ $group->id }}"
|
||||
@checked(\in_array($group->id, $user->notification->json_account_groups, true))
|
||||
/>
|
||||
{{ $group->name }}
|
||||
</label>
|
||||
</p>
|
||||
@endforeach
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('bon.bon') }}</legend>
|
||||
@foreach($groups as $group)
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="json_bon_groups[]"
|
||||
value="{{ $group->id }}"
|
||||
@checked(\in_array($group->id, $user->notification->json_bon_groups, true))
|
||||
/>
|
||||
{{ $group->name }}
|
||||
</label>
|
||||
</p>
|
||||
@endforeach
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('user.followers') }}</legend>
|
||||
@foreach($groups as $group)
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="json_following_groups[]"
|
||||
value="{{ $group->id }}"
|
||||
@checked(\in_array($group->id, $user->notification->json_following_groups, true))
|
||||
/>
|
||||
{{ $group->name }}
|
||||
</label>
|
||||
</p>
|
||||
@endforeach
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('forum.forums') }}</legend>
|
||||
@foreach($groups as $group)
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="json_forum_groups[]"
|
||||
value="{{ $group->id }}"
|
||||
@checked(\in_array($group->id, $user->notification->json_forum_groups, true))
|
||||
/>
|
||||
{{ $group->name }}
|
||||
</label>
|
||||
</p>
|
||||
@endforeach
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('request.requests') }}</legend>
|
||||
@foreach($groups as $group)
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="json_request_groups[]"
|
||||
value="{{ $group->id }}"
|
||||
@checked(\in_array($group->id, $user->notification->json_request_groups, true))
|
||||
/>
|
||||
{{ $group->name }}
|
||||
</label>
|
||||
</p>
|
||||
@endforeach
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('common.subscriptions') }}</legend>
|
||||
@foreach($groups as $group)
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="json_subscription_groups[]"
|
||||
value="{{ $group->id }}"
|
||||
@checked(\in_array($group->id, $user->notification->json_subscription_groups, true))
|
||||
/>
|
||||
{{ $group->name }}
|
||||
</label>
|
||||
</p>
|
||||
@endforeach
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">{{ __('torrent.torrents') }}</legend>
|
||||
@foreach($groups as $group)
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="json_torrent_groups[]"
|
||||
value="{{ $group->id }}"
|
||||
@checked(\in_array($group->id, $user->notification->json_torrent_groups, true))
|
||||
/>
|
||||
{{ $group->name }}
|
||||
</label>
|
||||
</p>
|
||||
@endforeach
|
||||
</fieldset>
|
||||
<fieldset class="form__fieldset">
|
||||
<legend class="form__legend">Mentions</legend>
|
||||
@foreach($groups as $group)
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
name="json_mention_groups[]"
|
||||
value="{{ $group->id }}"
|
||||
@checked(\in_array($group->id, $user->notification->json_mention_groups, true))
|
||||
/>
|
||||
{{ $group->name }}
|
||||
</label>
|
||||
</p>
|
||||
@endforeach
|
||||
</fieldset>
|
||||
</div>
|
||||
<h3>Override all notifications.</h3>
|
||||
<p class="form__group">
|
||||
<label class="form__label">
|
||||
<input type="hidden" name="block_notifications" value="0" />
|
||||
<input
|
||||
class="form__checkbox"
|
||||
type="checkbox"
|
||||
value="1"
|
||||
name="block_notifications"
|
||||
@checked($user->block_notifications)
|
||||
/>
|
||||
Block all notifications.
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<button class="form__button form__button--filled">
|
||||
{{ __('common.save') }}
|
||||
</button>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -1,872 +0,0 @@
|
||||
@extends('layout.default')
|
||||
|
||||
@section('title')
|
||||
<title>{{ $user->username }} - {{ __('user.notification') }} - {{ __('common.members') }} - {{ config('other.title') }}
|
||||
</title>
|
||||
@endsection
|
||||
|
||||
@section('breadcrumbs')
|
||||
<li class="breadcrumbV2">
|
||||
<a href="{{ route('users.show', ['username' => $user->username]) }}" class="breadcrumb__link">
|
||||
{{ $user->username }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumbV2">
|
||||
<a href="{{ route('user_settings', ['username' => $user->username]) }}" class="breadcrumb__link">
|
||||
{{ __('user.settings') }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb--active">
|
||||
{{ __('user.notification') }}
|
||||
</li>
|
||||
@endsection
|
||||
|
||||
@section('nav-tabs')
|
||||
@include('user.buttons.user')
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="block">
|
||||
<div class="container-fluid p-0 some-padding">
|
||||
<ul class="nav nav-tabs" role="tablist" id="basetabs">
|
||||
<li class="active"><a href="#account_tab" data-toggle="tab">Account</a></li>
|
||||
<li><a href="#bon_tab" data-toggle="tab">BON</a></li>
|
||||
<li><a href="#following_tab" data-toggle="tab">Followed User</a></li>
|
||||
<li><a href="#forum_tab" data-toggle="tab">Forum</a></li>
|
||||
<li><a href="#request_tab" data-toggle="tab">Request</a></li>
|
||||
<li><a href="#subscription_tab" data-toggle="tab">Subscription</a></li>
|
||||
<li><a href="#torrent_tab" data-toggle="tab">Torrent</a></li>
|
||||
<li><a href="#mention_tab" data-toggle="tab">@Mention</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<br>
|
||||
<div role="tabpanel" class="tab-pane active" id="account_tab">
|
||||
<form role="form" method="POST"
|
||||
action="{{ route('notification_account', ['username' => $user->username]) }}"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="well">
|
||||
<h3>{{ __('user.account-notification') }}:</h3>
|
||||
<div class="help-block">{{ __('user.account-notification-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.account-notification-follow') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_account_follow == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_account_follow" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_account_follow" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.account-notification-unfollow') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_account_unfollow == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_account_unfollow" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_account_unfollow" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<h3>{{ __('user.notification-from-account') }}:</h3>
|
||||
<div class="help-block">{{ __('user.notification-from-account-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
@foreach($groups as $group)
|
||||
@if($group->is_modo || $group->is_admin)
|
||||
@else
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ $group->name }}
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || !$user->notification->json_account_groups ||
|
||||
$group->isAllowed($user->notification->json_account_groups,$group->id))
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="well text-center">
|
||||
<button type="submit" class="btn btn-primary">{{ __('common.save') }}
|
||||
{{ __('user.account-notification') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="following_tab">
|
||||
<form role="form" method="POST"
|
||||
action="{{ route('notification_following', ['username' => $user->username]) }}"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="well">
|
||||
<h3>{{ __('user.following-notification') }}:</h3>
|
||||
<div class="help-block">{{ __('user.following-notification-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.following-notification-upload') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_following_upload == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_following_upload" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_following_upload" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<h3>{{ __('user.notification-from-following') }}:</h3>
|
||||
<div class="help-block">{{ __('user.notification-from-following-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
@foreach($groups as $group)
|
||||
@if($group->is_modo || $group->is_admin)
|
||||
@else
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ $group->name }}
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || !$user->notification->json_following_groups ||
|
||||
$group->isAllowed($user->notification->json_following_groups,$group->id))
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="well text-center">
|
||||
<button type="submit" class="btn btn-primary">{{ __('common.save') }}
|
||||
{{ __('user.following-notification') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="subscription_tab">
|
||||
<form role="form" method="POST"
|
||||
action="{{ route('notification_subscription', ['username' => $user->username]) }}"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="well">
|
||||
<h3>{{ __('user.subscription-notification') }}:</h3>
|
||||
<div class="help-block">{{ __('user.subscription-notification-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.subscription-notification-topic') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_subscription_topic == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_subscription_topic" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_subscription_topic" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.subscription-notification-forum') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_subscription_forum == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_subscription_forum" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_subscription_forum" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<h3>{{ __('user.notification-from-subscription') }}:</h3>
|
||||
<div class="help-block">{{ __('user.notification-from-subscription-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
@foreach($groups as $group)
|
||||
@if($group->is_modo || $group->is_admin)
|
||||
@else
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ $group->name }}
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || !$user->notification->json_subscription_groups
|
||||
||
|
||||
$group->isAllowed($user->notification->json_subscription_groups,$group->id))
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="well text-center">
|
||||
<button type="submit" class="btn btn-primary">{{ __('common.save') }}
|
||||
{{ __('user.subscription-notification') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="forum_tab">
|
||||
<form role="form" method="POST"
|
||||
action="{{ route('notification_forum', ['username' => $user->username]) }}"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="well">
|
||||
<h3>{{ __('user.forum-notification') }}:</h3>
|
||||
<div class="help-block">{{ __('user.forum-notification-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.forum-notification-topic') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_forum_topic == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_forum_topic" value="1" CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_forum_topic" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<h3>{{ __('user.notification-from-forum') }}:</h3>
|
||||
<div class="help-block">{{ __('user.notification-from-forum-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
@foreach($groups as $group)
|
||||
@if($group->is_modo || $group->is_admin)
|
||||
@else
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ $group->name }}
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || !$user->notification->json_forum_groups ||
|
||||
$group->isAllowed($user->notification->json_forum_groups,$group->id))
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="well text-center">
|
||||
<button type="submit" class="btn btn-primary">{{ __('common.save') }}
|
||||
{{ __('user.forum-notification') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="request_tab">
|
||||
<form role="form" method="POST"
|
||||
action="{{ route('notification_request', ['username' => $user->username]) }}"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="well">
|
||||
<h3>{{ __('user.request-notification') }}:</h3>
|
||||
<div class="help-block">{{ __('user.request-notification-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.request-notification-fill') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_request_fill == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_fill" value="1" CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_fill" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.request-notification-fill-approve') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_request_fill_approve == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_fill_approve" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_fill_approve" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.request-notification-fill-reject') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_request_fill_reject == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_fill_reject" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_fill_reject" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.request-notification-claim') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_request_claim == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_claim" value="1" CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_claim" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.request-notification-unclaim') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_request_unclaim == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_unclaim" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_unclaim" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.request-notification-comment') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_request_comment == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_comment" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_comment" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.request-notification-bounty') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_request_bounty == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_bounty" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_request_bounty" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<h3>{{ __('user.notification-from-request') }}:</h3>
|
||||
<div class="help-block">{{ __('user.notification-from-request-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
@foreach($groups as $group)
|
||||
@if($group->is_modo || $group->is_admin)
|
||||
@else
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ $group->name }}
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || !$user->notification->json_request_groups ||
|
||||
$group->isAllowed($user->notification->json_request_groups,$group->id))
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="well text-center">
|
||||
<button type="submit" class="btn btn-primary">{{ __('common.save') }}
|
||||
{{ __('user.request-notification') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="torrent_tab">
|
||||
<form role="form" method="POST"
|
||||
action="{{ route('notification_torrent', ['username' => $user->username]) }}"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="well">
|
||||
<h3>{{ __('user.torrent-notification') }}:</h3>
|
||||
<div class="help-block">{{ __('user.torrent-notification-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.torrent-notification-comment') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_torrent_comment == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_torrent_comment" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_torrent_comment" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.torrent-notification-thank') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_torrent_thank == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_torrent_thank" value="1" CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_torrent_thank" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.torrent-notification-tip') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_torrent_tip == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_torrent_tip" value="1" CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_torrent_tip" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<h3>{{ __('user.notification-from-torrent') }}:</h3>
|
||||
<div class="help-block">{{ __('user.notification-from-torrent-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
@foreach($groups as $group)
|
||||
@if($group->is_modo || $group->is_admin)
|
||||
@else
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ $group->name }}
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || !$user->notification->json_torrent_groups ||
|
||||
$group->isAllowed($user->notification->json_torrent_groups,$group->id))
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="well text-center">
|
||||
<button type="submit" class="btn btn-primary">{{ __('common.save') }}
|
||||
{{ __('user.torrent-notification') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="bon_tab">
|
||||
<form role="form" method="POST"
|
||||
action="{{ route('notification_bon', ['username' => $user->username]) }}"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="well">
|
||||
<h3>{{ __('user.bon-notification') }}:</h3>
|
||||
<div class="help-block">{{ __('user.bon-notification-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.bon-notification-gift') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_bon_gift == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_bon_gift" value="1" CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_bon_gift" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<h3>{{ __('user.notification-from-bon') }}:</h3>
|
||||
<div class="help-block">{{ __('user.notification-from-bon-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
@foreach($groups as $group)
|
||||
@if($group->is_modo || $group->is_admin)
|
||||
@else
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ $group->name }}
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || !$user->notification->json_bon_groups ||
|
||||
$group->isAllowed($user->notification->json_bon_groups,$group->id))
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="well text-center">
|
||||
<button type="submit" class="btn btn-primary">{{ __('common.save') }}
|
||||
{{ __('user.bon-notification') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="mention_tab">
|
||||
<form role="form" method="POST"
|
||||
action="{{ route('notification_mention', ['username' => $user->username]) }}"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="well">
|
||||
<h3>{{ __('user.mention-notification') }}:</h3>
|
||||
<div class="help-block">{{ __('user.mention-notification-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.mention-notification-article-comment') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_mention_article_comment == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_mention_article_comment" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_mention_article_comment"
|
||||
value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.mention-notification-request-comment') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_mention_request_comment == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_mention_request_comment" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_mention_request_comment"
|
||||
value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.mention-notification-torrent-comment') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_mention_torrent_comment == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_mention_torrent_comment" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_mention_torrent_comment"
|
||||
value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ __('user.mention-notification-forum-post') }}.
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || ($user->notification &&
|
||||
$user->notification->show_mention_forum_post == 1))
|
||||
<label>
|
||||
<input type="checkbox" name="show_mention_forum_post" value="1"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="show_mention_forum_post" value="1"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
<h3>{{ __('user.notification-from-mention') }}:</h3>
|
||||
<div class="help-block">{{ __('user.notification-from-mention-help') }}.</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
@foreach($groups as $group)
|
||||
@if($group->is_modo || $group->is_admin)
|
||||
@else
|
||||
<div class="button-holder">
|
||||
<div class="button-left">
|
||||
{{ $group->name }}
|
||||
</div>
|
||||
<div class="button-right">
|
||||
@if(!$user->notification || !$user->notification->json_mention_groups ||
|
||||
$group->isAllowed($user->notification->json_mention_groups,$group->id))
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"
|
||||
CHECKED/>
|
||||
</label>
|
||||
@else
|
||||
<label>
|
||||
<input type="checkbox" name="approved[]"
|
||||
value="{{ $group->id }}"/>
|
||||
</label>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<hr class="some-padding">
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="well text-center">
|
||||
<button type="submit" class="btn btn-primary">{{ __('common.save') }}
|
||||
{{ __('user.mention-notification') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('javascripts')
|
||||
<script nonce="{{ HDVinnie\SecureHeaders\SecureHeaders::nonce('script') }}">
|
||||
$(window).on('load', function () {
|
||||
loadTab()
|
||||
})
|
||||
|
||||
function loadTab () {
|
||||
if (window.location.hash && window.location.hash == '#account_tab') {
|
||||
$('#basetabs a[href="#account_tab"]').tab('show')
|
||||
}
|
||||
if (window.location.hash && window.location.hash == '#bon_tab') {
|
||||
$('#basetabs a[href="#bon_tab"]').tab('show')
|
||||
}
|
||||
if (window.location.hash && window.location.hash == '#following_tab') {
|
||||
$('#basetabs a[href="#following_tab"]').tab('show')
|
||||
}
|
||||
if (window.location.hash && window.location.hash == '#forum_tab') {
|
||||
$('#basetabs a[href="#forum_tab"]').tab('show')
|
||||
}
|
||||
if (window.location.hash && window.location.hash == '#torrent_tab') {
|
||||
$('#basetabs a[href="#torrent_tab"]').tab('show')
|
||||
}
|
||||
if (window.location.hash && window.location.hash == '#mention_tab') {
|
||||
$('#basetabs a[href="#mention_tab"]').tab('show')
|
||||
}
|
||||
if (window.location.hash && window.location.hash == '#subscription_tab') {
|
||||
$('#basetabs a[href="#subscription_tab"]').tab('show')
|
||||
}
|
||||
if (window.location.hash && window.location.hash == '#request_tab') {
|
||||
$('#basetabs a[href="#request_tab"]').tab('show')
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
+7
-11
@@ -419,10 +419,12 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::get('/', [App\Http\Controllers\User\BanController::class, 'index'])->name('index');
|
||||
});
|
||||
|
||||
// History
|
||||
Route::group(['prefix' => 'torrents', 'as' => 'history.'], function () {
|
||||
Route::get('/', [App\Http\Controllers\User\HistoryController::class, 'index'])->name('index');
|
||||
});
|
||||
|
||||
// Followers
|
||||
Route::group(['prefix' => 'followers', 'as' => 'followers.'], function () {
|
||||
Route::get('/', [App\Http\Controllers\User\FollowController::class, 'index'])->name('index');
|
||||
Route::post('/', [App\Http\Controllers\User\FollowController::class, 'store'])->name('store');
|
||||
@@ -433,6 +435,11 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::group(['prefix' => 'privacy-settings', 'as' => 'privacy_settings.'], function () {
|
||||
Route::get('/edit', [App\Http\Controllers\User\PrivacySettingController::class, 'edit'])->name('edit');
|
||||
Route::patch('/', [App\Http\Controllers\User\PrivacySettingController::class, 'update'])->name('update');
|
||||
|
||||
// Notification settings
|
||||
Route::group(['prefix' => 'notification-settings', 'as' => 'notification_settings.'], function () {
|
||||
Route::get('/edit', [App\Http\Controllers\User\NotificationSettingController::class, 'edit'])->name('edit');
|
||||
Route::patch('/', [App\Http\Controllers\User\NotificationSettingController::class, 'update'])->name('update');
|
||||
});
|
||||
|
||||
// Peers
|
||||
@@ -542,7 +549,6 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::group(['prefix' => 'users'], function () {
|
||||
Route::get('/{username}/settings', [App\Http\Controllers\User\UserController::class, 'settings'])->name('user_settings');
|
||||
Route::get('/{username}/settings/security{hash?}', [App\Http\Controllers\User\UserController::class, 'security'])->name('user_security');
|
||||
Route::get('/{username}/settings/notification{hash?}', [App\Http\Controllers\User\UserController::class, 'notification'])->name('user_notification');
|
||||
Route::get('/{username}/settings/change_twostep', [App\Http\Controllers\User\UserController::class, 'changeTwoStep']);
|
||||
Route::post('/{username}/settings/change_settings', [App\Http\Controllers\User\UserController::class, 'changeSettings'])->name('change_settings');
|
||||
Route::post('/{username}/settings/change_password', [App\Http\Controllers\User\UserController::class, 'changePassword'])->name('change_password');
|
||||
@@ -550,16 +556,6 @@ Route::group(['middleware' => 'language'], function () {
|
||||
Route::post('/{username}/settings/change_pid', [App\Http\Controllers\User\UserController::class, 'changePID'])->name('change_pid');
|
||||
Route::post('/{username}/settings/change_rid', [App\Http\Controllers\User\UserController::class, 'changeRID'])->name('change_rid');
|
||||
Route::post('/{username}/settings/change_api_token', [App\Http\Controllers\User\UserController::class, 'changeApiToken'])->name('change_api_token');
|
||||
Route::post('/{username}/settings/notification/disable', [App\Http\Controllers\User\UserController::class, 'disableNotifications'])->name('notification_disable');
|
||||
Route::post('/{username}/settings/notification/enable', [App\Http\Controllers\User\UserController::class, 'enableNotifications'])->name('notification_enable');
|
||||
Route::post('/{username}/settings/notification/account', [App\Http\Controllers\User\UserController::class, 'changeAccountNotification'])->name('notification_account');
|
||||
Route::post('/{username}/settings/notification/following', [App\Http\Controllers\User\UserController::class, 'changeFollowingNotification'])->name('notification_following');
|
||||
Route::post('/{username}/settings/notification/forum', [App\Http\Controllers\User\UserController::class, 'changeForumNotification'])->name('notification_forum');
|
||||
Route::post('/{username}/settings/notification/subscription', [App\Http\Controllers\User\UserController::class, 'changeSubscriptionNotification'])->name('notification_subscription');
|
||||
Route::post('/{username}/settings/notification/mention', [App\Http\Controllers\User\UserController::class, 'changeMentionNotification'])->name('notification_mention');
|
||||
Route::post('/{username}/settings/notification/torrent', [App\Http\Controllers\User\UserController::class, 'changeTorrentNotification'])->name('notification_torrent');
|
||||
Route::post('/{username}/settings/notification/bon', [App\Http\Controllers\User\UserController::class, 'changeBonNotification'])->name('notification_bon');
|
||||
Route::post('/{username}/settings/notification/request', [App\Http\Controllers\User\UserController::class, 'changeRequestNotification'])->name('notification_request');
|
||||
Route::post('/{username}/settings/change_twostep', [App\Http\Controllers\User\UserController::class, 'changeTwoStep'])->name('change_twostep');
|
||||
});
|
||||
|
||||
|
||||
@@ -131,23 +131,6 @@ class UserControllerTest extends TestCase
|
||||
// TODO: perform additional assertions
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function disable_notifications_returns_an_ok_response(): void
|
||||
{
|
||||
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
|
||||
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)->get(route('notification_disable', ['username' => $user->username]));
|
||||
|
||||
$response->assertRedirect(withSuccess('You Have Disabled Notifications!'));
|
||||
|
||||
// TODO: perform additional assertions
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
@@ -204,23 +187,6 @@ class UserControllerTest extends TestCase
|
||||
// TODO: perform additional assertions
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function enable_notifications_returns_an_ok_response(): void
|
||||
{
|
||||
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
|
||||
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)->get(route('notification_enable', ['username' => $user->username]));
|
||||
|
||||
$response->assertRedirect(withSuccess('You Have Enabled Notifications!'));
|
||||
|
||||
// TODO: perform additional assertions
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
@@ -292,10 +258,10 @@ class UserControllerTest extends TestCase
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)->get(route('user_notification', ['username' => $user->username]));
|
||||
$response = $this->actingAs($user)->get(route('users.notification_settings.edit', ['user' => $user]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertViewIs('user.settings.notification.index');
|
||||
$response->assertViewIs('user.notification_setting.edit');
|
||||
$response->assertViewHas('user');
|
||||
$response->assertViewHas('groups');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user