forked from MarseyWorld/MarseyWorld
make h/hole be valid syntax for moving post
parent
bc2a4d3e78
commit
f8e95564b5
|
@ -347,7 +347,7 @@ def get_sub_by_name(sub:str, v:Optional[User]=None, graceful=False) -> Optional[
|
||||||
if not sub:
|
if not sub:
|
||||||
if graceful: return None
|
if graceful: return None
|
||||||
else: abort(404)
|
else: abort(404)
|
||||||
sub = sub.replace('/h/', '').strip().lower()
|
sub = sub.replace('/h/', '').replace('h/', '').strip().lower()
|
||||||
if not sub:
|
if not sub:
|
||||||
if graceful: return None
|
if graceful: return None
|
||||||
else: abort(404)
|
else: abort(404)
|
||||||
|
|
|
@ -145,7 +145,9 @@ def remove_report_comment(v, cid, uid):
|
||||||
return {"message": "Report removed successfully!"}
|
return {"message": "Report removed successfully!"}
|
||||||
|
|
||||||
def move_post(post:Submission, v:User, reason:str) -> Union[bool, str]:
|
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_from = post.sub
|
||||||
sub_to = get_sub_by_name(reason, graceful=True)
|
sub_to = get_sub_by_name(reason, graceful=True)
|
||||||
sub_to = sub_to.name if sub_to else None
|
sub_to = sub_to.name if sub_to else None
|
||||||
|
|
Loading…
Reference in New Issue