fixes #692
This commit is contained in:
@@ -39,7 +39,7 @@ class User < ActiveRecord::Base
|
|||||||
has_many :feedback, :class_name => "UserFeedback", :dependent => :destroy
|
has_many :feedback, :class_name => "UserFeedback", :dependent => :destroy
|
||||||
has_many :posts, :foreign_key => "uploader_id"
|
has_many :posts, :foreign_key => "uploader_id"
|
||||||
has_one :ban
|
has_one :ban
|
||||||
has_many :subscriptions, :class_name => "TagSubscription", :foreign_key => "creator_id"
|
has_many :subscriptions, :class_name => "TagSubscription", :foreign_key => "creator_id", :order => "name"
|
||||||
has_many :note_versions, :foreign_key => "updater_id"
|
has_many :note_versions, :foreign_key => "updater_id"
|
||||||
has_many :dmails, :foreign_key => "owner_id", :order => "dmails.id desc"
|
has_many :dmails, :foreign_key => "owner_id", :order => "dmails.id desc"
|
||||||
belongs_to :inviter, :class_name => "User"
|
belongs_to :inviter, :class_name => "User"
|
||||||
|
|||||||
@@ -25,14 +25,6 @@ class UserPresenter
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_subscriptions
|
|
||||||
if CurrentUser.user.id == user.id
|
|
||||||
user.subscriptions
|
|
||||||
else
|
|
||||||
user.subscriptions.select {|x| x.is_public?}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def posts_for_subscription(subscription)
|
def posts_for_subscription(subscription)
|
||||||
Post.where("id in (?)", subscription.post_id_array.slice(0, 6).map(&:to_i)).order("id desc")
|
Post.where("id in (?)", subscription.post_id_array.slice(0, 6).map(&:to_i)).order("id desc")
|
||||||
end
|
end
|
||||||
@@ -144,16 +136,10 @@ class UserPresenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def subscriptions
|
def subscriptions
|
||||||
user.subscriptions
|
if CurrentUser.user.id == user.id
|
||||||
#
|
user.subscriptions
|
||||||
# if user.subscriptions.any?
|
else
|
||||||
# str = user.subscriptions.map do |subscription|
|
user.subscriptions.select {|x| x.is_public?}
|
||||||
# template.link_to(subscription.name, template.posts_path(:tags => "sub:#{user.name}:#{subscription.name}"))
|
end
|
||||||
# end.join(", ")
|
|
||||||
# str += " [" + template.link_to("edit", template.tag_subscriptions_path) + "]"
|
|
||||||
# str.html_safe
|
|
||||||
# else
|
|
||||||
# "None"
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user