[ARVADOS] updated: 23c1bc62ea3644636c0edce8ccee39f2094db190

git at public.curoverse.com git at public.curoverse.com
Sat Feb 14 18:47:26 EST 2015


Summary of changes:
 apps/workbench/app/controllers/collections_controller.rb  | 15 +++++++++++++++
 .../test/controllers/collections_controller_test.rb       | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

       via  23c1bc62ea3644636c0edce8ccee39f2094db190 (commit)
      from  175c31a1cc695285c035ca2a54d5b964ab4b1d5f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 23c1bc62ea3644636c0edce8ccee39f2094db190
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Sat Feb 14 18:46:14 2015 -0500

    5096: if only collection name or description is being updated, do not include manifest_text in the request.

diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 3ef4688..d9bf3a9 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -266,6 +266,21 @@ class CollectionsController < ApplicationController
     sharing_popup
   end
 
+  def update
+    @updates ||= params[@object.resource_param_name.to_sym]
+    if @updates && (@updates.keys - ["name", "description"]).empty?
+      # exclude manifest_text since only name or description is being updated
+      @object.manifest_text = nil
+      if @object.update_attributes @updates
+        show
+      else
+        self.render_error status: 422
+      end
+    else
+      super
+    end
+  end
+
   protected
 
   def find_usable_token(token_list)
diff --git a/apps/workbench/test/controllers/collections_controller_test.rb b/apps/workbench/test/controllers/collections_controller_test.rb
index 45124f7..8518378 100644
--- a/apps/workbench/test/controllers/collections_controller_test.rb
+++ b/apps/workbench/test/controllers/collections_controller_test.rb
@@ -355,4 +355,19 @@ class CollectionsControllerTest < ActionController::TestCase
     assert /#{stage3_id}->#{stage3_out}/.match(used_by_svg)
 
   end
+
+  test "update description and check manifest_text is not lost" do
+    collection = api_fixture("collections")["multilevel_collection_1"]
+    post :update, {
+      id: collection["uuid"],
+      collection: {
+        description: 'test description update'
+      },
+      format: :json
+    }, session_for(:active)
+    assert_response :success
+    assert_not_nil assigns(:object)
+    assert_equal 'test description update', assigns(:object).description
+    assert_equal collection['manifest_text'], assigns(:object).manifest_text
+  end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list