lib/mno_enterprise/concerns/controllers/pages_controller.rb in mno-enterprise-api-3.1.4 vs lib/mno_enterprise/concerns/controllers/pages_controller.rb in mno-enterprise-api-3.2.0

- old
+ new

@@ -21,13 +21,13 @@ # any dashboard app picture # # TODO: Access + existence checks could be added in the future. This is not # mandatory as Mno Enterprise will do it anyway def launch - app = MnoEnterprise::AppInstance.find_by(uid: params[:id]) - MnoEnterprise::EventLogger.info('app_launch', current_user.id, "App launched", app.name, app) - redirect_to MnoEnterprise.router.launch_url(params[:id], wtk: MnoEnterprise.jwt(user_id: current_user.uid)) + app_instance = MnoEnterprise::AppInstance.find_by(uid: params[:id]) + MnoEnterprise::EventLogger.info('app_launch', current_user.id, 'App launched', app_instance) + redirect_to MnoEnterprise.router.launch_url(params[:id], {wtk: MnoEnterprise.jwt(user_id: current_user.uid)}.reverse_merge(request.query_parameters)) end # GET /loading/:id # Loading lounge - wait for an app to be online def loading @@ -52,9 +52,23 @@ # GET /app_logout def app_logout @meta[:title] = "Logged out" @meta[:description] = "Logged out from application" + end + + def terms + @meta[:title] = 'Terms of Use' + @meta[:description] = 'Terms of Use' + + ts = MnoEnterprise::App.order_by("updated_at.desc").first.try(:updated_at) + @apps = if ts + Rails.cache.fetch(['pages/terms/app-list', ts]) do + MnoEnterprise::App.order_by("name.ac").reject{|i| i.terms_url.blank?} + end + else + [] + end end private def app_instance_hash(app_instance) return {} unless app_instance