Fix posting/commenting from API.

The rework to v.client meant that `is_bot` on Submission and Comment
would attempt to be populated with a ClientAuth object when submitted
by a bot other than Snappy or bbbb. SQLAlchemy requires an actual
boolean, not just a truthy value.
master
Snakes 2022-10-15 10:11:14 -04:00
parent ed2b6938ba
commit 616e15ebb9
Signed by: Snakes
GPG Key ID: E745A82778055C7E
2 changed files with 4 additions and 4 deletions

View File

@ -255,7 +255,9 @@ def comment(v):
if parent.author.any_block_exists(v) and v.admin_level < PERMS['POST_COMMENT_MODERATION']: if parent.author.any_block_exists(v) and v.admin_level < PERMS['POST_COMMENT_MODERATION']:
abort(403, "You can't reply to users who have blocked you or users that you have blocked.") abort(403, "You can't reply to users who have blocked you or users that you have blocked.")
is_bot = v.id != BBBB_ID and v.client or (SITE == 'pcmemes.net' and v.id == SNAPPY_ID) is_bot = (v.client is not None
and v.id != BBBB_ID
or (SITE == 'pcmemes.net' and v.id == SNAPPY_ID))
execute_antispam_comment_check(body, v) execute_antispam_comment_check(body, v)

View File

@ -877,8 +877,6 @@ def submit_post(v, sub=None):
if embed and len(embed) > 1500: embed = None if embed and len(embed) > 1500: embed = None
is_bot = v.id != BBBB_ID and v.client or (SITE == 'pcmemes.net' and v.id == SNAPPY_ID)
if request.values.get("ghost") and v.coins >= 100: if request.values.get("ghost") and v.coins >= 100:
v.charge_account('coins', 100) v.charge_account('coins', 100)
ghost = True ghost = True
@ -894,7 +892,7 @@ def submit_post(v, sub=None):
over_18=bool(request.values.get("over_18","")), over_18=bool(request.values.get("over_18","")),
new=bool(request.values.get("new","")), new=bool(request.values.get("new","")),
app_id=v.client.application.id if v.client else None, app_id=v.client.application.id if v.client else None,
is_bot = is_bot, is_bot=(v.client is not None),
url=url, url=url,
body=body, body=body,
body_html=body_html, body_html=body_html,