summaryrefslogtreecommitdiffstats
path: root/app/controllers/comments_controller.rb
diff options
context:
space:
mode:
authorMarius Mathiesen <marius@shortcut.no>2009-12-15 14:00:13 +0100
committerMarius Mathiesen <marius@shortcut.no>2009-12-15 14:00:28 +0100
commit72d9310014fe588c7ba2bca0e17472813e86ab1d (patch)
tree8256b8e29d2de5a5d961af8987638eadfc459493 /app/controllers/comments_controller.rb
parentfdc44ac950835e272b8ca7ff30a2e5e291b483d5 (diff)
downloadgitorious-mainline-outdated-72d9310014fe588c7ba2bca0e17472813e86ab1d.zip
gitorious-mainline-outdated-72d9310014fe588c7ba2bca0e17472813e86ab1d.tar.gz
gitorious-mainline-outdated-72d9310014fe588c7ba2bca0e17472813e86ab1d.tar.bz2
Support for watching a merge request version through commenting.
Also (finally) added support for login_as(<User>)
Diffstat (limited to 'app/controllers/comments_controller.rb')
-rw-r--r--app/controllers/comments_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index f7eb88d..9f44b04 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -115,7 +115,11 @@ class CommentsController < ApplicationController
end
def add_to_favorites
- current_user.favorites.create!(:watchable => @target)
+ favorite_target.watched_by!(current_user)
+ end
+
+ def favorite_target
+ @target.is_a?(MergeRequest) ? @target : @target.merge_request
end
def comment_was_invalid