allow ppl to disable purple notifs
parent
8e2dc4bd95
commit
f6b67a52cb
|
@ -150,6 +150,7 @@ class User(Base):
|
||||||
grinch = Column(Boolean, default=SITE_NAME != 'rDrama') #don't put in an if condition, it will cause an error bc it has a not-null constraint
|
grinch = Column(Boolean, default=SITE_NAME != 'rDrama') #don't put in an if condition, it will cause an error bc it has a not-null constraint
|
||||||
group_creation_notifs = Column(Boolean, default=False)
|
group_creation_notifs = Column(Boolean, default=False)
|
||||||
effortpost_notifs = Column(Boolean, default=False)
|
effortpost_notifs = Column(Boolean, default=False)
|
||||||
|
offsite_mentions = Column(Boolean)
|
||||||
|
|
||||||
if SITE_NAME == 'WPD' and not IS_LOCALHOST:
|
if SITE_NAME == 'WPD' and not IS_LOCALHOST:
|
||||||
nitter = False
|
nitter = False
|
||||||
|
@ -561,7 +562,7 @@ class User(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def can_view_offsite_mentions(self):
|
def can_view_offsite_mentions(self):
|
||||||
return self.has_badge(140) or self.admin_level >= PERMS['NOTIFICATIONS_OFFSITE']
|
return self.offsite_mentions or self.admin_level >= PERMS['NOTIFICATIONS_OFFSITE']
|
||||||
|
|
||||||
@lazy
|
@lazy
|
||||||
def can_edit(self, target):
|
def can_edit(self, target):
|
||||||
|
|
|
@ -452,6 +452,7 @@ def award_thing(v, thing_type, id):
|
||||||
elif kind == "eye":
|
elif kind == "eye":
|
||||||
badge_grant(badge_id=83, user=author)
|
badge_grant(badge_id=83, user=author)
|
||||||
elif kind == "offsitementions":
|
elif kind == "offsitementions":
|
||||||
|
author.offsite_mentions = True
|
||||||
badge_grant(user=author, badge_id=140)
|
badge_grant(user=author, badge_id=140)
|
||||||
elif kind == "alt":
|
elif kind == "alt":
|
||||||
badge_grant(badge_id=84, user=author)
|
badge_grant(badge_id=84, user=author)
|
||||||
|
|
|
@ -268,7 +268,7 @@ def notifications_modactions(v):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/notifications/offsite")
|
@app.get("/notifications/site_mentions")
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
|
|
|
@ -186,8 +186,15 @@ def settings_personal_post(v):
|
||||||
if v.spider: badge_grant(user=v, badge_id=179)
|
if v.spider: badge_grant(user=v, badge_id=179)
|
||||||
else:
|
else:
|
||||||
badge = v.has_badge(179)
|
badge = v.has_badge(179)
|
||||||
if badge:
|
if badge: g.db.delete(badge)
|
||||||
g.db.delete(badge)
|
|
||||||
|
elif not updated and request.values.get("offsite_mentions", v.offsite_mentions) != v.offsite_mentions:
|
||||||
|
updated = True
|
||||||
|
v.offsite_mentions = int(request.values.get("offsite_mentions") == 'true')
|
||||||
|
if v.offsite_mentions: badge_grant(user=v, badge_id=140)
|
||||||
|
else:
|
||||||
|
badge = v.has_badge(140)
|
||||||
|
if badge: g.db.delete(badge)
|
||||||
|
|
||||||
elif not updated and request.values.get("cursormarsey", v.cursormarsey) != v.cursormarsey:
|
elif not updated and request.values.get("cursormarsey", v.cursormarsey) != v.cursormarsey:
|
||||||
updated = True
|
updated = True
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if v.can_view_offsite_mentions %}
|
{% if v.can_view_offsite_mentions %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link py-3{% if request.path == '/notifications/offsite' %} active{% endif %}" href="/notifications/offsite">
|
<a class="nav-link py-3{% if request.path == '/notifications/site_mentions' %} active{% endif %}" href="/notifications/site_mentions">
|
||||||
Offsite {% if v.offsite_notifications_count %}<span class="font-weight-bold" style="color:#805ad5">({{v.offsite_notifications_count}})</span>{% endif %}
|
Site Mentions {% if v.offsite_notifications_count %}<span class="font-weight-bold" style="color:#805ad5">({{v.offsite_notifications_count}})</span>{% endif %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -170,6 +170,9 @@
|
||||||
<section id="site-settings-notifications" class="settings-section-section">
|
<section id="site-settings-notifications" class="settings-section-section">
|
||||||
<h5>Notifications</h5>
|
<h5>Notifications</h5>
|
||||||
<div class="settings-section rounded">
|
<div class="settings-section rounded">
|
||||||
|
{% if v.offsite_mentions != None %}
|
||||||
|
{{common.toggle_section('Site Mention Notifications', 'offsite_mentions', 'offsite_mentions', v.offsite_mentions, 'Get a notification when people on other sites talk about us', false)}}
|
||||||
|
{% endif %}
|
||||||
{{common.toggle_section('Effortpost Notifications', 'effortpost_notifs', 'effortpost_notifs', v.effortpost_notifs, 'Get a notification when a new effortpost is made.', false)}}
|
{{common.toggle_section('Effortpost Notifications', 'effortpost_notifs', 'effortpost_notifs', v.effortpost_notifs, 'Get a notification when a new effortpost is made.', false)}}
|
||||||
{% if SITE_NAME != 'WPD' %}
|
{% if SITE_NAME != 'WPD' %}
|
||||||
{{common.toggle_section('Hole Creation and Deletion Notifications', 'hole_creation_notifs', 'hole_creation_notifs', v.hole_creation_notifs, 'Get a notification when a hole is made or deleted.', false)}}
|
{{common.toggle_section('Hole Creation and Deletion Notifications', 'hole_creation_notifs', 'hole_creation_notifs', v.hole_creation_notifs, 'Get a notification when a hole is made or deleted.', false)}}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
alter table users add column offsite_mentions bool;
|
Loading…
Reference in New Issue