fix error preventing subscriptions
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Pau 2023-01-09 08:43:11 +01:00
parent 24b8b172b9
commit 3b69d76525
1 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ module.exports = Self => {
const models = Self.app.models; const models = Self.app.models;
const userId = ctx.options.accessToken.userId; const userId = ctx.options.accessToken.userId;
const user = await ctx.instance.userFk; const user = await ctx.instance.userFk;
const modifiedUser = await getUserToModify(user, models); const modifiedUser = await getUserToModify(null, user, models);
if (userId == modifiedUser.id || userId == modifiedUser.bossFk) if (userId == modifiedUser.id || userId == modifiedUser.bossFk)
return; return;
@ -40,7 +40,7 @@ module.exports = Self => {
Self.deleteNotification = async function(ctx, notificationId) { Self.deleteNotification = async function(ctx, notificationId) {
const models = Self.app.models; const models = Self.app.models;
const user = ctx.req.accessToken.userId; const user = ctx.req.accessToken.userId;
const modifiedUser = await getUserToModify(notificationId, models); const modifiedUser = await getUserToModify(notificationId, null, models);
if (user == modifiedUser.id || modifiedUser.bossFk == user) { if (user == modifiedUser.id || modifiedUser.bossFk == user) {
await models.NotificationSubscription.destroyById(notificationId); await models.NotificationSubscription.destroyById(notificationId);