From ab70a369fa483affdac95134ab5c384ddaaacbc1 Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Wed, 14 Aug 2019 11:20:32 +0800 Subject: [PATCH] Updated User model to support actions closes #11013 --- core/server/models/user.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/server/models/user.js b/core/server/models/user.js index a0743de8cf..1bd69854c6 100644 --- a/core/server/models/user.js +++ b/core/server/models/user.js @@ -322,6 +322,24 @@ User = ghostBookshelf.Model.extend({ delete options.status; return filter; + }, + + getAction(event, options) { + const actor = this.getActor(options); + + // @NOTE: we ignore internal updates (`options.context.internal`) for now + if (!actor) { + return; + } + + // @TODO: implement context + return { + event: event, + resource_id: this.id || this.previous('id'), + resource_type: 'user', + actor_id: actor.id, + actor_type: actor.type + }; } }, { orderDefaultOptions: function orderDefaultOptions() {