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)
|
unmutable = Column(Boolean)
|
||||||
eye = Column(Boolean)
|
eye = Column(Boolean)
|
||||||
alt = Column(Boolean)
|
alt = Column(Boolean)
|
||||||
|
profileeye = Column(Boolean)
|
||||||
frontsize = Column(Integer, default=25)
|
frontsize = Column(Integer, default=25)
|
||||||
controversial = Column(Boolean, default=False)
|
controversial = Column(Boolean, default=False)
|
||||||
bio = deferred(Column(String))
|
bio = deferred(Column(String))
|
||||||
|
@ -216,7 +217,11 @@ class User(Base):
|
||||||
if self.has_badge(badge): discount -= discounts[badge]
|
if self.has_badge(badge): discount -= discounts[badge]
|
||||||
|
|
||||||
return discount
|
return discount
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def can_see_visitors(self):
|
||||||
|
return self.admin_level >= 2 or self.patron or self.profileeye
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
|
@ -662,6 +662,14 @@ AWARDS = {
|
||||||
"color": "checkmark",
|
"color": "checkmark",
|
||||||
"price": 100000
|
"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':
|
if SITE_NAME == 'PCM':
|
||||||
|
|
|
@ -305,6 +305,13 @@ def award_post(pid, v):
|
||||||
g.db.add(new_badge)
|
g.db.add(new_badge)
|
||||||
g.db.flush()
|
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}")
|
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":
|
elif kind == "unblockable":
|
||||||
author.unblockable = True
|
author.unblockable = True
|
||||||
if not author.has_badge(87):
|
if not author.has_badge(87):
|
||||||
|
@ -551,6 +558,13 @@ def award_comment(cid, v):
|
||||||
g.db.add(new_badge)
|
g.db.add(new_badge)
|
||||||
g.db.flush()
|
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}")
|
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":
|
elif kind == "unblockable":
|
||||||
author.unblockable = True
|
author.unblockable = True
|
||||||
if not author.has_badge(87):
|
if not author.has_badge(87):
|
||||||
|
|
|
@ -867,7 +867,8 @@ def following(username, v):
|
||||||
@app.get("/views")
|
@app.get("/views")
|
||||||
@auth_required
|
@auth_required
|
||||||
def visitors(v):
|
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)
|
viewers=sorted(v.viewers, key = lambda x: x.last_view_utc, reverse=True)
|
||||||
return render_template("viewers.html", v=v, viewers=viewers)
|
return render_template("viewers.html", v=v, viewers=viewers)
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<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">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
|
||||||
{% if v.agendaposter %}
|
{% if v.agendaposter %}
|
||||||
<style>
|
<style>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<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/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<title>Chat</title>
|
<title>Chat</title>
|
||||||
|
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<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">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
|
||||||
{% if v.css %}
|
{% if v.css %}
|
||||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<script src="/assets/js/bootstrap.js?v=251"></script>
|
<script src="/assets/js/bootstrap.js?v=251"></script>
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<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/{{v.theme}}.css?v=58">
|
||||||
<link rel="stylesheet" href="/assets/css/awards.css?v=7">
|
<link rel="stylesheet" href="/assets/css/awards.css?v=7">
|
||||||
{% if v.agendaposter %}
|
{% if v.agendaposter %}
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<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/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||||
<link rel="stylesheet" href="/assets/css/awards.css?v=7">
|
<link rel="stylesheet" href="/assets/css/awards.css?v=7">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<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">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
|
||||||
{% if v.agendaposter %}
|
{% if v.agendaposter %}
|
||||||
<style>
|
<style>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<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/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<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/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<title>2-Step Login - {{SITE_NAME}}</title>
|
<title>2-Step Login - {{SITE_NAME}}</title>
|
||||||
|
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<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/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
|
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<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">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
|
||||||
{% if v.agendaposter %}
|
{% if v.agendaposter %}
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -39,11 +39,11 @@
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<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">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=57">
|
||||||
{% else %}
|
{% else %}
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<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/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title>
|
<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>
|
<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/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
|
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
|
||||||
|
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<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/{{config('DEFAULT_THEME')}}.css?v=57">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<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">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=49">
|
||||||
{% if v.agendaposter %}
|
{% if v.agendaposter %}
|
||||||
<style>
|
<style>
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
<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">
|
<link rel="stylesheet" href="/assets/css/{{config('DEFAULT_THEME')}}.css?v=49">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -229,7 +229,7 @@
|
||||||
|
|
||||||
{% elif v and v.id == u.id %}
|
{% elif v and v.id == u.id %}
|
||||||
<a href="/settings/profile" class="btn btn-secondary">Edit profile</a>
|
<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 %}
|
{% endif %}
|
||||||
|
|
||||||
{% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
|
{% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
|
||||||
|
@ -479,7 +479,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% if v and v.id == u.id %}
|
{% if v and v.id == u.id %}
|
||||||
<a href="/settings/profile" class="btn btn-secondary ">Edit profile</a>
|
<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 %}
|
{% endif %}
|
||||||
|
|
||||||
{% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
|
{% 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),
|
house character varying(16),
|
||||||
subs_created integer DEFAULT 0 NOT NULL,
|
subs_created integer DEFAULT 0 NOT NULL,
|
||||||
deflector integer,
|
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