ghost 5.4.1 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/tryghost-custom-theme-settings-service-0.0.0.tgz +0 -0
- package/components/tryghost-domain-events-0.0.0.tgz +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-0.0.0.tgz +0 -0
- package/components/tryghost-email-analytics-service-0.0.0.tgz +0 -0
- package/components/tryghost-express-dynamic-redirects-0.0.0.tgz +0 -0
- package/components/tryghost-magic-link-0.0.0.tgz +0 -0
- package/components/tryghost-member-analytics-service-0.0.0.tgz +0 -0
- package/components/tryghost-member-events-0.0.0.tgz +0 -0
- package/components/tryghost-members-analytics-ingress-0.0.0.tgz +0 -0
- package/components/tryghost-members-api-0.0.0.tgz +0 -0
- package/components/tryghost-members-csv-0.0.0.tgz +0 -0
- package/components/tryghost-members-events-service-0.0.0.tgz +0 -0
- package/components/tryghost-members-importer-0.0.0.tgz +0 -0
- package/components/tryghost-members-offers-0.0.0.tgz +0 -0
- package/components/tryghost-members-payments-0.0.0.tgz +0 -0
- package/components/tryghost-members-ssr-0.0.0.tgz +0 -0
- package/components/tryghost-members-stripe-service-0.0.0.tgz +0 -0
- package/components/tryghost-verification-trigger-0.0.0.tgz +0 -0
- package/content/themes/casper/assets/built/global.css +1 -1
- package/content/themes/casper/assets/built/global.css.map +1 -1
- package/content/themes/casper/assets/built/screen.css +1 -1
- package/content/themes/casper/assets/built/screen.css.map +1 -1
- package/content/themes/casper/assets/css/screen.css +9 -1
- package/content/themes/casper/gulpfile.js +1 -1
- package/content/themes/casper/package.json +9 -9
- package/content/themes/casper/yarn.lock +1154 -1249
- package/core/boot.js +5 -0
- package/core/built/assets/{chunk.3.dc389a0f93cb5fabd695.js → chunk.3.550552fbc71864fb9738.js} +20 -20
- package/core/built/assets/fonts/Inter.ttf +0 -0
- package/core/built/assets/ghost-dark-5c2a961b35311d7298136e02289d98b2.css +1 -0
- package/core/built/assets/ghost.min-a89d10b3b58c1a5ebaca68cef93a404c.css +1 -0
- package/core/built/assets/{ghost.min-36b64813b14c45075770658269d4b478.js → ghost.min-c75f224decd20f9538179d7564cd2ab4.js} +3005 -2874
- package/core/built/assets/icons/event-comment.svg +3 -0
- package/core/built/assets/{vendor.min-be0129c9c6897c9f10425e2402881d77.js → vendor.min-cf3af99dca0c71937669305afb3686a1.js} +6110 -3186
- package/core/frontend/helpers/comments.js +22 -10
- package/core/frontend/helpers/ghost_head.js +22 -4
- package/core/frontend/utils/frontend-apps.js +33 -0
- package/core/server/api/endpoints/comments-comments.js +50 -32
- package/core/server/api/endpoints/utils/serializers/output/config.js +2 -1
- package/core/server/api/endpoints/utils/serializers/output/mappers/activity-feed-events.js +17 -0
- package/core/server/api/endpoints/utils/serializers/output/mappers/comments.js +18 -0
- package/core/server/api/endpoints/utils/serializers/output/mappers/index.js +1 -0
- package/core/server/api/endpoints/utils/serializers/output/members.js +12 -1
- package/core/server/data/exporter/table-lists.js +2 -1
- package/core/server/data/migrations/versions/5.5/2022-07-18-14-29-add-comment-reporting-permissions.js +10 -0
- package/core/server/data/migrations/versions/5.5/2022-07-18-14-31-drop-reports-reason.js +3 -0
- package/core/server/data/migrations/versions/5.5/2022-07-18-14-32-drop-nullable-member-id-from-likes.js +4 -0
- package/core/server/data/migrations/versions/5.5/2022-07-18-14-33-fix-comments-on-delete-foreign-keys.js +119 -0
- package/core/server/data/migrations/versions/5.5/2022-07-21-08-56-add-jobs-table.js +11 -0
- package/core/server/data/schema/commands.js +7 -2
- package/core/server/data/schema/fixtures/fixtures.json +5 -0
- package/core/server/data/schema/schema.js +12 -4
- package/core/server/ghost-server.js +0 -22
- package/core/server/models/comment-report.js +34 -0
- package/core/server/models/comment.js +8 -7
- package/core/server/models/job.js +9 -0
- package/core/server/services/comments/email-templates/new-comment-reply.hbs +2 -2
- package/core/server/services/comments/email-templates/new-comment-reply.txt.js +7 -8
- package/core/server/services/comments/email-templates/new-comment.hbs +2 -2
- package/core/server/services/comments/email-templates/new-comment.txt.js +7 -6
- package/core/server/services/comments/email-templates/report.hbs +199 -0
- package/core/server/services/comments/email-templates/report.txt.js +16 -0
- package/core/server/services/comments/emails.js +57 -1
- package/core/server/services/comments/service.js +194 -2
- package/core/server/services/jobs/job-service.js +24 -1
- package/core/server/services/mail/GhostMailer.js +1 -0
- package/core/server/services/members/api.js +2 -1
- package/core/server/services/public-config/config.js +2 -1
- package/core/server/services/stripe/service.js +9 -1
- package/core/server/web/admin/views/default-prod.html +4 -4
- package/core/server/web/admin/views/default.html +4 -4
- package/core/server/web/api/testmode/jobs/graceful-job.js +2 -2
- package/core/server/web/api/testmode/routes.js +14 -0
- package/core/server/web/comments/routes.js +2 -0
- package/core/shared/config/defaults.json +12 -7
- package/core/shared/config/env/config.testing.json +3 -2
- package/package.json +70 -56
- package/yarn.lock +1763 -1796
- package/core/built/assets/ghost-dark-739c1f5546bd048eeeb253965ef36712.css +0 -1
- package/core/built/assets/ghost.min-5211776b9497f36fac8c9e5f2584cbcc.css +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const ghostBookshelf = require('./base');
|
|
2
|
+
|
|
3
|
+
const CommentReport = ghostBookshelf.Model.extend({
|
|
4
|
+
tableName: 'comment_reports',
|
|
5
|
+
|
|
6
|
+
defaults: function defaults() {
|
|
7
|
+
return {};
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
comment() {
|
|
11
|
+
return this.belongsTo('Comment', 'comment_id');
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
member() {
|
|
15
|
+
return this.belongsTo('Member', 'member_id');
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
emitChange: function emitChange(event, options) {
|
|
19
|
+
const eventToTrigger = 'comment_report' + '.' + event;
|
|
20
|
+
ghostBookshelf.Model.prototype.emitChange.bind(this)(this, eventToTrigger, options);
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
onCreated: function onCreated(model, options) {
|
|
24
|
+
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
|
25
|
+
|
|
26
|
+
model.emitChange('added', options);
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
CommentReport: ghostBookshelf.model('CommentReport', CommentReport)
|
|
34
|
+
};
|
|
@@ -2,7 +2,6 @@ const ghostBookshelf = require('./base');
|
|
|
2
2
|
const _ = require('lodash');
|
|
3
3
|
const errors = require('@tryghost/errors');
|
|
4
4
|
const tpl = require('@tryghost/tpl');
|
|
5
|
-
const commentsService = require('../services/comments');
|
|
6
5
|
|
|
7
6
|
const messages = {
|
|
8
7
|
commentNotFound: 'Comment could not be found',
|
|
@@ -70,14 +69,14 @@ const Comment = ghostBookshelf.Model.extend({
|
|
|
70
69
|
onCreated: function onCreated(model, options) {
|
|
71
70
|
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
|
72
71
|
|
|
73
|
-
if (!options.context.internal) {
|
|
74
|
-
commentsService.api.sendNewCommentNotifications(model);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
72
|
model.emitChange('added', options);
|
|
78
73
|
},
|
|
79
74
|
|
|
80
|
-
enforcedFilters: function enforcedFilters() {
|
|
75
|
+
enforcedFilters: function enforcedFilters(options) {
|
|
76
|
+
if (options.context && options.context.user) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
|
|
81
80
|
return 'parent_id:null';
|
|
82
81
|
}
|
|
83
82
|
|
|
@@ -151,7 +150,9 @@ const Comment = ghostBookshelf.Model.extend({
|
|
|
151
150
|
defaultRelations: function defaultRelations(methodName, options) {
|
|
152
151
|
// @todo: the default relations are not working for 'add' when we add it below
|
|
153
152
|
if (['findAll', 'findPage', 'edit', 'findOne'].indexOf(methodName) !== -1) {
|
|
154
|
-
options.withRelated
|
|
153
|
+
if (!options.withRelated || options.withRelated.length === 0) {
|
|
154
|
+
options.withRelated = ['member', 'likes', 'replies', 'replies.member', 'replies.likes'];
|
|
155
|
+
}
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
return options;
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<tr>
|
|
117
117
|
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top;">
|
|
118
118
|
<p style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 20px; color: #15212A; font-weight: bold; line-height: 25px; margin: 0; margin-bottom: 15px;">Hey there,</p>
|
|
119
|
-
<p style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; color: #3A464C; font-weight: normal; margin: 0; line-height: 25px; margin-bottom: 32px;">Someone just replied to your comment on <a href="
|
|
119
|
+
<p style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; color: #3A464C; font-weight: normal; margin: 0; line-height: 25px; margin-bottom: 32px;">Someone just replied to your comment on <a href="{{postUrl}}" target="_blank">{{postTitle}}</a>.</p>
|
|
120
120
|
|
|
121
121
|
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; box-sizing: border-box; background: #F9F9FA; border-radius: 7px;">
|
|
122
122
|
<tbody>
|
|
@@ -196,4 +196,4 @@
|
|
|
196
196
|
</tr>
|
|
197
197
|
</table>
|
|
198
198
|
</body>
|
|
199
|
-
</html>
|
|
199
|
+
</html>
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
module.exports = function (data) {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// Be careful when you indent the email, because whitespaces are visible in emails!
|
|
3
|
+
return `Hey there,
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Someone just replied to your comment on "${data.postTitle}"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
${data.postUrl}#ghost-comments-root
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
---
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`;
|
|
11
|
+
Sent to ${data.toEmail} from ${data.siteDomain}.
|
|
12
|
+
You can manage your notification preferences at ${data.profileUrl}.`;
|
|
14
13
|
};
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<tr>
|
|
117
117
|
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top;">
|
|
118
118
|
<p style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 20px; color: #15212A; font-weight: bold; line-height: 25px; margin: 0; margin-bottom: 15px;">Hey there,</p>
|
|
119
|
-
<p style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; color: #3A464C; font-weight: normal; margin: 0; line-height: 25px; margin-bottom: 32px;">Someone just left a comment on your post <a href="
|
|
119
|
+
<p style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; color: #3A464C; font-weight: normal; margin: 0; line-height: 25px; margin-bottom: 32px;">Someone just left a comment on your post <a href="{{postUrl}}" target="_blank">{{postTitle}}</a>.</p>
|
|
120
120
|
|
|
121
121
|
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; box-sizing: border-box; background: #F9F9FA; border-radius: 7px;">
|
|
122
122
|
<tbody>
|
|
@@ -196,4 +196,4 @@
|
|
|
196
196
|
</tr>
|
|
197
197
|
</table>
|
|
198
198
|
</body>
|
|
199
|
-
</html>
|
|
199
|
+
</html>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
module.exports = function (data) {
|
|
2
|
+
// Be careful when you indent the email, because whitespaces are visible in emails!
|
|
2
3
|
return `
|
|
3
|
-
|
|
4
|
+
Hey there,
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Someone just posted a comment on your post "${data.postTitle}"
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
${data.postUrl}#ghost-comments-root
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
---
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
Sent to ${data.toEmail} from ${data.siteDomain}.
|
|
13
|
+
You can manage your notification preferences at ${data.staffUrl}.
|
|
13
14
|
`;
|
|
14
15
|
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta name="viewport" content="width=device-width">
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
6
|
+
<title>🚩 A comment has been reported on {{postTitle}}</title>
|
|
7
|
+
<style>
|
|
8
|
+
/* -------------------------------------
|
|
9
|
+
RESPONSIVE AND MOBILE FRIENDLY STYLES
|
|
10
|
+
------------------------------------- */
|
|
11
|
+
@media only screen and (max-width: 620px) {
|
|
12
|
+
table[class=body] h1 {
|
|
13
|
+
font-size: 28px !important;
|
|
14
|
+
margin-bottom: 10px !important;
|
|
15
|
+
}
|
|
16
|
+
table[class=body] p,
|
|
17
|
+
table[class=body] ul,
|
|
18
|
+
table[class=body] ol,
|
|
19
|
+
table[class=body] td,
|
|
20
|
+
table[class=body] span,
|
|
21
|
+
table[class=body] a {
|
|
22
|
+
font-size: 16px !important;
|
|
23
|
+
}
|
|
24
|
+
table[class=body] .wrapper,
|
|
25
|
+
table[class=body] .article {
|
|
26
|
+
padding: 10px !important;
|
|
27
|
+
}
|
|
28
|
+
table[class=body] .content {
|
|
29
|
+
padding: 0 !important;
|
|
30
|
+
}
|
|
31
|
+
table[class=body] .container {
|
|
32
|
+
padding: 0 !important;
|
|
33
|
+
width: 100% !important;
|
|
34
|
+
}
|
|
35
|
+
table[class=body] .main {
|
|
36
|
+
border-left-width: 0 !important;
|
|
37
|
+
border-radius: 0 !important;
|
|
38
|
+
border-right-width: 0 !important;
|
|
39
|
+
}
|
|
40
|
+
table[class=body] .btn table {
|
|
41
|
+
width: 100% !important;
|
|
42
|
+
}
|
|
43
|
+
table[class=body] .btn a {
|
|
44
|
+
width: 100% !important;
|
|
45
|
+
}
|
|
46
|
+
table[class=body] .img-responsive {
|
|
47
|
+
height: auto !important;
|
|
48
|
+
max-width: 100% !important;
|
|
49
|
+
width: auto !important;
|
|
50
|
+
}
|
|
51
|
+
table[class=body] p[class=small],
|
|
52
|
+
table[class=body] a[class=small] {
|
|
53
|
+
font-size: 11px !important;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/* -------------------------------------
|
|
57
|
+
PRESERVE THESE STYLES IN THE HEAD
|
|
58
|
+
------------------------------------- */
|
|
59
|
+
@media all {
|
|
60
|
+
.ExternalClass {
|
|
61
|
+
width: 100%;
|
|
62
|
+
}
|
|
63
|
+
.ExternalClass,
|
|
64
|
+
.ExternalClass p,
|
|
65
|
+
.ExternalClass span,
|
|
66
|
+
.ExternalClass font,
|
|
67
|
+
.ExternalClass td,
|
|
68
|
+
.ExternalClass div {
|
|
69
|
+
line-height: 100%;
|
|
70
|
+
}
|
|
71
|
+
.recipient-link a {
|
|
72
|
+
color: inherit !important;
|
|
73
|
+
font-family: inherit !important;
|
|
74
|
+
font-size: inherit !important;
|
|
75
|
+
font-weight: inherit !important;
|
|
76
|
+
line-height: inherit !important;
|
|
77
|
+
text-decoration: none !important;
|
|
78
|
+
}
|
|
79
|
+
#MessageViewBody a {
|
|
80
|
+
color: inherit;
|
|
81
|
+
text-decoration: none;
|
|
82
|
+
font-size: inherit;
|
|
83
|
+
font-family: inherit;
|
|
84
|
+
font-weight: inherit;
|
|
85
|
+
line-height: inherit;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
hr {
|
|
89
|
+
border-width: 0;
|
|
90
|
+
height: 0;
|
|
91
|
+
margin-top: 34px;
|
|
92
|
+
margin-bottom: 34px;
|
|
93
|
+
border-bottom-width: 1px;
|
|
94
|
+
border-bottom-color: #EEF5F8;
|
|
95
|
+
}
|
|
96
|
+
a {
|
|
97
|
+
color: #3A464C;
|
|
98
|
+
}
|
|
99
|
+
</style>
|
|
100
|
+
</head>
|
|
101
|
+
<body style="background-color: #ffffff; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.5em; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;">
|
|
102
|
+
<table border="0" cellpadding="0" cellspacing="0" class="body" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
|
|
103
|
+
<tr>
|
|
104
|
+
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top;"> </td>
|
|
105
|
+
<td class="container" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top; display: block; Margin: 0 auto; max-width: 540px; padding: 10px; width: 540px;">
|
|
106
|
+
<div class="content" style="box-sizing: border-box; display: block; Margin: 0 auto; max-width: 600px; padding: 30px 20px;">
|
|
107
|
+
|
|
108
|
+
<!-- START CENTERED CONTAINER -->
|
|
109
|
+
<span class="preheader" style="color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">{{reporterName}} ({{reporterEmail}}) reported a comment on your post</span>
|
|
110
|
+
<table class="main" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background: #ffffff; border-radius: 8px;">
|
|
111
|
+
|
|
112
|
+
<!-- START MAIN CONTENT AREA -->
|
|
113
|
+
<tr>
|
|
114
|
+
<td class="wrapper" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top; box-sizing: border-box;">
|
|
115
|
+
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
|
|
116
|
+
<tr>
|
|
117
|
+
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top;">
|
|
118
|
+
<p style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 20px; color: #15212A; font-weight: bold; line-height: 25px; margin: 0; margin-bottom: 15px;">Hey there,</p>
|
|
119
|
+
<p style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; color: #3A464C; font-weight: normal; margin: 0; line-height: 25px; margin-bottom: 32px;">{{reporter}} has reported the comment below on <a href="{{postUrl}}" target="_blank">{{postTitle}}</a>. This comment will remain visible until you choose to remove it, which can be done directly on the post.</p>
|
|
120
|
+
|
|
121
|
+
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; box-sizing: border-box; background: #F9F9FA; border-radius: 7px;">
|
|
122
|
+
<tbody>
|
|
123
|
+
<tr>
|
|
124
|
+
<td align="left" style="padding: 16px;">
|
|
125
|
+
<table border="0" cellpadding="0" cellspacing="0">
|
|
126
|
+
<tr>
|
|
127
|
+
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; padding-right: 8px;">
|
|
128
|
+
<table border="0" cellpadding="0" cellspacing="0" width="44" height="44" style="width: 44px; height: 44px; background-color: #15171A; border-radius: 999px;">
|
|
129
|
+
<tr>
|
|
130
|
+
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 18px; color: #FFFFFF; text-align: center; font-weight: 500; height: 44px; width: 44px;">{{memberInitials}}</td>
|
|
131
|
+
</tr>
|
|
132
|
+
</table>
|
|
133
|
+
</td>
|
|
134
|
+
<td style="padding-right: 8px;">
|
|
135
|
+
<p style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; padding-right: 8px; padding: 0; margin: 0; color: #15171A; font-weight: 600;">{{memberName}}</p>
|
|
136
|
+
<p style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 13px; padding-right: 8px; padding: 0; margin: 0; color: #95A1AD;">{{#if memberBio}}{{memberBio}} • {{/if}}{{commentDate}}</p>
|
|
137
|
+
</td>
|
|
138
|
+
</tr>
|
|
139
|
+
</table>
|
|
140
|
+
</td>
|
|
141
|
+
</tr>
|
|
142
|
+
<tr>
|
|
143
|
+
<td align="left" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; vertical-align: top; padding-top: 0; padding-right: 16px; padding-bottom: 16px; padding-left: 16px; color: #15171A;">
|
|
144
|
+
{{{commentHtml}}}
|
|
145
|
+
</td>
|
|
146
|
+
</tr>
|
|
147
|
+
</tbody>
|
|
148
|
+
</table>
|
|
149
|
+
|
|
150
|
+
<table border="0" cellpadding="0" cellspacing="0" class="btn btn-primary" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; box-sizing: border-box;">
|
|
151
|
+
<tbody>
|
|
152
|
+
<tr>
|
|
153
|
+
<td align="left" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; vertical-align: top; padding-top: 32px; padding-bottom: 12px;">
|
|
154
|
+
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: auto;">
|
|
155
|
+
<tbody>
|
|
156
|
+
<tr>
|
|
157
|
+
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; vertical-align: top; background-color: {{accentColor}}; border-radius: 5px; text-align: center;"> <a href="{{postUrl}}#ghost-comments-root" target="_blank" style="display: inline-block; color: #ffffff; background-color: {{accentColor}}; border: solid 1px {{accentColor}}; border-radius: 5px; box-sizing: border-box; cursor: pointer; text-decoration: none; font-size: 16px; font-weight: normal; margin: 0; padding: 9px 22px 10px; border-color: {{accentColor}};">View comment</a> </td>
|
|
158
|
+
</tr>
|
|
159
|
+
</tbody>
|
|
160
|
+
</table>
|
|
161
|
+
</td>
|
|
162
|
+
</tr>
|
|
163
|
+
</tbody>
|
|
164
|
+
</table>
|
|
165
|
+
<hr/>
|
|
166
|
+
<p style="word-break: break-all; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 15px; color: #3A464C; font-weight: normal; margin: 0; line-height: 25px; margin-bottom: 5px;">You can also copy & paste this URL into your browser:</p>
|
|
167
|
+
<p style="word-break: break-all; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 15px; line-height: 25px; margin-top:0; color: #3A464C;">{{postUrl}}#ghost-comments-root</p>
|
|
168
|
+
</td>
|
|
169
|
+
</tr>
|
|
170
|
+
|
|
171
|
+
<!-- START FOOTER -->
|
|
172
|
+
<tr>
|
|
173
|
+
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top; padding-top: 80px;">
|
|
174
|
+
<p class="small" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; line-height: 18px; font-size: 11px; color: #738A94; font-weight: normal; margin: 0; margin-bottom: 2px;">This message was sent from <a class="small" href="{{siteUrl}}" style="text-decoration: underline; color: #738A94; font-size: 11px;">{{siteDomain}}</a> to <a class="small" href="mailto:{{toEmail}}" style="text-decoration: underline; color: #738A94; font-size: 11px;">{{toEmail}}</a></p>
|
|
175
|
+
</td>
|
|
176
|
+
</tr>
|
|
177
|
+
<tr>
|
|
178
|
+
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top; padding-top: 2px">
|
|
179
|
+
<p class="small" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; line-height: 18px; font-size: 11px; color: #738A94; font-weight: normal; margin: 0; margin-bottom: 2px;"><a class="small" href="{{staffUrl}}" style="text-decoration: underline; color: #738A94; font-size: 11px;">Manage your email preferences</a></p>
|
|
180
|
+
</td>
|
|
181
|
+
</tr>
|
|
182
|
+
|
|
183
|
+
<!-- END FOOTER -->
|
|
184
|
+
</table>
|
|
185
|
+
</td>
|
|
186
|
+
</tr>
|
|
187
|
+
|
|
188
|
+
<!-- END MAIN CONTENT AREA -->
|
|
189
|
+
</table>
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
<!-- END CENTERED CONTAINER -->
|
|
193
|
+
</div>
|
|
194
|
+
</td>
|
|
195
|
+
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top;"> </td>
|
|
196
|
+
</tr>
|
|
197
|
+
</table>
|
|
198
|
+
</body>
|
|
199
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = function (data) {
|
|
2
|
+
// Be careful when you indent the email, because whitespaces are visible in emails!
|
|
3
|
+
return `Hey there,
|
|
4
|
+
|
|
5
|
+
${data.reporter} has reported the comment below on ${data.postTitle}. This comment will remain visible until you choose to remove it, which can be done directly on the post.
|
|
6
|
+
|
|
7
|
+
${data.memberName} (${data.memberEmail}):
|
|
8
|
+
${data.commentText}
|
|
9
|
+
|
|
10
|
+
${data.postUrl}#ghost-comments-root
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Sent to ${data.toEmail} from ${data.siteDomain}.
|
|
15
|
+
You can manage your notification preferences at ${data.staffUrl}.`;
|
|
16
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const {promises: fs} = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const moment = require('moment');
|
|
4
|
+
const htmlToPlaintext = require('../../../shared/html-to-plaintext');
|
|
4
5
|
|
|
5
6
|
class CommentsServiceEmails {
|
|
6
7
|
constructor({config, logging, models, mailer, settingsCache, urlService, urlUtils}) {
|
|
@@ -48,7 +49,7 @@ class CommentsServiceEmails {
|
|
|
48
49
|
|
|
49
50
|
const {html, text} = await this.renderEmailTemplate('new-comment', templateData);
|
|
50
51
|
|
|
51
|
-
this.sendMail({
|
|
52
|
+
await this.sendMail({
|
|
52
53
|
to,
|
|
53
54
|
subject,
|
|
54
55
|
html,
|
|
@@ -65,6 +66,11 @@ class CommentsServiceEmails {
|
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
// Don't send a notification if you reply to your own comment
|
|
70
|
+
if (parentMember.id === reply.get('member_id')) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
68
74
|
const to = parentMember.get('email');
|
|
69
75
|
const subject = '💬 You have a new reply on one of your comments';
|
|
70
76
|
|
|
@@ -100,6 +106,56 @@ class CommentsServiceEmails {
|
|
|
100
106
|
});
|
|
101
107
|
}
|
|
102
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Send an email to notify the owner of the site that a comment has been reported by a member
|
|
111
|
+
* @param {*} comment The comment model that has been reported
|
|
112
|
+
* @param {*} reporter The member object who reported this comment
|
|
113
|
+
*/
|
|
114
|
+
async notifiyReport(comment, reporter) {
|
|
115
|
+
const post = await this.models.Post.findOne({id: comment.get('post_id')}, {withRelated: ['authors']});
|
|
116
|
+
const member = await this.models.Member.findOne({id: comment.get('member_id')});
|
|
117
|
+
const owner = await this.models.User.getOwnerUser();
|
|
118
|
+
|
|
119
|
+
// For now we only send the report to the owner
|
|
120
|
+
const to = owner.get('email');
|
|
121
|
+
const subject = '🚩 A comment has been reported on your post';
|
|
122
|
+
|
|
123
|
+
const memberName = member.get('name') || 'Anonymous';
|
|
124
|
+
|
|
125
|
+
const templateData = {
|
|
126
|
+
siteTitle: this.settingsCache.get('title'),
|
|
127
|
+
siteUrl: this.urlUtils.getSiteUrl(),
|
|
128
|
+
siteDomain: this.siteDomain,
|
|
129
|
+
postTitle: post.get('title'),
|
|
130
|
+
postUrl: this.urlService.getUrlByResourceId(post.get('id'), {absolute: true}),
|
|
131
|
+
commentHtml: comment.get('html'),
|
|
132
|
+
commentText: htmlToPlaintext.email(comment.get('html')),
|
|
133
|
+
commentDate: moment(comment.get('created_at')).tz(this.settingsCache.get('timezone')).format('D MMM YYYY'),
|
|
134
|
+
|
|
135
|
+
reporterName: reporter.name,
|
|
136
|
+
reporterEmail: reporter.email,
|
|
137
|
+
reporter: reporter.name ? `${reporter.name} (${reporter.email})` : reporter.email,
|
|
138
|
+
|
|
139
|
+
memberName: memberName,
|
|
140
|
+
memberEmail: member.get('email'),
|
|
141
|
+
memberBio: member.get('bio'),
|
|
142
|
+
memberInitials: this.extractInitials(memberName),
|
|
143
|
+
accentColor: this.settingsCache.get('accent_color'),
|
|
144
|
+
fromEmail: this.notificationFromAddress,
|
|
145
|
+
toEmail: to,
|
|
146
|
+
staffUrl: `${this.urlUtils.getAdminUrl()}ghost/#/settings/staff/${owner.get('slug')}`
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const {html, text} = await this.renderEmailTemplate('report', templateData);
|
|
150
|
+
|
|
151
|
+
await this.sendMail({
|
|
152
|
+
to,
|
|
153
|
+
subject,
|
|
154
|
+
html,
|
|
155
|
+
text
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
103
159
|
// Utils
|
|
104
160
|
|
|
105
161
|
get siteDomain() {
|