enable post view count tracking (for mods initially)

This commit is contained in:
r888888888
2017-11-09 16:10:34 -08:00
parent 0079e107fa
commit 131734f7a6
2 changed files with 17 additions and 0 deletions

View File

@@ -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?

View File

@@ -0,0 +1,9 @@
<% if CurrentUser.user.is_moderator? %>
<script type="text/javascript">
$(function() {
$.post("<%= Danbooru.config.reportbooru_server %>/post_views", {
msg: "<%= msg %>"
});
});
</script>
<% end %>