Ghost/ghost/audience-feedback/lib/AudienceFeedbackService.js
Elena Baidakova e831be6bc2
Added the feedback buttons in the emails (#15619)
closes TryGhost/Team#2046
closes TryGhost/Team#2045
- Added feedback buttons markup.
- Added feedback links generation.
2022-10-14 18:12:17 +04:00

29 lines
709 B
JavaScript

class AudienceFeedbackService {
/** @type URL */
#baseURL;
/**
* @param {object} deps
* @param {object} deps.config
* @param {URL} deps.config.baseURL
*/
constructor(deps) {
this.#baseURL = deps.config.baseURL;
}
/**
* @param {string} uuid
* @param {string} postId
* @param {0 | 1} score
*/
buildLink(uuid, postId, score) {
const url = new URL(this.#baseURL);
url.searchParams.set('action', 'feedback');
url.searchParams.set('post', postId);
url.searchParams.set('uuid', uuid);
url.searchParams.set('score', `${score}`);
return url;
}
}
module.exports = AudienceFeedbackService;