Merge branch 'release-3.0'
Этот коммит содержится в:
@@ -542,6 +542,7 @@ func convertTeamTo30(primaryTeamName string, team *TeamForUpgrade, uniqueEmails
|
|||||||
|
|
||||||
for _, user := range users {
|
for _, user := range users {
|
||||||
shouldUpdateUser := false
|
shouldUpdateUser := false
|
||||||
|
shouldUpdateRole := false
|
||||||
previousRole := user.Roles
|
previousRole := user.Roles
|
||||||
previousEmail := user.Email
|
previousEmail := user.Email
|
||||||
previousUsername := user.Username
|
previousUsername := user.Username
|
||||||
@@ -554,7 +555,7 @@ func convertTeamTo30(primaryTeamName string, team *TeamForUpgrade, uniqueEmails
|
|||||||
if model.IsInRole(user.Roles, model.ROLE_TEAM_ADMIN) {
|
if model.IsInRole(user.Roles, model.ROLE_TEAM_ADMIN) {
|
||||||
member.Roles = model.ROLE_TEAM_ADMIN
|
member.Roles = model.ROLE_TEAM_ADMIN
|
||||||
user.Roles = ""
|
user.Roles = ""
|
||||||
shouldUpdateUser = true
|
shouldUpdateRole = true
|
||||||
}
|
}
|
||||||
|
|
||||||
exists := false
|
exists := false
|
||||||
@@ -668,6 +669,25 @@ func convertTeamTo30(primaryTeamName string, team *TeamForUpgrade, uniqueEmails
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if shouldUpdateRole {
|
||||||
|
if _, err := store.GetMaster().Exec(`
|
||||||
|
UPDATE Users
|
||||||
|
SET
|
||||||
|
Roles = ''
|
||||||
|
WHERE
|
||||||
|
Id = :Id
|
||||||
|
`,
|
||||||
|
map[string]interface{}{
|
||||||
|
"Id": user.Id,
|
||||||
|
},
|
||||||
|
); err != nil {
|
||||||
|
l4g.Error("Failed to update user role %v details=%v", user.Email, err)
|
||||||
|
flushLogAndExit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
l4g.Info("modified user_id=%v, changed roles from=%v to=%v", user.Id, previousRole, user.Roles)
|
||||||
|
}
|
||||||
|
|
||||||
uniqueEmails[user.Email] = true
|
uniqueEmails[user.Email] = true
|
||||||
uniqueUsernames[user.Username] = true
|
uniqueUsernames[user.Username] = true
|
||||||
|
|
||||||
|
|||||||
@@ -394,11 +394,15 @@ export function newLocalizationSelected(locale) {
|
|||||||
} else {
|
} else {
|
||||||
Client.getTranslations(
|
Client.getTranslations(
|
||||||
I18n.getLanguageInfo(locale).url,
|
I18n.getLanguageInfo(locale).url,
|
||||||
(data) => {
|
(data, res) => {
|
||||||
|
let translations = data;
|
||||||
|
if (!data && res.text) {
|
||||||
|
translations = JSON.parse(res.text);
|
||||||
|
}
|
||||||
AppDispatcher.handleServerAction({
|
AppDispatcher.handleServerAction({
|
||||||
type: ActionTypes.RECEIVED_LOCALE,
|
type: ActionTypes.RECEIVED_LOCALE,
|
||||||
locale,
|
locale,
|
||||||
translations: data
|
translations
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
@@ -411,6 +415,12 @@ export function newLocalizationSelected(locale) {
|
|||||||
export function loadBrowserLocale() {
|
export function loadBrowserLocale() {
|
||||||
let locale = (navigator.languages && navigator.languages.length > 0 ? navigator.languages[0] :
|
let locale = (navigator.languages && navigator.languages.length > 0 ? navigator.languages[0] :
|
||||||
(navigator.language || navigator.userLanguage)).split('-')[0];
|
(navigator.language || navigator.userLanguage)).split('-')[0];
|
||||||
|
|
||||||
|
const user = UserStore.getCurrentUser();
|
||||||
|
if (user) {
|
||||||
|
locale = user.locale || locale;
|
||||||
|
}
|
||||||
|
|
||||||
if (!I18n.getLanguages()[locale]) {
|
if (!I18n.getLanguages()[locale]) {
|
||||||
locale = 'en';
|
locale = 'en';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ export default class LoginController extends React.Component {
|
|||||||
finishSignin() {
|
finishSignin() {
|
||||||
GlobalActions.emitInitialLoad(
|
GlobalActions.emitInitialLoad(
|
||||||
() => {
|
() => {
|
||||||
|
GlobalActions.loadBrowserLocale();
|
||||||
browserHistory.push('/select_team');
|
browserHistory.push('/select_team');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -26,6 +26,19 @@ export default class Root extends React.Component {
|
|||||||
|
|
||||||
this.localizationChanged = this.localizationChanged.bind(this);
|
this.localizationChanged = this.localizationChanged.bind(this);
|
||||||
this.redirectIfNecessary = this.redirectIfNecessary.bind(this);
|
this.redirectIfNecessary = this.redirectIfNecessary.bind(this);
|
||||||
|
|
||||||
|
// Ya....
|
||||||
|
/*eslint-disable */
|
||||||
|
if (window.mm_config.SegmentDeveloperKey != null && window.mm_config.SegmentDeveloperKey !== "") {
|
||||||
|
!function(){var analytics=global.window.analytics=global.window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.0.1";
|
||||||
|
analytics.load(window.mm_config.SegmentDeveloperKey);
|
||||||
|
analytics.page();
|
||||||
|
}}();
|
||||||
|
}
|
||||||
|
/*eslint-enable */
|
||||||
|
|
||||||
|
// Fastclick
|
||||||
|
FastClick.attach(document.body);
|
||||||
}
|
}
|
||||||
localizationChanged() {
|
localizationChanged() {
|
||||||
this.setState({locale: LocalizationStore.getLocale(), translations: LocalizationStore.getTranslations()});
|
this.setState({locale: LocalizationStore.getLocale(), translations: LocalizationStore.getTranslations()});
|
||||||
@@ -46,27 +59,15 @@ export default class Root extends React.Component {
|
|||||||
this.redirectIfNecessary(newProps);
|
this.redirectIfNecessary(newProps);
|
||||||
}
|
}
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
|
// Redirect if Necessary
|
||||||
|
this.redirectIfNecessary(this.props);
|
||||||
|
}
|
||||||
|
componentDidMount() {
|
||||||
// Setup localization listener
|
// Setup localization listener
|
||||||
LocalizationStore.addChangeListener(this.localizationChanged);
|
LocalizationStore.addChangeListener(this.localizationChanged);
|
||||||
|
|
||||||
// Ya....
|
|
||||||
/*eslint-disable */
|
|
||||||
if (window.mm_config.SegmentDeveloperKey != null && window.mm_config.SegmentDeveloperKey !== "") {
|
|
||||||
!function(){var analytics=global.window.analytics=global.window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.0.1";
|
|
||||||
analytics.load(window.mm_config.SegmentDeveloperKey);
|
|
||||||
analytics.page();
|
|
||||||
}}();
|
|
||||||
}
|
|
||||||
/*eslint-enable */
|
|
||||||
|
|
||||||
// Fastclick
|
|
||||||
FastClick.attach(document.body);
|
|
||||||
|
|
||||||
// Get our localizaiton
|
// Get our localizaiton
|
||||||
GlobalActions.loadBrowserLocale();
|
GlobalActions.loadBrowserLocale();
|
||||||
|
|
||||||
// Redirect if Necessary
|
|
||||||
this.redirectIfNecessary(this.props);
|
|
||||||
}
|
}
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
LocalizationStore.removeChangeListener(this.localizationChanged);
|
LocalizationStore.removeChangeListener(this.localizationChanged);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user