Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom status expiry (mattermost#8059)
* Made the UI for expiry Made expiry menu component with all the expiry items Made the dateTimeInput component with the react-day-picker along with customized navbar Removed the memoization from the getCustomStatus selector Solved the propType issue in the menuItemToggleModalRedux * Review fixes and added timepicker menu Changed the custom status selector to a simple function and changed its use everywhere Made constants for the expiry menu items and used them Changed the expiry menu items to use localized text Removed the daypicker.scss file and did the changes in _daypicker.scss file Added all the localization ids in en.json * Completed the timepicker menu Made a util for getting current date and time for timezone Made the function to round current time to nearest 30 min time Made the function to fill the menu with 30 minute intervals Unified the separate state variables for day and time to only time Made the dateTimeInput component to be controlled by the custom status modal Fixed the styles for the timepicker and daypicker Fixed lint errors and type check errors * Fixed some issues in daypicker Fixed the styling in daypicker Added logic for disabled days in daypicker Fixed the issue of prevMonth button not working in daypicker * Complete expiry support in custom status modal Changed the custom status type to include duration and expires_at and made enum duration Removed the duration constants from constants file and used enum type everywhere Added localization in the expiry menu values Modified custom status modal to send expiry with the custom status Modified custom status modal to handle initial custom expiry time Modified the disable set status variable to handle the confirm button disability Modified the custom status selector to return custom status only when it's not expired * Review fixes Code refactoring in custom status modal and dateTime input and expiry menu * Changed name of enum Duration to CustomStatusDuration * MI-1235 * Added expiry support in custom status suggestions Made durationValues constant to store all duration values with localization ids and default messages Modified expiry_menu to use durationValues constant Modified custom status suggestion component to handle duration of status Added duration in default custom status suggestions Fixed the calculateExpiryTime function to take right currentTime Modified handle and clear suggestion functions to include expiry * Display expiry time in custom status emoji tooltip Made relative range for tomorrow Fixed styling for the expiry in suggestions Added the logic for showing expiry time in custom status emoji component * Completed showing expiry time in several places Made custom status util for displaying expiry time Made getCurrentUserTimezone memoized selector Refactored custom status emoji and modal to use getCurrentUserTimezone selector Fixed the custom status modal UI accordingg to the comments on community Added expiry time in status dropdown and profile popover * Review fixes Memoized displayExpiryTime in custom status emoji component * Added memoization in expiry time in some places Added memoization in status dropdown and profile popover Added logic to show tooltip in custom status emoji in channel header Refactored some code in custom status emoji and custom status selector Added timezone dependent current time in custom status selector * Added unit tests and several fixes Sorted the order of imports in several files Made unit tests for date_time_input and expiry_menu components Updated some snapshots * Fixed custom status emoji unit tests * Fix types * Refactored some code Converted displayExpiryTime util to a separate functional component Replaced use of util with component everywhere Fixed styling of date time input Refactored disabling set status button in custom status modal * Fixed styles in status dropdown menu * Fixed types and added some unit tests Fixed type in custom status emoji tests Added unit tests in status dropdown and profile popover Updated snapshots * Code refactoring and localization ids change Added localization in Until and changed ids of all expiry dropdown options Modified ExpiryTime component to accept classname and wihinBrackets prop Fixed disableSetStatus bug in custom status modal Fixed styling of expiry time everywhere Modified status dropdown, profile_popover and custom status emoji according to new ExpiryTime component * Updated snapshots * Changed default custom status duration to Today * Fixed i18n-check failing test * Fixed failing unit and e2e tests Refactoed getCustomStatus selector * Added functionality to handle suggestions without duration * Review UI fixes Added font-weight and opacity in expiry value in clear after dropdown Fixed the styling for clear button in the custom status input Fixed the padding for the custom status modal and adjusted all components inside it Changed the opacity for duration in the suggestions Changed the styling for date and time input titles Changed the size of the daypicker Changed the date and time icons from font-awesome to compass icons * Trigger server creation * Fixed the timezone issue in date time input * WIP: Fixing timezone issues for custom status expiry * Fixed the timezone issue in the custom status modal and date/time input Made util for getCurrentMomentForTimezone Changed type for customExpiryTime from Date to Moment Fixed getRoundedTime and getTimeInIntervals functions and date/time inputs * Changed value of DONT_CLEAR key of CustomStatusDuration enum * Changed behavior of Clear after component and showing date/time component and review fixes (mattermost#57) * WIP : Fixing the flow for the custom date time if status already set * Changed display value of Clear after value and review fixes Added prop showPrefix in expiry_time component Changed the behaviour of timestamp in the expiry_time Moved custom status constants from constants.jsx to custom_status_modal and date_time_input Changed the display value in Clear after component if custom status set with custom date/time by adding additional value in CustomStatusDuration enum Changed the logic of disabling Set Status button and showing/hiding suggestions Fixed the failing unit tests of expiry_menu and date_time_input Added localization in date_time_input using useIntl instead of localizeMessage Added showing expiryTime feature in expiry menu component * Review fixes with some optimization Memoized the getCustomStatus selector and made a new selector isCustomStatusExpired for the expiry Changed the use of getCustomStatus selector in all places Added the use of isCustomStatusExpired selector in custom_status_emoji, custom_status_modal, status_dropdown, profile_popover, channel_header components Memoized the time options in the date/time input container by memoizing the handleTimeChange function Memoized the menu items in expiry menu by keeping them in state and only modifying in componentDidMount Changed the type of timestampProps and added logic for showing time for tomorrow in expiry_time component Fixed the memoization in the getCurrentUserTimezone selector by creating getTimezoneForUserProfile function * Added/Updated unit tests and fixed type check errors Changed the format of expiry time for periods longer than 6 days Fixed the styling of custom status in status dropdown and daypicker in custom status modal * Complete e2e tests (mattermost#58) * Merge branch 'master' of github.com:mattermost/mattermost-webapp into custom-status-expiry Resolved conflicts, updated snapshots and fixed type check errors * WIP : MM-T4063 e2e test for the custom status expiry * Complete e2e tests for expiry Modified and completed MM-T4063 test Completed MM-T4064, MM-T4065, MM-T4066 e2e tests * Updated snapshot * Updated custom_status_emoji to pass the tests * Fixed suggestion without duration bug in the custom status modal * Code refactoring and some bug fixes * Updated snapshots * UI review fixes (mattermost#61) Changed the text for Date and time to Custom Date and Time Removed duration from the suggestions if duration is Don't clear Changed the width of the suggestions dynamically based on the presence of duration Added a unit test for the suggestion and updated the existing snapshot * Resolved conflicts and updated snapshots * Apply suggestions from code review Co-authored-by: Guillermo Vayá <guivaya@gmail.com> * Added feature to show year in expiry time if expiry time is after the current year * Review fixes (mattermost#62) * Review fixes Fixed the memoization issue for multiple instances of class components by converting mapStateToProps to makeMapStateToProps Memoized the handleTimeChange function in the menu items of time picker by binding the function * Fixed memoization of makeGetCustomStatus in functional components Fixed memoization in custom_status_emoji, modal and post_header_custom_status components * Refactored some code * Fixed type check errors Co-authored-by: Chetanya Kandhari <chetanya.kandhari@brightscout.com> Co-authored-by: Guillermo Vayá <guivaya@gmail.com>
- Loading branch information