Fix #3438: Thumbnails on user profiles don't respect safe mode.
This commit is contained in:
@@ -44,23 +44,7 @@ class UserPresenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def posts_for_saved_search_category(category)
|
def posts_for_saved_search_category(category)
|
||||||
if !SavedSearch.enabled?
|
Post.tag_match("search:#{category}").limit(10)
|
||||||
return Post.where("false")
|
|
||||||
end
|
|
||||||
|
|
||||||
ids = SavedSearch.post_ids(CurrentUser.user.id, category)
|
|
||||||
|
|
||||||
if ids.any?
|
|
||||||
arel = Post.where("id in (?)", ids.map(&:to_i)).order("id desc").limit(10)
|
|
||||||
|
|
||||||
if CurrentUser.user.hide_deleted_posts?
|
|
||||||
arel = arel.undeleted
|
|
||||||
end
|
|
||||||
|
|
||||||
arel
|
|
||||||
else
|
|
||||||
Post.where("false")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload_limit(template)
|
def upload_limit(template)
|
||||||
@@ -80,15 +64,7 @@ class UserPresenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def uploads
|
def uploads
|
||||||
@uploads ||= begin
|
Post.tag_match("user:#{user.name}").limit(6)
|
||||||
arel = Post.where("uploader_id = ?", user.id).order("id desc").limit(6)
|
|
||||||
|
|
||||||
if CurrentUser.user.hide_deleted_posts?
|
|
||||||
arel = arel.undeleted
|
|
||||||
end
|
|
||||||
|
|
||||||
arel
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_uploads?
|
def has_uploads?
|
||||||
@@ -96,15 +72,7 @@ class UserPresenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def favorites
|
def favorites
|
||||||
@favorites ||= begin
|
Post.tag_match("ordfav:#{user.name}").limit(6)
|
||||||
arel = user.favorites.limit(6).joins(:post).reorder("favorites.id desc")
|
|
||||||
|
|
||||||
if CurrentUser.user.hide_deleted_posts?
|
|
||||||
arel = arel.where("posts.is_deleted = false")
|
|
||||||
end
|
|
||||||
|
|
||||||
arel.map(&:post).compact
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_favorites?
|
def has_favorites?
|
||||||
|
|||||||
Reference in New Issue
Block a user