summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-03-16 15:22:50 +0200
committerValery Sizov <vsv2711@gmail.com>2015-03-16 15:22:50 +0200
commit410d25c8ca8afabb25e5f89b36e3cfd09ffe6f87 (patch)
tree8f159d92f86fbebde5a97cb7c410c85b669475ca /app/models/concerns
parent0e20dc910f25db3b3f71867d54367db36334ff45 (diff)
downloadgitlab-ce-410d25c8ca8afabb25e5f89b36e3cfd09ffe6f87.tar.gz
rename table subscribe; make it polymorfic
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/issuable.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index c74d9cb9917..d1a35ca5294 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -15,7 +15,7 @@ module Issuable
has_many :notes, as: :noteable, dependent: :destroy
has_many :label_links, as: :target, dependent: :destroy
has_many :labels, through: :label_links
- has_many :subscribes, dependent: :destroy
+ has_many :subscriptions, dependent: :destroy, as: :subscribable
validates :author, presence: true
validates :title, presence: true, length: { within: 0..255 }
@@ -133,10 +133,11 @@ module Issuable
users.concat(mentions.reduce([], :|)).uniq
end
- def subscribe_status(user)
- subscribe = subscribes.find_by_user_id(user.id)
- if subscribe
- return subscribe.subscribed
+ def subscription_status(user)
+ subscription = subscriptions.find_by_user_id(user.id)
+
+ if subscription
+ return subscription.subscribed
end
participants.include?(user)