31a4135fec
refs https://github.com/TryGhost/Team/issues/1717 - Updates last_commented_at and last_seen_at (only once a day) - Used the LastSeenAtUpdater, so we can combine updating last_commented_at and last_seen_at in one query + used same pattern - Updated comments service to await emails in order to make E2E tests more stable (as we don't have any method to await emails and test emails otherwise). This removed the email sending logic from the `onCreated` hook of the model.
29 lines
651 B
JavaScript
29 lines
651 B
JavaScript
/**
|
|
* @typedef {object} MemberCommentEventData
|
|
* @prop {string} memberId
|
|
* @prop {string} commentId
|
|
* @prop {string} postId
|
|
*/
|
|
|
|
/**
|
|
* Server-side event firing on page views (page, post, tags...)
|
|
*/
|
|
module.exports = class MemberCommentEvent {
|
|
/**
|
|
* @param {MemberCommentEventData} data
|
|
* @param {Date} timestamp
|
|
*/
|
|
constructor(data, timestamp) {
|
|
this.data = data;
|
|
this.timestamp = timestamp;
|
|
}
|
|
|
|
/**
|
|
* @param {MemberCommentEventData} data
|
|
* @param {Date} [timestamp]
|
|
*/
|
|
static create(data, timestamp) {
|
|
return new MemberCommentEvent(data, timestamp || new Date);
|
|
}
|
|
};
|