This commit is contained in:
albert
2013-03-02 21:18:57 -05:00
parent 7ca8635051
commit b3ab52e889
2 changed files with 6 additions and 20 deletions

View File

@@ -39,7 +39,7 @@ class User < ActiveRecord::Base
has_many :feedback, :class_name => "UserFeedback", :dependent => :destroy
has_many :posts, :foreign_key => "uploader_id"
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 :dmails, :foreign_key => "owner_id", :order => "dmails.id desc"
belongs_to :inviter, :class_name => "User"

View File

@@ -25,14 +25,6 @@ class UserPresenter
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)
Post.where("id in (?)", subscription.post_id_array.slice(0, 6).map(&:to_i)).order("id desc")
end
@@ -144,16 +136,10 @@ class UserPresenter
end
def subscriptions
user.subscriptions
#
# if user.subscriptions.any?
# str = user.subscriptions.map do |subscription|
# template.link_to(subscription.name, template.posts_path(:tags => "sub:#{user.name}:#{subscription.name}"))
# end.join(", ")
# str += " [" + template.link_to("edit", template.tag_subscriptions_path) + "]"
# str.html_safe
# else
# "None"
# end
if CurrentUser.user.id == user.id
user.subscriptions
else
user.subscriptions.select {|x| x.is_public?}
end
end
end