forked from MarseyWorld/MarseyWorld
add toggle for event music
parent
0936e80cc5
commit
2183161916
|
@ -138,6 +138,8 @@ class User(Base):
|
|||
marsify = Column(Integer, default=0)
|
||||
rainbow = Column(Integer)
|
||||
spider = Column(Integer, default=0)
|
||||
if HOLIDAY_EVENT:
|
||||
event_music = Column(Boolean, default=True, nullable=False)
|
||||
|
||||
badges = relationship("Badge", order_by="Badge.created_utc", back_populates="user")
|
||||
subscriptions = relationship("Subscription", back_populates="user")
|
||||
|
@ -1139,7 +1141,5 @@ class User(Base):
|
|||
if HOLIDAY_EVENT:
|
||||
@property
|
||||
@lazy
|
||||
def event_music(self):
|
||||
if SITE_NAME != 'rDrama': return False
|
||||
if self.has_badge(91): return False
|
||||
return True
|
||||
def can_toggle_event_music(self):
|
||||
return self.has_badge(91)
|
||||
|
|
|
@ -194,7 +194,9 @@ def settings_personal_post(v):
|
|||
else:
|
||||
badge = v.has_badge(179)
|
||||
if badge: g.db.delete(badge)
|
||||
|
||||
elif not updated and request.values.get("event_music", v.event_music) != v.event_music and v.can_toggle_event_music:
|
||||
updated = True
|
||||
v.event_music = not v.event_music
|
||||
elif not updated and request.values.get("bio") == "" and not request.files.get('file'):
|
||||
v.bio = None
|
||||
v.bio_html = None
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
<section id="site-settings-experience-section" class="settings-section-section">
|
||||
<h5>Site Experience</h5>
|
||||
<div class="settings-section rounded" id="site-settings-experience">
|
||||
{% if v.can_toggle_event_music %}
|
||||
{{common.toggle_section('Event Music', 'event_music_switch', 'event_music', v.event_music, 'Toggle event music.', false)}}
|
||||
{% endif %}
|
||||
<div class="d-lg-flex border-bottom">
|
||||
<div class="title w-lg-25">
|
||||
<label for="patron-status">{{patron}} Status</label>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
alter table users add column event_music boolean NOT NULL default True;
|
||||
alter table users alter column event_music drop default;
|
Loading…
Reference in New Issue