make h/hole be valid syntax for moving post

master
Aevann 2023-03-13 20:51:30 +02:00
parent bc2a4d3e78
commit f8e95564b5
2 changed files with 4 additions and 2 deletions

View File

@ -347,7 +347,7 @@ def get_sub_by_name(sub:str, v:Optional[User]=None, graceful=False) -> Optional[
if not sub:
if graceful: return None
else: abort(404)
sub = sub.replace('/h/', '').strip().lower()
sub = sub.replace('/h/', '').replace('h/', '').strip().lower()
if not sub:
if graceful: return None
else: abort(404)

View File

@ -145,7 +145,9 @@ def remove_report_comment(v, cid, uid):
return {"message": "Report removed successfully!"}
def move_post(post:Submission, v:User, reason:str) -> Union[bool, str]:
if not reason.startswith('/h/'): return False
if not reason.startswith('/h/') and not reason.startswith('h/'):
return False
sub_from = post.sub
sub_to = get_sub_by_name(reason, graceful=True)
sub_to = sub_to.name if sub_to else None