File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ class Cards::Comments::ReactionsController < ApplicationController
22 include CardScoped
33
44 before_action :set_comment
5+ before_action :set_reaction , only : %i[ destroy ]
6+ before_action :ensure_permision_to_administer_reaction , only : %i[ destroy ]
57
68 def index
79 end
@@ -14,17 +16,19 @@ def create
1416 end
1517
1618 def destroy
17- @reaction = @comment . reactions . find ( params [ :id ] )
18-
19- if Current . user != @reaction . reacter
20- head :forbidden
21- else
22- @reaction . destroy
23- end
19+ @reaction . destroy
2420 end
2521
2622 private
2723 def set_comment
2824 @comment = @card . comments . find ( params [ :comment_id ] )
2925 end
26+
27+ def set_reaction
28+ @reaction = @comment . reactions . find ( params [ :id ] )
29+ end
30+
31+ def ensure_permision_to_administer_reaction
32+ head :forbidden if Current . user != @reaction . reacter
33+ end
3034end
You can’t perform that action at this time.
0 commit comments