fd
This commit is contained in:
parent
df357ccddb
commit
01b584774a
1 changed files with 2 additions and 2 deletions
|
@ -490,7 +490,7 @@ def follow_user(username, v):
|
||||||
if target.id==v.id: return {"error": "You can't follow yourself!"}, 400
|
if target.id==v.id: return {"error": "You can't follow yourself!"}, 400
|
||||||
|
|
||||||
# check for existing follow
|
# check for existing follow
|
||||||
if g.db.query(Follow).filter_by(user_id=v.id, target_id=target.id).first(): abort(409)
|
if g.db.query(Follow).filter_by(user_id=v.id, target_id=target.id).first(): return "", 204
|
||||||
|
|
||||||
new_follow = Follow(user_id=v.id, target_id=target.id)
|
new_follow = Follow(user_id=v.id, target_id=target.id)
|
||||||
g.db.add(new_follow)
|
g.db.add(new_follow)
|
||||||
|
@ -512,7 +512,7 @@ def unfollow_user(username, v):
|
||||||
# check for existing follow
|
# check for existing follow
|
||||||
follow = g.db.query(Follow).filter_by(user_id=v.id, target_id=target.id).first()
|
follow = g.db.query(Follow).filter_by(user_id=v.id, target_id=target.id).first()
|
||||||
|
|
||||||
if not follow: abort(409)
|
if not follow: return "", 204
|
||||||
|
|
||||||
g.db.delete(follow)
|
g.db.delete(follow)
|
||||||
target.stored_subscriber_count = g.db.query(Follow).filter_by(target_id=target.id).count()
|
target.stored_subscriber_count = g.db.query(Follow).filter_by(target_id=target.id).count()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue