Remove upload tags report
- Use the current comparison type for post versions instead - Also add the note versions as a report - No other versions are meaningful as reports since it is expected for them to be modified by other users, or they don't have version numbers as is the case with artist commentaries
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
class ReportsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
|
||||
def upload_tags
|
||||
@user = User.find(params[:user_id])
|
||||
@upload_reports = Reports::UploadTags.includes(versions: { post: :versions }).for_user(params[:user_id]).order("id desc").paginate(params[:page], :limit => params[:limit])
|
||||
respond_with(@upload_reports)
|
||||
end
|
||||
end
|
||||
@@ -1,51 +0,0 @@
|
||||
module Reports
|
||||
class UploadTags < ::Post
|
||||
def readonly?
|
||||
true
|
||||
end
|
||||
|
||||
def api_attributes
|
||||
[:id, :uploader_id, :uploader_tags, :added_tags, :removed_tags]
|
||||
end
|
||||
|
||||
def uploader_tags_array
|
||||
@uploader_tags ||= begin
|
||||
uploader_versions = versions.where(updater_id: uploader_id)
|
||||
tags = []
|
||||
uploader_versions.each do |version|
|
||||
tags += version.changes[:added_tags]
|
||||
tags -= version.changes[:removed_tags]
|
||||
end
|
||||
tags.uniq.sort
|
||||
end
|
||||
end
|
||||
|
||||
def current_tags_array
|
||||
latest_tags = tag_array
|
||||
latest_tags << "rating:#{rating}" if rating.present?
|
||||
latest_tags << "parent:#{parent_id}" if parent_id.present?
|
||||
latest_tags << "source:#{source}" if source.present?
|
||||
latest_tags
|
||||
end
|
||||
|
||||
def added_tags_array
|
||||
current_tags_array - uploader_tags_array
|
||||
end
|
||||
|
||||
def removed_tags_array
|
||||
uploader_tags_array - current_tags_array
|
||||
end
|
||||
|
||||
def uploader_tags
|
||||
uploader_tags_array.join(' ')
|
||||
end
|
||||
|
||||
def added_tags
|
||||
added_tags_array.join(' ')
|
||||
end
|
||||
|
||||
def removed_tags
|
||||
removed_tags_array.join(' ')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -73,7 +73,7 @@
|
||||
<td>
|
||||
<%= presenter.upload_count(self) %>
|
||||
<% if presenter.has_uploads? %>
|
||||
(<%= link_to "tag changes report", reports_upload_tags_path(user_id: user.id) %>)
|
||||
(<%= link_to "tag changes report", post_versions_path(search: { updater_id: user.id, version: 1 }, type: "current") %>)
|
||||
<% end %>
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
[<%= link_to "sample", posts_path(:tags => "user:#{user.name} order:random limit:300") %>]
|
||||
@@ -130,7 +130,10 @@
|
||||
|
||||
<tr>
|
||||
<th>Note Changes</th>
|
||||
<td><%= presenter.note_version_count(self) %> in <%= presenter.noted_posts_count(self) %> posts</td>
|
||||
<td>
|
||||
<%= presenter.note_version_count(self) %> in <%= presenter.noted_posts_count(self) %> posts
|
||||
(<%= link_to "note changes report", note_versions_path(search: { updater_id: user.id, version: 1 }, type: "current") %>)
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
@@ -216,8 +216,6 @@ Rails.application.routes.draw do
|
||||
end
|
||||
resources :artist_commentary_versions, :only => [:index, :show]
|
||||
resource :related_tag, :only => [:show, :update]
|
||||
get "reports/uploads" => "reports#uploads"
|
||||
get "reports/upload_tags" => "reports#upload_tags"
|
||||
resources :recommended_posts, only: [:index]
|
||||
resources :robots, only: [:index]
|
||||
resources :saved_searches, :except => [:show] do
|
||||
|
||||
Reference in New Issue
Block a user