Set post list data and timestamp based on the user timezone if available (#2888)
This commit is contained in:
parent
056d5a91b7
commit
6546dfdfd2
11 changed files with 16 additions and 22 deletions
|
|
@ -7,12 +7,13 @@ import {getSessions} from 'mattermost-redux/actions/users';
|
|||
import {autoUpdateTimezone} from 'mattermost-redux/actions/timezone';
|
||||
import {Client4} from 'mattermost-redux/client';
|
||||
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
|
||||
import {isTimezoneEnabled} from 'mattermost-redux/selectors/entities/timezone';
|
||||
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||
|
||||
import {ViewTypes} from 'app/constants';
|
||||
import {app} from 'app/mattermost';
|
||||
import PushNotifications from 'app/push_notifications';
|
||||
import {getDeviceTimezone, isTimezoneEnabled} from 'app/utils/timezone';
|
||||
import {getDeviceTimezone} from 'app/utils/timezone';
|
||||
import {setCSRFFromCookie} from 'app/utils/security';
|
||||
|
||||
export function handleLoginIdChanged(loginId) {
|
||||
|
|
|
|||
|
|
@ -29,11 +29,8 @@ export default class FormattedTime extends React.PureComponent {
|
|||
} = this.props;
|
||||
|
||||
if (timeZone) {
|
||||
return intl.formatDate(moment.tz(value, timeZone).toDate(), {
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
hour12,
|
||||
});
|
||||
const format = hour12 ? 'hh:mm A' : 'HH:mm';
|
||||
return moment.tz(value, timeZone).format(format);
|
||||
}
|
||||
|
||||
// If no timezone is defined fallback to the previous implementation
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {connect} from 'react-redux';
|
|||
import {Preferences} from 'mattermost-redux/constants';
|
||||
import {makeGetCommentCountForPost} from 'mattermost-redux/selectors/entities/posts';
|
||||
import {getBool, getTeammateNameDisplaySetting, getTheme} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {isTimezoneEnabled} from 'mattermost-redux/selectors/entities/timezone';
|
||||
import {getUser, getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||
import {isPostPendingOrFailed, isSystemMessage} from 'mattermost-redux/utils/post_utils';
|
||||
import {getUserCurrentTimezone} from 'mattermost-redux/utils/timezone_utils';
|
||||
|
|
@ -13,7 +14,6 @@ import {displayUsername} from 'mattermost-redux/utils/user_utils';
|
|||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||
|
||||
import {fromAutoResponder} from 'app/utils/general';
|
||||
import {isTimezoneEnabled} from 'app/utils/timezone';
|
||||
|
||||
import PostHeader from './post_header';
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,9 @@ import {connect} from 'react-redux';
|
|||
|
||||
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {isTimezoneEnabled} from 'mattermost-redux/selectors/entities/timezone';
|
||||
import {getUserCurrentTimezone} from 'mattermost-redux/utils/timezone_utils';
|
||||
|
||||
import {isTimezoneEnabled} from 'app/utils/timezone';
|
||||
|
||||
import DateHeader from './date_header';
|
||||
|
||||
function mapStateToProps(state) {
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ import {connect} from 'react-redux';
|
|||
import {setDeviceToken} from 'mattermost-redux/actions/general';
|
||||
import {autoUpdateTimezone} from 'mattermost-redux/actions/timezone';
|
||||
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {isTimezoneEnabled} from 'mattermost-redux/selectors/entities/timezone';
|
||||
|
||||
import {isLandscape} from 'app/selectors/device';
|
||||
import {getDeviceTimezone, isTimezoneEnabled} from 'app/utils/timezone';
|
||||
import {getDeviceTimezone} from 'app/utils/timezone';
|
||||
|
||||
const lazyLoadEntry = () => {
|
||||
return require('./entry').default;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {clearSearch, removeSearchTerms, searchPostsWithParams, getMorePostsForSe
|
|||
import {getCurrentChannelId, filterPostIds} from 'mattermost-redux/selectors/entities/channels';
|
||||
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
||||
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {isTimezoneEnabled} from 'mattermost-redux/selectors/entities/timezone';
|
||||
import {isMinimumServerVersion} from 'mattermost-redux/utils/helpers';
|
||||
import {getUserCurrentTimezone} from 'mattermost-redux/utils/timezone_utils';
|
||||
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||
|
|
@ -17,7 +18,7 @@ import {loadChannelsByTeamName, loadThreadIfNecessary} from 'app/actions/views/c
|
|||
import {isLandscape} from 'app/selectors/device';
|
||||
import {makePreparePostIdsForSearchPosts} from 'app/selectors/post_list';
|
||||
import {handleSearchDraftChanged} from 'app/actions/views/search';
|
||||
import {getDeviceUtcOffset, getUtcOffsetForTimeZone, isTimezoneEnabled} from 'app/utils/timezone';
|
||||
import {getDeviceUtcOffset, getUtcOffsetForTimeZone} from 'app/utils/timezone';
|
||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||
|
||||
import Search from './search';
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
import {connect} from 'react-redux';
|
||||
|
||||
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {isTimezoneEnabled} from 'mattermost-redux/selectors/entities/timezone';
|
||||
|
||||
import {isTimezoneEnabled} from 'app/utils/timezone';
|
||||
import {isThemeSwitchingEnabled} from 'app/utils/theme';
|
||||
|
||||
import DisplaySettings from './display_settings';
|
||||
|
|
|
|||
|
|
@ -7,15 +7,14 @@ import {connect} from 'react-redux';
|
|||
import {setChannelDisplayName} from 'app/actions/views/channel';
|
||||
import {makeDirectChannel} from 'app/actions/views/more_dms';
|
||||
|
||||
import {getTeammateNameDisplaySetting, getTheme, getBool} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||
import {getTeammateNameDisplaySetting, getTheme, getBool} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {isTimezoneEnabled} from 'mattermost-redux/selectors/entities/timezone';
|
||||
import Preferences from 'mattermost-redux/constants/preferences';
|
||||
import {loadBot} from 'mattermost-redux/actions/bots';
|
||||
import {getBotAccounts} from 'mattermost-redux/selectors/entities/bots';
|
||||
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||
|
||||
import {isTimezoneEnabled} from 'app/utils/timezone';
|
||||
|
||||
import UserProfile from './user_profile';
|
||||
|
||||
function mapStateToProps(state, ownProps) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,3 @@ export function getUtcOffsetForTimeZone(timezone) {
|
|||
return moment.tz(timezone).utcOffset();
|
||||
}
|
||||
|
||||
export function isTimezoneEnabled(state) {
|
||||
const {config} = state.entities.general;
|
||||
return config.ExperimentalTimezone === 'true';
|
||||
}
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -13134,8 +13134,8 @@
|
|||
"integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A=="
|
||||
},
|
||||
"mattermost-redux": {
|
||||
"version": "github:mattermost/mattermost-redux#be6bbb1d4d131c2aabd1fcda2a077c4402923ea3",
|
||||
"from": "github:mattermost/mattermost-redux#be6bbb1d4d131c2aabd1fcda2a077c4402923ea3",
|
||||
"version": "github:mattermost/mattermost-redux#40cecab5d74708d651460515b24115fd75fb334e",
|
||||
"from": "github:mattermost/mattermost-redux#40cecab5d74708d651460515b24115fd75fb334e",
|
||||
"requires": {
|
||||
"deep-equal": "1.0.1",
|
||||
"eslint-plugin-header": "3.0.0",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
"intl": "1.2.5",
|
||||
"jail-monkey": "2.2.0",
|
||||
"jsc-android": "241213.1.0",
|
||||
"mattermost-redux": "github:mattermost/mattermost-redux#be6bbb1d4d131c2aabd1fcda2a077c4402923ea3",
|
||||
"mattermost-redux": "github:mattermost/mattermost-redux#40cecab5d74708d651460515b24115fd75fb334e",
|
||||
"mime-db": "1.40.0",
|
||||
"moment-timezone": "0.5.25",
|
||||
"prop-types": "15.7.2",
|
||||
|
|
|
|||
Loading…
Reference in a new issue