diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index dd75b99a5..8e7bcab40 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -89,7 +89,6 @@ class JournalsController < ApplicationController journal_attributes[:updated_by] = User.current @journal.safe_attributes = journal_attributes @journal.save - @journal.destroy if @journal.details.empty? && @journal.notes.blank? call_hook(:controller_journals_edit_post, {:journal => @journal, :params => params}) respond_to do |format| format.html {redirect_to issue_path(@journal.journalized)} diff --git a/app/models/journal.rb b/app/models/journal.rb index 271a9291d..1874feb0c 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -102,7 +102,7 @@ class Journal < ApplicationRecord def save(*args) journalize_changes # Do not save an empty journal - notes_and_details_empty? ? false : super() + (new_record? && notes_and_details_empty?) ? false : super() end def notes_and_details_empty? diff --git a/app/views/journals/update.js.erb b/app/views/journals/update.js.erb index cd75cd8fa..2ab11cac9 100644 --- a/app/views/journals/update.js.erb +++ b/app/views/journals/update.js.erb @@ -1,4 +1,4 @@ -<% if @journal.frozen? %> +<% if @journal.frozen? || @journal.notes_and_details_empty? %> $("#change-<%= @journal.id %>").remove(); <% else %> $("#change-<%= @journal.id %>").attr('class', '<%= @journal.css_classes %>');