Merge branch 'frost' of github.com:Aevann1/rDrama into frost

remotes/1693176582716663532/tmp_refs/heads/watchparty
Outrun Colors 2022-09-24 21:50:41 -05:00
commit 4e3489640b
4 changed files with 25 additions and 2 deletions

View File

@ -71,7 +71,7 @@ class Badge(Base):
def text(self):
if self.until:
text = self.badge.description + " until"
elif self.badge_id in (28, 170):
elif self.badge_id in (28, 170, 179):
text = self.badge.description + " permanently"
elif self.description:
text = self.description

View File

@ -141,7 +141,7 @@ class User(Base):
owoify = Column(Integer)
marsify = Column(Integer, default=0)
rainbow = Column(Integer)
spider = Column(Integer)
spider = Column(Integer, default=0)
badges = relationship("Badge", order_by="Badge.created_utc", back_populates="user")
subscriptions = relationship("Subscription", back_populates="user")

View File

@ -108,6 +108,14 @@ def settings_profile_post(v):
badge = v.has_badge(170)
if badge: g.db.delete(badge)
elif request.values.get("spider", v.spider) != v.spider and v.spider <= 1:
updated = True
v.spider = int(request.values.get("spider") == 'true')
if v.spider: badge_grant(user=v, badge_id=179)
else:
badge = v.has_badge(170)
if badge: g.db.delete(badge)
elif request.values.get("bio") == "":
v.bio = None
v.bio_html = None

View File

@ -761,6 +761,21 @@
</div>
</div>
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="spiderswitch">Spider</label>
</div>
<div class="body w-lg-100">
<div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="spiderswitch" name="spider" {% if v.spider%}checked{% endif %} {% if v.spider > 1 %}disabled{% endif %} onchange="post_toast(this,'/settings/profile?spider='+document.getElementById('spiderswitch').checked)">
<label class="custom-control-label" for="spiderswitch"></label>
</div>
<span class="text-small text-muted">Have a spider friend accompany you during your journey in the site.</span>
</div>
</div>
</div>
</div>