Web: Files: Added opportunity to turn off "New" files badge
This commit is contained in:
parent
9f97d1f2b7
commit
ed2298663c
@ -758,7 +758,7 @@ class FilesActionStore {
|
|||||||
else updateFolderBadge(id, item.new);
|
else updateFolderBadge(id, item.new);
|
||||||
};
|
};
|
||||||
|
|
||||||
markAsRead = (folderIds, fileId, item) => {
|
markAsRead = (folderIds, fileIds, item) => {
|
||||||
const {
|
const {
|
||||||
setSecondaryProgressBarData,
|
setSecondaryProgressBarData,
|
||||||
clearSecondaryProgressData,
|
clearSecondaryProgressData,
|
||||||
@ -771,13 +771,22 @@ class FilesActionStore {
|
|||||||
visible: true,
|
visible: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
return markAsRead(folderIds, fileId)
|
return markAsRead(folderIds, fileIds)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res[0] ? res[0] : null;
|
const data = res[0] ? res[0] : null;
|
||||||
const pbData = { icon: "file" };
|
const pbData = { icon: "file" };
|
||||||
await this.uploadDataStore.loopFilesOperations(data, pbData);
|
await this.uploadDataStore.loopFilesOperations(data, pbData);
|
||||||
})
|
})
|
||||||
.then(() => item && this.setNewBadgeCount(item))
|
.then(() => {
|
||||||
|
if (!item) return;
|
||||||
|
|
||||||
|
this.setNewBadgeCount(item);
|
||||||
|
|
||||||
|
const { getFileIndex, updateFileStatus } = this.filesStore;
|
||||||
|
|
||||||
|
const index = getFileIndex(item.id);
|
||||||
|
updateFileStatus(index, item.fileStatus & ~FileStatus.IsNew);
|
||||||
|
})
|
||||||
.catch((err) => toastr.error(err))
|
.catch((err) => toastr.error(err))
|
||||||
.finally(() => setTimeout(() => clearSecondaryProgressData(), TIMEOUT));
|
.finally(() => setTimeout(() => clearSecondaryProgressData(), TIMEOUT));
|
||||||
};
|
};
|
||||||
|
@ -404,12 +404,13 @@ class FilesStore {
|
|||||||
this.folders = folders;
|
this.folders = folders;
|
||||||
};
|
};
|
||||||
|
|
||||||
updateFileStatus = (index, status, file) => {
|
getFileIndex = (id) => {
|
||||||
if (index < 0) return;
|
const index = this.files.findIndex((x) => x.id === id);
|
||||||
|
return index;
|
||||||
|
};
|
||||||
|
|
||||||
if (file) {
|
updateFileStatus = (index, status) => {
|
||||||
this.files[index] = file;
|
if (index < 0) return;
|
||||||
}
|
|
||||||
|
|
||||||
this.files[index].fileStatus = status;
|
this.files[index].fileStatus = status;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user