lib/scrivito/basic_obj.rb in scrivito_sdk-1.7.0 vs lib/scrivito/basic_obj.rb in scrivito_sdk-1.8.0.rc1

- old
+ new

@@ -991,61 +991,10 @@ return true if has_conflict? cms_data_for_revision(base_revision) != cms_data_for_revision(published_revision) end - def transfer_modifications_to(target_workspace) - return unless modification - if has_conflict? || future_conflict?(target_workspace) - raise TransferModificationsConflictError, "Transfer will result in a conflict. " \ - "Please update the current and target workspace and ensure they are conflict free." - end - if in_revision(target_workspace.revision).try(:modification) - raise TransferModificationsModifiedError, - "Already modified in workspace #{target_workspace.id}" - end - copy_modifications_to(target_workspace) - reset_modifications - end - private - - def copy_modifications_to(target_workspace) - case - when new? then create_in(target_workspace) - when deleted? then destroy_in(target_workspace) - else update_in(target_workspace) - end - end - - def future_conflict?(target_workspace) - base_revision = workspace.base_revision - target_base_revision = target_workspace.base_revision - - base_revision != target_base_revision && - cms_data_for_revision(base_revision) != cms_data_for_revision(target_base_revision) - end - - def create_in(target_workspace) - target_workspace.api_request(:post, '/objs', obj: get_attributes) - end - - def update_in(target_workspace) - update_attributes = reset_blank_attributes(copyable_attributes) - target_workspace.api_request(:put, "/objs/#{id}", obj: update_attributes) - end - - def destroy_in(target_workspace) - target_workspace.api_request(:delete, "/objs/#{id}") - end - - def reset_modifications - case - when new? then workspace.api_request(:delete, "/objs/#{id}") - when deleted? then self.class.restore(id) - else revert - end - end def cms_data_for_revision(revision) return nil unless revision result = CmsBackend.find_obj_data_by(revision, "id", [id])