Skip to content

Commit

Permalink
Fixed revision comments not saving on document versions.
Browse files Browse the repository at this point in the history
Fixes #446
  • Loading branch information
fbacall committed Oct 22, 2020
1 parent 64dc3c4 commit 716598f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DocumentsController < ApplicationController

def new_version
if handle_upload_data(true)
comments = params[:revision_comment]
comments = params[:revision_comments]

respond_to do |format|
if @document.save_as_new_version(comments)
Expand Down
20 changes: 20 additions & 0 deletions test/functional/documents_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,26 @@ def edit_max_object(document)
assert_redirected_to document_path(assigns(:document))
end

test 'should create document version' do
document = Factory(:document)
login_as(document.contributor)

assert_difference('ActivityLog.count') do
assert_no_difference('Document.count') do
assert_difference('Document::Version.count') do
assert_difference('ContentBlob.count') do
post :new_version, params: { id: document.id, content_blobs: [{ data: fixture_file_upload('files/little_file.txt') }], revision_comments: 'new version!' }
end
end
end
end

assert_redirected_to document_path(assigns(:document))
assert_equal 2, assigns(:document).version
assert_equal 2, assigns(:document).versions.count
assert_equal 'new version!', assigns(:document).latest_version.revision_comments
end

test 'should create and link to event' do
person = Factory(:person)
login_as(person)
Expand Down

0 comments on commit 716598f

Please sign in to comment.