Skip to content

Commit

Permalink
Fix for Viewing / Editing of all doc type except PDF not possible any…
Browse files Browse the repository at this point in the history
…more #17
  • Loading branch information
Baco authored and kendy committed Oct 20, 2020
1 parent 3b48be6 commit 777f489
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 19 deletions.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ require (

// Workaround for https://github.com/golang/go/issues/30831 and fallout.
replace github.com/golang/lint => github.com/golang/lint v0.0.0-20190227174305-8f45f776aaf1

// Workaround for willnorris.com/go/imageproxy@v0.8.1-0.20190326225038-d4246a08fdec: invalid pseudo-version: does not match version-control
replace willnorris.com/go/imageproxy => github.com/willnorris/imageproxy v0.8.0
4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "com.collaboraonline.mattermost",
"name": "Collabora Online",
"description": "Allows users to edit/view documents with the help of Collabora Online",
"version": "1.0.0",
"version": "1.0.1",
"min_server_version": "5.11.0",
"server": {
"executables": {
Expand All @@ -26,4 +26,4 @@
}
]
}
}
}
4 changes: 2 additions & 2 deletions server/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var WOPIData WopiDiscovery

//WOPIFileInfo is used top map file extension with the action & url
type WOPIFileInfo struct {
Url string //WOPI url to view/edit the file
URL string //WOPI url to view/edit the file
Action string //edit or view
}

Expand Down Expand Up @@ -102,7 +102,7 @@ func (p *Plugin) setConfiguration(configuration *configuration) {

WOPIFiles = make(map[string]WOPIFileInfo)
for i := 0; i < len(WOPIData.NetZone.App); i++ {
for j := 0; j < len(WOPIData.NetZone.App[i].Action; j++) {
for j := 0; j < len(WOPIData.NetZone.App[i].Action); j++ {
ext := strings.ToLower(WOPIData.NetZone.App[i].Action[j].Ext)
if ext == "" || ext == "png" || ext == "jpg" || ext == "jpeg" || ext == "gif" {
continue
Expand Down
2 changes: 1 addition & 1 deletion server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (p *Plugin) returnCollaboraOnlineFileURL(w http.ResponseWriter, r *http.Req
return
}

url := WOPIFiles[strings.ToLower(file.Extension)].Url + "WOPISrc=" + *p.API.GetConfig().ServiceSettings.SiteURL + "/plugins/" + manifest.ID + "/wopi/files/" + fileID
url := WOPIFiles[strings.ToLower(file.Extension)].URL + "WOPISrc=" + *p.API.GetConfig().ServiceSettings.SiteURL + "/plugins/" + manifest.ID + "/wopi/files/" + fileID
token := EncodeToken(r.Header.Get("Mattermost-User-Id"), fileID, p)

response := struct {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/redux/action_types.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { id as pluginId } from '../manifest';
import {id as pluginId} from '../manifest';

export const OPEN_ROOT_MODAL = pluginId + '_open_root_modal';
export const CLOSE_ROOT_MODAL = pluginId + '_close_root_modal';
24 changes: 12 additions & 12 deletions webapp/src/redux/reducers.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { OPEN_ROOT_MODAL, CLOSE_ROOT_MODAL } from './action_types';
import {OPEN_ROOT_MODAL, CLOSE_ROOT_MODAL} from './action_types';

export const rootModalData = (state, action) => {
switch (action.type) {
case OPEN_ROOT_MODAL:
return {
visible: true,
fileId: action.payload.fileId
};
case CLOSE_ROOT_MODAL:
return {
visible: false
};
default:
return state === undefined ? { visible: false } : state;
case OPEN_ROOT_MODAL:
return {
visible: true,
fileId: action.payload.fileId,
};
case CLOSE_ROOT_MODAL:
return {
visible: false,
};
default:
return typeof state === 'undefined' ? {visible: false} : state;
}
};
2 changes: 1 addition & 1 deletion webapp/src/redux/selectors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { id as pluginId } from '../manifest';
import {id as pluginId} from '../manifest';

const getPluginState = (state) => state['plugins-' + pluginId] || {};

Expand Down

0 comments on commit 777f489

Please sign in to comment.