addendum to last commit
parent
2c19f5922c
commit
d920ae47c1
|
@ -116,6 +116,11 @@ MODACTION_TYPES = {
|
|||
"icon": 'fa-dollar-sign',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'edit_comment': {
|
||||
"str": 'edited {self.target_link}',
|
||||
"icon": 'fa-edit',
|
||||
"color": 'bg-primary'
|
||||
},
|
||||
'edit_post': {
|
||||
"str": 'edited {self.target_link}',
|
||||
"icon": 'fa-edit',
|
||||
|
|
|
@ -630,10 +630,12 @@ def edit_comment(cid, v):
|
|||
abort(400, "You have to actually type something!")
|
||||
|
||||
if body != c.body or request.files.get("file") and not g.is_tor:
|
||||
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
||||
abort(403, "You have to type more than 280 characters!")
|
||||
elif v.bird and len(body) > 140:
|
||||
abort(403, "You have to type less than 140 characters!")
|
||||
|
||||
if v.id == c.author_id:
|
||||
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
||||
abort(403, "You have to type more than 280 characters!")
|
||||
elif v.bird and len(body) > 140:
|
||||
abort(403, "You have to type less than 140 characters!")
|
||||
|
||||
execute_antispam_comment_check(body, v)
|
||||
|
||||
|
@ -641,10 +643,13 @@ def edit_comment(cid, v):
|
|||
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip() # process_files potentially adds characters to the post
|
||||
|
||||
body_for_sanitize = body
|
||||
if v.owoify:
|
||||
body_for_sanitize = owoify(body_for_sanitize)
|
||||
if v.marsify and not v.chud:
|
||||
body_for_sanitize = marsify(body_for_sanitize)
|
||||
|
||||
if v.id == c.author_id:
|
||||
if v.owoify:
|
||||
body_for_sanitize = owoify(body_for_sanitize)
|
||||
if v.marsify and not v.chud:
|
||||
body_for_sanitize = marsify(body_for_sanitize)
|
||||
|
||||
if c.sharpened:
|
||||
body_for_sanitize = sharpen(body_for_sanitize)
|
||||
|
||||
|
@ -652,7 +657,7 @@ def edit_comment(cid, v):
|
|||
|
||||
if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT: abort(400)
|
||||
|
||||
if v.marseyawarded and marseyaward_body_regex.search(body_html):
|
||||
if v.id == c.author_id and v.marseyawarded and marseyaward_body_regex.search(body_html):
|
||||
abort(403, "You can only type marseys!")
|
||||
|
||||
oldtext = c.body
|
||||
|
@ -668,8 +673,16 @@ def edit_comment(cid, v):
|
|||
|
||||
process_poll_options(v, c)
|
||||
|
||||
if int(time.time()) - c.created_utc > 60 * 3:
|
||||
c.edited_utc = int(time.time())
|
||||
if v.id == c.author_id:
|
||||
if int(time.time()) - c.created_utc > 60 * 3:
|
||||
c.edited_utc = int(time.time())
|
||||
else:
|
||||
ma=ModAction(
|
||||
kind="edit_comment",
|
||||
user_id=v.id,
|
||||
target_comment_id=c.id
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
g.db.add(c)
|
||||
|
||||
|
|
|
@ -1041,8 +1041,8 @@ def edit_post(pid, v):
|
|||
|
||||
|
||||
if v.id == p.author_id:
|
||||
if int(time.time()) - p.created_utc > 60 * 3: p.edited_utc = int(time.time())
|
||||
g.db.add(p)
|
||||
if int(time.time()) - p.created_utc > 60 * 3:
|
||||
p.edited_utc = int(time.time())
|
||||
else:
|
||||
ma=ModAction(
|
||||
kind="edit_post",
|
||||
|
|
|
@ -252,7 +252,7 @@
|
|||
</div>
|
||||
|
||||
{% if c.parent_post or c.wall_user_id %}
|
||||
{% if v and v.id==c.author_id %}
|
||||
{% if v and (v.id == c.author_id or v.admin_level >= PERMS['POST_COMMENT_EDITING']) %}
|
||||
<div id="comment-edit-{{c.id}}" class="d-none comment-write collapsed child">
|
||||
<input hidden name="formkey" value="{{v|formkey}}">
|
||||
<textarea autocomplete="off" {% if v.longpost %}minlength="280"{% endif %} maxlength="{% if v.bird %}140{% else %}10000{% endif %}" data-preview="preview-edit-{{c.id}}" data-nonce="{{g.nonce}}" data-oninput="markdown(this);charLimit('comment-edit-body-{{c.id}}','charcount-edit-{{c.id}}')" id="comment-edit-body-{{c.id}}" data-id="{{c.id}}" name="body" form="comment-edit-form-{{c.id}}" class="file-ta comment-box form-control rounded" placeholder="Add your comment..." rows="3">{{c.body}}</textarea>
|
||||
|
|
Loading…
Reference in New Issue