diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index 56cbcab86d0aa7f689cf837e4b13c5fcea57bcf5..e3698091b4e7b7232fc73872b445d71cf61d42d0 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -20,9 +20,12 @@ class AnswersController < ApplicationController body: AnswersController.renderer.render(params[:answer][:body_markdown]), last_activity: DateTime.now, last_activity_by: current_user, category: @question.category)) - @question.user.create_notification("New answer to your question '#{@question.title.truncate(50)}'", - share_question_url(@question)) + unless current_user.id == @question.user.id + @question.user.create_notification("New answer to your question '#{@question.title.truncate(50)}'", + share_question_url(@question)) + end 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]) else render :new, status: 422