This repository was archived by the owner on Feb 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
2+ "k3b4422dc" : " This user is not a temporary user" ,
3+ "k429851b9" : " No operation authority" ,
4+ "k42cdd273" : " Username already exists!" ,
5+ "k45c8d1bf" : " Claimed user does not exist" ,
6+ "k719464e0" : " This message has been recall" ,
7+ "k89bf46fc" : " Unable to recall messages from {{minutes}} minutes ago" ,
8+ "ka8b712f7" : " Email already exists!" ,
29 "kb32d3d62" : " Anonymous" ,
10+ "kb5971793" : " Username or email is empty" ,
11+ "kb8be9969" : " Recall failed, no permission" ,
312 "ke9fabda8" : " Token Invalid"
413}
Original file line number Diff line number Diff line change 11{
2+ "k3b4422dc" : " 该用户不是临时用户" ,
3+ "k429851b9" : " 没有操作权限" ,
4+ "k42cdd273" : " 用户名已存在!" ,
5+ "k45c8d1bf" : " 认领用户不存在" ,
6+ "k719464e0" : " 该消息已被撤回" ,
7+ "k89bf46fc" : " 无法撤回 {{minutes}} 分钟前的消息" ,
8+ "ka8b712f7" : " 邮箱已存在!" ,
29 "kb32d3d62" : " 匿名用户" ,
10+ "kb5971793" : " 用户名或邮箱为空" ,
11+ "kb8be9969" : " 撤回失败, 没有权限" ,
312 "ke9fabda8" : " Token不合规"
413}
Original file line number Diff line number Diff line change 1+ import moment from 'moment' ;
12import { Types } from 'mongoose' ;
23import { NoPermissionError } from '../../lib/errors' ;
34import type { TcDbService } from '../../mixins/db.mixin' ;
@@ -106,6 +107,14 @@ class MessageService extends TcService {
106107 throw new Error ( t ( '该消息已被撤回' ) ) ;
107108 }
108109
110+ // 消息撤回限时
111+ if (
112+ moment ( ) . valueOf ( ) - moment ( message . createdAt ) . valueOf ( ) >
113+ 15 * 60 * 1000
114+ ) {
115+ throw new Error ( t ( '无法撤回 {{minutes}} 分钟前的消息' , { minutes : 15 } ) ) ;
116+ }
117+
109118 let allowToRecall = false ;
110119
111120 //#region 撤回权限检查
You can’t perform that action at this time.
0 commit comments