MM-61947 Run DND expiry job more often and round expiry time to match interval (#29938)
* MM-61947 Run DND expiry job more often and round expiry time to match interval * Move comment to make it godoc-compatible * Change truncateDNDEndTime to work with seconds --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e8ef26196c
Коммит
3902d00d0f
@@ -21,7 +21,7 @@ import MenuWrapper from 'components/widgets/menu/menu_wrapper';
|
||||
|
||||
import Constants, {A11yCustomEventTypes, UserStatuses} from 'utils/constants';
|
||||
import type {A11yFocusEventDetail} from 'utils/constants';
|
||||
import {toUTCUnix} from 'utils/datetime';
|
||||
import {toUTCUnixInSeconds} from 'utils/datetime';
|
||||
import {isKeyPressed} from 'utils/keyboard';
|
||||
import {localizeMessage} from 'utils/utils';
|
||||
|
||||
@@ -126,9 +126,9 @@ export default class DndCustomTimePicker extends React.PureComponent<Props, Stat
|
||||
await this.props.actions.setStatus({
|
||||
user_id: this.props.userId,
|
||||
status: UserStatuses.DND,
|
||||
dnd_end_time: toUTCUnix(endTime),
|
||||
dnd_end_time: toUTCUnixInSeconds(endTime),
|
||||
manual: true,
|
||||
last_activity_at: toUTCUnix(this.props.currentDate),
|
||||
last_activity_at: toUTCUnixInSeconds(this.props.currentDate),
|
||||
});
|
||||
this.props.onExited();
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ import * as Menu from 'components/menu';
|
||||
import PostReminderCustomTimePicker from 'components/post_reminder_custom_time_picker_modal';
|
||||
|
||||
import {ModalIdentifiers} from 'utils/constants';
|
||||
import {toUTCUnix} from 'utils/datetime';
|
||||
import {toUTCUnixInSeconds} from 'utils/datetime';
|
||||
import {getCurrentMomentForTimezone} from 'utils/timezone';
|
||||
|
||||
type Props = {
|
||||
@@ -67,7 +67,7 @@ function PostReminderSubmenu(props: Props) {
|
||||
endTime = currentDate.add(1, 'day').set({hour: 9, minute: 0});
|
||||
}
|
||||
|
||||
dispatch(addPostReminder(props.userId, props.post.id, toUTCUnix(endTime.toDate())));
|
||||
dispatch(addPostReminder(props.userId, props.post.id, toUTCUnixInSeconds(endTime.toDate())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import {useIntl} from 'react-intl';
|
||||
import {getRoundedTime} from 'components/custom_status/date_time_input';
|
||||
import DateTimePickerModal from 'components/date_time_picker_modal/date_time_picker_modal';
|
||||
|
||||
import {toUTCUnix} from 'utils/datetime';
|
||||
import {toUTCUnixInSeconds} from 'utils/datetime';
|
||||
import {getCurrentMomentForTimezone} from 'utils/timezone';
|
||||
|
||||
import type {PropsFromRedux} from './index';
|
||||
@@ -31,7 +31,7 @@ function PostReminderCustomTimePicker({userId, timezone, onExited, postId, actio
|
||||
const initialReminderTime = getRoundedTime(currentTime);
|
||||
|
||||
const handleConfirm = useCallback((dateTime: Moment) => {
|
||||
actions.addPostReminder(userId, postId, toUTCUnix(dateTime.toDate()));
|
||||
actions.addPostReminder(userId, postId, toUTCUnixInSeconds(dateTime.toDate()));
|
||||
onExited();
|
||||
}, [actions, postId, userId, onExited]);
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ export function isYesterday(date: Date): boolean {
|
||||
return isSameDay(date, yesterday);
|
||||
}
|
||||
|
||||
export function toUTCUnix(date: Date): number {
|
||||
export function toUTCUnixInSeconds(date: Date): number {
|
||||
return Math.round(new Date(date.toISOString()).getTime() / 1000);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,11 @@ export type UserStatus = {
|
||||
manual?: boolean;
|
||||
last_activity_at?: number;
|
||||
active_channel?: string;
|
||||
|
||||
/**
|
||||
* The time when a user's timed DND status will expire. Unlike other timestamps in the app, this is in seconds
|
||||
* instead of milliseconds.
|
||||
*/
|
||||
dnd_end_time?: number;
|
||||
};
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user