@waline/vercel 1.6.0 → 1.6.1
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/package.json
CHANGED
|
@@ -154,13 +154,33 @@ module.exports = class extends BaseRest {
|
|
|
154
154
|
offset: Math.max((page - 1) * pageSize, 0),
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
+
const userModel = this.service(
|
|
158
|
+
`storage/${this.config('storage')}`,
|
|
159
|
+
'Users'
|
|
160
|
+
);
|
|
161
|
+
const user_ids = Array.from(
|
|
162
|
+
new Set(comments.map(({ user_id }) => user_id).filter((v) => v))
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
let users = [];
|
|
166
|
+
if (user_ids.length) {
|
|
167
|
+
users = await userModel.select(
|
|
168
|
+
{ objectId: ['IN', user_ids] },
|
|
169
|
+
{
|
|
170
|
+
field: ['display_name', 'email', 'url', 'type', 'avatar'],
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
157
175
|
return this.success({
|
|
158
176
|
page,
|
|
159
177
|
totalPages: Math.ceil(count / pageSize),
|
|
160
178
|
pageSize,
|
|
161
179
|
spamCount,
|
|
162
180
|
waitingCount,
|
|
163
|
-
data:
|
|
181
|
+
data: await Promise.all(
|
|
182
|
+
comments.map((cmt) => formatCmt(cmt, users, this.config()))
|
|
183
|
+
),
|
|
164
184
|
});
|
|
165
185
|
}
|
|
166
186
|
|
package/src/service/notify.js
CHANGED
|
@@ -287,7 +287,7 @@ module.exports = class extends think.Service {
|
|
|
287
287
|
? parent && parent.mail.toLowerCase() === AUTHOR.toLowerCase()
|
|
288
288
|
: false;
|
|
289
289
|
|
|
290
|
-
const title = mailSubjectAdmin || '{{site.name}} 上有新评论了';
|
|
290
|
+
const title = mailSubjectAdmin || '{{site.name | safe}} 上有新评论了';
|
|
291
291
|
const content =
|
|
292
292
|
mailTemplateAdmin ||
|
|
293
293
|
`
|
|
@@ -331,7 +331,8 @@ module.exports = class extends think.Service {
|
|
|
331
331
|
mailList.push({
|
|
332
332
|
to: parent.mail,
|
|
333
333
|
title:
|
|
334
|
-
mailSubject ||
|
|
334
|
+
mailSubject ||
|
|
335
|
+
'{{parent.nick | safe}},『{{site.name | safe}}』上的评论收到了回复',
|
|
335
336
|
content:
|
|
336
337
|
mailTemplate ||
|
|
337
338
|
`
|
|
@@ -115,8 +115,9 @@ module.exports = class extends Base {
|
|
|
115
115
|
async select(where, options = {}) {
|
|
116
116
|
let data = [];
|
|
117
117
|
let ret = [];
|
|
118
|
+
let offset = options.offset || 0;
|
|
118
119
|
do {
|
|
119
|
-
options.offset =
|
|
120
|
+
options.offset = offset + data.length;
|
|
120
121
|
ret = await this._select(where, options);
|
|
121
122
|
data = data.concat(ret);
|
|
122
123
|
} while (ret.length === 100);
|
|
@@ -101,8 +101,9 @@ module.exports = class extends Base {
|
|
|
101
101
|
async select(where, options = {}) {
|
|
102
102
|
let data = [];
|
|
103
103
|
let ret = [];
|
|
104
|
+
let offset = options.offset || 0;
|
|
104
105
|
do {
|
|
105
|
-
options.offset =
|
|
106
|
+
options.offset = offset + data.length;
|
|
106
107
|
ret = await this._select(where, options);
|
|
107
108
|
data = data.concat(ret);
|
|
108
109
|
} while (ret.length === 1000);
|
|
@@ -88,8 +88,9 @@ module.exports = class extends Base {
|
|
|
88
88
|
async select(where, options = {}) {
|
|
89
89
|
let data = [];
|
|
90
90
|
let ret = [];
|
|
91
|
+
let offset = options.offset || 0;
|
|
91
92
|
do {
|
|
92
|
-
options.offset =
|
|
93
|
+
options.offset = offset + data.length;
|
|
93
94
|
ret = await this._select(where, options);
|
|
94
95
|
data = data.concat(ret);
|
|
95
96
|
} while (ret.length === 100);
|