fixed tag category coloring, fixed tag category expiration when updating, work on migration
This commit is contained in:
@@ -20,6 +20,18 @@ article.post-preview.blacklisted-active {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div#c-posts {
|
div#c-posts {
|
||||||
|
li.category-1 a {
|
||||||
|
color: #A00;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.category-3 a {
|
||||||
|
color: #A0A;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.category-4 a {
|
||||||
|
color: #0A0;
|
||||||
|
}
|
||||||
|
|
||||||
span.post-count {
|
span.post-count {
|
||||||
color: #CCC;
|
color: #CCC;
|
||||||
margin-left: 0.2em;
|
margin-left: 0.2em;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class Tag < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_category_cache
|
def update_category_cache
|
||||||
Cache.put("tc:#{Cache.sanitize(name)}", category)
|
Cache.put("tc:#{Cache.sanitize(name)}", category, 1.hour)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -95,6 +95,7 @@ class Tag < ActiveRecord::Base
|
|||||||
|
|
||||||
if tag
|
if tag
|
||||||
if category > 0
|
if category > 0
|
||||||
|
tag.update_category_cache
|
||||||
tag.update_column(:category, category)
|
tag.update_column(:category, category)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ private
|
|||||||
|
|
||||||
def build_list_item(tag, template, options)
|
def build_list_item(tag, template, options)
|
||||||
html = ""
|
html = ""
|
||||||
html << %{<li data-tag-type="#{categories[tag]}" data-tag-name="#{u(tag)}">}
|
html << %{<li class="category-#{categories[tag]}">}
|
||||||
|
|
||||||
if CurrentUser.user.is_privileged?
|
if CurrentUser.user.is_privileged?
|
||||||
html << %{<a href="/wiki_pages?title=#{u(tag)}">?</a> }
|
html << %{<a href="/wiki_pages?title=#{u(tag)}">?</a> }
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% content_for(:page_title) do %>
|
<% content_for(:page_title) do %>
|
||||||
/login
|
/sign in
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "secondary_links" %>
|
<%= render "secondary_links" %>
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
<div id="c-users">
|
<div id="c-users">
|
||||||
<div id="a-edit">
|
<div id="a-edit">
|
||||||
<h1>Edit Settings</h1>
|
<h1>Settings</h1>
|
||||||
|
|
||||||
<%= simple_form_for @user do |f| %>
|
<%= simple_form_for @user do |f| %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Basic</legend>
|
|
||||||
|
|
||||||
<%= f.input :email, :required => Danbooru.config.enable_email_verification?, :hint => "Your email address (used for messages and for password resets)" %>
|
<%= f.input :email, :required => Danbooru.config.enable_email_verification?, :hint => "Your email address (used for messages and for password resets)" %>
|
||||||
<%= f.input :time_zone, :hint => "Your local time zone" %>
|
<%= f.input :time_zone, :hint => "Your local time zone" %>
|
||||||
<%= f.input :receive_email_notifications, :hint => "Enable to receive email notification when you receive a DMail" %>
|
<%= f.input :receive_email_notifications, :hint => "Enable to receive email notification when you receive a DMail" %>
|
||||||
@@ -17,8 +15,6 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Password</legend>
|
|
||||||
|
|
||||||
<%= f.input :password, :hint => "What you want your new password to be (leave blank if you don't want to change your password)", :label => "New password", :input_html => {:autocomplete => "off"} %>
|
<%= f.input :password, :hint => "What you want your new password to be (leave blank if you don't want to change your password)", :label => "New password", :input_html => {:autocomplete => "off"} %>
|
||||||
<%= f.input :old_password, :hint => "Your old password (you must enter your password if updating your name or password)", :as => :password, :input_html => {:autocomplete => "off"} %>
|
<%= f.input :old_password, :hint => "Your old password (you must enter your password if updating your name or password)", :as => :password, :input_html => {:autocomplete => "off"} %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -29,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% content_for(:page_title) do %>
|
<% content_for(:page_title) do %>
|
||||||
/Users/<%= @user.name %>/Settings
|
/settings
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "secondary_links" %>
|
<%= render "secondary_links" %>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<div id="c-users">
|
<div id="c-users">
|
||||||
<div id="a-show">
|
<div id="a-show">
|
||||||
<h1>Show User: <%= @presenter.name %></h1>
|
<h1><%= @presenter.name %></h1>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Join Date</dt>
|
<dt>Join Date</dt>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace :deploy do
|
|||||||
|
|
||||||
desc "Precompiles assets"
|
desc "Precompiles assets"
|
||||||
task :precompile_assets do
|
task :precompile_assets do
|
||||||
run "bundle exec rake assets:precompile"
|
run "cd #{current_path}; bundle exec rake assets:precompile"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Restart the application"
|
desc "Restart the application"
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ class CreateCommentVotes < ActiveRecord::Migration
|
|||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index :comment_votes, :comment_id
|
||||||
add_index :comment_votes, :user_id
|
add_index :comment_votes, :user_id
|
||||||
|
add_index :comment_votes, :created_at
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class CreateArtistVersions < ActiveRecord::Migration
|
|||||||
t.column :other_names, :text
|
t.column :other_names, :text
|
||||||
t.column :group_name, :string
|
t.column :group_name, :string
|
||||||
t.column :url_string, :text
|
t.column :url_string, :text
|
||||||
|
t.column :is_banned, :boolean, :null => false, :default => false
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class CreateArtistUrls < ActiveRecord::Migration
|
|||||||
|
|
||||||
add_index :artist_urls, :artist_id
|
add_index :artist_urls, :artist_id
|
||||||
add_index :artist_urls, :normalized_url
|
add_index :artist_urls, :normalized_url
|
||||||
|
add_index :artist_urls, :url
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class CreateAdvertisements < ActiveRecord::Migration
|
|||||||
t.column :width, :integer, :null => false
|
t.column :width, :integer, :null => false
|
||||||
t.column :height, :integer, :null => false
|
t.column :height, :integer, :null => false
|
||||||
t.column :file_name, :string, :null => false
|
t.column :file_name, :string, :null => false
|
||||||
|
t.column :is_work_safe, :boolean, :null => false, :default => false
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class CreateBans < ActiveRecord::Migration
|
|||||||
|
|
||||||
add_index :bans, :user_id
|
add_index :bans, :user_id
|
||||||
add_index :bans, :expires_at
|
add_index :bans, :expires_at
|
||||||
|
add_index :bans, :banner_id
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
|
|||||||
202
script/upgrade_schema.sql
Normal file
202
script/upgrade_schema.sql
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
create index index_advertisements_on_ad_type on advertisements (ad_type);
|
||||||
|
|
||||||
|
alter table artist_urls drop constraint artist_urls_artist_id_fkey;
|
||||||
|
alter table artist_urls add column created_at timestamp not null default now();
|
||||||
|
alter table artist_urls add column updated_at timestamp not null default now();
|
||||||
|
|
||||||
|
alter table artist_versions drop column version;
|
||||||
|
alter table artist_versions add column updater_ip_addr inet default '127.0.0.1';
|
||||||
|
alter table artist_versions add column other_names text default '';
|
||||||
|
update artist_versions set other_names = array_to_string(other_names_array, ' ');
|
||||||
|
alter table artist_versions drop column other_names_array;
|
||||||
|
alter table artist_versions rename column cached_urls to url_string;
|
||||||
|
|
||||||
|
alter table artists drop column version;
|
||||||
|
alter table artists add column updater_ip_addr inet default '127.0.0.1';
|
||||||
|
alter table artists add column other_names text default '';
|
||||||
|
update artists set other_names = array_to_string(other_names_array, ' ');
|
||||||
|
alter table artists drop column other_names_array;
|
||||||
|
alter table artists drop constraint artists_updater_id_fkey;
|
||||||
|
alter index artists_name_uniq rename to index_artists_on_name;
|
||||||
|
alter table artists add column other_names_index tsvector;
|
||||||
|
CREATE INDEX index_artists_on_other_names_index ON artists USING GIN (other_names_index);
|
||||||
|
CREATE TRIGGER trigger_artists_on_update BEFORE INSERT OR UPDATE ON artists FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('other_names_index', 'public.danbooru', 'other_names');
|
||||||
|
|
||||||
|
alter table banned_ips rename to ip_bans;
|
||||||
|
alter index index_banned_ips_on_ip_addr rename to index_ip_bans_on_ip_addr;
|
||||||
|
alter table ip_bans drop column id;
|
||||||
|
alter table ip_bans add column id serial primary key;
|
||||||
|
|
||||||
|
alter table bans drop constraint bans_banned_by_fkey;
|
||||||
|
alter table bans drop constraint bans_user_id_fkey;
|
||||||
|
alter table bans rename column banned_by to banner_id;
|
||||||
|
create index index_bans_on_banner_id on bans (banner_id);
|
||||||
|
create index index_bans_on_expires_at on bans (expires_at);
|
||||||
|
alter table bans drop column old_level;
|
||||||
|
alter table bans add column created_at timestamp not null default now();
|
||||||
|
alter table bans add column updated_at timestamp not null default now();
|
||||||
|
|
||||||
|
alter table comment_votes add column score integer not null default 0;
|
||||||
|
alter table comment_votes drop constraint comment_votes_comment_id_fkey;
|
||||||
|
alter table comment_votes drop constraint comment_votes_user_id_fkey;
|
||||||
|
|
||||||
|
alter index idx_comments__post rename to index_comments_on_post_id;
|
||||||
|
alter table comments drop constraint fk_comments__post;
|
||||||
|
alter table comments drop constraint fk_comments__user;
|
||||||
|
alter table comments rename column text_search_index to body_index;
|
||||||
|
alter table comments add column updated_at timestamp;
|
||||||
|
alter table comments rename column user_id to creator_id;
|
||||||
|
alter index index_comments_on_user_id rename to index_comments_on_creator_id;
|
||||||
|
drop trigger trg_comment_search_update on comments;
|
||||||
|
CREATE TRIGGER trigger_comments_on_update BEFORE INSERT OR UPDATE ON comments FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('body_index', 'pg_catalog.english', 'body');
|
||||||
|
|
||||||
|
CREATE TABLE delayed_jobs (
|
||||||
|
id integer NOT NULL,
|
||||||
|
priority integer DEFAULT 0,
|
||||||
|
attempts integer DEFAULT 0,
|
||||||
|
handler text,
|
||||||
|
last_error text,
|
||||||
|
run_at timestamp without time zone,
|
||||||
|
locked_at timestamp without time zone,
|
||||||
|
failed_at timestamp without time zone,
|
||||||
|
locked_by character varying(255),
|
||||||
|
created_at timestamp without time zone,
|
||||||
|
updated_at timestamp without time zone
|
||||||
|
);
|
||||||
|
CREATE SEQUENCE delayed_jobs_id_seq
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MAXVALUE
|
||||||
|
NO MINVALUE
|
||||||
|
CACHE 1;
|
||||||
|
ALTER SEQUENCE delayed_jobs_id_seq OWNED BY delayed_jobs.id;
|
||||||
|
ALTER TABLE delayed_jobs ALTER COLUMN id SET DEFAULT nextval('delayed_jobs_id_seq'::regclass);
|
||||||
|
ALTER TABLE ONLY delayed_jobs ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
|
||||||
|
CREATE INDEX index_delayed_jobs_on_run_at ON delayed_jobs USING btree (run_at);
|
||||||
|
|
||||||
|
alter table dmails rename to dmails_orig;
|
||||||
|
alter table dmails_orig drop constraint dmails_from_id_fkey;
|
||||||
|
alter table dmails_orig drop constraint dmails_parent_id_fkey;
|
||||||
|
alter table dmails_orig drop constraint dmails_to_id_fkey;
|
||||||
|
alter table dmails_orig drop column id;
|
||||||
|
CREATE TABLE dmails (
|
||||||
|
id integer NOT NULL,
|
||||||
|
owner_id integer NOT NULL,
|
||||||
|
from_id integer NOT NULL,
|
||||||
|
to_id integer NOT NULL,
|
||||||
|
title character varying(255) NOT NULL,
|
||||||
|
body text NOT NULL,
|
||||||
|
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,
|
||||||
|
updated_at timestamp without time zone
|
||||||
|
);
|
||||||
|
CREATE SEQUENCE dmails_id_seq
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MAXVALUE
|
||||||
|
NO MINVALUE
|
||||||
|
CACHE 1;
|
||||||
|
ALTER SEQUENCE dmails_id_seq OWNED BY dmails.id;
|
||||||
|
ALTER TABLE dmails ALTER COLUMN id SET DEFAULT nextval('dmails_id_seq'::regclass);
|
||||||
|
ALTER TABLE ONLY dmails ADD CONSTRAINT dmails_pkey PRIMARY KEY (id);
|
||||||
|
CREATE INDEX index_dmails_on_message_index ON dmails USING gin (message_index);
|
||||||
|
CREATE INDEX index_dmails_on_owner_id ON dmails USING btree (owner_id);
|
||||||
|
insert into dmails (owner_id, from_id, to_id, title, body, is_read, is_deleted, created_at, updated_at) select dmails_orig.from_id, dmails_orig.from_id, dmails_orig.to_id, dmails_orig.title, dmails_orig.body, dmails_orig.has_seen, false, dmails_orig.created_at, dmails_orig.created_at from dmails_orig;
|
||||||
|
insert into dmails (owner_id, from_id, to_id, title, body, is_read, is_deleted, created_at, updated_at) select dmails_orig.to_id, dmails_orig.from_id, dmails_orig.to_id, dmails_orig.title, dmails_orig.body, dmails_orig.has_seen, false, dmails_orig.created_at, dmails_orig.created_at from dmails_orig;
|
||||||
|
|
||||||
|
drop sequence favorite_tags_id_seq;
|
||||||
|
alter table favorites drop column id;
|
||||||
|
alter table favorites rename to favorites_orig;
|
||||||
|
alter table favorites_orig drop constraint fk_favorites__post;
|
||||||
|
alter table favorites_orig drop constraint fk_favorites__user;
|
||||||
|
alter table favorites_orig drop column created_at;
|
||||||
|
|
||||||
|
-- create favorites
|
||||||
|
-- convert favorites
|
||||||
|
|
||||||
|
alter table flagged_post_details rename to post_flags;
|
||||||
|
alter table post_flags rename column user_id to creator_id;
|
||||||
|
alter table post_flags add column creator_ip_addr inet not null default '127.0.0.1';
|
||||||
|
alter table post_flags add column updated_at timestamp not null default now();
|
||||||
|
alter table post_flags drop constraint flagged_post_details_post_id_fkey;
|
||||||
|
alter table post_flags drop constraint flagged_post_details_user_id_fkey;
|
||||||
|
alter index flagged_post_details_pkey rename to post_flags_pkey;
|
||||||
|
alter index index_flagged_post_details_on_post_id rename to index_post_flags_on_post_id;
|
||||||
|
alter table post_flags drop column id;
|
||||||
|
alter table post_flags add column id serial primary key;
|
||||||
|
|
||||||
|
CREATE TABLE forum_topics (
|
||||||
|
id integer NOT NULL,
|
||||||
|
creator_id integer NOT NULL,
|
||||||
|
updater_id integer NOT NULL,
|
||||||
|
title character varying(255) NOT NULL,
|
||||||
|
response_count integer DEFAULT 0 NOT NULL,
|
||||||
|
is_sticky boolean DEFAULT false NOT NULL,
|
||||||
|
is_locked boolean DEFAULT false NOT NULL,
|
||||||
|
text_index tsvector NOT NULL,
|
||||||
|
created_at timestamp without time zone,
|
||||||
|
updated_at timestamp without time zone,
|
||||||
|
original_post_id integer not null
|
||||||
|
);
|
||||||
|
CREATE SEQUENCE forum_topics_id_seq
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MAXVALUE
|
||||||
|
NO MINVALUE
|
||||||
|
CACHE 1;
|
||||||
|
ALTER SEQUENCE forum_topics_id_seq OWNED BY forum_topics.id;
|
||||||
|
ALTER TABLE forum_topics ALTER COLUMN id SET DEFAULT nextval('forum_topics_id_seq'::regclass);
|
||||||
|
ALTER TABLE ONLY forum_topics
|
||||||
|
ADD CONSTRAINT forum_topics_pkey PRIMARY KEY (id);
|
||||||
|
CREATE INDEX index_forum_topics_on_creator_id ON forum_topics USING btree (creator_id);
|
||||||
|
CREATE INDEX index_forum_topics_on_original_post_id ON forum_topics USING btree (original_post_id);
|
||||||
|
CREATE INDEX index_forum_topics_on_text_index ON forum_topics USING gin (text_index);
|
||||||
|
CREATE TRIGGER trigger_forum_topics_on_update
|
||||||
|
BEFORE INSERT OR UPDATE ON forum_topics
|
||||||
|
FOR EACH ROW
|
||||||
|
EXECUTE PROCEDURE tsvector_update_trigger('text_index', 'pg_catalog.english', 'title');
|
||||||
|
insert into forum_topics (creator_id, updater_id, title, response_count, is_sticky, is_locked, text_index, created_at, updated_at, original_post_id) select forum_posts.creator_id, forum_posts.creator_id, forum_posts.title, forum_posts.response_count, forum_posts.is_sticky, forum_posts.is_locked, forum_posts.text_search_index, forum_posts.created_at, forum_posts.updated_at, forum_posts.id from forum_posts where parent_id is null;
|
||||||
|
|
||||||
|
alter table forum_posts drop constraint forum_posts_creator_id_fkey;
|
||||||
|
alter table forum_posts drop constraint forum_posts_last_updated_by_fkey;
|
||||||
|
alter table forum_posts drop constraint forum_posts_parent_id_fkey;
|
||||||
|
alter table forum_posts rename column text_search_index to text_index;
|
||||||
|
alter index forum_posts_search_idx rename to index_forum_posts_on_text_index;
|
||||||
|
drop trigger trg_forum_post_search_update on forum_posts;
|
||||||
|
CREATE TRIGGER trigger_forum_posts_on_update
|
||||||
|
BEFORE INSERT OR UPDATE ON forum_posts
|
||||||
|
FOR EACH ROW
|
||||||
|
EXECUTE PROCEDURE tsvector_update_trigger('text_index', 'pg_catalog.english', 'body');
|
||||||
|
alter table forum_posts add column topic_id integer;
|
||||||
|
update forum_posts set topic_id = (select forum_topics.id from forum_topics where forum_topics.original_post_id = forum_posts.parent_id) where forum_posts.parent_id is not null;
|
||||||
|
update forum_posts set topic_id = (select forum_topics.id from forum_topics where forum_topics.original_post_id = forum_posts.id) where forum_posts.parent_id is null;
|
||||||
|
alter table forum_posts drop column parent_id;
|
||||||
|
alter table forum_topics drop column original_post_id;
|
||||||
|
alter table forum_posts drop column is_sticky;
|
||||||
|
alter table forum_posts drop column is_locked;
|
||||||
|
alter table forum_posts drop column title;
|
||||||
|
alter table forum_posts drop column response_count;
|
||||||
|
alter table forum_posts drop column last_updated_by;
|
||||||
|
alter table forum_posts add column updater_id integer;
|
||||||
|
create index index_forum_posts_on_topic_id on forum_posts (topic_id);
|
||||||
|
|
||||||
|
drop table job_tasks;
|
||||||
|
|
||||||
|
alter table mod_actions rename column user_id to creator_id;
|
||||||
|
alter index index_mod_actions_on_user_id rename to index_mod_actions_on_creator_id;
|
||||||
|
|
||||||
|
alter table mod_queue_posts rename to post_disapprovals;
|
||||||
|
alter table post_disapprovals add column created_at timestamp default now();
|
||||||
|
alter table post_disapprovals add column updated_at timestamp default now();
|
||||||
|
alter table post_disapprovals drop constraint mod_queue_posts_post_id_fkey;
|
||||||
|
alter table post_disapprovals drop constraint mod_queue_posts_user_id_fkey;
|
||||||
|
alter table post_disapprovals drop column id;
|
||||||
|
alter table post_disapprovals add column id serial primary key;
|
||||||
|
create index index_post_disapprovals_on_user_id on post_disapprovals (user_id);
|
||||||
|
create index index_post_disapprovals_on_post_id on post_disapprovals (post_id);
|
||||||
|
|
||||||
|
-- post processing
|
||||||
|
drop table dmails_orig;
|
||||||
|
drop table favorites_orig;
|
||||||
Reference in New Issue
Block a user