[themotte/rDrama#451] When a comment is removed, aggregates (post comment count, author comment count) are updated

This commit is contained in:
faul_sname 2023-01-03 01:17:41 -08:00
parent f8c27f3620
commit 19e9b161d4

View file

@ -13,7 +13,7 @@ from files.classes import *
from flask import * from flask import *
from files.__main__ import app, cache, limiter from files.__main__ import app, cache, limiter
from .front import frontlist from .front import frontlist
from files.helpers.comments import comment_on_publish from files.helpers.comments import comment_on_publish, comment_on_unpublish
from datetime import datetime from datetime import datetime
import requests import requests
from urllib.parse import quote, urlencode from urllib.parse import quote, urlencode
@ -406,6 +406,11 @@ def update_filter_status(v):
and new_status in ['normal', 'ignored']): and new_status in ['normal', 'ignored']):
comment_on_publish(c) comment_on_publish(c)
if (comment_id
and old_status in ['normal', 'ignored']
and new_status in ['filtered', 'removed']):
comment_on_unpublish(c)
g.db.commit() g.db.commit()
return { 'result': 'Update successful' } return { 'result': 'Update successful' }
else: else: