Various improvements to preferences code (#27710)
* Add isPostFlagged selector * Remove unused code for actions_menu preferences * Improve types of Preference and getPreference * MM-58111 Change makeGetCategory to take category name once * Use shouldShowJoinLeaveMessages everywhere * Change makeGetCategory to better memoize its result * Fix test that needs EnableJoinLeaveMessageByDefault to be set * Remove more references to action_menu preferences
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
28939d84da
Коммит
6956923b6a
12
e2e-tests/cypress/tests/support/api/preference.d.ts
поставляемый
12
e2e-tests/cypress/tests/support/api/preference.d.ts
поставляемый
@@ -126,18 +126,6 @@ declare namespace Cypress {
|
||||
*/
|
||||
apiSaveCloudTrialBannerPreference(userId: string, name: string, value: string): Chainable<Response>;
|
||||
|
||||
/**
|
||||
* Save actions menu preference.
|
||||
* See https://api.mattermost.com/#tag/preferences/paths/~1users~1{user_id}~1preferences/put
|
||||
* @param {string} userId - User ID
|
||||
* @param {string} value - true (default) or false
|
||||
* @returns {Response} response: Cypress-chainable response which should have successful HTTP status of 200 OK to continue or pass.
|
||||
*
|
||||
* @example
|
||||
* cy.apiSaveActionsMenuPreference('user-id', true);
|
||||
*/
|
||||
apiSaveActionsMenuPreference(userId: string, value: boolean): Chainable<Response>;
|
||||
|
||||
/**
|
||||
* Save show trial modal.
|
||||
* See https://api.mattermost.com/#tag/preferences/paths/~1users~1{user_id}~1preferences/put
|
||||
|
||||
@@ -256,17 +256,6 @@ Cypress.Commands.add('apiSaveCloudTrialBannerPreference', (userId, name, value)
|
||||
return cy.apiSaveUserPreference([preference], userId);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('apiSaveActionsMenuPreference', (userId, value = true) => {
|
||||
const preference = {
|
||||
user_id: userId,
|
||||
category: 'actions_menu',
|
||||
name: 'actions_menu_tutorial_state',
|
||||
value: JSON.stringify({actions_menu_modal_viewed: value}),
|
||||
};
|
||||
|
||||
return cy.apiSaveUserPreference([preference], userId);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('apiSaveStartTrialModal', (userId, value = 'true') => {
|
||||
const preference = {
|
||||
user_id: userId,
|
||||
@@ -402,12 +391,6 @@ Cypress.Commands.add('apiDisableTutorials', (userId) => {
|
||||
name: userId,
|
||||
value: '999',
|
||||
},
|
||||
{
|
||||
user_id: userId,
|
||||
category: 'actions_menu',
|
||||
name: 'actions_menu_tutorial_state',
|
||||
value: '{"actions_menu_modal_viewed":true}',
|
||||
},
|
||||
{
|
||||
user_id: userId,
|
||||
category: 'drafts',
|
||||
|
||||
@@ -234,7 +234,6 @@ Cypress.Commands.add('apiCreateUser', ({
|
||||
prefix = 'user',
|
||||
createAt = 0,
|
||||
bypassTutorial = true,
|
||||
hideActionsMenu = true,
|
||||
hideOnboarding = true,
|
||||
bypassWhatsNewModal = true,
|
||||
user = null,
|
||||
@@ -265,10 +264,6 @@ Cypress.Commands.add('apiCreateUser', ({
|
||||
cy.apiDisableTutorials(createdUser.id);
|
||||
}
|
||||
|
||||
if (hideActionsMenu) {
|
||||
cy.apiSaveActionsMenuPreference(createdUser.id, true);
|
||||
}
|
||||
|
||||
if (hideOnboarding) {
|
||||
cy.apiSaveOnboardingPreference(createdUser.id, 'hide', 'true');
|
||||
cy.apiSaveOnboardingPreference(createdUser.id, 'skip', 'true');
|
||||
|
||||
@@ -261,7 +261,6 @@ function resetUserPreference(userId) {
|
||||
cy.apiSaveOnboardingTaskListPreference(userId, 'onboarding_task_list_open', 'false');
|
||||
cy.apiSaveOnboardingTaskListPreference(userId, 'onboarding_task_list_show', 'false');
|
||||
cy.apiSaveCloudTrialBannerPreference(userId, 'trial', 'max_days_banner');
|
||||
cy.apiSaveActionsMenuPreference(userId);
|
||||
cy.apiSaveSkipStepsPreference(userId, 'true');
|
||||
cy.apiSaveStartTrialModal(userId, 'true');
|
||||
cy.apiSaveUnreadScrollPositionPreference(userId, 'start_from_left_off');
|
||||
|
||||
Ссылка в новой задаче
Block a user