Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions services/collaboration/pkg/connector/fileconnector.go
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,7 @@ func (f *FileConnector) CheckFileInfo(ctx context.Context) (*ConnectorResponse,

fileinfo.KeyEnableOwnerTermination: true, // only for collabora
fileinfo.KeyEnableInsertRemoteImage: true,
fileinfo.KeyEnableInsertRemoteFile: true,
fileinfo.KeySupportsExtendedLockLength: true,
fileinfo.KeySupportsGetLock: true,
fileinfo.KeySupportsLocks: true,
Expand Down
2 changes: 2 additions & 0 deletions services/collaboration/pkg/connector/fileconnector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,7 @@ var _ = Describe("FileConnector", func() {
BreadcrumbDocName: "test.txt",
PostMessageOrigin: "https://cloud.opencloud.test",
EnableInsertRemoteImage: true,
EnableInsertRemoteFile: true,
IsAnonymousUser: true,
}

Expand Down Expand Up @@ -1993,6 +1994,7 @@ var _ = Describe("FileConnector", func() {
BreadcrumbDocName: "test.txt",
PostMessageOrigin: "https://cloud.opencloud.test",
EnableInsertRemoteImage: true,
EnableInsertRemoteFile: true,
IsAdminUser: true,
}

Expand Down
4 changes: 4 additions & 0 deletions services/collaboration/pkg/connector/fileinfo/collabora.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

// 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.
EnableInsertRemoteImage bool `json:"EnableInsertRemoteImage,omitempty"`
// 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.
EnableInsertRemoteFile bool `json:"EnableInsertRemoteFile,omitempty"`
// 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.
DisableInsertLocalImage bool `json:"DisableInsertLocalImage,omitempty"`
// If set to true, hides the print option from the file menu bar in the UI.
Expand Down Expand Up @@ -87,7 +89,7 @@
// SetProperties will set the file properties for the Collabora implementation.
func (cinfo *Collabora) SetProperties(props map[string]interface{}) {
for key, value := range props {
switch key {

Check warning on line 92 in services/collaboration/pkg/connector/fileinfo/collabora.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Reduce the number of switch branches from 31 to at most 30.

See more on https://sonarcloud.io/project/issues?id=opencloud-eu_opencloud&issues=AZ1EIaWjs9dkVuN-Hfd2&open=AZ1EIaWjs9dkVuN-Hfd2&pullRequest=2555
case KeyBaseFileName:
cinfo.BaseFileName = value.(string)
case KeyDisablePrint:
Expand All @@ -111,6 +113,8 @@

case KeyEnableInsertRemoteImage:
cinfo.EnableInsertRemoteImage = value.(bool)
case KeyEnableInsertRemoteFile:
cinfo.EnableInsertRemoteFile = value.(bool)
case KeyDisableInsertLocalImage:
cinfo.DisableInsertLocalImage = value.(bool)
case KeyHidePrintOption:
Expand Down
1 change: 1 addition & 0 deletions services/collaboration/pkg/connector/fileinfo/fileinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const (
KeyTemplateSource = "TemplateSource"

KeyEnableInsertRemoteImage = "EnableInsertRemoteImage"
KeyEnableInsertRemoteFile = "EnableInsertRemoteFile"
KeyDisableInsertLocalImage = "DisableInsertLocalImage"
KeyHidePrintOption = "HidePrintOption"
KeyHideSaveOption = "HideSaveOption"
Expand Down