-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Added member activity entry when gift subscription ends #27649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,7 +86,8 @@ module.exports = class EventRepository { | |
| {type: 'payment_event', action: 'getPaymentEvents'}, | ||
| {type: 'email_change_event', action: 'getEmailChangeEvent'}, | ||
| {type: 'gift_purchase_event', action: 'getGiftPurchaseEvents'}, | ||
| {type: 'gift_redemption_event', action: 'getGiftRedemptionEvents'} | ||
| {type: 'gift_redemption_event', action: 'getGiftRedemptionEvents'}, | ||
| {type: 'gift_ended_event', action: 'getGiftEndedEvents'} | ||
|
sagzy marked this conversation as resolved.
|
||
| ); | ||
|
|
||
| if (this._AutomatedEmailRecipient) { | ||
|
|
@@ -136,6 +137,7 @@ module.exports = class EventRepository { | |
| login_event: 0, | ||
| subscription_event: 1, | ||
| gift_redemption_event: 1, | ||
| gift_ended_event: 1, | ||
| newsletter_event: 2, | ||
| signup_event: 3 | ||
| }; | ||
|
|
@@ -554,6 +556,46 @@ module.exports = class EventRepository { | |
| }; | ||
| } | ||
|
|
||
| async getGiftEndedEvents(options = {}, filter) { | ||
| options = { | ||
| ...options, | ||
| withRelated: ['member'], | ||
| filter: 'from_status:gift+to_status:free+custom:true', | ||
| useBasicCount: true, | ||
| mongoTransformer: chainTransformers( | ||
| // First set the filter manually | ||
| replaceCustomFilterTransformer(filter), | ||
|
|
||
| // Map the used keys in that filter | ||
| ...mapKeys({ | ||
| 'data.created_at': 'created_at', | ||
| 'data.member_id': 'member_id' | ||
|
Comment on lines
+571
to
+572
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this re-mapping if we are using the same named keys?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still needed to strip the |
||
| }) | ||
| ) | ||
| }; | ||
|
|
||
| const {data: models, meta} = await this._MemberStatusEvent.findPage(options); | ||
|
|
||
| const data = models.map((model) => { | ||
| const json = model.toJSON(options); | ||
|
|
||
| return { | ||
| type: 'gift_ended_event', | ||
| data: { | ||
| id: json.id, | ||
| member: json.member || null, | ||
| member_id: json.member_id, | ||
| created_at: json.created_at | ||
| } | ||
| }; | ||
| }); | ||
|
|
||
| return { | ||
| data, | ||
| meta | ||
| }; | ||
| } | ||
|
|
||
| async getCommentEvents(options = {}, filter) { | ||
| options = { | ||
| ...options, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ok being the same as
subscription_event.expired? I don't think we can end up with the same event twice right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, it's either a gift or a paid subscription, so won't be logged twice for the same subscription. The copy / icon for the event are intentionally the same as with a paid subscription: