diff --git a/app/assets/javascripts/cookie.js b/app/assets/javascripts/cookie.js index a3b3a158b..0b5c2d2f1 100644 --- a/app/assets/javascripts/cookie.js +++ b/app/assets/javascripts/cookie.js @@ -49,14 +49,6 @@ if (loc.match(/^http/)) { loc = loc.replace(/^https?:\/\/[^\/]+/, "") } - - if (!loc.match(/\/static\/terms_of_service/) && this.get("tos") != "1") { - // Setting location.pathname in Safari doesn't work, so manually extract the domain. - var domain = location.href.match(/^(https?:\/\/[^\/]+)/)[0]; - location.href = domain + "/static/terms_of_service"; - this.put("toc", "1", 365) - return; - } if (this.get("hide-upgrade-account") != "1") { $("#upgrade-account").show(); diff --git a/app/assets/stylesheets/common/main_layout.css.scss b/app/assets/stylesheets/common/main_layout.css.scss index 3756e36e2..fbc6d8ca2 100644 --- a/app/assets/stylesheets/common/main_layout.css.scss +++ b/app/assets/stylesheets/common/main_layout.css.scss @@ -8,7 +8,7 @@ div#page { overflow: visible; margin: 0 30px; - div#upgrade-account-notice, div#sign-up-notice { + div#upgrade-account-notice, div#sign-up-notice, div#tos-notice { margin: 1em 0; padding: 1em; text-align: center; diff --git a/app/models/tag.rb b/app/models/tag.rb index 743fbedd6..d5f845d94 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -37,6 +37,10 @@ class Tag < ActiveRecord::Base def counts_for(tag_names) select_all_sql("SELECT name, post_count FROM tags WHERE name IN (?)", tag_names) end + + def fix_post_count + update_column(:post_count, Post.tag_match("#{name} status:any").count) + end end module ViewCountMethods diff --git a/app/models/tag_alias.rb b/app/models/tag_alias.rb index d25202546..ce951df90 100644 --- a/app/models/tag_alias.rb +++ b/app/models/tag_alias.rb @@ -105,7 +105,7 @@ class TagAlias < ActiveRecord::Base end def update_posts - Post.tag_match(antecedent_name).find_each do |post| + Post.tag_match("#{antecedent_name} status:any").find_each do |post| escaped_antecedent_name = Regexp.escape(antecedent_name) fixed_tags = post.tag_string.sub(/(?:\A| )#{escaped_antecedent_name}(?:\Z| )/, " #{consequent_name} ").strip diff --git a/app/models/tag_implication.rb b/app/models/tag_implication.rb index be312586b..c63dd0a91 100644 --- a/app/models/tag_implication.rb +++ b/app/models/tag_implication.rb @@ -119,7 +119,7 @@ class TagImplication < ActiveRecord::Base end def update_posts - Post.tag_match(antecedent_name).find_each do |post| + Post.tag_match("#{antecedent_name} status:any").find_each do |post| escaped_antecedent_name = Regexp.escape(antecedent_name) fixed_tags = post.tag_string.sub(/(?:\A| )#{escaped_antecedent_name}(?:\Z| )/, " #{antecedent_name} #{descendant_names} ").strip CurrentUser.scoped(creator, creator_ip_addr) do diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 1f44682d3..9fb06d710 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -43,6 +43,10 @@ <%= render "users/upgrade_notice" %> <% end %> + <% if !CurrentUser.is_privileged? && CurrentUser.user.created_at > 2.weeks.ago %> + <%= render "users/tos" %> + <% end %> + <%- if flash[:notice] -%>
<%= flash[:notice] %>
<%- else -%> diff --git a/app/views/static/terms_of_service.html.erb b/app/views/static/terms_of_service.html.erb index 5d757a6f0..08f4d578c 100644 --- a/app/views/static/terms_of_service.html.erb +++ b/app/views/static/terms_of_service.html.erb @@ -52,11 +52,5 @@

The Site will not disclose the IP address, email address, password, or DMails of any user except to the staff.

The Site is allowed to make public everything else, including but not limited to: uploaded posts, favorited posts, comments, forum posts, wiki edits, and note edits.

- -
-

Agreement

-

By clicking on the "I Agree" link, you have read all the terms and have agreed to them.

-

<%= link_to("I Agree", params[:url] || "/", :onclick => "Danbooru.Cookie.put('tos', '1')") %> | <%= link_to("Cancel", "/") %>

-
diff --git a/app/views/users/_tos.html.erb b/app/views/users/_tos.html.erb new file mode 100644 index 000000000..f0df1d8d2 --- /dev/null +++ b/app/views/users/_tos.html.erb @@ -0,0 +1,3 @@ +
+

<%= link_to "Read the rules before proceeding!", terms_of_service_path %>

+