From 9d1b50d5b2bcbf1f1d1ca54f91ce81752aba59f1 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Tue, 23 Jul 2013 13:55:48 -0700 Subject: [PATCH 1/6] #1885: add prefetch for pools --- app/presenters/post_presenter.rb | 3 +++ app/views/posts/show.html.erb | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index 74ad40f02..afa9ff7d1 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -1,4 +1,6 @@ class PostPresenter < Presenter + attr_reader :pool, :next_post_in_pool + def self.preview(post, options = {}) if post.is_deleted? && options[:tags] !~ /status:(?:all|any|deleted|banned)/ && !options[:raw] return "" @@ -231,6 +233,7 @@ class PostPresenter < Presenter pool_html << ' ' if pool.neighbors(@post).next + @next_post_in_pool = pool.neighbors(@post).next pool_html << template.link_to("next ›".html_safe, template.post_path(pool.neighbors(@post).next, :pool_id => pool.id), :rel => next_rel, :class => "#{klass} next", :title => "to page #{pool.page_number(pool.neighbors(@post).next)}") match_found = true else diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index 3b9e3b69a..ba45e0d38 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -116,6 +116,10 @@ <% end %> + + <% if @post.presenter.next_post_in_pool %> + + <% end %> <% end %> <%= render "posts/partials/common/secondary_links" %> From 532bb6260cdb3ecee2b751d96f557a93d46b5d9c Mon Sep 17 00:00:00 2001 From: r888888888 Date: Tue, 23 Jul 2013 15:11:42 -0700 Subject: [PATCH 2/6] #1885: add support for chrome --- app/views/posts/show.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index ba45e0d38..440d4d8b2 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -119,6 +119,7 @@ <% if @post.presenter.next_post_in_pool %> + <% end %> <% end %> From ee34db677f15928c9da04d24b7118cf9d208704f Mon Sep 17 00:00:00 2001 From: r888888888 Date: Tue, 23 Jul 2013 15:24:45 -0700 Subject: [PATCH 3/6] fixes #1855 --- app/views/forum_topics/index.html.erb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/views/forum_topics/index.html.erb b/app/views/forum_topics/index.html.erb index 14e838df6..6e5ff00d8 100644 --- a/app/views/forum_topics/index.html.erb +++ b/app/views/forum_topics/index.html.erb @@ -2,6 +2,11 @@

Forum

+

+ Categories: + <%= link_to "All", forum_topics_path %>, <%= ForumTopic::CATEGORIES.map {|id, name| link_to_unless_current(name, forum_topics_path(:search => {:category_id => id}))}.join(", ").html_safe %> +

+ From 468d68d834f6410618fd15c2779361646b2503af Mon Sep 17 00:00:00 2001 From: r888888888 Date: Tue, 23 Jul 2013 15:29:39 -0700 Subject: [PATCH 4/6] fixes #1856 --- app/views/forum_topics/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/forum_topics/index.html.erb b/app/views/forum_topics/index.html.erb index 6e5ff00d8..c14969da5 100644 --- a/app/views/forum_topics/index.html.erb +++ b/app/views/forum_topics/index.html.erb @@ -18,7 +18,7 @@ <% @forum_topics.each do |topic| %> - + <% if CurrentUser.user.is_janitor? %> - - + + <% end %> @@ -41,8 +41,8 @@ <% if CurrentUser.user.is_janitor? %> - + <% end %> diff --git a/config/danbooru_default_config.rb b/config/danbooru_default_config.rb index 05c49feb5..794596b9b 100644 --- a/config/danbooru_default_config.rb +++ b/config/danbooru_default_config.rb @@ -4,7 +4,7 @@ module Danbooru class Configuration # The version of this Danbooru. def version - "2.25.0" + "2.26.0" end # The name of this Danbooru. From e4568e2f05ea22fb49b48ccbf296c5f8fe3eb864 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Tue, 23 Jul 2013 17:27:13 -0700 Subject: [PATCH 6/6] tweak Tag.trending algorithm --- app/models/tag.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index ae6dd2407..84a1c94bb 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -124,10 +124,10 @@ class Tag < ActiveRecord::Base def trending Cache.get("popular-tags-v3", 1.hour) do CurrentUser.scoped(User.admins.first, "127.0.0.1") do - n = 8 + n = 24 counts = {} - while counts.empty? && n < 256 + while counts.empty? && n < 1000 tag_strings = Post.select_values_sql("select tag_string from posts where created_at >= ?", n.hours.ago) tag_strings.each do |tag_string| tag_string.scan(/\S+/).each do |tag|
<% if topic.is_sticky? %> Sticky: From 073efaacb4727d516b2dc56746fceebb45a70f21 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Tue, 23 Jul 2013 17:14:41 -0700 Subject: [PATCH 5/6] update version, update user listing to match promotion report --- app/views/users/index.html.erb | 6 +++--- config/danbooru_default_config.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 8fd57ed6a..0b96da77f 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -15,8 +15,8 @@ Posts Deleted1+ FBCI5+ FBCI5+ SBCI10+ SBCINotes Edits<%= link_to user.posts.count, posts_path(:tags => "user:#{user.name}") %> <%= user.posts.deleted.count %><%= number_to_percentage Reports::UserPromotions.confidence_interval_for(user, 1), :precision => 0 %> <%= number_to_percentage Reports::UserPromotions.confidence_interval_for(user, 5), :precision => 0 %><%= number_to_percentage Reports::UserPromotions.confidence_interval_for(user, 10), :precision => 0 %><%= link_to user.note_versions.count, note_versions_path(:search => {:updater_id => user.id}) %> <%= link_to user.post_update_count, post_versions_path(:search => {:updater_id => user.id}) %>