From 9f60a66c7974bf44afa6171c0a25a738ca92b7be Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 31 Jul 2021 15:00:15 +0000 Subject: [PATCH 1/3] schema --- schema.sql | 70 ++++++++++++++++-------------------------------------- 1 file changed, 21 insertions(+), 49 deletions(-) diff --git a/schema.sql b/schema.sql index da38abecd..cb41b2f29 100644 --- a/schema.sql +++ b/schema.sql @@ -117,38 +117,6 @@ CREATE FUNCTION public.comment_count(public.submissions) RETURNS bigint ALTER FUNCTION public.comment_count(public.submissions) OWNER TO postgres; --- --- Name: notifications; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.notifications ( - id integer NOT NULL, - user_id integer, - comment_id integer, - read boolean NOT NULL, - followsender integer, - unfollowsender integer, - blocksender integer, - unblocksender integer -); - - -ALTER TABLE public.notifications OWNER TO postgres; - --- --- Name: created_utc(public.notifications); Type: FUNCTION; Schema: public; Owner: postgres --- - -CREATE FUNCTION public.created_utc(public.notifications) RETURNS integer - LANGUAGE sql IMMUTABLE STRICT - AS $_$ -select created_utc from comments -where comments.id=$1.comment_id -$_$; - - -ALTER FUNCTION public.created_utc(public.notifications) OWNER TO postgres; - -- -- Name: users; Type: TABLE; Schema: public; Owner: postgres -- @@ -411,8 +379,7 @@ CREATE TABLE public.badges ( badge_id integer, user_id integer, description character varying(256), - url character varying(256), - created_utc integer + url character varying(256) ); @@ -567,7 +534,6 @@ CREATE TABLE public.commentflags ( id integer NOT NULL, user_id integer, comment_id integer, - created_utc integer NOT NULL, reason text ); @@ -741,7 +707,6 @@ CREATE TABLE public.flags ( id integer NOT NULL, user_id integer, post_id integer, - created_utc integer NOT NULL, reason text ); @@ -777,8 +742,7 @@ ALTER SEQUENCE public.flags_id_seq OWNED BY public.flags.id; CREATE TABLE public.follows ( id integer NOT NULL, user_id integer, - target_id integer, - created_utc integer + target_id integer ); @@ -883,6 +847,24 @@ ALTER TABLE public.modactions_id_seq OWNER TO postgres; ALTER SEQUENCE public.modactions_id_seq OWNED BY public.modactions.id; +-- +-- Name: notifications; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.notifications ( + id integer NOT NULL, + user_id integer, + comment_id integer, + read boolean NOT NULL, + followsender integer, + unfollowsender integer, + blocksender integer, + unblocksender integer +); + + +ALTER TABLE public.notifications OWNER TO postgres; + -- -- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- @@ -1054,8 +1036,6 @@ CREATE TABLE public.subscriptions ( id integer NOT NULL, user_id integer, board_id integer, - created_utc integer NOT NULL, - is_active boolean, submission_id integer ); @@ -1129,8 +1109,7 @@ ALTER SEQUENCE public.useragents_id_seq OWNED BY public.useragents.id; CREATE TABLE public.userblocks ( id integer NOT NULL, user_id integer, - target_id integer, - created_utc integer + target_id integer ); @@ -2156,13 +2135,6 @@ CREATE INDEX post_app_id_idx ON public.submissions USING btree (app_id); CREATE INDEX post_author_index ON public.submissions USING btree (author_id); --- --- Name: sub_active_index; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX sub_active_index ON public.subscriptions USING btree (is_active); - - -- -- Name: sub_user_index; Type: INDEX; Schema: public; Owner: postgres -- From bcf4b740ed4f56d8a90def3e3f9beae3c90bf42a Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Sat, 31 Jul 2021 23:50:25 +0200 Subject: [PATCH 2/3] sex --- drama/routes/admin.py | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/drama/routes/admin.py b/drama/routes/admin.py index 687e8f03c..c7b35db67 100644 --- a/drama/routes/admin.py +++ b/drama/routes/admin.py @@ -188,11 +188,38 @@ def badge_grant_post(v): send_notification(1046, user, text) if badge_id in [21,22,23,24,28]: - user.patron = int(str(badge_id)[-1]) - user.animatedname = True - # if badge_id == 23: user.banawards = 1 - # elif badge_id in [24,28]: user.banawards = 3 - g.db.add(user) + user.patron = int(str(badge_id)[-1]) + user.animatedname = True + + grant_awards = {} + + if badge_id == 23: + grant_awards["ban"] = 1 + grant_awards["shit"] = 5 + elif badge_id in [24, 28]: + grant_awards["ban"] = 3 + grant_awards["shit"] = 10 + + if len(grant_awards): + + _awards = [] + + thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id + + for name in grant_awards: + for count in range(grant_awards[name]): + + thing += 1 + + _awards.append(AwardRelationship( + id=thing, + user_id=user.id, + kind=name + )) + + g.db.bulk_save_objects(_awards) + + g.db.add(user) return redirect(user.url) From cbd54a6473556412285b6870a760d495ffbedacd Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Sat, 31 Jul 2021 23:54:51 +0200 Subject: [PATCH 3/3] sex --- drama/routes/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drama/routes/admin.py b/drama/routes/admin.py index c7b35db67..89ee90130 100644 --- a/drama/routes/admin.py +++ b/drama/routes/admin.py @@ -166,7 +166,7 @@ def badge_grant_post(v): new_badge = Badge(badge_id=badge_id, user_id=user.id, - created_utc=int(time.time()) + #created_utc=int(time.time()) ) desc = request.form.get("description")