1 class IssueCommentsController < ApplicationController
4 before_action :authorize_web
5 before_action :set_locale
10 @issue = Issue.find(params[:issue_id])
11 comment = @issue.comments.build(issue_comment_params)
12 comment.user = current_user
16 reassign_issue(@issue)
17 flash[:notice] = t ".issue_reassigned"
19 if current_user.has_role? @issue.assigned_role
22 redirect_to issues_path(:status => "open")
25 flash[:notice] = t(".comment_created")
32 def issue_comment_params
33 params.require(:issue_comment).permit(:body)
36 # This sort of assumes there are only two roles
37 def reassign_issue(issue)
38 role = (Issue::ASSIGNED_ROLES - [issue.assigned_role]).first
39 issue.assigned_role = role