From cacc74f3b4c99fda1cd97db7aa07db89c618aadd Mon Sep 17 00:00:00 2001 From: "Fabien \"egg\" O'Carroll" Date: Fri, 14 Jan 2022 12:03:35 +0200 Subject: [PATCH] Added "api" source to MemberSubscribedEvents refs https://github.com/TryGhost/Team/issues/1275 We want to be able to track where member subscriptions came from, so that we can use the information to reduce spam imports of members. We were missing information when members were uploaded via the Admin API, and setting the source to 'member' be default - this fixes that both when creating members and when updating their subscription status. --- ghost/members-api/lib/repositories/member.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ghost/members-api/lib/repositories/member.js b/ghost/members-api/lib/repositories/member.js index 275762cd24..eab234b2fb 100644 --- a/ghost/members-api/lib/repositories/member.js +++ b/ghost/members-api/lib/repositories/member.js @@ -151,6 +151,8 @@ module.exports = class MemberRepository { source = 'system'; } else if (context.user) { source = 'admin'; + } else if (context.api_key) { + source = 'api'; } else { source = 'member'; } @@ -266,6 +268,8 @@ module.exports = class MemberRepository { source = 'system'; } else if (context.user) { source = 'admin'; + } else if (context.api_key) { + source = 'api'; } else { source = 'member'; }