mirror of
https://github.com/outline/outline.git
synced 2026-04-24 11:20:11 -05:00
fix: notifications.pixel errors, regressed in 5780959e93
This commit is contained in:
@@ -34,12 +34,19 @@ export default async function notificationUpdater(
|
||||
if (changed) {
|
||||
await notification.save({ transaction });
|
||||
|
||||
await Event.createFromContext(ctx, {
|
||||
name: "notifications.update",
|
||||
userId: notification.userId,
|
||||
modelId: notification.id,
|
||||
documentId: notification.documentId,
|
||||
});
|
||||
await Event.createFromContext(
|
||||
ctx,
|
||||
{
|
||||
name: "notifications.update",
|
||||
userId: notification.userId,
|
||||
modelId: notification.id,
|
||||
documentId: notification.documentId,
|
||||
},
|
||||
{
|
||||
actorId: notification.userId,
|
||||
teamId: notification.teamId,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return notification;
|
||||
|
||||
@@ -162,16 +162,19 @@ class Event extends IdModel<
|
||||
static createFromContext(
|
||||
ctx: APIContext,
|
||||
attributes: Omit<Partial<Event>, "ip" | "teamId" | "actorId"> = {},
|
||||
defaultAttributes: Pick<Partial<Event>, "ip" | "teamId" | "actorId"> = {},
|
||||
options?: CreateOptions<InferAttributes<Event>>
|
||||
) {
|
||||
const { user } = ctx.state.auth;
|
||||
const user = ctx.state.auth?.user;
|
||||
const authType = ctx.state.auth?.type;
|
||||
|
||||
return this.create(
|
||||
{
|
||||
...attributes,
|
||||
actorId: user.id,
|
||||
teamId: user.teamId,
|
||||
ip: ctx.request.ip,
|
||||
authType: ctx.state.auth.type,
|
||||
actorId: user?.id || defaultAttributes.actorId,
|
||||
teamId: user?.teamId || defaultAttributes.teamId,
|
||||
ip: ctx.request.ip || defaultAttributes.ip,
|
||||
authType,
|
||||
},
|
||||
{
|
||||
transaction: ctx.state.transaction,
|
||||
|
||||
Reference in New Issue
Block a user