From ed003aca13779a6393a3988f7b8a2ed55a71978b Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Tue, 30 Apr 2019 08:19:52 +0200 Subject: [PATCH] Add editnew action for editing new office files Closes SCI-3380 --- app/controllers/assets_controller.rb | 3 ++- app/utilities/wopi_util.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index fe96f274a..9800d6f2a 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -128,8 +128,9 @@ class AssetsController < ApplicationController end def edit + action = @asset.file_file_size.zero? && !@asset.locked? ? 'editnew' : 'edit' @action_url = append_wd_params(@asset - .get_action_url(current_user, 'edit', false)) + .get_action_url(current_user, action, false)) @favicon_url = @asset.favicon_url('edit') tkn = current_user.get_wopi_token @token = tkn.token diff --git a/app/utilities/wopi_util.rb b/app/utilities/wopi_util.rb index a66f2510b..eabeaa693 100644 --- a/app/utilities/wopi_util.rb +++ b/app/utilities/wopi_util.rb @@ -55,7 +55,8 @@ module WopiUtil wopi_app.save! app.xpath('action').each do |action| name = action.xpath('@name').first.value - next unless %w(view edit wopitest).include?(name) + next unless %w(view edit editnew wopitest).include?(name) + wopi_action = WopiAction.new wopi_action.action = name wopi_action.extension = action.xpath('@ext').first.value