fd
This commit is contained in:
parent
d6bfa63907
commit
e18de12a07
20 changed files with 55 additions and 42 deletions
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.6 KiB |
|
@ -541,7 +541,7 @@ class User(Base, Stndrd, Age_times):
|
|||
def is_blocked(self):
|
||||
return self.__dict__.get('_is_blocked', 0)
|
||||
|
||||
def refresh_selfset_badges(self):
|
||||
def refresh_referral_badges(self):
|
||||
|
||||
# check self-setting badges
|
||||
badge_types = g.db.query(BadgeDef).filter(BadgeDef.qualification_expr.isnot(None)).all()
|
||||
|
|
|
@ -667,11 +667,16 @@ def agendaposter(user_id, v):
|
|||
note = note
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
user.refresh_selfset_badges()
|
||||
|
||||
g.db.flush()
|
||||
|
||||
if user.agendaposter:
|
||||
if not user.has_badge(26):
|
||||
badge = Badge(user_id=user.id, badge_id=26)
|
||||
g.db.add(badge)
|
||||
else:
|
||||
badge = user.has_badge(26)
|
||||
if badge: g.db.delete(badge)
|
||||
|
||||
if user.agendaposter: send_notification(NOTIFICATIONS_ACCOUNT, user, f"You have been marked by an admin as an agendaposter ({note}).")
|
||||
else: send_notification(NOTIFICATIONS_ACCOUNT, user, f"You have been unmarked by an admin as an agendaposter.")
|
||||
|
||||
|
|
|
@ -151,8 +151,6 @@ def login_post():
|
|||
|
||||
check_for_alts(account.id)
|
||||
|
||||
account.refresh_selfset_badges()
|
||||
|
||||
# check for previous page
|
||||
|
||||
redir = request.form.get("redirect", "/").replace("/logged_out", "")
|
||||
|
@ -336,7 +334,7 @@ def sign_up_post(v):
|
|||
ref_user = g.db.query(User).options(
|
||||
lazyload('*')).filter_by(id=ref_id).first()
|
||||
if ref_user:
|
||||
ref_user.refresh_selfset_badges()
|
||||
ref_user.refresh_referral_badges()
|
||||
g.db.add(ref_user)
|
||||
|
||||
id_1 = g.db.query(User).filter_by(id=6).count()
|
||||
|
|
|
@ -842,14 +842,4 @@ def settings_title_change(v):
|
|||
v.customtitle = filter_title(new_name)
|
||||
|
||||
g.db.add(v)
|
||||
return redirect("/settings/profile")
|
||||
|
||||
|
||||
@app.post("/settings/badges")
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def settings_badge_recheck(v):
|
||||
|
||||
v.refresh_selfset_badges()
|
||||
|
||||
return {"message":"Badges Refreshed"}
|
||||
return redirect("/settings/profile")
|
|
@ -365,8 +365,6 @@ def u_username(username, v=None):
|
|||
|
||||
u = get_user(username, v=v)
|
||||
|
||||
#if v and v == u: v.refresh_selfset_badges()
|
||||
|
||||
# check for wrong cases
|
||||
|
||||
if username != u.username:
|
||||
|
|
|
@ -446,9 +446,9 @@
|
|||
{% if v and c.parent_submission and c.author_id==v.id %}
|
||||
<li class="list-group-item"><a href="javascript:void(0)" data-dismiss="modal" onclick="toggleEdit('{{c.id}}')" class="d-block"><i class="fas fa-edit"></i>Edit</a></li>
|
||||
|
||||
<li id="delete2-{{c.id}}" class="list-group-item"><a class="{% if c.deleted_utc %}d-none{% endif %}" href="javascript:void(0)" data-toggle="modal" data-target="#deleteCommentModal" onclick="delete_commentModal2('{{c.id}}','delete2-{{c.id}}','undelete2-{{c.id}}')"><i class="fas fa-trash-alt"></i>Delete</a></li>
|
||||
<li id="delete2-{{c.id}}" class="{% if c.deleted_utc %}d-none{% endif %} list-group-item"><a href="javascript:void(0)" data-toggle="modal" data-target="#deleteCommentModal" onclick="delete_commentModal2('{{c.id}}','delete2-{{c.id}}','undelete2-{{c.id}}')"><i class="fas fa-trash-alt"></i>Delete</a></li>
|
||||
|
||||
<li id="undelete2-{{c.id}}" class="list-group-item"><a class="{% if not c.deleted_utc %}d-none{% endif %}" href="javascript:void(0)" onclick="post_toast2('/undelete/comment/{{c.id}}','delete2-{{c.id}}','undelete2-{{c.id}}')" data-dismiss="modal"><i class="fas fa-trash-alt"></i>Undelete</a></li>
|
||||
<li id="undelete2-{{c.id}}" class="{% if not c.deleted_utc %}d-none{% endif %} list-group-item"><a href="javascript:void(0)" onclick="post_toast2('/undelete/comment/{{c.id}}','delete2-{{c.id}}','undelete2-{{c.id}}')" data-dismiss="modal"><i class="fas fa-trash-alt"></i>Undelete</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% if v and c.post and (v.admin_level >= 1 or v.id == c.post.author_id) and c.level == 1 %}
|
||||
|
|
|
@ -7,28 +7,28 @@
|
|||
<div>
|
||||
<ul class="nav nav-pills py-2">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active btn-sm" data-toggle="tab" href="#emoji-tab-favorite">Favorite</a>
|
||||
<a class="nav-link active " data-toggle="tab" href="#emoji-tab-favorite">Favorite</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link btn-sm" data-toggle="tab" href="#emoji-tab-marsey">Marsey</a>
|
||||
<a class="nav-link " data-toggle="tab" href="#emoji-tab-marsey">Marsey</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link btn-sm" data-toggle="tab" href="#emoji-tab-platy">Platy</a>
|
||||
<a class="nav-link " data-toggle="tab" href="#emoji-tab-platy">Platy</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link btn-sm" data-toggle="tab" href="#emoji-tab-tay">Tay</a>
|
||||
<a class="nav-link " data-toggle="tab" href="#emoji-tab-tay">Tay</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link btn-sm" data-toggle="tab" href="#emoji-tab-classic">Classic</a>
|
||||
<a class="nav-link " data-toggle="tab" href="#emoji-tab-classic">Classic</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link btn-sm" data-toggle="tab" href="#emoji-tab-rage">Rage</a>
|
||||
<a class="nav-link " data-toggle="tab" href="#emoji-tab-rage">Rage</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link btn-sm" data-toggle="tab" href="#emoji-tab-wojak">Wojak</a>
|
||||
<a class="nav-link " data-toggle="tab" href="#emoji-tab-wojak">Wojak</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link btn-sm" data-toggle="tab" href="#emoji-tab-flags">Flags</a>
|
||||
<a class="nav-link " data-toggle="tab" href="#emoji-tab-flags">Flags</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
</div>
|
||||
<hr class="my-2">
|
||||
<div class="px-2">
|
||||
<a class="dropdown-item" href="javascript:void(0)", onclick="post('/logout', '1'"><i class="fas fa-sign-out fa-fw text-left mr-3"></i>Log out</a>
|
||||
<a class="dropdown-item" href="javascript:void(0)", onclick="post('/logout', '1')"><i class="fas fa-sign-out fa-fw text-left mr-3"></i>Log out</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -190,7 +190,7 @@
|
|||
<li class="nav-item"><a class="nav-link" href="/contact"><i class="fas fa-file-signature fa-fw mr-3"></i>Contact us</a></li>
|
||||
|
||||
<li class="nav-item border-top border-bottom mt-2 pt-2">
|
||||
<a class="nav-link" href="javascript:void(0)", onclick="post('/logout', '1'"><i class="fas fa-sign-out fa-fw mr-3 text-danger"></i>Log out</a>
|
||||
<a class="nav-link" href="javascript:void(0)", onclick="post('/logout', '1')"><i class="fas fa-sign-out fa-fw mr-3 text-danger"></i>Log out</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item d-flex align-items-center justify-content-center pb-3">
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<h1 class="h5">{{title}}</h1>
|
||||
<div class="text-small text-muted mb-3">{{message if message else error}}</div>
|
||||
<a href="/" class="btn btn-primary btn-sm">Go to homepage</a>
|
||||
<a href="/" class="btn btn-primary ">Go to homepage</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<h1 class="h5">You haven't set up your rules page yet</h1>
|
||||
<div class="text-small text-muted mb-3">Your rules will be publicly available here.</div>
|
||||
<a href="/admin/rules" class="btn btn-primary btn-sm">Set up rules</a>
|
||||
<a href="/admin/rules" class="btn btn-primary ">Set up rules</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
<div class="h5">No unread messages</div>
|
||||
<div class="text-small text-muted mb-3">When someone comments or replies, it will show up here.</div>
|
||||
<a href="/notifications" class="btn btn-primary btn-sm">View entire inbox</a>
|
||||
<a href="/notifications" class="btn btn-primary ">View entire inbox</a>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
|
||||
{% if v %}
|
||||
{% if v.id!=u.id and not u.is_private and not u.is_nofollow %}
|
||||
<div id="button-sub-{{u.id}}" style="z-index: 2" class="{% if u.has_follower(v) %}d-none{% endif %}"><a class="btn btn-primary btn-sm" href="javascript:void(0)" onclick="post_toast('/follow/{{u.username}}','button-sub-{{u.id}}','button-unsub-{{u.id}}')">Follow</a></div>
|
||||
<div id="button-sub-{{u.id}}" style="z-index: 2" class="{% if u.has_follower(v) %}d-none{% endif %}"><a class="btn btn-primary " href="javascript:void(0)" onclick="post_toast('/follow/{{u.username}}','button-sub-{{u.id}}','button-unsub-{{u.id}}')">Follow</a></div>
|
||||
|
||||
<div id="button-unsub-{{u.id}}" style="z-index: 2" class="{% if not u.has_follower(v) %} d-none{% endif %}"><a class="btn btn-secondary btn-sm" href="javascript:void(0)" onclick="post_toast('/unfollow/{{u.username}}','button-sub-{{u.id}}','button-unsub-{{u.id}}')">Unfollow</a></div>
|
||||
<div id="button-unsub-{{u.id}}" style="z-index: 2" class="{% if not u.has_follower(v) %} d-none{% endif %}"><a class="btn btn-secondary " href="javascript:void(0)" onclick="post_toast('/unfollow/{{u.username}}','button-sub-{{u.id}}','button-unsub-{{u.id}}')">Unfollow</a></div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div id="button-sub-{{u.id}}" style="z-index: 2" "><a class="btn btn-primary btn-sm" href="/signup?redirect={{request.path}}">Follow</a></div>
|
||||
<div id="button-sub-{{u.id}}" style="z-index: 2" "><a class="btn btn-primary " href="/signup?redirect={{request.path}}">Follow</a></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -247,7 +247,6 @@
|
|||
{% 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>
|
||||
<a href="javascript:void(0)" onclick="post_toast('/settings/badges','1')" class="btn btn-secondary">Refresh Badges</a>
|
||||
{% endif %}
|
||||
{% if v and v.id != u.id and v.admin_level > 1 %}
|
||||
<br><br>
|
||||
|
@ -448,8 +447,7 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
{% if v and v.id == u.id %}
|
||||
<a href="/settings/profile" class="btn btn-secondary btn-sm">Edit profile</a>
|
||||
<a href="javascript:void(0)" onclick="post_toast('/settings/badges','1')" class="btn btn-secondary">Refresh Badges</a>
|
||||
<a href="/settings/profile" class="btn btn-secondary ">Edit profile</a>
|
||||
{% endif %}
|
||||
{% if v and v.id != u.id %}
|
||||
<a id="button-unsub2" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" href="javascript:void(0)" onclick="post_toast2('/unfollow/{{u.username}}','button-unsub2','button-sub2')">Unfollow</a>
|
||||
|
|
26
seed-db.sql
26
seed-db.sql
|
@ -1,4 +1,28 @@
|
|||
INSERT INTO public.badge_defs VALUES (6, 'Beta User', 'Joined during open beta', 'beta.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (12, 'Gold Recruiter', 'Recruited 100 friends to join Drama', 'recruit-100.gif', 1, 'v.referral_count>=100 and v.referral_count <=999');
|
||||
INSERT INTO public.badge_defs VALUES (11, 'Silver Recruiter', 'Recruited 10 friends to join Drama', 'recruit-10.gif', 1, 'v.referral_count>=10 and v.referral_count <= 99');
|
||||
INSERT INTO public.badge_defs VALUES (10, 'Bronze Recruiter', 'Recruited 1 friend to join Drama', 'recruit-1.gif', 1, 'v.referral_count>=1 and v.referral_count<9');
|
||||
INSERT INTO public.badge_defs VALUES (58, 'Diamond Recruiter', 'Recruited 1000 friends to join Drama', 'recruit-1000.gif', 1, 'v.referral_count >= 1000');
|
||||
INSERT INTO public.badge_defs VALUES (25, 'Footpig', 'Contributed at least $100/month', 'patron-5.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (61, 'Lab Rat', 'Helped test features in development', 'labrat.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (63, 'Balls', 'I wrote carp on my balls as a sign of submission', 'carpballs.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (4, 'White Hat', 'Responsibly reported a security issue', 'whitehat.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (2, 'Verified Email', 'Verified Email', 'mail.gif', 1, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (6, 'Beta User', 'Joined during open beta', 'beta.gif', 4, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (15, 'Idea Maker', 'Had a good idea for Drama which was implemented by the developers', 'idea.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (3, 'Code Contributor', 'Contributed to Drama source code', 'git.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (1, 'Alpha User', 'Joined during open alpha', 'alpha.gif', 4, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (18, 'Artisan', 'Contributed to Drama artwork', 'art.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (27, 'Lolcow', 'Beautiful and valid milk provider', 'lolcow.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (21, 'Paypig', 'Contributed at least $5/month', 'patron-1.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (22, 'Renthog', 'Contributed at least $10/month', 'patron-2.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (23, 'Landchad', 'Contributed at least $20/month', 'patron-3.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (24, 'Terminally online turboautist', 'Contributed at least $50/month', 'patron-4.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (28, 'Rich Bich', 'Contributed $500', 'patron-8.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (7, 'Bug Finder', 'Found a bug', 'sitebreaker.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (60, 'Unironically Retarded', 'Demonstrated a wholesale inability to read the room', 'retarded.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (26, 'Agendaposter', 'Forced to use the agendaposter theme', 'agendaposter.gif', 1, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (17, 'Marsey Artisan', 'Contributed a Marsey emoji ✨', 'marseybadge-1.gif', 3, NULL);
|
||||
INSERT INTO public.badge_defs VALUES (16, 'Marsey Master', 'Contributed 10 (or more!!!!) Marsey emojis ✨', 'marseybadge-2.gif', 3, NULL);
|
||||
|
||||
INSERT INTO public.users (
|
||||
id, username, passhash, created_utc, admin_level, over_18, is_activated, bio, bio_html, login_nonce, is_private,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue