This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add timezone support Support timezone settings Add automatic timezone update feature newTimezone may be undefined Add timezone suggestion provider Remove unused variables update timezone from /user endpoint Refactor autoUpdateTimezone logic Display Timezones when in focus Remove unused variables/functions Remove preference_store changes completely Move autoUpdateTimezone logic to LoggedIn component Update snapshots for timezone in display settings Add timezone support for profile_popover and post_time components Add EnableTimezoneSelection config to UI related to Timezone feature Remove .window from global.window.mm_config Check if user timezone is null Parse SupportedTimezones from mm_config Update jest snapshots Add trailing commas Refactor global.mm_config to redux config Updated jest snapshots Add timezone support from redux Disable timezone input if timezones array is zero Move getCurrentTimezone and getTimezoneRegion to redux Move autoUpdateTimezone to redux Move getUserCurrentTimezone to redux selector Remove getTimezone from UserStore Refactor local dateTime into a component Minor fixes Fix failing test Include moment-timezone for timezone support Remove enableTimezone props Remove EnableTimezoneSelection flag Specify user timezone in LocalDateTime Add FormatTime from react-intl in LocalDateTime Move styles for timezone container in scss Remove useMilitaryTime props from components that use <PostTime Fix snapshot test Add minimum server support for the timezone feature Fix snapshot test for timezone settings Fix typo in user_settings/display/index.js Remove minimum server version check * Fix test for user_settings_display * Fix snapshot test for timezone settings * Add ExperimentalTimezone flag * Add fixed snapshot tests * Updating spacing and margin for timezones * Add last request for timezone feature * autoUpdate for new users and update in settings if user timezone is not set * Ensure automaticTImezone is properly not se
- Loading branch information
Showing
37 changed files
with
908 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. | ||
// See License.txt for license information. | ||
|
||
import {connect} from 'react-redux'; | ||
|
||
import {getConfig} from 'mattermost-redux/selectors/entities/general'; | ||
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; | ||
import {getUserTimezone} from 'mattermost-redux/selectors/entities/timezone'; | ||
import {getUserCurrentTimezone} from 'mattermost-redux/utils/timezone_utils'; | ||
import {getBool} from 'mattermost-redux/selectors/entities/preferences'; | ||
|
||
import {Preferences} from 'utils/constants.jsx'; | ||
|
||
import LocalDateTime from './local_date_time'; | ||
|
||
function mapStateToProps(state, props) { | ||
const config = getConfig(state); | ||
const currentUserId = getCurrentUserId(state); | ||
|
||
let userTimezone; | ||
if (props.userTimezone) { | ||
userTimezone = props.userTimezone; | ||
} else { | ||
userTimezone = getUserTimezone(state, currentUserId); | ||
} | ||
|
||
return { | ||
enableTimezone: config.ExperimentalTimezone === 'true', | ||
useMilitaryTime: getBool(state, Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.USE_MILITARY_TIME, false), | ||
timeZone: getUserCurrentTimezone(userTimezone), | ||
}; | ||
} | ||
|
||
export default connect(mapStateToProps)(LocalDateTime); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See License.txt for license information. | ||
|
||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import {FormattedTime} from 'react-intl'; | ||
|
||
export default class LocalDateTime extends React.PureComponent { | ||
static propTypes = { | ||
|
||
/* | ||
* The time to display | ||
*/ | ||
eventTime: PropTypes.number, | ||
|
||
/* | ||
* Set to display using 24 hour format | ||
*/ | ||
useMilitaryTime: PropTypes.bool, | ||
|
||
/* | ||
* Current timezone of the user | ||
*/ | ||
timeZone: PropTypes.string, | ||
|
||
/* | ||
* Enable timezone feature | ||
*/ | ||
enableTimezone: PropTypes.bool, | ||
}; | ||
|
||
render() { | ||
const { | ||
enableTimezone, | ||
eventTime, | ||
timeZone, | ||
useMilitaryTime, | ||
} = this.props; | ||
|
||
const date = eventTime ? new Date(eventTime) : new Date(); | ||
|
||
const timezoneProps = enableTimezone && timeZone ? {timeZone} : {}; | ||
|
||
return ( | ||
<time | ||
className='post__time' | ||
dateTime={date.toISOString()} | ||
title={date} | ||
> | ||
<FormattedTime | ||
{...timezoneProps} | ||
hour12={!useMilitaryTime} | ||
value={date} | ||
/> | ||
</time> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.