#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 = ''
|
anchor = ''
|
||||||
if !@comment.set_additional_data params
|
if !@comment.set_additional_data params
|
||||||
flash[:error] = I18n.t("flash.comment.save_error")
|
flash[:error] = I18n.t("flash.comment.save_error")
|
||||||
elsif @comment.save
|
elsif @comment.save && touch_issue
|
||||||
flash[:notice] = I18n.t("flash.comment.saved")
|
flash[:notice] = I18n.t("flash.comment.saved")
|
||||||
anchor = view_context.comment_anchor(@comment)
|
anchor = view_context.comment_anchor(@comment)
|
||||||
else
|
else
|
||||||
|
@ -26,7 +26,7 @@ class Projects::CommentsController < Projects::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
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)]
|
[200, view_context.markdown(@comment.body)]
|
||||||
else
|
else
|
||||||
[400, view_context.local_alert(@comment.errors.full_messages.join('. '))]
|
[400, view_context.local_alert(@comment.errors.full_messages.join('. '))]
|
||||||
|
@ -35,7 +35,7 @@ class Projects::CommentsController < Projects::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@comment.destroy
|
@comment.destroy && touch_issue
|
||||||
flash[:notice] = t("flash.comment.destroyed")
|
flash[:notice] = t("flash.comment.destroyed")
|
||||||
redirect_to project_commentable_path(@project, @commentable)
|
redirect_to project_commentable_path(@project, @commentable)
|
||||||
end
|
end
|
||||||
|
@ -47,6 +47,11 @@ class Projects::CommentsController < Projects::BaseController
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def touch_issue
|
||||||
|
return true unless @comment.issue_comment?
|
||||||
|
@comment.commentable.touch
|
||||||
|
end
|
||||||
|
|
||||||
def find_commentable
|
def find_commentable
|
||||||
@commentable = params[:issue_id].present? && @project.issues.find_by_serial_id(params[:issue_id]) ||
|
@commentable = params[:issue_id].present? && @project.issues.find_by_serial_id(params[:issue_id]) ||
|
||||||
params[:commit_id].present? && @project.repo.commit(params[:commit_id])
|
params[:commit_id].present? && @project.repo.commit(params[:commit_id])
|
||||||
|
|
Loading…
Reference in New Issue