forked from e621ng/e621ng
add status field to janitor trials #2408
This commit is contained in:
parent
5b0c84f393
commit
5dbbc12fe1
@ -6,9 +6,11 @@ class JanitorTrial < ActiveRecord::Base
|
||||
validates_presence_of :user
|
||||
before_validation :initialize_creator
|
||||
attr_accessible :user_id
|
||||
validates_inclusion_of :status, :in => %w(active inactive)
|
||||
before_validation :initialize_status
|
||||
|
||||
def self.search(params)
|
||||
q = where("true")
|
||||
q = where("status = ?", "active")
|
||||
return q if params.blank?
|
||||
|
||||
if params[:user_name]
|
||||
@ -43,6 +45,10 @@ class JanitorTrial < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_status
|
||||
self.status = "active"
|
||||
end
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id = CurrentUser.id
|
||||
end
|
||||
@ -77,9 +83,11 @@ class JanitorTrial < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def promote!
|
||||
update_attribute(:status, "inactive")
|
||||
end
|
||||
|
||||
def demote!
|
||||
update_attribute(:status, "inactive")
|
||||
user.update_column(:level, original_level)
|
||||
self.create_feedback
|
||||
end
|
||||
|
@ -0,0 +1,5 @@
|
||||
class AddStatusToJanitorTrials < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :janitor_trials, :status, :string, :null => false, :default => "active"
|
||||
end
|
||||
end
|
184
db/structure.sql
184
db/structure.sql
@ -3,6 +3,7 @@
|
||||
--
|
||||
|
||||
SET statement_timeout = 0;
|
||||
SET lock_timeout = 0;
|
||||
SET client_encoding = 'UTF8';
|
||||
SET standard_conforming_strings = on;
|
||||
SET check_function_bodies = false;
|
||||
@ -421,8 +422,8 @@ CREATE TABLE advertisement_hits (
|
||||
id integer NOT NULL,
|
||||
advertisement_id integer NOT NULL,
|
||||
ip_addr inet NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -459,8 +460,8 @@ CREATE TABLE advertisements (
|
||||
height integer NOT NULL,
|
||||
file_name character varying(255) NOT NULL,
|
||||
is_work_safe boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -490,8 +491,8 @@ ALTER SEQUENCE advertisements_id_seq OWNED BY advertisements.id;
|
||||
CREATE TABLE amazon_backups (
|
||||
id integer NOT NULL,
|
||||
last_id integer,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -557,8 +558,8 @@ CREATE TABLE artist_commentaries (
|
||||
original_description text,
|
||||
translated_title text,
|
||||
translated_description text,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -594,8 +595,8 @@ CREATE TABLE artist_commentary_versions (
|
||||
original_description text,
|
||||
translated_title text,
|
||||
translated_description text,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -627,8 +628,8 @@ CREATE TABLE artist_urls (
|
||||
artist_id integer NOT NULL,
|
||||
url text NOT NULL,
|
||||
normalized_url text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -666,8 +667,9 @@ CREATE TABLE artist_versions (
|
||||
group_name character varying(255),
|
||||
url_string text,
|
||||
is_banned boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
normalized_url_string text
|
||||
);
|
||||
|
||||
|
||||
@ -703,8 +705,8 @@ CREATE TABLE artists (
|
||||
other_names text,
|
||||
other_names_index tsvector,
|
||||
group_name character varying(255),
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -737,8 +739,8 @@ CREATE TABLE bans (
|
||||
reason text NOT NULL,
|
||||
banner_id integer NOT NULL,
|
||||
expires_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -804,8 +806,8 @@ CREATE TABLE comment_votes (
|
||||
comment_id integer NOT NULL,
|
||||
user_id integer NOT NULL,
|
||||
score integer NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -840,8 +842,8 @@ CREATE TABLE comments (
|
||||
ip_addr inet NOT NULL,
|
||||
body_index tsvector NOT NULL,
|
||||
score integer DEFAULT 0 NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
updater_id integer,
|
||||
updater_ip_addr inet,
|
||||
do_not_bump_post boolean DEFAULT false NOT NULL
|
||||
@ -881,8 +883,8 @@ CREATE TABLE delayed_jobs (
|
||||
locked_at timestamp without time zone,
|
||||
failed_at timestamp without time zone,
|
||||
locked_by character varying(255),
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
queue character varying(255)
|
||||
);
|
||||
|
||||
@ -952,8 +954,8 @@ CREATE TABLE dmails (
|
||||
message_index tsvector NOT NULL,
|
||||
is_read boolean DEFAULT false NOT NULL,
|
||||
is_deleted boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
creator_ip_addr inet DEFAULT '127.0.0.1'::inet NOT NULL
|
||||
);
|
||||
|
||||
@ -2019,8 +2021,8 @@ CREATE TABLE forum_posts (
|
||||
body text NOT NULL,
|
||||
text_index tsvector NOT NULL,
|
||||
is_deleted boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2122,8 +2124,8 @@ CREATE TABLE forum_topics (
|
||||
is_locked boolean DEFAULT false NOT NULL,
|
||||
is_deleted boolean DEFAULT false NOT NULL,
|
||||
text_index tsvector NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
category_id integer DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
@ -2156,8 +2158,8 @@ CREATE TABLE ip_bans (
|
||||
creator_id integer NOT NULL,
|
||||
ip_addr inet NOT NULL,
|
||||
reason text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2189,8 +2191,9 @@ CREATE TABLE janitor_trials (
|
||||
creator_id integer NOT NULL,
|
||||
user_id integer NOT NULL,
|
||||
original_level integer NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
status character varying(255) DEFAULT 'active'::character varying NOT NULL
|
||||
);
|
||||
|
||||
|
||||
@ -2221,8 +2224,8 @@ CREATE TABLE key_values (
|
||||
id integer NOT NULL,
|
||||
key character varying(255) NOT NULL,
|
||||
value text,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2253,8 +2256,8 @@ CREATE TABLE mod_actions (
|
||||
id integer NOT NULL,
|
||||
creator_id integer NOT NULL,
|
||||
description text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2286,8 +2289,8 @@ CREATE TABLE news_updates (
|
||||
message text NOT NULL,
|
||||
creator_id integer NOT NULL,
|
||||
updater_id integer NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2326,8 +2329,8 @@ CREATE TABLE note_versions (
|
||||
height integer NOT NULL,
|
||||
is_active boolean DEFAULT true NOT NULL,
|
||||
body text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
version integer DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
@ -2366,8 +2369,8 @@ CREATE TABLE notes (
|
||||
is_active boolean DEFAULT true NOT NULL,
|
||||
body text NOT NULL,
|
||||
body_index tsvector NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
version integer DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
@ -2432,8 +2435,8 @@ CREATE TABLE pool_versions (
|
||||
post_ids text DEFAULT ''::text NOT NULL,
|
||||
updater_id integer NOT NULL,
|
||||
updater_ip_addr inet NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
name character varying(255)
|
||||
);
|
||||
|
||||
@ -2470,8 +2473,8 @@ CREATE TABLE pools (
|
||||
post_ids text DEFAULT ''::text NOT NULL,
|
||||
post_count integer DEFAULT 0 NOT NULL,
|
||||
is_deleted boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
category character varying(255) DEFAULT 'series'::character varying NOT NULL
|
||||
);
|
||||
|
||||
@ -2505,8 +2508,8 @@ CREATE TABLE post_appeals (
|
||||
creator_id integer NOT NULL,
|
||||
creator_ip_addr integer NOT NULL,
|
||||
reason text,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2537,8 +2540,8 @@ CREATE TABLE post_disapprovals (
|
||||
id integer NOT NULL,
|
||||
user_id integer NOT NULL,
|
||||
post_id integer NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2572,8 +2575,8 @@ CREATE TABLE post_flags (
|
||||
creator_ip_addr inet NOT NULL,
|
||||
reason text,
|
||||
is_resolved boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2602,8 +2605,8 @@ ALTER SEQUENCE post_flags_id_seq OWNED BY post_flags.id;
|
||||
|
||||
CREATE TABLE post_versions (
|
||||
id integer NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
post_id integer NOT NULL,
|
||||
tags text DEFAULT ''::text NOT NULL,
|
||||
rating character(1),
|
||||
@ -2642,8 +2645,8 @@ CREATE TABLE post_votes (
|
||||
post_id integer NOT NULL,
|
||||
user_id integer NOT NULL,
|
||||
score integer NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2672,8 +2675,8 @@ ALTER SEQUENCE post_votes_id_seq OWNED BY post_votes.id;
|
||||
|
||||
CREATE TABLE posts (
|
||||
id integer NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
up_score integer DEFAULT 0 NOT NULL,
|
||||
down_score integer DEFAULT 0 NOT NULL,
|
||||
score integer DEFAULT 0 NOT NULL,
|
||||
@ -2789,8 +2792,8 @@ CREATE TABLE tag_aliases (
|
||||
creator_ip_addr inet NOT NULL,
|
||||
forum_topic_id integer,
|
||||
status text DEFAULT 'pending'::text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
post_count integer DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
@ -2827,8 +2830,8 @@ CREATE TABLE tag_implications (
|
||||
creator_ip_addr inet NOT NULL,
|
||||
forum_topic_id integer,
|
||||
status text DEFAULT 'pending'::text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2864,8 +2867,8 @@ CREATE TABLE tag_subscriptions (
|
||||
is_public boolean DEFAULT true NOT NULL,
|
||||
last_accessed_at timestamp without time zone,
|
||||
is_opted_in boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2899,8 +2902,8 @@ CREATE TABLE tags (
|
||||
category integer DEFAULT 0 NOT NULL,
|
||||
related_tags text,
|
||||
related_tags_updated_at timestamp without time zone,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
is_locked boolean DEFAULT false NOT NULL
|
||||
);
|
||||
|
||||
@ -2933,8 +2936,8 @@ CREATE TABLE transaction_log_items (
|
||||
category character varying(255),
|
||||
user_id integer,
|
||||
data text,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -2974,8 +2977,8 @@ CREATE TABLE uploads (
|
||||
backtrace text,
|
||||
post_id integer,
|
||||
md5_confirmation character varying(255),
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
server text,
|
||||
parent_id integer
|
||||
);
|
||||
@ -3010,8 +3013,8 @@ CREATE TABLE user_feedback (
|
||||
creator_id integer NOT NULL,
|
||||
category character varying(255) NOT NULL,
|
||||
body text NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -3047,8 +3050,8 @@ CREATE TABLE user_name_change_requests (
|
||||
desired_name character varying(255),
|
||||
change_reason text,
|
||||
rejection_reason text,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -3079,8 +3082,8 @@ CREATE TABLE user_password_reset_nonces (
|
||||
id integer NOT NULL,
|
||||
key character varying(255) NOT NULL,
|
||||
email character varying(255) NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@ -3109,8 +3112,8 @@ ALTER SEQUENCE user_password_reset_nonces_id_seq OWNED BY user_password_reset_no
|
||||
|
||||
CREATE TABLE users (
|
||||
id integer NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
name character varying(255) NOT NULL,
|
||||
password_hash character varying(255) NOT NULL,
|
||||
email character varying(255),
|
||||
@ -3168,8 +3171,8 @@ CREATE TABLE wiki_page_versions (
|
||||
title character varying(255) NOT NULL,
|
||||
body text NOT NULL,
|
||||
is_locked boolean NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
other_names text
|
||||
);
|
||||
|
||||
@ -3204,8 +3207,8 @@ CREATE TABLE wiki_pages (
|
||||
body text NOT NULL,
|
||||
body_index tsvector NOT NULL,
|
||||
is_locked boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
updater_id integer,
|
||||
other_names text,
|
||||
other_names_index tsvector
|
||||
@ -6669,13 +6672,6 @@ CREATE INDEX index_posts_on_last_noted_at ON posts USING btree (last_noted_at);
|
||||
CREATE UNIQUE INDEX index_posts_on_md5 ON posts USING btree (md5);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_posts_on_mpixels; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX index_posts_on_mpixels ON posts USING btree (((((image_width * image_height))::numeric / 1000000.0)));
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_posts_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
@ -7183,6 +7179,10 @@ INSERT INTO schema_migrations (version) VALUES ('20141017231608');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20141120045943');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20141203230229');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150116013315');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150119191042');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150120005624');
|
||||
@ -7191,3 +7191,5 @@ INSERT INTO schema_migrations (version) VALUES ('20150128005954');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150403224949');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150613010904');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user