mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: add discuss delete msg (#370)
This commit is contained in:
1 parent
ef5a2f5334
commit
8fc64a0654
2 files changed
+35
No files matched your search
@@ -1,6 +1,7 @@
|
|||||||
__id: zh
|
__id: zh
|
||||||
__langname: 简体中文
|
__langname: 简体中文
|
||||||
'"{data}" copied to clipboard!': “{data}”已复制到剪贴板!
|
'"{data}" copied to clipboard!': “{data}”已复制到剪贴板!
|
||||||
|
'{0} {1} delete your discussion reply {2} in "{3}"({4}).' : '{0} {1} 从讨论 {3}({4}) 删除了你的回复 {2}。'
|
||||||
'{0} comments': '{0} 条评论'
|
'{0} comments': '{0} 条评论'
|
||||||
'{0} discussions': '{0} 条讨论'
|
'{0} discussions': '{0} 条讨论'
|
||||||
'{0} is a moderator of this domain.': '{}是这个域的管理者之一。'
|
'{0} is a moderator of this domain.': '{}是这个域的管理者之一。'
|
||||||
@@ -59,6 +60,8 @@ Add new data: 添加新数据
|
|||||||
Add User: 添加用户
|
Add User: 添加用户
|
||||||
Add: 添加
|
Add: 添加
|
||||||
Additional File: 附加文件
|
Additional File: 附加文件
|
||||||
|
Admin {0} delete your discussion "{1}". : 管理员 {0} 删除了你的讨论 "{1}"。
|
||||||
|
Admin {0} delete your discussion tail reply {1} in "{2}"({3}). : 管理员 {0} 从讨论 {2}({3}) 中删除了你的楼中楼回复 {1}。
|
||||||
All {0} Contests: 所有 {0} 比赛
|
All {0} Contests: 所有 {0} 比赛
|
||||||
All Contests: 所有比赛
|
All Contests: 所有比赛
|
||||||
All Homeworks: 所有作业
|
All Homeworks: 所有作业
|
||||||
|
|||||||
@@ -282,14 +282,26 @@ class DiscussionDetailHandler extends DiscussionHandler {
|
|||||||
|
|
||||||
@param('drid', Types.ObjectID)
|
@param('drid', Types.ObjectID)
|
||||||
async postDeleteReply(domainId: string, drid: ObjectID) {
|
async postDeleteReply(domainId: string, drid: ObjectID) {
|
||||||
|
const deleteBy = this.user.own(this.drdoc) ? 'self' : this.user.own(this.ddoc) ? 'DiscussionOwner' : 'Admin';
|
||||||
if (!(this.user.own(this.ddoc)
|
if (!(this.user.own(this.ddoc)
|
||||||
&& this.user.hasPerm(PERM.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION))) {
|
&& this.user.hasPerm(PERM.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION))) {
|
||||||
if (!this.user.own(this.drdoc)) {
|
if (!this.user.own(this.drdoc)) {
|
||||||
this.checkPerm(PERM.PERM_DELETE_DISCUSSION_REPLY);
|
this.checkPerm(PERM.PERM_DELETE_DISCUSSION_REPLY);
|
||||||
} else this.checkPerm(PERM.PERM_DELETE_DISCUSSION_SELF);
|
} else this.checkPerm(PERM.PERM_DELETE_DISCUSSION_SELF);
|
||||||
}
|
}
|
||||||
|
const msg = JSON.stringify({
|
||||||
|
message: '{0} {1} delete your discussion reply {2} in "{3}"({4:link}).',
|
||||||
|
params: [
|
||||||
|
deleteBy,
|
||||||
|
this.user.uname,
|
||||||
|
this.drdoc.content.length > 10 ? `${this.drdoc.content.substring(0, 10)}...` : `${this.drdoc.content}`,
|
||||||
|
this.ddoc.title,
|
||||||
|
`/d/${domainId}${this.request.path}`,
|
||||||
|
],
|
||||||
|
});
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
discussion.delReply(domainId, drid),
|
discussion.delReply(domainId, drid),
|
||||||
|
deleteBy !== 'self' && message.send(1, this.drdoc.owner, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD),
|
||||||
oplog.log(this, 'discussion.reply.delete', this.drdoc),
|
oplog.log(this, 'discussion.reply.delete', this.drdoc),
|
||||||
]);
|
]);
|
||||||
this.back();
|
this.back();
|
||||||
@@ -311,9 +323,20 @@ class DiscussionDetailHandler extends DiscussionHandler {
|
|||||||
@param('drid', Types.ObjectID)
|
@param('drid', Types.ObjectID)
|
||||||
@param('drrid', Types.ObjectID)
|
@param('drrid', Types.ObjectID)
|
||||||
async postDeleteTailReply(domainId: string, drid: ObjectID, drrid: ObjectID) {
|
async postDeleteTailReply(domainId: string, drid: ObjectID, drrid: ObjectID) {
|
||||||
|
const deleteBy = this.user.own(this.drrdoc) ? 'self' : 'Admin';
|
||||||
if (!this.user.own(this.drrdoc)) this.checkPerm(PERM.PERM_DELETE_DISCUSSION_REPLY);
|
if (!this.user.own(this.drrdoc)) this.checkPerm(PERM.PERM_DELETE_DISCUSSION_REPLY);
|
||||||
|
const msg = JSON.stringify({
|
||||||
|
message: 'Admin {0} delete your discussion tail reply {1} in "{2}"({3:link}).',
|
||||||
|
params: [
|
||||||
|
this.user.uname,
|
||||||
|
this.drrdoc.content.length > 10 ? `${this.drrdoc.content.substring(0, 10)}...` : this.drrdoc.content,
|
||||||
|
this.ddoc.title,
|
||||||
|
`/d/${domainId}${this.request.path}`,
|
||||||
|
],
|
||||||
|
});
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
discussion.delTailReply(domainId, drid, drrid),
|
discussion.delTailReply(domainId, drid, drrid),
|
||||||
|
deleteBy !== 'self' && message.send(1, this.drrdoc.owner, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD),
|
||||||
oplog.log(this, 'discussion.tailReply.delete', this.drrdoc),
|
oplog.log(this, 'discussion.tailReply.delete', this.drrdoc),
|
||||||
]);
|
]);
|
||||||
this.back();
|
this.back();
|
||||||
@@ -379,10 +402,19 @@ class DiscussionEditHandler extends DiscussionHandler {
|
|||||||
|
|
||||||
@param('did', Types.ObjectID)
|
@param('did', Types.ObjectID)
|
||||||
async postDelete(domainId: string, did: ObjectID) {
|
async postDelete(domainId: string, did: ObjectID) {
|
||||||
|
const deleteBy = this.user.own(this.ddoc) ? 'self' : 'Admin';
|
||||||
if (!this.user.own(this.ddoc)) this.checkPerm(PERM.PERM_DELETE_DISCUSSION);
|
if (!this.user.own(this.ddoc)) this.checkPerm(PERM.PERM_DELETE_DISCUSSION);
|
||||||
else this.checkPerm(PERM.PERM_DELETE_DISCUSSION_SELF);
|
else this.checkPerm(PERM.PERM_DELETE_DISCUSSION_SELF);
|
||||||
|
const msg = JSON.stringify({
|
||||||
|
message: 'Admin {0} delete your discussion "{1}".',
|
||||||
|
params: [
|
||||||
|
this.user.uname,
|
||||||
|
this.ddoc.title,
|
||||||
|
],
|
||||||
|
});
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
oplog.log(this, 'discussion.delete', this.ddoc),
|
oplog.log(this, 'discussion.delete', this.ddoc),
|
||||||
|
deleteBy !== 'self' && message.send(1, this.ddoc.owner, msg, message.FLAG_RICHTEXT | message.FLAG_UNREAD),
|
||||||
discussion.del(domainId, did),
|
discussion.del(domainId, did),
|
||||||
]);
|
]);
|
||||||
this.response.body = { type: this.ddoc.parentType, parent: this.ddoc.parentId };
|
this.response.body = { type: this.ddoc.parentType, parent: this.ddoc.parentId };
|
||||||
|
|||||||
Reference in new issue
Block a user