diff --git a/app/logical/post_query_builder.rb b/app/logical/post_query_builder.rb
index 8fff27df7..dd5a2f350 100644
--- a/app/logical/post_query_builder.rb
+++ b/app/logical/post_query_builder.rb
@@ -189,6 +189,16 @@ class PostQueryBuilder
has_constraints!
end
+ if q[:commenter_id]
+ relation = relation.where(:id => Comment.where("creator_id = ?", q[:commenter_id]).select("post_id").uniq)
+ has_constraints!
+ end
+
+ if q[:noter_id]
+ relation = relation.where(:id => Note.where("creator_id = ?", q[:noter_id]).select("post_id").uniq)
+ has_constraints!
+ end
+
if q[:parent_id]
relation = relation.where("(posts.id = ? or posts.parent_id = ?)", q[:parent_id], q[:parent_id])
has_constraints!
@@ -235,10 +245,10 @@ class PostQueryBuilder
when "favcount_asc"
relation = relation.order("posts.fav_count ASC, posts.id DESC")
- when "comment"
+ when "comment", "comm"
relation = relation.order("posts.last_commented_at DESC, posts.id DESC").where("posts.last_commented_at is not null")
- when "comment_asc"
+ when "comment_asc", "comm_asc"
relation = relation.order("posts.last_commented_at ASC, posts.id DESC").where("posts.last_commented_at is not null")
when "note"
diff --git a/app/models/artist_version.rb b/app/models/artist_version.rb
index 3677675e6..0bd3b40a3 100644
--- a/app/models/artist_version.rb
+++ b/app/models/artist_version.rb
@@ -1,5 +1,5 @@
class ArtistVersion < ActiveRecord::Base
- belongs_to :updater
+ belongs_to :updater, :class_name => "User"
belongs_to :artist
def self.search(params)
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 604bcd6f5..6c4fd6faa 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -3,6 +3,7 @@ class Comment < ActiveRecord::Base
validates_format_of :body, :with => /\S/, :message => 'has no content'
belongs_to :post
belongs_to :creator, :class_name => "User"
+ belongs_to :updater, :class_name => "User"
has_many :votes, :class_name => "CommentVote", :dependent => :destroy
before_validation :initialize_creator, :on => :create
before_validation :initialize_updater
diff --git a/app/models/forum_post.rb b/app/models/forum_post.rb
index 0a239d6ce..32f5dd964 100644
--- a/app/models/forum_post.rb
+++ b/app/models/forum_post.rb
@@ -2,6 +2,7 @@ class ForumPost < ActiveRecord::Base
attr_accessible :body, :topic_id, :as => [:member, :builder, :janitor, :privileged, :platinum, :contributor, :admin, :moderator, :default]
attr_accessible :is_locked, :is_sticky, :is_deleted, :as => [:admin, :moderator, :janitor]
belongs_to :creator, :class_name => "User"
+ belongs_to :updater, :class_name => "User"
belongs_to :topic, :class_name => "ForumTopic"
before_validation :initialize_creator, :on => :create
before_validation :initialize_updater
diff --git a/app/models/tag.rb b/app/models/tag.rb
index eb8698e87..ef23c739f 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -1,5 +1,5 @@
class Tag < ActiveRecord::Base
- METATAGS = "-user|user|-approver|approver|-pool|pool|-fav|fav|sub|md5|-rating|rating|width|height|mpixels|score|filesize|source|id|date|order|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|pixiv"
+ METATAGS = "-user|user|-approver|approver|commenter|comm|noter|-pool|pool|-fav|fav|sub|md5|-rating|rating|width|height|mpixels|score|filesize|source|id|date|order|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|pixiv"
attr_accessible :category
has_one :wiki_page, :foreign_key => "name", :primary_key => "title"
@@ -280,6 +280,14 @@ class Tag < ActiveRecord::Base
q[:approver_id] = User.name_to_id($2)
q[:approver_id] = -1 if q[:approver_id].nil?
+ when "commenter", "comm"
+ q[:commenter_id] = User.name_to_id($2)
+ q[:commenter_id] = -1 if q[:commenter_id].nil?
+
+ when "noter"
+ q[:noter_id] = User.name_to_id($2)
+ q[:noter_id] = -1 if q[:noter_id].nil?
+
when "-pool"
q[:tags][:exclude] << "pool:#{Pool.name_to_id($2)}"
diff --git a/app/models/user.rb b/app/models/user.rb
index eb6b8ebac..6e45cd9eb 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -355,6 +355,10 @@ class User < ActiveRecord::Base
return true
end
+
+ def level_class
+ "user-#{level_string.downcase}"
+ end
end
module EmailMethods
diff --git a/app/presenters/user_presenter.rb b/app/presenters/user_presenter.rb
index b626914e5..788fd982a 100644
--- a/app/presenters/user_presenter.rb
+++ b/app/presenters/user_presenter.rb
@@ -105,7 +105,7 @@ class UserPresenter
def inviter(template)
if user.inviter_id
- template.link_to(user.inviter.name, template.user_path(user.inviter_id))
+ template.link_to(user.inviter.name, template.user_path(user.inviter_id), { :class => user.inviter.level_class })
else
"None"
end
diff --git a/app/views/artist_versions/index.html.erb b/app/views/artist_versions/index.html.erb
index 762b5fb52..ec2b72bf2 100644
--- a/app/views/artist_versions/index.html.erb
+++ b/app/views/artist_versions/index.html.erb
@@ -27,7 +27,7 @@
<%= artist_version_other_names_diff(artist_version) %> |
<%= artist_version.group_name %> |
<%= compact_time artist_version.created_at %> |
- <%= link_to artist_version.updater_name, user_path(artist_version.updater_id) %> |
+ <%= link_to artist_version.updater_name, user_path(artist_version.updater_id), { :class => artist_version.updater.level_class } %> |
<%= artist_version.is_active? %> |
diff --git a/app/views/comments/partials/show/_comment.html.erb b/app/views/comments/partials/show/_comment.html.erb
index be178e30e..5296df968 100644
--- a/app/views/comments/partials/show/_comment.html.erb
+++ b/app/views/comments/partials/show/_comment.html.erb
@@ -1,6 +1,6 @@
|
- <%= link_to topic.creator.name, user_path(topic.creator) %> |
- <%= link_to topic.updater.name, user_path(topic.updater) %> |
+ <%= link_to topic.creator.name, user_path(topic.creator), { :class => topic.creator.level_class } %> |
+ <%= link_to topic.updater.name, user_path(topic.updater), { :class => topic.updater.level_class } %> |
<%= compact_time topic.updated_at %> |
<% end %>
diff --git a/app/views/mod_actions/index.html.erb b/app/views/mod_actions/index.html.erb
index 94b88fdd6..9c17f7c05 100644
--- a/app/views/mod_actions/index.html.erb
+++ b/app/views/mod_actions/index.html.erb
@@ -13,7 +13,7 @@
<% @mod_actions.each do |mod_action| %>
| <%= compact_time mod_action.created_at %> |
- <%= link_to mod_action.creator.name, user_path(mod_action.creator) %> |
+ <%= link_to mod_action.creator.name, user_path(mod_action.creator), { :class => mod_action.creator.level_class } %> |
<%= format_text(mod_action.description) %> |
<% end %>
diff --git a/app/views/note_versions/index.html.erb b/app/views/note_versions/index.html.erb
index 05efde2e2..2758c587b 100644
--- a/app/views/note_versions/index.html.erb
+++ b/app/views/note_versions/index.html.erb
@@ -29,7 +29,7 @@
<%= note_version.updater_ip_addr %>
<% end %>
- <%= link_to note_version.updater.try(:name), user_path(note_version.updater) %> |
+ <%= link_to note_version.updater.try(:name), user_path(note_version.updater), { :class => note_version.updater.level_class } %> |
<%= compact_time note_version.updated_at %> |
<% if CurrentUser.is_member? %>
diff --git a/app/views/notes/index_by_note.html.erb b/app/views/notes/index_by_note.html.erb
index 1d721591f..4d31ea455 100644
--- a/app/views/notes/index_by_note.html.erb
+++ b/app/views/notes/index_by_note.html.erb
@@ -16,7 +16,7 @@
<% @notes.each do |note| %>
|
| <%= link_to note.post_id, post_path(note.post_id) %> |
- <%= link_to note.creator.name, user_path(note.creator_id) %> |
+ <%= link_to note.creator.name, user_path(note.creator_id), { :class => note.creator.level_class } %> |
<%= compact_time(note.created_at) %> |
<%= note.is_active? %> |
<%= format_text(note.body) %> |
diff --git a/app/views/pool_versions/index.html.erb b/app/views/pool_versions/index.html.erb
index f82c80813..ff348d147 100644
--- a/app/views/pool_versions/index.html.erb
+++ b/app/views/pool_versions/index.html.erb
@@ -20,7 +20,7 @@
<%= link_to pool_version.pool.name, pool_path(pool_version.pool_id) %> |
<%= link_to pool_version.post_id_array.size, pool_versions_path(:search => {:pool_id => pool_version.pool_id}) %> |
<%= pool_version_diff(pool_version) %> |
- <%= link_to pool_version.updater_name, user_path(pool_version.updater_id) %> |
+ <%= link_to pool_version.updater_name, user_path(pool_version.updater_id), { :class => pool_version.updater.level_class } %> |
<% if CurrentUser.is_janitor? %>
<%= pool_version.updater_ip_addr %>
diff --git a/app/views/pools/index.html.erb b/app/views/pools/index.html.erb
index 8e27ac4a7..bcda70dea 100644
--- a/app/views/pools/index.html.erb
+++ b/app/views/pools/index.html.erb
@@ -19,7 +19,7 @@
<%= link_to h(pool.pretty_name), pool_path(pool) %>
|
- <%= link_to h(pool.creator.name), user_path(pool.creator) %>
+ <%= link_to h(pool.creator.name), user_path(pool.creator), { :class => pool.creator.level_class } %>
|
<%= pool.post_count %>
diff --git a/app/views/posts/partials/show/_information.html.erb b/app/views/posts/partials/show/_information.html.erb
index aca43d9f5..4ac51b9f1 100644
--- a/app/views/posts/partials/show/_information.html.erb
+++ b/app/views/posts/partials/show/_information.html.erb
@@ -1,9 +1,9 @@
- ID: <%= post.id %>
- - Uploader: <%= link_to_unless(post.uploader.nil?, post.uploader_name, user_path(post.uploader)) %>
+ - Uploader: <%= link_to_unless(post.uploader.nil?, post.uploader_name, user_path(post.uploader), { :class => post.uploader.level_class }) %>
- Date: <%= link_to time_ago_in_words_tagged(post.created_at), posts_path(:tags => "date:#{post.created_at.to_date}") %>
<% if post.approver %>
- - Approver: <%= link_to(post.approver.name, user_path(post.approver_id)) %>
+ - Approver: <%= link_to(post.approver.name, user_path(post.approver_id), { :class => post.approver.level_class }) %>
<% end %>
-
Size: <%= link_to_if Danbooru.config.can_user_see_post?(CurrentUser.user, post), number_to_human_size(post.file_size), post.file_url %>
diff --git a/app/views/user_feedbacks/index.html.erb b/app/views/user_feedbacks/index.html.erb
index 84db628fe..ce4601949 100644
--- a/app/views/user_feedbacks/index.html.erb
+++ b/app/views/user_feedbacks/index.html.erb
@@ -15,8 +15,8 @@
<% @user_feedbacks.each do |feedback| %>
- | <%= link_to feedback.user_name, user_path(feedback.user_id) %> |
- <%= link_to feedback.creator_name, user_path(feedback.creator_id) %> |
+ <%= link_to feedback.user_name, user_path(feedback.user_id), { :class => feedback.user.level_class } %> |
+ <%= link_to feedback.creator_name, user_path(feedback.creator_id), { :class => feedback.creator.level_class } %> |
<%= compact_time(feedback.created_at) %> |
<%= format_text(feedback.body) %> |
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index 2aded5c6e..1ac0d48b9 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -30,9 +30,9 @@
<% end %>
|
- <%= link_to user.pretty_name, user_path(user.id) %>
+ <%= link_to user.pretty_name, user_path(user.id), { :class => user.level_class } %>
<% if user.inviter %>
- ← <%= link_to user.inviter.name, user_path(user.inviter_id) %>
+ ← <%= link_to user.inviter.name, user_path(user.inviter_id), { :class => user.inviter.level_class } %>
<% end %>
|
<%= link_to user.posts.count, posts_path(:tags => "user:#{user.name}") %> |
diff --git a/app/views/wiki_page_versions/index.html.erb b/app/views/wiki_page_versions/index.html.erb
index 5d1c8b4ec..8bad2d85f 100644
--- a/app/views/wiki_page_versions/index.html.erb
+++ b/app/views/wiki_page_versions/index.html.erb
@@ -43,7 +43,7 @@
<%= compact_time(wiki_page_version.updated_at) %>
<% if wiki_page_version.updater %>
by
- <%= link_to wiki_page_version.updater_name, user_path(wiki_page_version.updater) %>
+ <%= link_to wiki_page_version.updater_name, user_path(wiki_page_version.updater), { :class => wiki_page_version.updater.level_class } %>
<% end %>
|