Merge branch 'hotfix/v1.0.1' of github.com:ONLYOFFICE/AppServer into hotfix/campaigns-banner

This commit is contained in:
Viktor Fomin 2021-11-09 14:50:19 +03:00
commit bc3b9e640b
23 changed files with 173 additions and 85 deletions

View File

@ -428,8 +428,9 @@ namespace Frontend.Translations.Tests
.Select(item => item.Key);
var allJsTranslationKeys = JavaScriptFiles
.Where(f => !f.Path.Contains("Banner.js")) // skip Banner.js (translations from firebase)
.SelectMany(j => j.TranslationKeys)
.Select(k => k.Replace("Common:", "").Replace("Translations:", ""))
.Select(k => k.Replace("Common:", "").Replace("Translations:", "").Replace("Home:", ""))
.Distinct();
var notFoundJsKeys = allJsTranslationKeys.Except(allEnKeys);

View File

@ -7,10 +7,6 @@ const StyledSectionPaging = styled.div`
`;
class SectionPaging extends React.Component {
shouldComponentUpdate(nextProps) {
return !equal(this.props, nextProps);
}
render() {
return <StyledSectionPaging {...this.props} />;
}

View File

@ -31,6 +31,9 @@ const StyledTableContainer = styled.div`
margin: 14px 8px 0 auto;
z-index: 1;
border-right: 2px solid #d0d5da;
&:hover {
border-color: #657077;
}
}
.table-container_group-menu,
@ -175,6 +178,9 @@ const StyledTableHeaderCell = styled.div`
height: 38px;
display: flex;
align-items: center;
&:hover {
color: #657077;
}
}
`;

View File

@ -54,6 +54,7 @@ const TableHeaderCell = ({
iconName="/static/images/folder arrow.react.svg"
className="header-container-text-icon"
size="small"
hoverColor="#657077"
/>
</div>
{resizable && (

View File

@ -1,3 +0,0 @@
{
"SuccessEmptyTrash": "Papierkorb wurde geleert"
}

View File

@ -21,12 +21,10 @@
"EmptyFolderHeader": "Keine Dateien in diesem Ordner",
"EmptyRecycleBin": "Papierkorb leeren",
"FavoritesEmptyContainerDescription": "Benutzen Sie das Kontext-Menü, um Dateien als Favoriten zu kennzeichnen oder sie aus dieser Liste zu entfernen.",
"FileCreated": "Neue Datei <strong>{{itemTitle}}.{{exst}}</strong> wurde erstellt",
"FileRemoved": "Die Datei wurde in den Papierkorb verschoben",
"Filter": "Filter",
"FinalizeVersion": "Version abschließen",
"Folder": "Ordner",
"FolderCreated": "Neuer Ordner <strong>{{itemTitle}}</strong> wurde erstellt",
"FolderRemoved": "Ordner wurde in den Papierkorb verschoben",
"GoToMyButton": "Meine Dokumente öffnen",
"Images": "Bilder",

View File

@ -1,6 +1,5 @@
{
"DeleteForeverButton": "Delete forever",
"DeleteForeverNote": "All items from Trash will be deleted forever. You wont be able to restore them.",
"DeleteForeverTitle": "Delete forever?",
"SuccessEmptyTrash": "Trash emptied"
}
"DeleteForeverTitle": "Delete forever?"
}

View File

@ -21,13 +21,11 @@
"EmptyFolderHeader": "No files in this folder",
"EmptyRecycleBin": "Empty Trash",
"FavoritesEmptyContainerDescription": "To mark files as favorites or remove them from this list, use the context menu.",
"FileCreated": "New file <strong>{{itemTitle}}.{{exst}}</strong> is created",
"FileRemoved": "File moved to Trash",
"FileRenamed": "The document '{{oldTitle}}' is renamed to '{{newTitle}}'",
"Filter": "Filter",
"FinalizeVersion": "Finalize version",
"Folder": "Folder",
"FolderCreated": "New folder <strong>{{itemTitle}}</strong> is created",
"FolderRemoved": "Folder moved to Trash",
"FolderRenamed": "The folder '{{folderTitle}}' is renamed to '{{newFoldedTitle}}'",
"GoToMyButton": "Go to My Documents",

View File

@ -1,3 +0,0 @@
{
"SuccessEmptyTrash": "Cestino svuotato"
}

View File

@ -21,12 +21,10 @@
"EmptyFolderHeader": "Non ci sono file in questa cartella",
"EmptyRecycleBin": "Svuota cestino",
"FavoritesEmptyContainerDescription": "Non hai ancora preferiti. Per contrassegnare i file come preferiti o rimuoverli da questo elenco, utilizzare il menù contestuale.",
"FileCreated": "Nuovo file <strong>{{itemTitle}}.{{exst}}</strong> è stato creato",
"FileRemoved": "File spostato nel Cestino",
"Filter": "Filtro",
"FinalizeVersion": "Finalizza versione",
"Folder": "Cartella",
"FolderCreated": "Nuova cartella <strong>{{itemTitle}}</strong> è stata creata",
"FolderRemoved": "Cartella spostata nel cestino",
"GoToMyButton": "Vai ai Miei Documenti",
"Images": "Immagini",

View File

@ -1,3 +0,0 @@
{
"SuccessEmptyTrash": "ລ້າງຖັງຂີ້ເຫຍື້ອແລ້ວ"
}

View File

@ -21,12 +21,10 @@
"EmptyFolderHeader": "ບໍ່ມີເອກະສານຢູ່ໃນແຟ້ມນີ້",
"EmptyRecycleBin": "ຖັງຂີ້ເຫຍື້ອຫວ່າງເປົ່າ",
"FavoritesEmptyContainerDescription": "ຖ້າຕ້ອງການເຮັດເຄື່ອງໝາຍໄຟລ໌ເປັນລາຍການໂປດ ຫຼື ລົບອອກຈາກລາຍການນີ້ໃຫ້ໃຊ້ເມນູ context ",
"FileCreated": "ເອກະສານໃໝ່ <strong>{{itemTitle}}.{{exst}}</strong> ຖືກສ້າງຂື້ນ",
"FileRemoved": "ຍ້າຍແຟ້ມໄປທີ່ຖັງຂີ້ເຫຍື້ອ",
"Filter": "ຄັດກອງ",
"FinalizeVersion": "ສະບັບສຸດທ້າຍ",
"Folder": "ແຟ້ມ",
"FolderCreated": "ແຟ້ມໃໝ່ <strong>{{itemTitle}}</strong> ຖືກສ້າງຂຶ້ນ",
"FolderRemoved": "ຍ້າຍແຟ້ມໄປທີ່ຖັງຂີ້ເຫຍື້ອ",
"GoToMyButton": "ໄປທີ່ເອກະສານຂອງຂ້ອຍ",
"Images": "ຮູບພາບ",

View File

@ -1,3 +0,0 @@
{
"SuccessEmptyTrash": "Lixo esvaziado"
}

View File

@ -21,12 +21,10 @@
"EmptyFolderHeader": "Não há arquivos nesta pasta",
"EmptyRecycleBin": "Esvaziar lixeira",
"FavoritesEmptyContainerDescription": "Para marcar os arquivos como favoritos ou removê-los desta lista, use o menu de contexto.",
"FileCreated": "Novo arquivo <strong>{{itemTitle}}.{{exst}}</strong> é criado",
"FileRemoved": "Arquivo movido para a lixeira",
"Filter": "Filtro",
"FinalizeVersion": "Finalizar versão",
"Folder": "Pasta",
"FolderCreated": "Nova pasta <strong>{{itemTitle}}</strong> é criada",
"FolderRemoved": "Pasta movida para a lixeira",
"GoToMyButton": "Ir aos Meus Documentos",
"Images": "Imagens",

View File

@ -1,3 +0,0 @@
{
"SuccessEmptyTrash": "Coșul de gunoi a fost golit"
}

View File

@ -21,12 +21,10 @@
"EmptyFolderHeader": "Niciun fișier în dosarul",
"EmptyRecycleBin": "Golire Coş de gunoi",
"FavoritesEmptyContainerDescription": "Marcați fișiere ca preferate sau le ștergeți din lista prin intermediu meniului contextual. ",
"FileCreated": "A fost creat un fișier nou <strong>{{itemTitle}}.{{exst}}</strong>",
"FileRemoved": "Fișierul mutat în Coșul de gunoi",
"Filter": "Filtrare",
"FinalizeVersion": "Finalizarea versiunii",
"Folder": "Dosar",
"FolderCreated": "A fost creat un dosar nou <strong>{{itemTitle}}</strong>",
"FolderRemoved": "Dosarul mutat în Coșul de gunoi",
"GoToMyButton": "Accesează Documentele mele",
"Images": "Imagini",

View File

@ -1,6 +1,5 @@
{
"DeleteForeverButton": "Удалить навсегда",
"DeleteForeverNote": "Все объекты из корзины будут удалены навсегда. Вы не сможете их восстановить.",
"DeleteForeverTitle": "Удалить навсегда?",
"SuccessEmptyTrash": "Корзина успешно очищена"
}
"DeleteForeverTitle": "Удалить навсегда?"
}

View File

@ -21,13 +21,11 @@
"EmptyFolderHeader": "В этой папке нет файлов",
"EmptyRecycleBin": "Очистить корзину",
"FavoritesEmptyContainerDescription": "Чтобы добавить файлы в избранное или удалить их из этого списка, используйте контекстное меню.",
"FileCreated": "Создан новый файл <strong>{{itemTitle}}.{{exst}}</strong>",
"FileRemoved": "Файл перемещен в корзину",
"FileRenamed": "Документ '{{oldTitle}}' переименован в '{{newTitle}}'",
"Filter": "Фильтр",
"FinalizeVersion": "Сформировать версию",
"Folder": "Папка",
"FolderCreated": "Создана новая папка <strong>{{itemTitle}}</strong>",
"FolderRemoved": "Папка перемещена в корзину",
"FolderRenamed": "Папка '{{folderTitle}}' переименована в '{{newFoldedTitle}}'",
"GoToMyButton": "Перейти к моим документам",

View File

@ -196,7 +196,7 @@ const StyledFileTileTop = styled.div`
justify-content: space-between;
align-items: baseline;
background-color: #f8f9f9;
padding: 13px;
padding-top: 21px;
height: ${(props) => (props.checked || props.isActive ? "156px" : "156px")};
position: relative;
border-bottom: ${(props) =>
@ -213,6 +213,11 @@ const StyledFileTileTop = styled.div`
bottom: 0;
margin: auto;
z-index: 0;
min-width: 208px;
}
.temporary-icon > .injected-svg {
margin-bottom: 16px;
}
`;

View File

@ -13,6 +13,7 @@ const SectionPagingContent = ({
selectedCount,
selectedFolderId,
tReady,
totalPages,
}) => {
const { t } = useTranslation("Home");
const onNextClick = useCallback(
@ -105,7 +106,6 @@ const SectionPagingContent = ({
const pageItems = useMemo(() => {
if (filter.total < filter.pageCount) return [];
const totalPages = Math.ceil(filter.total / filter.pageCount);
return [...Array(totalPages).keys()].map((item) => {
return {
key: item,
@ -115,7 +115,7 @@ const SectionPagingContent = ({
}),
};
});
}, [filter.total, filter.pageCount, t]);
}, [filter.total, filter.pageCount, t, totalPages]);
const emptyPageSelection = {
key: 0,
@ -168,11 +168,14 @@ const SectionPagingContent = ({
export default inject(({ filesStore, selectedFolderStore }) => {
const { files, folders, fetchFiles, filter, setIsLoading } = filesStore;
const totalPages = Math.ceil(filter.total / filter.pageCount);
return {
files,
folders,
selectedFolderId: selectedFolderStore.id,
filter,
totalPages,
setIsLoading,
fetchFiles,

View File

@ -310,6 +310,8 @@ class FilesStore {
const isRecycleBinFolder =
data.current.rootFolderType === FolderType.TRASH;
!isRecycleBinFolder && this.checkUpdateNode(data, folderId);
if (!isRecycleBinFolder && withSubfolders) {
const path = data.pathParts.slice(0);
const foldersCount = data.current.foldersCount;
@ -340,7 +342,7 @@ class FilesStore {
const selectedFolder = {
selectedFolder: { ...this.selectedFolderStore },
};
this.createThumbnails();
this.viewAs === "tile" && this.createThumbnails();
return Promise.resolve(selectedFolder);
})
.catch((err) => {
@ -363,6 +365,29 @@ class FilesStore {
return request();
};
checkUpdateNode = async (data, folderId) => {
const { treeFolders, getSubfolders } = this.treeFoldersStore;
const somePath = data.pathParts.slice(0);
const path = data.pathParts.slice(0);
let newItems = treeFolders;
while (somePath.length !== 1) {
newItems = newItems.find((x) => x.id === somePath[0])?.folders;
if (!newItems) {
return;
}
somePath.shift();
}
if (!newItems.find((x) => x.id == folderId)) {
path.splice(data.pathParts.length - 1, 1);
const subfolders = await getSubfolders(data.current.parentId);
loopTreeFolders(path, treeFolders, subfolders, 0);
}
};
isFileSelected = (fileId, parentId) => {
const item = this.selection.find(
(x) => x.id === fileId && x.parentId === parentId

View File

@ -2,12 +2,12 @@ import { makeAutoObservable, runInAction } from "mobx";
import { TIMEOUT } from "../helpers/constants";
import { loopTreeFolders } from "../helpers/files-helpers";
import uniqueid from "lodash/uniqueId";
import throttle from "lodash/throttle";
import sumBy from "lodash/sumBy";
import { ConflictResolveType } from "@appserver/common/constants";
import {
getFolder,
getFileInfo,
getFolderInfo,
getProgress,
uploadFile,
convertFile,
@ -317,7 +317,8 @@ class UploadDataStore {
file.inConversion = false;
}
});
this.refreshFiles(toFolderId, false);
//this.refreshFiles(toFolderId, false);
break;
}
@ -335,7 +336,7 @@ class UploadDataStore {
}
});
this.refreshFiles(toFolderId, false);
this.refreshFiles(file);
const percent = this.getConversationPercent(index + 1);
this.setConversionPercent(percent, !!error);
}
@ -450,46 +451,122 @@ class UploadDataStore {
}
};
refreshFiles = (folderId, needUpdateTree = true) => {
const { setTreeFolders } = this.treeFoldersStore;
if (
this.selectedFolderStore.id === folderId &&
window.location.pathname.indexOf("/history") === -1
) {
return this.filesStore.fetchFiles(
this.selectedFolderStore.id,
this.filesStore.filter.clone(),
false,
true
);
} else if (needUpdateTree) {
return getFolder(folderId, this.filesStore.filter.clone()).then(
(data) => {
const path = data.pathParts;
const newTreeFolders = this.treeFoldersStore.treeFolders;
const folders = data.folders;
const foldersCount = data.count;
loopTreeFolders(path, newTreeFolders, folders, foldersCount);
setTreeFolders(newTreeFolders);
refreshFiles = async (currentFile) => {
const {
files,
setFiles,
folders,
setFolders,
filter,
setFilter,
} = this.filesStore;
if (window.location.pathname.indexOf("/history") === -1) {
const newFiles = files;
const newFolders = folders;
const path = currentFile.path;
let folderInfo = null;
const index = path.findIndex((x) => x === this.selectedFolderStore.id);
const folderId = index !== -1 ? path[index + 1] : null;
if (folderId) folderInfo = await getFolderInfo(folderId);
const newPath = [];
if (folderInfo) {
let i = 0;
while (path[i] && path[i] !== folderId) {
newPath.push(path[i]);
i++;
}
);
}
if (newPath[newPath.length - 1] !== this.selectedFolderStore.id) {
return;
}
const addNewFile = () => {
if (folderInfo) {
const isFolderExist = newFolders.find((x) => x.id === folderInfo.id);
if (!isFolderExist && folderInfo) {
newFolders.unshift(folderInfo);
setFolders(newFolders);
const newFilter = filter;
newFilter.total = newFilter.total += 1;
setFilter(newFilter);
}
} else {
const isFileExist = newFiles.find(
(x) => x.id === currentFile.fileInfo.id
);
if (!isFileExist && currentFile && currentFile.fileInfo) {
newFiles.unshift(currentFile.fileInfo);
setFiles(newFiles);
const newFilter = filter;
newFilter.total = newFilter.total += 1;
setFilter(newFilter);
}
}
};
const isFiltered =
filter.filterType ||
filter.authorType ||
filter.search ||
filter.page !== 0;
if ((!currentFile && !folderInfo) || isFiltered) return;
if (folderInfo && this.selectedFolderStore.id === folderInfo.id) return;
if (folderInfo) {
const folderIndex = folders.findIndex((f) => f.id === folderInfo.id);
if (folderIndex !== -1) {
folders[folderIndex] = folderInfo;
return;
}
}
if (filter.total >= filter.pageCount) {
if (files.length) {
newFiles.pop();
addNewFile();
} else {
newFolders.pop();
addNewFile();
}
} else {
addNewFile();
}
if (!!folderInfo) {
const {
expandedKeys,
setExpandedKeys,
treeFolders,
} = this.treeFoldersStore;
const newExpandedKeys = expandedKeys.filter(
(x) => x !== newPath[newPath.length - 1] + ""
);
setExpandedKeys(newExpandedKeys);
loopTreeFolders(
newPath,
treeFolders,
this.filesStore.folders.length === 1 ? this.filesStore.folders : [],
this.filesStore.folders.length
);
}
}
};
throttleRefreshFiles = throttle((toFolderId) => {
return this.refreshFiles(toFolderId).catch((err) => {
console.log("RefreshFiles failed", err);
return Promise.resolve();
});
}, 1000);
uploadFileChunks = async (
location,
requestsDataArray,
fileSize,
indexOfFile,
file,
t
path
) => {
const length = requestsDataArray.length;
for (let index = 0; index < length; index++) {
@ -543,8 +620,9 @@ class UploadDataStore {
// All chuncks are uploaded
const currentFile = this.files[indexOfFile];
currentFile.path = path;
if (!currentFile) return Promise.resolve();
const { toFolderId, needConvert } = currentFile;
const { needConvert } = currentFile;
if (needConvert) {
runInAction(() => (currentFile.action = "convert"));
@ -556,7 +634,10 @@ class UploadDataStore {
}
return Promise.resolve();
} else {
return this.throttleRefreshFiles(toFolderId);
if (currentFile.action === "uploaded") {
this.refreshFiles(currentFile);
}
return Promise.resolve();
}
};
@ -646,6 +727,7 @@ class UploadDataStore {
)
.then((res) => {
const location = res.data.location;
const path = res.data.path;
const requestsDataArray = [];
@ -659,9 +741,9 @@ class UploadDataStore {
chunk++;
}
return { location, requestsDataArray, fileSize };
return { location, requestsDataArray, fileSize, path };
})
.then(({ location, requestsDataArray, fileSize }) => {
.then(({ location, requestsDataArray, fileSize, path }) => {
this.primaryProgressDataStore.setPrimaryProgressBarData({
icon: "upload",
visible: true,
@ -678,7 +760,7 @@ class UploadDataStore {
fileSize,
indexOfFile,
file,
t
path
);
})
.catch((err) => {

View File

@ -3,7 +3,7 @@
"DocumentManagement": "Управление документами",
"OnlineEditors": "Онлайн редакторы",
"SoftwareLicense": "Лицензия на ПО",
"AboutCompanyAddressTitle": "Адрес",
"AboutCompanyEmailTitle": "Email",
"AboutCompanyTelTitle": "Телефон"
"AboutCompanyAddressTitle": "адрес",
"AboutCompanyEmailTitle": "email",
"AboutCompanyTelTitle": "тел."
}