Job reuse bugfix: do not reuse completed jobs that have NULL output.
[arvados.git] / services / api / app / controllers / arvados / v1 / users_controller.rb
index 0934642261bb314fdfbf76175251a2d702fb3a6b..08368cb5ef110d6181dcdd0f4f696adacba48eee 100644 (file)
@@ -59,7 +59,7 @@ class Arvados::V1::UsersController < ApplicationController
           "but is not invited"
         raise ArgumentError.new "Cannot activate without being invited."
       end
-      act_as_system_user do       
+      act_as_system_user do
         required_uuids = Link.where("owner_uuid = ? and link_class = ? and name = ? and tail_uuid = ? and head_uuid like ?",
                                     system_user_uuid,
                                     'signature',
@@ -130,7 +130,12 @@ class Arvados::V1::UsersController < ApplicationController
                     params[:repo_name], params[:vm_uuid]
     end
 
-    render json: { kind: "arvados#HashList", items: @response }
+    # setup succeeded. send email to user
+    if params[:send_notification_email] == true || params[:send_notification_email] == 'true'
+      UserNotifier.account_is_setup(@object).deliver
+    end
+
+    render json: { kind: "arvados#HashList", items: @response.as_api_response(nil) }
   end
 
   # delete user agreements, vm, repository, login links; set state to inactive
@@ -140,4 +145,12 @@ class Arvados::V1::UsersController < ApplicationController
     show
   end
 
+  protected
+
+  def self._setup_requires_parameters 
+    {
+      send_notification_email: { type: 'boolean', required: true },
+    }  
+  end
+
 end