Web: Files: fixed opening documents for public user
This commit is contained in:
parent
e21ecb69b0
commit
6473e6a684
@ -108,20 +108,27 @@ export const openDocEditor = async (
|
||||
providerKey = null,
|
||||
tab = null,
|
||||
url = null,
|
||||
isPrivacy
|
||||
isPrivacy,
|
||||
shareKey = null
|
||||
) => {
|
||||
if (!providerKey && id && !isPrivacy) {
|
||||
if (!providerKey && id && !isPrivacy && !shareKey) {
|
||||
await addFileToRecent(id);
|
||||
}
|
||||
|
||||
const share = shareKey ? `&share=${shareKey}` : "";
|
||||
|
||||
if (!url && id) {
|
||||
url = combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
config.homepage,
|
||||
`/doceditor?fileId=${encodeURIComponent(id)}`
|
||||
`/doceditor?fileId=${encodeURIComponent(id)}${share}`
|
||||
);
|
||||
}
|
||||
|
||||
if (shareKey) {
|
||||
url += share;
|
||||
}
|
||||
|
||||
if (tab) {
|
||||
url ? (tab.location = url) : tab.close();
|
||||
} else {
|
||||
|
@ -2155,7 +2155,11 @@ class FilesStore {
|
||||
};
|
||||
|
||||
addFileToRecentlyViewed = (fileId) => {
|
||||
if (this.treeFoldersStore.isPrivacyFolder) return Promise.resolve();
|
||||
if (
|
||||
this.treeFoldersStore.isPrivacyFolder ||
|
||||
this.publicRoomStore.isPublicRoom
|
||||
)
|
||||
return Promise.resolve();
|
||||
return api.files.addFileToRecentlyViewed(fileId);
|
||||
};
|
||||
|
||||
@ -2808,12 +2812,8 @@ class FilesStore {
|
||||
}
|
||||
|
||||
get cbMenuItems() {
|
||||
const {
|
||||
isDocument,
|
||||
isPresentation,
|
||||
isSpreadsheet,
|
||||
isArchive,
|
||||
} = this.filesSettingsStore;
|
||||
const { isDocument, isPresentation, isSpreadsheet, isArchive } =
|
||||
this.filesSettingsStore;
|
||||
|
||||
let cbMenu = ["all"];
|
||||
const filesItems = [...this.files, ...this.folders];
|
||||
@ -3241,7 +3241,15 @@ class FilesStore {
|
||||
}
|
||||
|
||||
const isPrivacy = this.treeFoldersStore.isPrivacyFolder;
|
||||
return openEditor(id, providerKey, tab, url, isPrivacy);
|
||||
|
||||
return openEditor(
|
||||
id,
|
||||
providerKey,
|
||||
tab,
|
||||
url,
|
||||
isPrivacy,
|
||||
this.publicRoomStore.publicKey
|
||||
);
|
||||
};
|
||||
|
||||
createThumbnails = async () => {
|
||||
|
@ -7,7 +7,7 @@ import { checkFilterInstance, decodeDisplayName } from "../../utils";
|
||||
import { getRooms } from "../rooms";
|
||||
import RoomsFilter from "../rooms/filter";
|
||||
|
||||
export function openEdit(fileId, version, doc, view) {
|
||||
export function openEdit(fileId, version, doc, view, shareKey) {
|
||||
const params = []; // doc ? `?doc=${doc}` : "";
|
||||
|
||||
if (view) {
|
||||
@ -22,6 +22,10 @@ export function openEdit(fileId, version, doc, view) {
|
||||
params.push(`doc=${doc}`);
|
||||
}
|
||||
|
||||
if (shareKey) {
|
||||
params.push(`share=${shareKey}`);
|
||||
}
|
||||
|
||||
const paramsString = params.length > 0 ? `?${params.join("&")}` : "";
|
||||
|
||||
const options = {
|
||||
|
@ -51,6 +51,7 @@ export const initDocEditor = async (req) => {
|
||||
}
|
||||
|
||||
const doc = query?.doc || null;
|
||||
const shareKey = query?.share ?? null;
|
||||
const view = url.indexOf("action=view") !== -1;
|
||||
const fileVersion = version || null;
|
||||
|
||||
@ -79,7 +80,7 @@ export const initDocEditor = async (req) => {
|
||||
|
||||
personal = settings?.personal;
|
||||
|
||||
if (!successAuth && !doc) {
|
||||
if (!successAuth && !doc && !shareKey) {
|
||||
error = {
|
||||
unAuthorized: true,
|
||||
// redirectPath: combineUrl(
|
||||
@ -90,7 +91,7 @@ export const initDocEditor = async (req) => {
|
||||
return { error };
|
||||
}
|
||||
|
||||
const config = await openEdit(fileId, fileVersion, doc, view);
|
||||
const config = await openEdit(fileId, fileVersion, doc, view, shareKey);
|
||||
|
||||
//const sharingSettings = await getShareFiles([+fileId], []);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user