add " (copy)" to copied OpenOffice files

Normally, copied CryptPad files have a " (copy)" suffixed to them but OnlyOffice doesn't because it has different internal architechture.

Copied OnlyOffice files can be identified by two attributes: a non-empty title and template data.

Since OnlyOffice files cannot be just copy and pasted, I resorted to modifying their metadata through metadataMgr in `./common/onlyoffice/inner.js`

Essentially, this commit check if a file is a copied file. If it is, it updates the title. It doesn't actually copy the file but merely modifies the title after it has been copied.
This commit is contained in:
Ahmed Mazen 2023-07-01 08:20:29 +08:00
parent a5d5dba9f2
commit 78957817e2
1 changed files with 5 additions and 0 deletions

View File

@ -241,6 +241,11 @@ define([
type = APP.downloadType; type = APP.downloadType;
title = "download"; title = "download";
} }
if(title === "" && APP.startWithTemplate) {
var copyTitle = Messages._getKey('copy_title', [APP.startWithTemplate.content.metadata.title]);
common.getMetadataMgr().updateTitle(copyTitle);
title = copyTitle
}
var file = {}; var file = {};
switch(type) { switch(type) {
case 'doc': case 'doc':