diff --git a/app/models/user.rb b/app/models/user.rb index 887509236..60c061456 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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" diff --git a/app/presenters/user_presenter.rb b/app/presenters/user_presenter.rb index f5b388d4c..dfc657e9b 100644 --- a/app/presenters/user_presenter.rb +++ b/app/presenters/user_presenter.rb @@ -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