Skip to content

Commit

Permalink
Merge pull request #5320 from avalonmediasystem/SME_save
Browse files Browse the repository at this point in the history
Fix SME saving structure
  • Loading branch information
cjcolvar authored Aug 21, 2023
2 parents 268e0d7 + ae700eb commit e9d2e79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/master_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class MasterFilesController < ApplicationController
include NoidValidator

before_action :authenticate_user!, :only => [:create]
before_action :set_masterfile_proxy, except: [:create, :oembed, :attach_structure, :attach_captions, :delete_structure, :delete_captions, :destroy, :update]
before_action :set_masterfile, only: [:attach_structure, :attach_captions, :delete_structure, :delete_captions, :destroy, :update]
before_action :set_masterfile_proxy, except: [:create, :oembed, :attach_structure, :attach_captions, :delete_structure, :delete_captions, :destroy, :update, :set_structure]
before_action :set_masterfile, only: [:attach_structure, :attach_captions, :delete_structure, :delete_captions, :destroy, :update, :set_structure]
before_action :ensure_readable_filedata, :only => [:create]
skip_before_action :verify_authenticity_token, only: [:set_structure, :delete_structure]

Expand Down
7 changes: 7 additions & 0 deletions spec/controllers/master_files_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,13 @@ class << file
expect(master_file.structuralMetadata.content).not_to include('<b>')
expect(master_file.structuralMetadata.content).not_to include('<i>')
end

context "updating existing structure" do
it "persists updates" do
structure_json["label"] = "Different label"
expect { patch 'set_structure', params: { id: master_file.id, json: structure_json } }.to change { master_file.reload.structuralMetadata.content }
end
end
end

describe "#delete_structure" do
Expand Down

0 comments on commit e9d2e79

Please sign in to comment.