Merge branch 'master' of github.com:ONLYOFFICE/AppServer
This commit is contained in:
commit
2b18e75606
@ -116,13 +116,9 @@ namespace ASC.Api.Settings
|
||||
var settings = new SettingsWrapper
|
||||
{
|
||||
Culture = Tenant.GetCulture().ToString(),
|
||||
GreetingSettings = Tenant.Name
|
||||
};
|
||||
|
||||
if (!SecurityContext.IsAuthenticated)
|
||||
{
|
||||
settings.GreetingSettings = Tenant.Name;
|
||||
}
|
||||
|
||||
if (SecurityContext.IsAuthenticated)
|
||||
{
|
||||
settings.TrustedDomains = Tenant.TrustedDomains;
|
||||
@ -178,11 +174,11 @@ namespace ASC.Api.Settings
|
||||
return listOfTimezones;
|
||||
}
|
||||
|
||||
[Read("greetingsettings")]
|
||||
/* [Read("greetingsettings")]
|
||||
public string GetGreetingSettings()
|
||||
{
|
||||
return Tenant.Name;
|
||||
}
|
||||
}*/
|
||||
|
||||
[Create("greetingsettings")]
|
||||
public object SaveGreetingSettings(GreetingSettingsModel model)
|
||||
|
@ -18,7 +18,6 @@ import {
|
||||
getConfirmationInfo,
|
||||
logout
|
||||
} from "../../../../../src/store/auth/actions";
|
||||
import { getGreetingTitle } from '../../../../store/settings/actions';
|
||||
|
||||
const BodyStyle = styled(Container)`
|
||||
margin-top: 70px;
|
||||
@ -108,13 +107,12 @@ class Form extends React.PureComponent {
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const { getConfirmationInfo, history, getGreetingTitle } = this.props;
|
||||
const { getConfirmationInfo, history } = this.props;
|
||||
getConfirmationInfo(this.state.key)
|
||||
.catch(error => {
|
||||
toastr.error(this.props.t(`${error}`));
|
||||
history.push("/");
|
||||
});
|
||||
getGreetingTitle();
|
||||
|
||||
window.addEventListener("keydown", this.onKeyPress);
|
||||
window.addEventListener("keyup", this.onKeyPress);
|
||||
@ -219,11 +217,11 @@ function mapStateToProps(state) {
|
||||
isConfirmLoaded: state.auth.isConfirmLoaded,
|
||||
settings: state.auth.settings.passwordSettings,
|
||||
isAuthenticated: state.auth.isAuthenticated,
|
||||
greetingTitle: state.settings.greetingSettings,
|
||||
greetingTitle: state.auth.settings.greetingSettings,
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
{ changePassword, getConfirmationInfo, logout, getGreetingTitle }
|
||||
{ changePassword, getConfirmationInfo, logout }
|
||||
)(withRouter(withTranslation()(ChangePasswordForm)));
|
||||
|
@ -7,7 +7,6 @@ import PropTypes from 'prop-types';
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import { deleteSelf } from './../../../../store/services/api';
|
||||
import { logout } from '../../../../store/auth/actions';
|
||||
import { getGreetingTitle } from '../../../../store/settings/actions';
|
||||
|
||||
const ProfileRemoveContainer = styled.div`
|
||||
display: flex;
|
||||
@ -30,25 +29,14 @@ const ProfileRemoveContainer = styled.div`
|
||||
|
||||
class ProfileRemove extends React.PureComponent {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const { greetingTitle } = props;
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.state = {
|
||||
isProfileDeleted: false,
|
||||
greetingTitle
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { greetingTitle } = this.state;
|
||||
const { getGreetingTitle } = this.props;
|
||||
if (!greetingTitle) {
|
||||
getGreetingTitle()
|
||||
.then(() => this.setState({ greetingTitle: this.props.greetingTitleSettings }));
|
||||
}
|
||||
}
|
||||
|
||||
onDeleteProfile = () => {
|
||||
this.setState({ isLoading: true }, function () {
|
||||
const { linkData, logout } = this.props;
|
||||
@ -72,8 +60,8 @@ class ProfileRemove extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
console.log('profileRemove render');
|
||||
const { t } = this.props;
|
||||
const { isProfileDeleted, greetingTitle } = this.state;
|
||||
const { t, greetingTitle } = this.props;
|
||||
const { isProfileDeleted } = this.state;
|
||||
return (
|
||||
<ProfileRemoveContainer>
|
||||
<div className='start-basis'>
|
||||
@ -120,9 +108,8 @@ const ProfileRemoveForm = (props) => (<PageLayout sectionBodyContent={<ProfileRe
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
greetingTitle: state.auth.settings.greetingSettings,
|
||||
greetingTitleSettings: state.settings.greetingSettings
|
||||
greetingTitle: state.auth.settings.greetingSettings
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, { logout, getGreetingTitle })(withRouter(withTranslation()(ProfileRemoveForm)));
|
||||
export default connect(mapStateToProps, { logout })(withRouter(withTranslation()(ProfileRemoveForm)));
|
@ -2,8 +2,7 @@ import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import { FieldContainer, Text, ComboBox, Loader, Button, toastr, Link, TextInput } from "asc-web-components";
|
||||
import { getCultures, setLanguageAndTime, getPortalTimezones } from '../../../../../store/auth/actions';
|
||||
import { getGreetingTitle, setGreetingTitle, restoreGreetingTitle } from '../../../../../store/settings/actions';
|
||||
import { getCultures, setLanguageAndTime, getPortalTimezones, setGreetingTitle, restoreGreetingTitle } from '../../../../../store/auth/actions';
|
||||
import styled from 'styled-components';
|
||||
import { Trans } from 'react-i18next';
|
||||
|
||||
@ -72,13 +71,8 @@ class Customization extends React.Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
const { getCultures, portalLanguage, portalTimeZoneId, t, getPortalTimezones, getGreetingTitle } = this.props;
|
||||
const { timezones, languages, greetingTitle } = this.state;
|
||||
|
||||
if (!greetingTitle) {
|
||||
getGreetingTitle()
|
||||
.then(() => this.setState({ greetingTitle: this.props.greetingSettings }));
|
||||
}
|
||||
const { getCultures, portalLanguage, portalTimeZoneId, t, getPortalTimezones } = this.props;
|
||||
const { timezones, languages } = this.state;
|
||||
|
||||
if (!timezones.length && !languages.length) {
|
||||
let languages;
|
||||
@ -98,8 +92,8 @@ class Customization extends React.Component {
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
const { timezones, languages, greetingTitle } = this.state;
|
||||
if (greetingTitle !== null && timezones.length && languages.length && !prevState.isLoadedData) {
|
||||
const { timezones, languages } = this.state;
|
||||
if (timezones.length && languages.length && !prevState.isLoadedData) {
|
||||
this.setState({ isLoadedData: true });
|
||||
}
|
||||
}
|
||||
@ -280,11 +274,11 @@ function mapStateToProps(state) {
|
||||
language: state.auth.user.cultureName || state.auth.settings.culture,
|
||||
rawTimezones: state.auth.settings.timezones,
|
||||
rawCultures: state.auth.settings.cultures,
|
||||
greetingSettings: state.settings.greetingSettings,
|
||||
greetingSettings: state.auth.settings.greetingSettings,
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, {
|
||||
getCultures, setLanguageAndTime, getPortalTimezones,
|
||||
getGreetingTitle, setGreetingTitle, restoreGreetingTitle
|
||||
setGreetingTitle, restoreGreetingTitle
|
||||
})(withTranslation()(Customization));
|
||||
|
@ -14,6 +14,7 @@ export const GET_PORTAL_CULTURES = 'GET_PORTAL_CULTURES';
|
||||
export const SET_PORTAL_LANGUAGE_AND_TIME = 'SET_PORTAL_LANGUAGE_AND_TIME';
|
||||
export const GET_TIMEZONES = 'GET_TIMEZONES';
|
||||
export const SET_CURRENT_PRODUCT_ID = 'SET_CURRENT_PRODUCT_ID';
|
||||
export const SET_GREETING_SETTINGS = "SET_GREETING_SETTINGS";
|
||||
|
||||
export function setCurrentUser(user) {
|
||||
return {
|
||||
@ -98,6 +99,13 @@ export function setCurrentProductId(currentProductId) {
|
||||
};
|
||||
};
|
||||
|
||||
export function setGreetingSettings(title) {
|
||||
return {
|
||||
type: SET_GREETING_SETTINGS,
|
||||
title
|
||||
};
|
||||
};
|
||||
|
||||
export function getUser(dispatch) {
|
||||
return api.getUser()
|
||||
.then(user => dispatch(setCurrentUser(user)));
|
||||
@ -224,3 +232,30 @@ export function getPortalTimezones() {
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/* export function getGreetingTitle() {
|
||||
return dispatch => {
|
||||
return api.getGreetingSettings()
|
||||
.then(greetingTitle => dispatch(setGreetingSettings(greetingTitle)));
|
||||
};
|
||||
} */
|
||||
|
||||
export function setGreetingTitle(greetingTitle) {
|
||||
return dispatch => {
|
||||
return api.setGreetingSettings(greetingTitle)
|
||||
.then((res) => {
|
||||
dispatch(setGreetingSettings(greetingTitle))
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function restoreGreetingTitle() {
|
||||
return dispatch => {
|
||||
return api.restoreGreetingSettings()
|
||||
.then((res) => {
|
||||
dispatch(setGreetingSettings(res.companyName))
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {
|
||||
SET_CURRENT_USER, SET_MODULES, SET_SETTINGS, SET_IS_LOADED, LOGOUT, SET_PASSWORD_SETTINGS, SET_IS_CONFIRM_LOADED, SET_NEW_EMAIL,
|
||||
GET_PORTAL_CULTURES, SET_PORTAL_LANGUAGE_AND_TIME, GET_TIMEZONES, SET_CURRENT_PRODUCT_ID
|
||||
GET_PORTAL_CULTURES, SET_PORTAL_LANGUAGE_AND_TIME, GET_TIMEZONES, SET_CURRENT_PRODUCT_ID, SET_GREETING_SETTINGS
|
||||
} from './actions';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import config from "../../../package.json";
|
||||
@ -31,9 +31,7 @@ const initialState = {
|
||||
dateTimePattern: "DD, mm dd, yy h:mm:ss tt",
|
||||
timePattern: "h:mm tt"
|
||||
},
|
||||
settingsTree: {
|
||||
selectedKey: ['0-0']
|
||||
}
|
||||
greetingSettings: 'Web Office Applications'
|
||||
}/*,
|
||||
password: null*/
|
||||
}
|
||||
@ -85,8 +83,14 @@ const authReducer = (state = initialState, action) => {
|
||||
return Object.assign({}, state, {
|
||||
settings: { ...state.settings, currentProductId: action.currentProductId }
|
||||
});
|
||||
case SET_GREETING_SETTINGS:
|
||||
return Object.assign({}, state, {
|
||||
settings: { ...state.settings, greetingSettings: action.title }
|
||||
});
|
||||
case LOGOUT:
|
||||
return initialState;
|
||||
return Object.assign({}, initialState, {
|
||||
settings: { greetingSettings: state.settings.greetingSettings, culture: state.settings.culture }
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
@ -182,12 +182,12 @@ export function getUserById(userId) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getGreetingSettings() {
|
||||
/* export function getGreetingSettings() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/settings/greetingsettings.json`,
|
||||
});
|
||||
}
|
||||
} */
|
||||
|
||||
export function setGreetingSettings(title) {
|
||||
return request({
|
||||
|
@ -10,7 +10,6 @@ import {
|
||||
export const SET_USERS = "SET_USERS";
|
||||
export const SET_ADMINS = "SET_ADMINS";
|
||||
export const SET_OWNER = "SET_OWNER";
|
||||
export const SET_GREETING_SETTINGS = "SET_GREETING_SETTINGS";
|
||||
|
||||
export function setUsers(options) {
|
||||
return {
|
||||
@ -34,12 +33,6 @@ export function setOwner(owner) {
|
||||
};
|
||||
}
|
||||
|
||||
export function setGreetingSettings(title) {
|
||||
return {
|
||||
type: SET_GREETING_SETTINGS,
|
||||
title
|
||||
};
|
||||
}
|
||||
|
||||
export function getListUsers() {
|
||||
return (dispatch, getState) => {
|
||||
@ -109,28 +102,3 @@ export function getUserById(userId) {
|
||||
return api.getUserById(userId).then(owner => dispatch(setOwner(owner)));
|
||||
};
|
||||
}
|
||||
|
||||
export function getGreetingTitle() {
|
||||
return dispatch => {
|
||||
return api.getGreetingSettings()
|
||||
.then(greetingTitle => dispatch(setGreetingSettings(greetingTitle)));
|
||||
};
|
||||
}
|
||||
|
||||
export function setGreetingTitle(greetingTitle) {
|
||||
return dispatch => {
|
||||
return api.setGreetingSettings(greetingTitle)
|
||||
.then((res) => {
|
||||
dispatch(setGreetingSettings(greetingTitle))
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function restoreGreetingTitle() {
|
||||
return dispatch => {
|
||||
return api.restoreGreetingSettings()
|
||||
.then((res) => {
|
||||
dispatch(setGreetingSettings(res.companyName))
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { SET_USERS, SET_ADMINS, SET_OWNER, SET_GREETING_SETTINGS } from "./actions";
|
||||
import { SET_USERS, SET_ADMINS, SET_OWNER } from "./actions";
|
||||
|
||||
const initialState = {
|
||||
|
||||
@ -7,7 +7,6 @@ const initialState = {
|
||||
admins: [],
|
||||
owner: {}
|
||||
},
|
||||
greetingSettings: null
|
||||
};
|
||||
|
||||
const peopleReducer = (state = initialState, action) => {
|
||||
@ -30,10 +29,6 @@ const peopleReducer = (state = initialState, action) => {
|
||||
owner: action.owner
|
||||
})
|
||||
});
|
||||
case SET_GREETING_SETTINGS:
|
||||
return Object.assign({}, state, {
|
||||
greetingSettings: action.title
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user