1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-06 12:02:45 +03:00

Notifications: User watch list and differnt page watch options

- Adds option filtering and alternative text for page watch options.
- Adds "Watched & Ignored Items" list to user notification preferences
  page to show existing watched items.
This commit is contained in:
Dan Brown
2023-08-14 13:11:18 +01:00
parent c47b3f805a
commit d9fdecd902
10 changed files with 99 additions and 16 deletions

View File

@@ -2,7 +2,9 @@
namespace BookStack\Users\Controllers;
use BookStack\Activity\Models\Watch;
use BookStack\Http\Controller;
use BookStack\Permissions\PermissionApplicator;
use BookStack\Settings\UserNotificationPreferences;
use BookStack\Settings\UserShortcutMap;
use BookStack\Users\UserRepo;
@@ -49,12 +51,17 @@ class UserPreferencesController extends Controller
/**
* Show the notification preferences for the current user.
*/
public function showNotifications()
public function showNotifications(PermissionApplicator $permissions)
{
$preferences = (new UserNotificationPreferences(user()));
$query = Watch::query()->where('user_id', '=', user()->id);
$query = $permissions->restrictEntityRelationQuery($query, 'watches', 'watchable_id', 'watchable_type');
$watches = $query->with('watchable')->paginate(20);
return view('users.preferences.notifications', [
'preferences' => $preferences,
'watches' => $watches,
]);
}