forked from MarseyWorld/MarseyWorld
fgh
parent
733c63d384
commit
13e575a6b5
|
@ -95,8 +95,6 @@ def before_request():
|
|||
|
||||
g.db = db_session()
|
||||
|
||||
g.timestamp = int(time.time())
|
||||
|
||||
ua = request.headers.get("User-Agent","").lower()
|
||||
|
||||
if '; wv) ' in ua: g.webview = True
|
||||
|
|
|
@ -792,11 +792,9 @@ def admin_removed_comments(v):
|
|||
def agendaposter(user_id, v):
|
||||
user = g.db.query(User).filter_by(id=user_id).one_or_none()
|
||||
|
||||
expiry = request.values.get("days", 0)
|
||||
if expiry:
|
||||
expiry = float(expiry)
|
||||
expiry = g.timestamp + expiry*60*60*24
|
||||
else: expiry = g.timestamp + 2629746
|
||||
days = request.values.get("days", 30)
|
||||
expiry = float(days)
|
||||
expiry = int(time.time() + expiry*60*60*24)
|
||||
|
||||
user.agendaposter = expiry
|
||||
g.db.add(user)
|
||||
|
@ -806,7 +804,7 @@ def agendaposter(user_id, v):
|
|||
alt.agendaposter = expiry
|
||||
g.db.add(alt)
|
||||
|
||||
note = f"for {request.values.get('days')} days" if expiry else "never expires"
|
||||
note = f"for {days} days"
|
||||
|
||||
ma = ModAction(
|
||||
kind="agendaposter",
|
||||
|
@ -816,8 +814,8 @@ def agendaposter(user_id, v):
|
|||
)
|
||||
g.db.add(ma)
|
||||
|
||||
if not user.has_badge(26):
|
||||
badge = Badge(user_id=user.id, badge_id=26)
|
||||
if not user.has_badge(28):
|
||||
badge = Badge(user_id=user.id, badge_id=28)
|
||||
g.db.add(badge)
|
||||
g.db.flush()
|
||||
send_notification(user.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
|
||||
|
@ -851,7 +849,7 @@ def unagendaposter(user_id, v):
|
|||
|
||||
g.db.add(ma)
|
||||
|
||||
badge = user.has_badge(26)
|
||||
badge = user.has_badge(28)
|
||||
if badge: g.db.delete(badge)
|
||||
|
||||
send_repeatable_notification(user.id, "You have been unmarked by an admin as an agendaposter.")
|
||||
|
|
|
@ -285,8 +285,8 @@ def award_post(pid, v):
|
|||
if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400
|
||||
else: author.agendaposter = int(time.time()) + 86400
|
||||
|
||||
if not author.has_badge(26):
|
||||
badge = Badge(user_id=author.id, badge_id=26)
|
||||
if not author.has_badge(28):
|
||||
badge = Badge(user_id=author.id, badge_id=28)
|
||||
g.db.add(badge)
|
||||
g.db.flush()
|
||||
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
|
||||
|
@ -515,8 +515,8 @@ def award_comment(cid, v):
|
|||
if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400
|
||||
else: author.agendaposter = int(time.time()) + 86400
|
||||
|
||||
if not author.has_badge(26):
|
||||
badge = Badge(user_id=author.id, badge_id=26)
|
||||
if not author.has_badge(28):
|
||||
badge = Badge(user_id=author.id, badge_id=28)
|
||||
g.db.add(badge)
|
||||
g.db.flush()
|
||||
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
|
||||
|
|
|
@ -206,7 +206,7 @@ def front_all(v, sub=None):
|
|||
v.agendaposter = 0
|
||||
send_repeatable_notification(v.id, "Your chud theme has expired!")
|
||||
g.db.add(v)
|
||||
badge = v.has_badge(26)
|
||||
badge = v.has_badge(28)
|
||||
if badge: g.db.delete(badge)
|
||||
g.db.commit()
|
||||
|
||||
|
|
|
@ -701,7 +701,7 @@ def u_username(username, v=None):
|
|||
if v and u.id != v.id and u.patron:
|
||||
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
|
||||
|
||||
if view: view.last_view_utc = g.timestamp
|
||||
if view: view.last_view_utc = int(time.time())
|
||||
else: view = ViewerRelationship(viewer_id=v.id, user_id=u.id)
|
||||
|
||||
g.db.add(view)
|
||||
|
|
|
@ -53,9 +53,10 @@ INSERT INTO public.badge_defs VALUES
|
|||
(22,'Renthog','Contributed at least $10'),
|
||||
(23,'Landchad','Contributed at least $20'),
|
||||
(24,'Terminally online turboautist','Contributed at least $50'),
|
||||
(25,'Rich Bich','Contributed at least $100'),
|
||||
(26,'Chud','Forced to use the chud theme'),
|
||||
(25,'Footpig','Contributed at least $100'),
|
||||
(26,'Rich Bich','Contributed at least $250'),
|
||||
(27,'Lolcow','Beautiful and valid milk provider'),
|
||||
(28,'Chud','Forced to use the chud theme'),
|
||||
(60,'Unironically Retarded','Demonstrated a wholesale inability to read the room'),
|
||||
(61,'Lab Rat','Helped test features in development'),
|
||||
(62,'Master Baiter','For outstanding achievement in the field of catching fish'),
|
||||
|
|
Loading…
Reference in New Issue