mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 16:10:07 +00:00
fix(notifications): list the paddle region request for admins while any trip has Tours on
The admin matrix decided a trip addon by the admin's own trips, so with Tours off for the instance and on for a member's trip the paddle region request still reached admins but had no row to switch it. Admin-scoped rows now follow the addon being on for the instance or any trip.
This commit is contained in:
@@ -95,6 +95,18 @@ export class TripAddonOverridesRepository extends TrekRepository<TripAddonOverri
|
||||
.execute();
|
||||
}
|
||||
|
||||
/** Whether any trip at all switched the addon on for itself. */
|
||||
async anyEnabled(addon_id: string): Promise<boolean> {
|
||||
const row = await this.kysely<OverridesKyselyDB>()
|
||||
.selectFrom('trip_addon_overrides')
|
||||
.select('trip_id')
|
||||
.where('addon_id', '=', addon_id)
|
||||
.where('enabled', '=', 1)
|
||||
.limit(1)
|
||||
.executeTakeFirst();
|
||||
return row !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether any trip the user owns or is a member of switched the addon on for
|
||||
* itself. Routes without a trip (a library, a search across trips) open on
|
||||
|
||||
Reference in New Issue
Block a user