mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: encodeURIComponent
This commit is contained in:
1 parent
b6a6f46d20
commit
00dcf3864f
4 files changed
+13
-16
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.23.21",
|
||||
"version": "2.23.22",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { ObjectID } from 'mongodb';
|
||||
import { isSafeInteger } from 'lodash';
|
||||
import { DiscussionNotFoundError, DocumentNotFoundError, PermissionError } from '../error';
|
||||
import {
|
||||
Mdoc, Drdoc, Ddoc, Drrdoc,
|
||||
} from '../interface';
|
||||
import { Drdoc, Ddoc, Drrdoc } from '../interface';
|
||||
import paginate from '../lib/paginate';
|
||||
import * as system from '../model/system';
|
||||
import user from '../model/user';
|
||||
@@ -215,16 +213,13 @@ class DiscussionDetailHandler extends DiscussionHandler {
|
||||
this.checkPerm(PERM.PERM_REPLY_DISCUSSION);
|
||||
await this.limitRate('add_discussion', 3600, 60);
|
||||
// Notify related users
|
||||
const replies: Drdoc[] = await discussion.getMultiReply(domainId, did).toArray();
|
||||
const uids = Array.from(new Set(replies.map((drdoc) => drdoc.owner)));
|
||||
const tasks = uids.map((uid) => {
|
||||
if (uid !== this.user._id) {
|
||||
return message.send(1, uid, `Discussion update: ${domainId} ${did}`);
|
||||
}
|
||||
return Promise.resolve(null as Mdoc);
|
||||
});
|
||||
await Promise.all(tasks);
|
||||
await discussion.addReply(domainId, did, this.user._id, content, this.request.ip);
|
||||
const replies: Drdoc[] = await discussion.getMultiReply(domainId, did).toArray();
|
||||
const uids = new Set(replies.map((drdoc) => drdoc.owner));
|
||||
uids.delete(this.user._id);
|
||||
const str = JSON.stringify({ message: '{0} replied to discussion {1}{2}.', params: [this.user._id, domainId, did] });
|
||||
const tasks = Array.from(uids).map((uid) => message.send(1, uid, str));
|
||||
await Promise.all(tasks);
|
||||
this.back();
|
||||
}
|
||||
|
||||
@@ -234,6 +229,8 @@ class DiscussionDetailHandler extends DiscussionHandler {
|
||||
this.checkPerm(PERM.PERM_REPLY_DISCUSSION);
|
||||
await this.limitRate('add_discussion', 3600, 60);
|
||||
await discussion.addTailReply(domainId, drid, this.user._id, content, this.request.ip);
|
||||
const str = JSON.stringify({ message: '{0} replied to discussion reply {1}{2}.', params: [this.user._id, domainId, drid] });
|
||||
if (this.drdoc.owner !== this.user._id) await message.send(1, this.drdoc.owner, str);
|
||||
this.back();
|
||||
}
|
||||
|
||||
|
||||
@@ -344,11 +344,11 @@ export class HandlerCommon {
|
||||
const query: any = {};
|
||||
for (const key in kwargs) {
|
||||
if (kwargs[key] instanceof ObjectID) args[key] = kwargs[key].toHexString();
|
||||
else args[key] = kwargs[key].toString();
|
||||
else args[key] = encodeURIComponent(kwargs[key].toString());
|
||||
}
|
||||
for (const key in kwargs.query || {}) {
|
||||
if (query[key] instanceof ObjectID) query[key] = kwargs.query[key].toHexString();
|
||||
else query[key] = kwargs.query[key].toString();
|
||||
else query[key] = encodeURIComponent(kwargs.query[key].toString());
|
||||
}
|
||||
try {
|
||||
const { anchor } = args;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<h1 class="section__title scratchpad--hide">
|
||||
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rdoc['status']] }}"></span>
|
||||
<span class="record-status--text {{ model.builtin.STATUS_CODES[rdoc['status']] }}">
|
||||
{{ 'Accepted' if rdoc.status == model.builtin.STATUS.STATUS_ACCEPTED else rdoc.score }}
|
||||
{{ model.builtin.STATUS_TEXTS[rdoc.status] }}{% if rdoc.status != model.builtin.STATUS.STATUS_ACCEPTED %} {{ rdoc.score }}{% endif %}
|
||||
</span>
|
||||
</h1>
|
||||
{% endif %}
|
||||
|
||||
Reference in new issue
Block a user