sdffds
This commit is contained in:
parent
54a5727975
commit
5c8759f97a
3 changed files with 8 additions and 10 deletions
|
@ -176,10 +176,8 @@ class User(Base):
|
|||
def referral_count(self):
|
||||
return len(self.referrals)
|
||||
|
||||
def has_block(self, target):
|
||||
|
||||
return g.db.query(UserBlock).filter_by(
|
||||
user_id=self.id, target_id=target.id).first()
|
||||
def is_blocking(self, target):
|
||||
return g.db.query(UserBlock).filter_by(user_id=self.id, target_id=target.id).first()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -999,10 +999,10 @@ def submit_post(v):
|
|||
|
||||
g.db.flush()
|
||||
|
||||
|
||||
n = Notification(comment_id=c.id, user_id=v.id)
|
||||
g.db.add(n)
|
||||
g.db.flush()
|
||||
if not v.is_blocking(snappy):
|
||||
n = Notification(comment_id=c.id, user_id=v.id)
|
||||
g.db.add(n)
|
||||
g.db.flush()
|
||||
|
||||
v.post_count = g.db.query(Submission.id).filter_by(author_id=v.id, is_banned=False, deleted_utc=0).count()
|
||||
g.db.add(v)
|
||||
|
|
|
@ -832,7 +832,7 @@ def settings_block_user(v):
|
|||
if user.id == v.id:
|
||||
return {"error": "You can't block yourself."}, 409
|
||||
|
||||
if v.has_block(user):
|
||||
if v.is_blocking(user):
|
||||
return {"error": f"You have already blocked @{user.username}."}, 409
|
||||
|
||||
if user.id == NOTIFICATIONS_ID:
|
||||
|
@ -863,7 +863,7 @@ def settings_unblock_user(v):
|
|||
|
||||
user = get_user(request.values.get("username"))
|
||||
|
||||
x = v.has_block(user)
|
||||
x = v.is_blocking(user)
|
||||
|
||||
if not x: abort(409)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue