Add noteupdater:, update user profile links

fixes #1827, fixes #1397
This commit is contained in:
Toks
2013-12-07 22:06:20 -05:00
parent 81aa294b38
commit 468c0c7b63
4 changed files with 17 additions and 13 deletions

View File

@@ -237,6 +237,13 @@ class PostQueryBuilder
has_constraints!
end
if q[:note_updater_ids]
q[:note_updater_ids].each do |note_updater_id|
relation = relation.where(:id => NoteVersion.where("updater_id = ?", note_updater_id).select("post_id").uniq)
end
has_constraints!
end
if q[:artcomm_ids]
q[:artcomm_ids].each do |artcomm_id|
relation = relation.where(:id => ArtistCommentaryVersion.where("updater_id = ?", artcomm_id).select("post_id").uniq)

View File

@@ -1,5 +1,5 @@
class Tag < ActiveRecord::Base
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|artcomm|-pool|pool|-fav|fav|ordfav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|score|favcount|filesize|source|-source|id|-id|date|age|order|limit|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|child|pixiv_id|pixiv"
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-pool|pool|-fav|fav|ordfav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|score|favcount|filesize|source|-source|id|-id|date|age|order|limit|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|child|pixiv_id|pixiv"
attr_accessible :category, :as => [:moderator, :janitor, :contributor, :gold, :member, :anonymous, :default, :builder, :admin]
attr_accessible :is_locked, :as => [:moderator, :janitor, :admin]
has_one :wiki_page, :foreign_key => "title", :primary_key => "name"
@@ -375,6 +375,11 @@ class Tag < ActiveRecord::Base
user_id = User.name_to_id($2)
q[:noter_ids] << user_id unless user_id.blank?
when "noteupdater"
q[:note_updater_ids] ||= []
user_id = User.name_to_id($2)
q[:note_updater_ids] << user_id unless user_id.blank?
when "artcomm"
q[:artcomm_ids] ||= []
user_id = User.name_to_id($2)

View File

@@ -98,7 +98,7 @@ class UserPresenter
end
def commented_posts_count(template)
template.link_to(Post.fast_count("commenter:#{user.name}"), template.posts_path(:tags => "commenter:#{user.name}"))
template.link_to(Post.fast_count("commenter:#{user.name} order:comm"), template.posts_path(:tags => "commenter:#{user.name} order:comm"))
end
def post_version_count(template)
@@ -110,7 +110,7 @@ class UserPresenter
end
def noted_posts_count(template)
template.link_to(Post.fast_count("noter:#{user.name}"), template.posts_path(:tags => "noter:#{user.name}"))
template.link_to(Post.fast_count("noteupdater:#{user.name} order:note"), template.posts_path(:tags => "noteupdater:#{user.name} order:note"))
end
def wiki_page_version_count(template)

View File

@@ -51,11 +51,7 @@
<tr>
<th>Note Changes</th>
<td><%= presenter.note_version_count(self) %>
<% if CurrentUser.user.id == user.id %>
in <%= presenter.noted_posts_count(self) %> posts
<% end %>
</td>
<td><%= presenter.note_version_count(self) %> in <%= presenter.noted_posts_count(self) %> posts</td>
</tr>
<tr>
@@ -90,11 +86,7 @@
<tr>
<th>Comments</th>
<td><%= presenter.comment_count(self) %>
<% if CurrentUser.user.id == user.id %>
in <%= presenter.commented_posts_count(self) %> posts
<% end %>
</td>
<td><%= presenter.comment_count(self) %> in <%= presenter.commented_posts_count(self) %> posts</td>
</tr>
<% if CurrentUser.user.id == user.id || CurrentUser.user.is_janitor? %>