rename column and award kind

pull/216/head
Aevann 2023-10-13 22:04:45 +03:00
parent 42216dbc99
commit 1f0dd04406
11 changed files with 23 additions and 22 deletions

View File

@ -60,7 +60,7 @@ class Badge(Base):
if self.badge_id == 95: return self.user.bird
if self.badge_id == 96: return self.user.flairchanged
if self.badge_id == 97: return self.user.longpost
if self.badge_id == 98: return self.user.marseyawarded
if self.badge_id == 98: return self.user.hieroglyphs
if self.badge_id == 109: return self.user.rehab
if self.badge_id == 167: return self.user.owoify
if self.badge_id == 168: return self.user.bite

View File

@ -71,7 +71,7 @@ class User(Base):
patron_utc = Column(Integer, default=0)
verified = Column(String)
verifiedcolor = Column(String)
marseyawarded = Column(Integer, default=0)
hieroglyphs = Column(Integer, default=0)
rehab = Column(Integer, default=0)
longpost = Column(Integer, default=0)
bird = Column(Integer, default=0)

View File

@ -787,8 +787,8 @@ AWARDS = {
"positive": False,
"included_in_lootbox": False,
},
"marsey": {
"kind": "marsey",
"hieroglyphs": {
"kind": "hieroglyphs",
"title": "Hieroglyphs",
"description": "Makes the recipient unable to post/comment anything but emojis for 24 hours.",
"icon": "fas fa-ankh",

View File

@ -915,7 +915,7 @@ forced_hats = {
"progressivestack": ("Attention Whore", "I won the oppression olympics!"),
"longpost": ("The Pizzashill", "We need to get rid of the character limit!"),
"bird": ("Bluecheck", "Three sentences is too much for me..."),
"marseyawarded": ("Three Lil Marseys", ":marseynotes: :marseynotes: :I prefer to speak in cats:"),
"hieroglyphs": ("Three Lil Marseys", ":marseynotes: :marseynotes: :I prefer to speak in cats:"),
"bite": ("Vampire Mask", "When other little girls wanted to be ballet dancers I kind of wanted to be a vampire."),
"rainbow": ("Globohomo", "Homosexuality is no longer optional!"),
"owoify": ("Cat Ears (wiggly)", "Nuzzles, pounces on you, UwU, you're so warm!.."),

View File

@ -364,7 +364,7 @@ def _award_timers_task():
_process_timer(User.progressivestack, [94], "The progressive stack award you received has expired!")
_process_timer(User.bird, [95], "The bird site award you received has expired!")
_process_timer(User.longpost, [97], "The pizzashill award you received has expired!")
_process_timer(User.marseyawarded, [98], "The hieroglyphs award you received has expired!")
_process_timer(User.hieroglyphs, [98], "The hieroglyphs award you received has expired!")
_process_timer(User.rehab, [109], "The rehab award you received has expired!")
_process_timer(User.owoify, [167], "The OwOify award you received has expired!")
_process_timer(User.sharpen, [289], "The Sharpen award you received has expired!")

View File

@ -831,7 +831,7 @@ def torture_chud(string, username):
def complies_with_chud(obj):
#check for cases where u should leave
if not obj.chudded: return True
if obj.author.marseyawarded: return True
if obj.author.hieroglyphs: return True
if isinstance(obj, Post):
if obj.id in ADMIGGER_THREADS: return True

View File

@ -414,9 +414,9 @@ def award_thing(v, thing_type, id):
badge_grant(badge_id=68, user=author)
elif kind == "unpausable":
badge_grant(badge_id=67, user=author)
elif kind == "marsey":
if author.marseyawarded: author.marseyawarded += 86400
else: author.marseyawarded = int(time.time()) + 86400
elif kind == "hieroglyphs":
if author.hieroglyphs: author.hieroglyphs += 86400
else: author.hieroglyphs = int(time.time()) + 86400
badge_grant(user=author, badge_id=98)
elif kind == "pizzashill":
if author.bird:

View File

@ -275,7 +275,7 @@ def comment(v):
c.upvotes = 1
body_html = sanitize(body, limit_pings=5, showmore=(not v.marseyawarded), count_emojis=not v.marsify, commenters_ping_post_id=commenters_ping_post_id, obj=c, author=v)
body_html = sanitize(body, limit_pings=5, showmore=(not v.hieroglyphs), count_emojis=not v.marsify, commenters_ping_post_id=commenters_ping_post_id, obj=c, author=v)
if post_target.id not in ADMIGGER_THREADS and not (v.chud and v.chud_phrase in body.lower()):
existing = g.db.query(Comment.id).filter(
@ -291,7 +291,7 @@ def comment(v):
execute_antispam_comment_check(body, v)
execute_antispam_duplicate_comment_check(v, body_html)
if v.marseyawarded and marseyaward_body_regex.search(body_html) and not (posting_to_post and post_target.id in ADMIGGER_THREADS):
if v.hieroglyphs and marseyaward_body_regex.search(body_html) and not (posting_to_post and post_target.id in ADMIGGER_THREADS):
abort(403, "You can only type marseys!")
if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT:
@ -675,11 +675,11 @@ def edit_comment(cid, v):
body = process_files(request.files, v, body)
body = body[:COMMENT_BODY_LENGTH_LIMIT].strip() # process_files potentially adds characters to the post
body_html = sanitize(body, golden=False, limit_pings=5, showmore=(not v.marseyawarded), commenters_ping_post_id=c.parent_post, obj=c, author=c.author)
body_html = sanitize(body, golden=False, limit_pings=5, showmore=(not v.hieroglyphs), commenters_ping_post_id=c.parent_post, obj=c, author=c.author)
if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT: abort(400)
if c.author.marseyawarded and marseyaward_body_regex.search(body_html):
if c.author.hieroglyphs and marseyaward_body_regex.search(body_html):
abort(403, "You can only type marseys!")
oldtext = c.body

View File

@ -576,14 +576,14 @@ def submit_post(v, hole=None):
title_html = filter_emojis_only(title, count_emojis=True, obj=p, author=v)
if v.marseyawarded and not marseyaward_title_regex.fullmatch(title_html):
if v.hieroglyphs and not marseyaward_title_regex.fullmatch(title_html):
abort(400, "You can only type marseys!")
p.title_html = title_html
body_html = sanitize(body, count_emojis=True, limit_pings=100, obj=p, author=v)
if v.marseyawarded and marseyaward_body_regex.search(body_html):
if v.hieroglyphs and marseyaward_body_regex.search(body_html):
abort(400, "You can only type marseys!")
if len(body_html) > POST_BODY_HTML_LENGTH_LIMIT:
@ -1016,7 +1016,7 @@ def edit_post(pid, v):
if title != p.title:
title_html = filter_emojis_only(title, golden=False, obj=p, author=p.author)
if p.author.marseyawarded and not marseyaward_title_regex.fullmatch(title_html):
if p.author.hieroglyphs and not marseyaward_title_regex.fullmatch(title_html):
abort(403, "You can only type marseys!")
if 'megathread' in title.lower() and 'megathread' not in p.title.lower():
@ -1031,7 +1031,7 @@ def edit_post(pid, v):
if body != p.body:
body_html = sanitize(body, golden=False, limit_pings=100, obj=p, author=p.author)
if p.author.marseyawarded and marseyaward_body_regex.search(body_html):
if p.author.hieroglyphs and marseyaward_body_regex.search(body_html):
abort(403, "You can only type marseys!")

View File

@ -0,0 +1,2 @@
alter table users rename column marseyawarded to hieroglyphs;
update award_relationships set kind='hieroglyphs' where kind='marsey';

View File

@ -129,7 +129,7 @@ CREATE TABLE public.users (
coins_spent integer DEFAULT 0 NOT NULL,
marseybux integer DEFAULT 0 NOT NULL,
verifiedcolor character varying(6),
marseyawarded integer,
hieroglyphs integer,
sig character varying(200),
sig_html character varying(1000),
friends character varying(5000),
@ -2222,10 +2222,10 @@ CREATE INDEX users_longpost_idx ON public.users USING btree (longpost);
--
-- Name: users_marseyawarded_idx; Type: INDEX; Schema: public; Owner: -
-- Name: users_hieroglyphs_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX users_marseyawarded_idx ON public.users USING btree (marseyawarded);
CREATE INDEX users_hieroglyphs_idx ON public.users USING btree (hieroglyphs);
--
@ -3047,4 +3047,3 @@ ALTER TABLE ONLY public.comments
--
-- PostgreSQL database dump complete
--