#26: touch Issue#updated_at field when comment has been changed (created/updated/destroyed)
This commit is contained in:
parent
dc5026f675
commit
32062f75c7
|
@ -12,7 +12,7 @@ class Projects::CommentsController < Projects::BaseController
|
|||
anchor = ''
|
||||
if !@comment.set_additional_data params
|
||||
flash[:error] = I18n.t("flash.comment.save_error")
|
||||
elsif @comment.save
|
||||
elsif @comment.save && touch_issue
|
||||
flash[:notice] = I18n.t("flash.comment.saved")
|
||||
anchor = view_context.comment_anchor(@comment)
|
||||
else
|
||||
|
@ -26,7 +26,7 @@ class Projects::CommentsController < Projects::BaseController
|
|||
end
|
||||
|
||||
def update
|
||||
status, message = if @comment.update_attributes(params[:comment])
|
||||
status, message = if @comment.update_attributes(params[:comment]) && touch_issue
|
||||
[200, view_context.markdown(@comment.body)]
|
||||
else
|
||||
[400, view_context.local_alert(@comment.errors.full_messages.join('. '))]
|
||||
|
@ -35,7 +35,7 @@ class Projects::CommentsController < Projects::BaseController
|
|||
end
|
||||
|
||||
def destroy
|
||||
@comment.destroy
|
||||
@comment.destroy && touch_issue
|
||||
flash[:notice] = t("flash.comment.destroyed")
|
||||
redirect_to project_commentable_path(@project, @commentable)
|
||||
end
|
||||
|
@ -47,6 +47,11 @@ class Projects::CommentsController < Projects::BaseController
|
|||
|
||||
protected
|
||||
|
||||
def touch_issue
|
||||
return true unless @comment.issue_comment?
|
||||
@comment.commentable.touch
|
||||
end
|
||||
|
||||
def find_commentable
|
||||
@commentable = params[:issue_id].present? && @project.issues.find_by_serial_id(params[:issue_id]) ||
|
||||
params[:commit_id].present? && @project.repo.commit(params[:commit_id])
|
||||
|
|
Loading…
Reference in New Issue