mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 19:02:29 +03:00
4c5ba4ed7d
closes https://github.com/TryGhost/Team/issues/1916 closes https://github.com/TryGhost/Team/issues/1917 - Added database storage for link redirects and click events via repositories (hides away database layer) defined in the wrapper services - Added LinkClickRepository to store click events to database - Added LinkRedirectRepository to store link redirects to database - Added PostLinkRepository to link LinkRedirects with posts - Renamed link-replacement package to link-replacer, and made it dependency less (it only replaces links now, doesn't do anything else) - The link-tracking service has a new `addTrackingToUrl` which returns a new URL that includes tracking. The new `addRedirectToUrl` method does the same but without tracking for now. - MEGA service now uses the link-replacer to replace links in the emails using a combination of different services (member attribution + link-tracking service)
26 lines
584 B
JavaScript
26 lines
584 B
JavaScript
const ObjectID = require('bson-objectid').default;
|
|
|
|
module.exports = class ClickEvent {
|
|
/** @type {ObjectID} */
|
|
event_id;
|
|
/** @type {string} */
|
|
member_uuid;
|
|
/** @type {ObjectID} */
|
|
link_id;
|
|
|
|
constructor(data) {
|
|
if (!data.id) {
|
|
this.event_id = new ObjectID();
|
|
}
|
|
|
|
if (typeof data.id === 'string') {
|
|
this.event_id = ObjectID.createFromHexString(data.id);
|
|
} else {
|
|
this.event_id = data.id;
|
|
}
|
|
|
|
this.member_uuid = data.member_uuid;
|
|
this.link_id = data.link_id;
|
|
}
|
|
};
|