Skip to content

Commit

Permalink
nodejs: fix default actions on mobile (For Bug 65920)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinneyS committed Sep 6, 2024
1 parent 763512a commit 7eac06a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion web/documentserver-example/nodejs/helpers/wopi/wopiRouting.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@ exports.registerRoutes = function registerRoutes(app) {
file.actions = await utils.getActions(req.DocManager, ext); // get actions of the specified extension
// eslint-disable-next-line no-await-in-loop
file.defaultAction = await utils.getDefaultAction(req.DocManager, ext);// get the default action for extension
if (mobile) file.actions.forEach((act) => { if (act.name === 'mobileEdit') file.defaultAction = act; });
if (mobile) {
file.actions.forEach((act) => {
if ((file.defaultAction.name === 'edit' || file.defaultAction.name === 'formsubmit')
&& act.name === 'mobileEdit') {
file.defaultAction = act;
} else if (file.defaultAction.name === 'view' && act.name === 'mobileView') {
file.defaultAction = act;
}
});
}
}

// render wopiIndex template with the parameters specified
Expand Down

0 comments on commit 7eac06a

Please sign in to comment.