From 131734f7a6bed5ddb30625cabf77fccfe1740eae Mon Sep 17 00:00:00 2001 From: r888888888 Date: Thu, 9 Nov 2017 16:10:34 -0800 Subject: [PATCH] enable post view count tracking (for mods initially) --- app/helpers/posts_helper.rb | 8 ++++++++ app/views/posts/partials/show/_view_count.html.erb | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 app/views/posts/partials/show/_view_count.html.erb diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index edb36dc00..0ab9b00a7 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -46,6 +46,14 @@ module PostsHelper return nil end + def post_view_count_js + return nil unless Danbooru.config.enable_post_search_counts + + msg = "#{params[:id]},#{session.id}" + verifier = ActiveSupport::MessageVerifier.new(Danbooru.config.reportbooru_key, digest: "SHA256").generate(msg) + return render("posts/partials/index/view_count", msg: msg) + end + def common_searches_html(user) return nil unless Danbooru.config.enable_post_search_counts return nil unless user.is_platinum? diff --git a/app/views/posts/partials/show/_view_count.html.erb b/app/views/posts/partials/show/_view_count.html.erb new file mode 100644 index 000000000..7a3f99796 --- /dev/null +++ b/app/views/posts/partials/show/_view_count.html.erb @@ -0,0 +1,9 @@ +<% if CurrentUser.user.is_moderator? %> + +<% end %> \ No newline at end of file