Skip to content
Snippets Groups Projects
Commit ba6f9ab6 authored by ArtOfCode-'s avatar ArtOfCode-
Browse files

Always update question last_activity on answer

parent ead971b0
Branches
Tags
No related merge requests found
...@@ -20,9 +20,12 @@ class AnswersController < ApplicationController ...@@ -20,9 +20,12 @@ class AnswersController < ApplicationController
body: AnswersController.renderer.render(params[:answer][:body_markdown]), body: AnswersController.renderer.render(params[:answer][:body_markdown]),
last_activity: DateTime.now, last_activity_by: current_user, last_activity: DateTime.now, last_activity_by: current_user,
category: @question.category)) category: @question.category))
unless current_user.id == @question.user.id
@question.user.create_notification("New answer to your question '#{@question.title.truncate(50)}'", @question.user.create_notification("New answer to your question '#{@question.title.truncate(50)}'",
share_question_url(@question)) share_question_url(@question))
end
if @answer.save if @answer.save
@question.update(last_activity: DateTime.now, last_activity_by: current_user)
redirect_to url_for(controller: :questions, action: :show, id: params[:id]) redirect_to url_for(controller: :questions, action: :show, id: params[:id])
else else
render :new, status: 422 render :new, status: 422
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment