Skip to content

Commit

Permalink
Merge branch 'hotfix/v1.0.1' of github.com:ONLYOFFICE/AppServer into …
Browse files Browse the repository at this point in the history
…hotfix/v1.0.1
  • Loading branch information
dmitry-sychugov committed Nov 11, 2021
2 parents 4c55228 + 738cacb commit ae0a437
Show file tree
Hide file tree
Showing 76 changed files with 1,567 additions and 237 deletions.
2 changes: 1 addition & 1 deletion build/install/common/systemd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ BASE_DIR="/var/www/${PRODUCT}"
PATH_TO_CONF="/etc/onlyoffice/${PRODUCT}"
STORAGE_ROOT="${PATH_TO_CONF}/data"
LOG_DIR="/var/log/onlyoffice/${PRODUCT}"
DOTNET_RUN="/usr/bin/dotnet"
DOTNET_RUN="/usr/share/dotnet/dotnet"
APP_URLS="http://0.0.0.0"
ENVIRONMENT=" --ENVIRONMENT=production"

Expand Down
3 changes: 2 additions & 1 deletion common/Tests/Frontend.Translations.Tests/LocalesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,9 @@ public void NotFoundKeysTest()
.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);
Expand Down
4 changes: 4 additions & 0 deletions packages/asc-web-common/api/files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export function getFolderPath(folderId) {
}

export function getFolder(folderId, filter) {
if (folderId && typeof folderId === "string") {
folderId = encodeURIComponent(folderId.replace(/\\\\/g, "\\"));
}

const params =
filter && filter instanceof FilesFilter
? `${folderId}?${filter.toApiUrlParams()}`
Expand Down
19 changes: 19 additions & 0 deletions packages/asc-web-common/api/people/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { request } from "../client";
//import axios from "axios";
import Filter from "./filter";
import * as fakePeople from "./fake";
import { Encoder } from "../../utils/encoder";

export function getUserList(filter = Filter.getDefault(), fake = false) {
if (fake) {
Expand All @@ -18,6 +19,14 @@ export function getUserList(filter = Filter.getDefault(), fake = false) {
return request({
method: "get",
url: `/people${params}`,
}).then((res) => {
res.items = res.items.map((user) => {
if (user && user.displayName) {
user.displayName = Encoder.htmlDecode(user.displayName);
}
return user;
});
return res;
});
}

Expand All @@ -26,6 +35,11 @@ export function getUser(userName = null) {
method: "get",
url: `/people/${userName || "@self"}.json`,
skipUnauthorized: true,
}).then((user) => {
if (user && user.displayName) {
user.displayName = Encoder.htmlDecode(user.displayName);
}
return user;
});
}
export function getUserPhoto(userId) {
Expand Down Expand Up @@ -156,6 +170,11 @@ export function updateUserCulture(id, cultureName) {
method: "put",
url: `/people/${id}/culture`,
data: { cultureName },
}).then((user) => {
if (user && user.displayName) {
user.displayName = Encoder.htmlDecode(user.displayName);
}
return user;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import MediaDownloadIcon from "../../../../../public/images/media.download.react
import commonIconsStyles from "@appserver/components/utils/common-icons-style";
import MediaScrollButton from "./scroll-button";
import ControlBtn from "./control-btn";
import equal from "fast-deep-equal/react";

const StyledMediaZoomInIcon = styled(MediaZoomInIcon)`
${commonIconsStyles}
Expand Down Expand Up @@ -228,6 +229,9 @@ class ImageViewer extends React.Component {
document.getElementsByClassName("iconContainer reset")[0].click();
}

shouldComponentUpdate(nextProps) {
return !equal(this.props, nextProps);
}
render() {
const {
className,
Expand Down
2 changes: 1 addition & 1 deletion packages/asc-web-common/components/PageLayout/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ i18n
.init({
lng: localStorage.getItem(LANGUAGE) || "en",
fallbackLng: "en",
load: "all",
load: "currentOnly",
//debug: true,

interpolation: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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} />;
}
Expand Down
33 changes: 17 additions & 16 deletions packages/asc-web-common/store/AuthStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class AuthStore {
tfaStore = null;

isLoading = false;
isAuthenticated = false;
version = null;
skipModules = false;
providers = [];
Expand All @@ -42,8 +41,6 @@ class AuthStore {

await this.userStore.init();

if (this.userStore.user) this.setIsAuthenticated(true);

const requests = [];
requests.push(this.settingsStore.init());

Expand Down Expand Up @@ -202,15 +199,17 @@ class AuthStore {
}
};

reset = () => {
reset = (skipUser = false) => {
this.isInit = false;
this.skipModules = false;
this.userStore = new UserStore();
if (!skipUser) {
this.userStore = new UserStore();
}
this.moduleStore = new ModuleStore();
this.settingsStore = new SettingsStore();
};

logout = async (withoutRedirect) => {
logout = async (redirectToLogin = true) => {
await api.user.logout();

//console.log("Logout response ", response);
Expand All @@ -221,22 +220,24 @@ class AuthStore {

isDesktop && logoutDesktop();

this.reset();

this.init();

if (!withoutRedirect) {
if (redirectToLogin) {
if (personal) {
window.location.replace("/");
return window.location.replace("/");
} else {
history.push(combineUrl(proxyURL, "/login"));
this.reset(true);
this.userStore.setUser(null);
this.init();
return history.push(combineUrl(proxyURL, "/login"));
}
} else {
this.reset();
this.init();
}
};

setIsAuthenticated = (isAuthenticated) => {
this.isAuthenticated = isAuthenticated;
};
get isAuthenticated() {
return this.userStore.isAuthenticated;
}

getEncryptionAccess = (fileId) => {
return api.files
Expand Down
25 changes: 10 additions & 15 deletions packages/asc-web-common/store/UserStore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { action, makeObservable, observable } from "mobx";
import { makeAutoObservable } from "mobx";
import api from "../api";

class UserStore {
Expand All @@ -8,29 +8,20 @@ class UserStore {
userIsUpdate = false;

constructor() {
makeObservable(this, {
user: observable,
isLoading: observable,
isLoaded: observable,
userIsUpdate: observable,
getCurrentUser: action,
setIsLoading: action,
setIsLoaded: action,
setUser: action,
setUserIsUpdate: action,
});
makeAutoObservable(this);
}

getCurrentUser = async () => {
loadCurrentUser = async () => {
const user = await api.people.getUser();

this.setUser(user);
};

init = async () => {
if (this.isLoaded) return;

this.setIsLoading(true);

await this.getCurrentUser();
await this.loadCurrentUser();

this.setIsLoading(false);
this.setIsLoaded(true);
Expand Down Expand Up @@ -61,6 +52,10 @@ class UserStore {
//console.log("setUserIsUpdate");
this.userIsUpdate = isUpdate;
};

get isAuthenticated() {
return !!this.user;
}
}

export default UserStore;
Loading

0 comments on commit ae0a437

Please sign in to comment.