Remove Global Drafts Feature Flag (#23767)

* Remove global draft feature flag

* More removal - in progress

* Removed the rest in webapp

* Removed the rest in webapp

* Fix tests

* Update feature_flags.go

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Maria A Nunez
2023-07-05 12:18:30 -04:00
коммит произвёл GitHub
родитель bf0e0ed45a
Коммит 5779bd49d5
15 изменённых файлов: 14 добавлений и 77 удалений

Просмотреть файл

@@ -13,7 +13,6 @@ jest.mock('selectors/drafts', () => ({
jest.mock('mattermost-redux/selectors/entities/preferences', () => ({
insightsAreEnabled: jest.fn(),
isCollapsedThreadsEnabled: jest.fn(),
localDraftsAreEnabled: jest.fn(),
}));
beforeEach(() => {
@@ -58,7 +57,6 @@ describe('Selectors.Lhs', () => {
it('handles nothing enabled', () => {
jest.spyOn(PreferencesSelectors, 'insightsAreEnabled').mockImplementationOnce(() => false);
jest.spyOn(PreferencesSelectors, 'isCollapsedThreadsEnabled').mockImplementationOnce(() => false);
jest.spyOn(PreferencesSelectors, 'localDraftsAreEnabled').mockImplementationOnce(() => false);
jest.spyOn(Lhs, 'getDraftsCount').mockImplementationOnce(() => 0);
const items = Lhs.getVisibleStaticPages(state as GlobalState);
expect(items).toEqual([]);
@@ -67,7 +65,6 @@ describe('Selectors.Lhs', () => {
it('handles insights', () => {
jest.spyOn(PreferencesSelectors, 'insightsAreEnabled').mockImplementation(() => true);
jest.spyOn(PreferencesSelectors, 'isCollapsedThreadsEnabled').mockImplementation(() => false);
jest.spyOn(PreferencesSelectors, 'localDraftsAreEnabled').mockImplementation(() => false);
jest.spyOn(Lhs, 'getDraftsCount').mockImplementationOnce(() => 0);
const items = Lhs.getVisibleStaticPages(state as GlobalState);
expect(items).toEqual([
@@ -81,7 +78,6 @@ describe('Selectors.Lhs', () => {
it('handles threads - default off', () => {
jest.spyOn(PreferencesSelectors, 'insightsAreEnabled').mockImplementation(() => false);
jest.spyOn(PreferencesSelectors, 'isCollapsedThreadsEnabled').mockImplementation(() => true);
jest.spyOn(PreferencesSelectors, 'localDraftsAreEnabled').mockImplementation(() => false);
jest.spyOn(Lhs, 'getDraftsCount').mockImplementationOnce(() => 0);
const items = Lhs.getVisibleStaticPages(state as GlobalState);
expect(items).toEqual([
@@ -95,7 +91,6 @@ describe('Selectors.Lhs', () => {
it('should not return drafts when empty', () => {
jest.spyOn(PreferencesSelectors, 'insightsAreEnabled').mockImplementation(() => false);
jest.spyOn(PreferencesSelectors, 'isCollapsedThreadsEnabled').mockImplementation(() => false);
jest.spyOn(PreferencesSelectors, 'localDraftsAreEnabled').mockImplementation(() => true);
jest.spyOn(Lhs, 'getDraftsCount').mockImplementationOnce(() => 0);
const items = Lhs.getVisibleStaticPages(state as GlobalState);
expect(items).toEqual([]);
@@ -104,7 +99,6 @@ describe('Selectors.Lhs', () => {
it('should return drafts when there are available', () => {
jest.spyOn(PreferencesSelectors, 'insightsAreEnabled').mockImplementation(() => false);
jest.spyOn(PreferencesSelectors, 'isCollapsedThreadsEnabled').mockImplementation(() => false);
jest.spyOn(PreferencesSelectors, 'localDraftsAreEnabled').mockImplementation(() => true);
jest.spyOn(Lhs, 'getDraftsCount').mockImplementationOnce(() => 1);
const items = Lhs.getVisibleStaticPages(state as GlobalState);
expect(items).toEqual([

Просмотреть файл

@@ -9,7 +9,6 @@ import {makeGetDraftsCount} from 'selectors/drafts';
import {
insightsAreEnabled,
isCollapsedThreadsEnabled,
localDraftsAreEnabled,
} from 'mattermost-redux/selectors/entities/preferences';
export function getIsLhsOpen(state: GlobalState): boolean {
@@ -26,9 +25,8 @@ export const getVisibleStaticPages = createSelector(
'getVisibleSidebarStaticPages',
insightsAreEnabled,
isCollapsedThreadsEnabled,
localDraftsAreEnabled,
getDraftsCount,
(insightsEnabled, collapsedThreadsEnabled, localDraftsEnabled, draftsCount) => {
(insightsEnabled, collapsedThreadsEnabled, draftsCount) => {
const staticPages: StaticPage[] = [];
if (insightsEnabled) {
@@ -45,12 +43,10 @@ export const getVisibleStaticPages = createSelector(
});
}
if (localDraftsEnabled) {
staticPages.push({
id: 'drafts',
isVisible: draftsCount > 0,
});
}
staticPages.push({
id: 'drafts',
isVisible: draftsCount > 0,
});
return staticPages.filter((item) => item.isVisible);
},