1 class IssueCommentsController < ApplicationController
4 before_action :authorize_web
5 before_action :require_user
6 before_action :check_permission
9 @issue = Issue.find(params[:issue_id])
10 comment = @issue.comments.build(issue_comment_params)
11 comment.user = current_user
13 notice = t("issues.comment.comment_created")
14 reassign_issue(@issue) if params[:reassign]
15 redirect_to @issue, :notice => notice
20 def issue_comment_params
21 params.require(:issue_comment).permit(:body)
25 unless current_user.administrator? || current_user.moderator?
26 flash[:error] = t("application.require_admin.not_an_admin")
31 # This sort of assumes there are only two roles
32 def reassign_issue(issue)
33 role = (Issue::ASSIGNED_ROLES - [issue.assigned_role]).first
34 issue.assigned_role = role