forked from rDrama/rDrama
Merge branch 'master' of https://github.com/Aevann1/Drama
commit
6ab8543530
|
@ -187,11 +187,38 @@ def badge_grant_post(v):
|
||||||
send_notification(1046, user, text)
|
send_notification(1046, user, text)
|
||||||
|
|
||||||
if badge_id in [21,22,23,24,28]:
|
if badge_id in [21,22,23,24,28]:
|
||||||
user.patron = int(str(badge_id)[-1])
|
user.patron = int(str(badge_id)[-1])
|
||||||
user.animatedname = True
|
user.animatedname = True
|
||||||
# if badge_id == 23: user.banawards = 1
|
|
||||||
# elif badge_id in [24,28]: user.banawards = 3
|
grant_awards = {}
|
||||||
g.db.add(user)
|
|
||||||
|
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)
|
return redirect(user.url)
|
||||||
|
|
||||||
|
|
70
schema.sql
70
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;
|
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
|
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
|
||||||
--
|
--
|
||||||
|
@ -411,8 +379,7 @@ CREATE TABLE public.badges (
|
||||||
badge_id integer,
|
badge_id integer,
|
||||||
user_id integer,
|
user_id integer,
|
||||||
description character varying(256),
|
description character varying(256),
|
||||||
url character varying(256),
|
url character varying(256)
|
||||||
created_utc integer
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -567,7 +534,6 @@ CREATE TABLE public.commentflags (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
user_id integer,
|
user_id integer,
|
||||||
comment_id integer,
|
comment_id integer,
|
||||||
created_utc integer NOT NULL,
|
|
||||||
reason text
|
reason text
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -741,7 +707,6 @@ CREATE TABLE public.flags (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
user_id integer,
|
user_id integer,
|
||||||
post_id integer,
|
post_id integer,
|
||||||
created_utc integer NOT NULL,
|
|
||||||
reason text
|
reason text
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -777,8 +742,7 @@ ALTER SEQUENCE public.flags_id_seq OWNED BY public.flags.id;
|
||||||
CREATE TABLE public.follows (
|
CREATE TABLE public.follows (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
user_id integer,
|
user_id integer,
|
||||||
target_id integer,
|
target_id integer
|
||||||
created_utc 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;
|
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
|
-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
||||||
--
|
--
|
||||||
|
@ -1054,8 +1036,6 @@ CREATE TABLE public.subscriptions (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
user_id integer,
|
user_id integer,
|
||||||
board_id integer,
|
board_id integer,
|
||||||
created_utc integer NOT NULL,
|
|
||||||
is_active boolean,
|
|
||||||
submission_id integer
|
submission_id integer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1129,8 +1109,7 @@ ALTER SEQUENCE public.useragents_id_seq OWNED BY public.useragents.id;
|
||||||
CREATE TABLE public.userblocks (
|
CREATE TABLE public.userblocks (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
user_id integer,
|
user_id integer,
|
||||||
target_id integer,
|
target_id integer
|
||||||
created_utc 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);
|
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
|
-- Name: sub_user_index; Type: INDEX; Schema: public; Owner: postgres
|
||||||
--
|
--
|
||||||
|
|
Loading…
Reference in New Issue