Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
saturn
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
saturn
Commits
2cfc4b5b
Commit
2cfc4b5b
authored
Jul 01, 2019
by
haowang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add check when create reply
parent
539ed5f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
reply.py
api/views/reply.py
+18
-1
No files found.
api/views/reply.py
View file @
2cfc4b5b
import
json
from
api.views.base_view
import
BaseView
from
alpha_types.venus.enum
import
REPLY_TYPE
from
api.utils.sensitive
import
Sensitive
class
CreateReplyForInner
(
BaseView
):
"""
内部使用,创建评论回复
"""
def
check_sensitive_content
(
self
,
content
):
# 敏感词检测,获取可用的帖子
check_info
=
Sensitive
.
check
([
content
])
succ
=
check_info
.
get
(
content
)
if
not
succ
:
return
content
else
:
return
def
post
(
self
,
request
):
user_id
=
request
.
POST
.
get
(
'user_id'
)
topic_id
=
request
.
POST
.
get
(
'topic_id'
)
content
=
request
.
POST
.
get
(
'content'
,
''
)
replied_id
=
request
.
POST
.
get
(
'replied_id'
)
reply_type
=
request
.
POST
.
get
(
'type'
,
REPLY_TYPE
.
PUPPET_REPLY
)
if
reply_type
not
in
(
REPLY_TYPE
.
PUPPET_REPLY
,
REPLY_TYPE
.
PUPPET_REPLY_ANS
):
if
not
self
.
check_sensitive_content
(
content
):
return
error
,
data
=
self
.
call_rpc
(
'venus/community/reply/for_inner_create'
,
user_id
=
user_id
,
topic_id
=
topic_id
,
content
=
content
,
replied_id
=
replied_id
)
error
,
data
=
self
.
call_rpc
(
'venus/community/reply/for_inner_create'
,
user_id
=
user_id
,
topic_id
=
topic_id
,
content
=
content
,
replied_id
=
replied_id
,
reply_type
=
reply_type
)
if
error
:
return
self
.
error
(
error
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment