Skip to content

Commit a4809da

Browse files
feat: enable EnableInsertRemoteFile WOPI flag for Collabora
Set EnableInsertRemoteFile: true in CheckFileInfo response so Collabora shows "Insert Multimedia" and "Compare Document" menu entries. This triggers UI_InsertFile postMessages to the WOPI host, following the same pattern as the existing EnableInsertRemoteImage flag. Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
1 parent 0c8829c commit a4809da

4 files changed

Lines changed: 8 additions & 0 deletions

File tree

services/collaboration/pkg/connector/fileconnector.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,7 @@ func (f *FileConnector) CheckFileInfo(ctx context.Context) (*ConnectorResponse,
12671267

12681268
fileinfo.KeyEnableOwnerTermination: true, // only for collabora
12691269
fileinfo.KeyEnableInsertRemoteImage: true,
1270+
fileinfo.KeyEnableInsertRemoteFile: true,
12701271
fileinfo.KeySupportsExtendedLockLength: true,
12711272
fileinfo.KeySupportsGetLock: true,
12721273
fileinfo.KeySupportsLocks: true,

services/collaboration/pkg/connector/fileconnector_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,7 @@ var _ = Describe("FileConnector", func() {
18011801
BreadcrumbDocName: "test.txt",
18021802
PostMessageOrigin: "https://cloud.opencloud.test",
18031803
EnableInsertRemoteImage: true,
1804+
EnableInsertRemoteFile: true,
18041805
IsAnonymousUser: true,
18051806
}
18061807

@@ -1993,6 +1994,7 @@ var _ = Describe("FileConnector", func() {
19931994
BreadcrumbDocName: "test.txt",
19941995
PostMessageOrigin: "https://cloud.opencloud.test",
19951996
EnableInsertRemoteImage: true,
1997+
EnableInsertRemoteFile: true,
19961998
IsAdminUser: true,
19971999
}
19982000

services/collaboration/pkg/connector/fileinfo/collabora.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ type Collabora struct {
3636

3737
// If set to true, this will enable the insertion of images chosen from the WOPI storage. A UI_InsertGraphic postMessage will be send to the WOPI host to request the UI to select the file.
3838
EnableInsertRemoteImage bool `json:"EnableInsertRemoteImage,omitempty"`
39+
// If set to true, this will enable the insertion of remote files chosen from the WOPI storage. A UI_InsertFile postMessage will be sent to the WOPI host to request the UI to select the file. This enables multimedia insertion and document comparison features.
40+
EnableInsertRemoteFile bool `json:"EnableInsertRemoteFile,omitempty"`
3941
// If set to true, this will disable the insertion of image chosen from the local device. If EnableInsertRemoteImage is not set to true, then inserting images files is not possible.
4042
DisableInsertLocalImage bool `json:"DisableInsertLocalImage,omitempty"`
4143
// If set to true, hides the print option from the file menu bar in the UI.
@@ -111,6 +113,8 @@ func (cinfo *Collabora) SetProperties(props map[string]interface{}) {
111113

112114
case KeyEnableInsertRemoteImage:
113115
cinfo.EnableInsertRemoteImage = value.(bool)
116+
case KeyEnableInsertRemoteFile:
117+
cinfo.EnableInsertRemoteFile = value.(bool)
114118
case KeyDisableInsertLocalImage:
115119
cinfo.DisableInsertLocalImage = value.(bool)
116120
case KeyHidePrintOption:

services/collaboration/pkg/connector/fileinfo/fileinfo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const (
103103
KeyTemplateSource = "TemplateSource"
104104

105105
KeyEnableInsertRemoteImage = "EnableInsertRemoteImage"
106+
KeyEnableInsertRemoteFile = "EnableInsertRemoteFile"
106107
KeyDisableInsertLocalImage = "DisableInsertLocalImage"
107108
KeyHidePrintOption = "HidePrintOption"
108109
KeyHideSaveOption = "HideSaveOption"

0 commit comments

Comments
 (0)