forked from MarseyWorld/MarseyWorld
Add Y'all Seein' Eye award.
Adds award to enable viewing profile visitors for non-mops and non-patrons. This commit should encompass all frontend, backend, and database changes necessary. Perhaps usable as a model for other user upgrade flag awards.master
parent
a749a7eea9
commit
a0f441a67d
|
@ -89,6 +89,7 @@ class User(Base):
|
|||
unmutable = Column(Boolean)
|
||||
eye = Column(Boolean)
|
||||
alt = Column(Boolean)
|
||||
profileeye = Column(Boolean)
|
||||
frontsize = Column(Integer, default=25)
|
||||
controversial = Column(Boolean, default=False)
|
||||
bio = deferred(Column(String))
|
||||
|
@ -216,7 +217,11 @@ class User(Base):
|
|||
if self.has_badge(badge): discount -= discounts[badge]
|
||||
|
||||
return discount
|
||||
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def can_see_visitors(self):
|
||||
return self.admin_level >= 2 or self.patron or self.profileeye
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -662,6 +662,14 @@ AWARDS = {
|
|||
"color": "checkmark",
|
||||
"price": 100000
|
||||
},
|
||||
"profileeye": {
|
||||
"kind": "profileeye",
|
||||
"title": "Y'all Seein' Eye",
|
||||
"description": "Gives the recipient the ability to see who visited their profile.",
|
||||
"icon": "fas fa-eyes",
|
||||
"color": "text-silver",
|
||||
"price": 150000,
|
||||
},
|
||||
}
|
||||
|
||||
if SITE_NAME == 'PCM':
|
||||
|
|
|
@ -305,6 +305,13 @@ def award_post(pid, v):
|
|||
g.db.add(new_badge)
|
||||
g.db.flush()
|
||||
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
|
||||
elif kind == "profileeye":
|
||||
author.profileeye = True
|
||||
if not author.has_badge(136):
|
||||
new_badge = Badge(badge_id=136, user_id=author.id)
|
||||
g.db.add(new_badge)
|
||||
g.db.flush()
|
||||
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
|
||||
elif kind == "unblockable":
|
||||
author.unblockable = True
|
||||
if not author.has_badge(87):
|
||||
|
@ -551,6 +558,13 @@ def award_comment(cid, v):
|
|||
g.db.add(new_badge)
|
||||
g.db.flush()
|
||||
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
|
||||
elif kind == "profileeye":
|
||||
author.profileeye = True
|
||||
if not author.has_badge(136):
|
||||
new_badge = Badge(badge_id=136, user_id=author.id)
|
||||
g.db.add(new_badge)
|
||||
g.db.flush()
|
||||
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
|
||||
elif kind == "unblockable":
|
||||
author.unblockable = True
|
||||
if not author.has_badge(87):
|
||||
|
|
|
@ -867,7 +867,8 @@ def following(username, v):
|
|||
@app.get("/views")
|
||||
@auth_required
|
||||
def visitors(v):
|
||||
if v.admin_level < 2 and not v.patron: return render_template("errors/patron.html", v=v)
|
||||
if not v.can_see_visitors:
|
||||
return render_template("errors/patron.html", v=v)
|
||||
viewers=sorted(v.viewers, key = lambda x: x.last_view_utc, reverse=True)
|
||||
return render_template("viewers.html", v=v, viewers=viewers)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
|
@ -40,7 +40,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<title>Chat</title>
|
||||
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
|
||||
{% if v.css %}
|
||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<script src="/assets/js/bootstrap.js?v=251"></script>
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=58">
|
||||
<link rel="stylesheet" href="/assets/css/awards.css?v=7">
|
||||
{% if v.agendaposter %}
|
||||
|
@ -33,7 +33,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||
<link rel="stylesheet" href="/assets/css/awards.css?v=7">
|
||||
{% endif %}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% block content %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
|
@ -31,7 +31,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{% endblock %}
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||
|
||||
</head>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<title>2-Step Login - {{SITE_NAME}}</title>
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||
|
||||
</head>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
|
|
|
@ -39,11 +39,11 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||
{% endif %}
|
||||
</head>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title>
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||
|
||||
</head>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||
|
||||
</head>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
{% block stylesheets %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=49">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
|
@ -51,7 +51,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=275">
|
||||
<link rel="stylesheet" href="/assets/css/main.css?v=276">
|
||||
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=49">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -229,7 +229,7 @@
|
|||
|
||||
{% elif v and v.id == u.id %}
|
||||
<a href="/settings/profile" class="btn btn-secondary">Edit profile</a>
|
||||
<a href="/views" class="btn btn-secondary">Profile views</a>
|
||||
{% if v.can_see_visitors %}<a href="/views" class="btn btn-secondary">Profile views</a>{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
|
||||
|
@ -479,7 +479,7 @@
|
|||
</div>
|
||||
{% if v and v.id == u.id %}
|
||||
<a href="/settings/profile" class="btn btn-secondary ">Edit profile</a>
|
||||
<a href="/views" class="btn btn-secondary">Profile views</a>
|
||||
{% if v.can_see_visitors %}<a href="/views" class="btn btn-secondary">Profile views</a>{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
|
||||
|
|
|
@ -629,7 +629,8 @@ CREATE TABLE public.users (
|
|||
house character varying(16),
|
||||
subs_created integer DEFAULT 0 NOT NULL,
|
||||
deflector integer,
|
||||
reddit character varying(15) NOT NULL
|
||||
reddit character varying(15) NOT NULL,
|
||||
profileeye boolean
|
||||
);
|
||||
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue