[CLD-6430] Remove telemetry check from true_up_review (#26073)
* Remove telemetry check from true_up_review * Fix bug * Fix linter * fix tests
Этот коммит содержится в:
@@ -25,7 +25,7 @@ describe('TrueUpReview', () => {
|
||||
IsLicensed: 'true',
|
||||
}),
|
||||
config: {
|
||||
EnableDiagnostics: 'false',
|
||||
EnableDiagnostics: 'true',
|
||||
},
|
||||
},
|
||||
users: {
|
||||
@@ -55,13 +55,31 @@ describe('TrueUpReview', () => {
|
||||
},
|
||||
|
||||
};
|
||||
it('regular self hosted license in the true up window sees content', () => {
|
||||
|
||||
it('regular self hosted license (NOT air-gapped) in the true up window sees content', () => {
|
||||
jest.spyOn(useCWSAvailabilityCheckAll, 'default').mockImplementation(() => useCWSAvailabilityCheckAll.CSWAvailabilityCheckTypes.Available);
|
||||
|
||||
renderWithContext(<TrueUpReview/>, showsTrueUpReviewState);
|
||||
screen.getByText('Share to Mattermost');
|
||||
});
|
||||
|
||||
it('regular self hosted license thats air gapped sees download button only', () => {
|
||||
jest.spyOn(useCWSAvailabilityCheckAll, 'default').mockImplementation(() => useCWSAvailabilityCheckAll.CSWAvailabilityCheckTypes.Unavailable);
|
||||
|
||||
renderWithContext(<TrueUpReview/>, showsTrueUpReviewState);
|
||||
screen.getByText('Download Data');
|
||||
expect(screen.queryByText('Share to Mattermost')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('displays the panel regardless of the config value for EnableDiagnostic', () => {
|
||||
const store = JSON.parse(JSON.stringify(showsTrueUpReviewState));
|
||||
store.entities.general.config.EnableDiagnostics = 'false';
|
||||
jest.spyOn(useCWSAvailabilityCheckAll, 'default').mockImplementation(() => useCWSAvailabilityCheckAll.CSWAvailabilityCheckTypes.Available);
|
||||
|
||||
renderWithContext(<TrueUpReview/>, store);
|
||||
screen.getByText('Share to Mattermost');
|
||||
});
|
||||
|
||||
it('gov sku self-hosted license does not see true up content', () => {
|
||||
const store = JSON.parse(JSON.stringify(showsTrueUpReviewState));
|
||||
store.entities.general.license.IsGovSku = 'true';
|
||||
|
||||
@@ -10,7 +10,7 @@ import {useDispatch, useSelector} from 'react-redux';
|
||||
import type {GlobalState} from '@mattermost/types/store';
|
||||
|
||||
import {isCurrentLicenseCloud} from 'mattermost-redux/selectors/entities/cloud';
|
||||
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
|
||||
import {getLicense} from 'mattermost-redux/selectors/entities/general';
|
||||
import {
|
||||
getSelfHostedErrors,
|
||||
getTrueUpReviewProfile as trueUpReviewProfileSelector,
|
||||
@@ -50,7 +50,6 @@ const TrueUpReview: React.FC = () => {
|
||||
// * are not on starter/free
|
||||
// * are not a government sku
|
||||
const licenseIsTrueUpEligible = isLicensed && !isCloud && !isStarter && !isGovSku;
|
||||
const telemetryEnabled = useSelector(getConfig).EnableDiagnostics === 'true';
|
||||
const trueUpReviewError = useSelector((state: GlobalState) => {
|
||||
const errors = getSelfHostedErrors(state);
|
||||
return Boolean(errors.trueUpReview);
|
||||
@@ -70,7 +69,7 @@ const TrueUpReview: React.FC = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reviewProfile.getRequestState === 'OK' && isAirGapped && !trueUpReviewError && reviewProfile.content.length > 0) {
|
||||
if (reviewProfile.getRequestState === 'OK' && !reviewStatus.complete && isAirGapped && !trueUpReviewError && reviewProfile.content.length > 0) {
|
||||
// Create the bundle as a blob containing base64 encoded json data and assign it to a link element.
|
||||
const blob = new Blob([reviewProfile.content], {type: 'application/text'});
|
||||
const href = URL.createObjectURL(blob);
|
||||
@@ -85,6 +84,7 @@ const TrueUpReview: React.FC = () => {
|
||||
// Remove link and revoke object url to avoid memory leaks.
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(href);
|
||||
dispatch(getTrueUpReviewStatus());
|
||||
}
|
||||
}, [isAirGapped, reviewProfile, reviewProfile.getRequestState, trueUpReviewError]);
|
||||
|
||||
@@ -221,10 +221,6 @@ const TrueUpReview: React.FC = () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (telemetryEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
pageVisited(TELEMETRY_CATEGORIES.TRUE_UP_REVIEW, 'pageview_true_up_review');
|
||||
|
||||
return (
|
||||
|
||||
Ссылка в новой задаче
Block a user