Fixed Bug 60575 - Rooms.Files. Images/media are not opening from the New files panel.
This commit is contained in:
parent
dd3cc9d489
commit
5fe82aee03
@ -71,14 +71,14 @@ class NewFilesPanel extends React.Component {
|
|||||||
const folderIds = folders
|
const folderIds = folders
|
||||||
.filter((f) => !readingFiles.includes(f.id.toString()))
|
.filter((f) => !readingFiles.includes(f.id.toString()))
|
||||||
.map((f) => f.id);
|
.map((f) => f.id);
|
||||||
|
console.log("tut check 2");
|
||||||
this.props
|
this.props
|
||||||
.markAsRead(folderIds, fileIds)
|
.markAsRead(folderIds, fileIds)
|
||||||
//.then(() => this.setNewBadgeCount())
|
//.then(() => this.setNewBadgeCount())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const { hasNew, refreshFiles } = this.props;
|
const { hasNew, refreshFiles } = this.props;
|
||||||
|
|
||||||
return hasNew ? refreshFiles() : Promise.resolve();
|
return Promise.resolve(); //hasNew ? refreshFiles() :
|
||||||
})
|
})
|
||||||
.catch((err) => toastr.error(err))
|
.catch((err) => toastr.error(err))
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
@ -111,6 +111,8 @@ class NewFilesPanel extends React.Component {
|
|||||||
return this.onFileClick(item);
|
return this.onFileClick(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("tut check");
|
||||||
|
|
||||||
markAsRead(folderIds, fileIds, item)
|
markAsRead(folderIds, fileIds, item)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
//updateFolderBadge(folderId, 1);
|
//updateFolderBadge(folderId, 1);
|
||||||
@ -121,7 +123,7 @@ class NewFilesPanel extends React.Component {
|
|||||||
this.onFileClick(item);
|
this.onFileClick(item);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
refreshFiles();
|
// refreshFiles();
|
||||||
})
|
})
|
||||||
.catch((err) => toastr.error(err));
|
.catch((err) => toastr.error(err));
|
||||||
};
|
};
|
||||||
@ -130,9 +132,13 @@ class NewFilesPanel extends React.Component {
|
|||||||
const { id, fileExst, webUrl, fileType, providerKey } = item;
|
const { id, fileExst, webUrl, fileType, providerKey } = item;
|
||||||
const {
|
const {
|
||||||
filter,
|
filter,
|
||||||
//setMediaViewerData,
|
setMediaViewerData,
|
||||||
fetchFiles,
|
fetchFiles,
|
||||||
addFileToRecentlyViewed,
|
addFileToRecentlyViewed,
|
||||||
|
playlist,
|
||||||
|
setCurrentItem,
|
||||||
|
isMediaOrImage,
|
||||||
|
currentFolderId,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (!fileExst) {
|
if (!fileExst) {
|
||||||
@ -141,7 +147,10 @@ class NewFilesPanel extends React.Component {
|
|||||||
.finally(() => this.onClose());
|
.finally(() => this.onClose());
|
||||||
} else {
|
} else {
|
||||||
const canEdit = [5, 6, 7].includes(fileType); //TODO: maybe dirty
|
const canEdit = [5, 6, 7].includes(fileType); //TODO: maybe dirty
|
||||||
const isMedia = [2, 3, 4].includes(fileType);
|
// const isMedia = [2, 3, 4].includes(fileType);
|
||||||
|
|
||||||
|
const isMedia = isMediaOrImage(fileExst);
|
||||||
|
const isMediaActive = playlist.findIndex((el) => el.fileId === id) !== -1;
|
||||||
|
|
||||||
if (canEdit && providerKey) {
|
if (canEdit && providerKey) {
|
||||||
return addFileToRecentlyViewed(id)
|
return addFileToRecentlyViewed(id)
|
||||||
@ -160,8 +169,21 @@ class NewFilesPanel extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isMedia) {
|
if (isMedia) {
|
||||||
//const mediaItem = { visible: true, id };
|
if (currentFolderId !== item.folderId) {
|
||||||
//setMediaViewerData(mediaItem);
|
fetchFiles(item.folderId, null)
|
||||||
|
.then(() => {
|
||||||
|
const mediaItem = { visible: true, id };
|
||||||
|
setMediaViewerData(mediaItem);
|
||||||
|
})
|
||||||
|
.catch((err) => toastr.error(err))
|
||||||
|
.finally(() => this.onClose());
|
||||||
|
} else {
|
||||||
|
const mediaItem = { visible: true, id };
|
||||||
|
setMediaViewerData(mediaItem);
|
||||||
|
|
||||||
|
return this.onClose();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,10 +333,14 @@ export default inject(
|
|||||||
refreshFiles,
|
refreshFiles,
|
||||||
} = filesStore;
|
} = filesStore;
|
||||||
//const { updateRootBadge } = treeFoldersStore;
|
//const { updateRootBadge } = treeFoldersStore;
|
||||||
const { setMediaViewerData } = mediaViewerDataStore;
|
const {
|
||||||
const { getIcon, getFolderIcon } = settingsStore;
|
playlist,
|
||||||
|
setMediaViewerData,
|
||||||
|
setCurrentItem,
|
||||||
|
} = mediaViewerDataStore;
|
||||||
|
const { getIcon, getFolderIcon, isMediaOrImage } = settingsStore;
|
||||||
const { markAsRead } = filesActionsStore;
|
const { markAsRead } = filesActionsStore;
|
||||||
const { pathParts } = selectedFolderStore;
|
const { pathParts, id: currentFolderId } = selectedFolderStore;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
setNewFilesPanelVisible,
|
setNewFilesPanelVisible,
|
||||||
@ -331,6 +357,11 @@ export default inject(
|
|||||||
newFilesIds,
|
newFilesIds,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
|
||||||
|
playlist,
|
||||||
|
setCurrentItem,
|
||||||
|
isMediaOrImage,
|
||||||
|
currentFolderId,
|
||||||
|
|
||||||
//setIsLoading,
|
//setIsLoading,
|
||||||
fetchFiles,
|
fetchFiles,
|
||||||
setMediaViewerData,
|
setMediaViewerData,
|
||||||
|
@ -287,6 +287,8 @@ class FilesStore {
|
|||||||
console.log(`[WS] markasnew-file ${fileId}:${count}`);
|
console.log(`[WS] markasnew-file ${fileId}:${count}`);
|
||||||
|
|
||||||
const foundIndex = fileId && this.files.findIndex((x) => x.id === fileId);
|
const foundIndex = fileId && this.files.findIndex((x) => x.id === fileId);
|
||||||
|
|
||||||
|
this.treeFoldersStore.fetchTreeFolders();
|
||||||
if (foundIndex == -1) return;
|
if (foundIndex == -1) return;
|
||||||
|
|
||||||
this.updateFileStatus(
|
this.updateFileStatus(
|
||||||
@ -295,7 +297,6 @@ class FilesStore {
|
|||||||
? this.files[foundIndex].fileStatus | FileStatus.IsNew
|
? this.files[foundIndex].fileStatus | FileStatus.IsNew
|
||||||
: this.files[foundIndex].fileStatus & ~FileStatus.IsNew
|
: this.files[foundIndex].fileStatus & ~FileStatus.IsNew
|
||||||
);
|
);
|
||||||
this.treeFoldersStore.fetchTreeFolders();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//WAIT FOR RESPONSES OF EDITING FILE
|
//WAIT FOR RESPONSES OF EDITING FILE
|
||||||
|
Loading…
Reference in New Issue
Block a user