You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"authorized?" method fails (for users who have permissions to change states and/or edit tickets and/or delete tickets) in the ticket show template when submitting a blank comment since no project object is being specified when reloading the template. This will prevent Edit, Delete links and the select (State) from showing. It is very simple to fix:
classCommentsController < ApplicationControllerbefore_action:require_signin!before_action:set_ticketdefcreatesanitize_parameters!@comment=CommentWithNotifications.create(@ticket.comments,current_user,comment_params)if@comment.saveflash[:notice]="Comment has been created."redirect_to[@ticket.project,@ticket]else@states=State.all```@project = @ticket.project```@comment=@comment.commentflash[:alert]="Comment has not been created."rendertemplate: "tickets/show"endendend
Also update the spec Creating an invalid comment as well. This will further test to make sure that the State select box is there when saving comment fails:
File: creating_comments_spec.rb
scenario"Creating an invalid comment"doclick_linkticket.titleclick_button"Create Comment"expect(page).tohave_content("Comment has not been created.")expect(page).tohave_content("Text can't be blank")within("#new_comment")doexpect(page).tohave_content("State Open")expect(page).tohave_selector("#comment_state_id")endend
First images shows the issue and the second one show the behaviour after adding @project = @ticket.project!
The text was updated successfully, but these errors were encountered:
"authorized?" method fails (for users who have permissions to change states and/or edit tickets and/or delete tickets) in the ticket show template when submitting a blank comment since no project object is being specified when reloading the template. This will prevent Edit, Delete links and the select (State) from showing. It is very simple to fix:
Also update the spec
Creating an invalid comment
as well. This will further test to make sure that the State select box is there when saving comment fails:File: creating_comments_spec.rb
First images shows the issue and the second one show the behaviour after adding
@project = @ticket.project
!The text was updated successfully, but these errors were encountered: