Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 49183ea

Browse files
authoredFeb 22, 2025··
Protect: Remove "new" badge from Firewall tab (#41902)
1 parent 6389b56 commit 49183ea

File tree

7 files changed

+5
-113
lines changed

7 files changed

+5
-113
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: removed
3+
4+
Firewall: removed "new" badge from tab.

‎projects/plugins/protect/src/class-jetpack-protect.php

-19
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ public function initial_state() {
229229
'waf' => array(
230230
'wafSupported' => Waf_Runner::is_supported_environment(),
231231
'currentIp' => IP_Utils::get_ip(),
232-
'isSeen' => self::get_waf_seen_status(),
233232
'upgradeIsSeen' => self::get_waf_upgrade_seen_status(),
234233
'displayUpgradeBadge' => self::get_waf_upgrade_badge_display_status(),
235234
'isEnabled' => Waf_Runner::is_enabled(),
@@ -371,24 +370,6 @@ public static function jetpack_check_user_licenses( $has_license, $licenses, $pl
371370
return $license_found;
372371
}
373372

374-
/**
375-
* Get WAF "Seen" Status
376-
*
377-
* @return bool Whether the current user has viewed the WAF screen.
378-
*/
379-
public static function get_waf_seen_status() {
380-
return (bool) get_user_meta( get_current_user_id(), 'jetpack_protect_waf_seen', true );
381-
}
382-
383-
/**
384-
* Set WAF "Seen" Status
385-
*
386-
* @return bool True if seen status updated to true, false on failure.
387-
*/
388-
public static function set_waf_seen_status() {
389-
return (bool) update_user_meta( get_current_user_id(), 'jetpack_protect_waf_seen', true );
390-
}
391-
392373
/**
393374
* Get WAF Upgrade "Seen" Status
394375
*

‎projects/plugins/protect/src/class-rest-controller.php

-43
Original file line numberDiff line numberDiff line change
@@ -141,30 +141,6 @@ public static function register_rest_endpoints() {
141141
)
142142
);
143143

144-
register_rest_route(
145-
'jetpack-protect/v1',
146-
'waf-seen',
147-
array(
148-
'methods' => \WP_REST_Server::READABLE,
149-
'callback' => __CLASS__ . '::api_get_waf_seen_status',
150-
'permission_callback' => function () {
151-
return current_user_can( 'manage_options' );
152-
},
153-
)
154-
);
155-
156-
register_rest_route(
157-
'jetpack-protect/v1',
158-
'waf-seen',
159-
array(
160-
'methods' => \WP_REST_Server::EDITABLE,
161-
'callback' => __CLASS__ . '::api_set_waf_seen_status',
162-
'permission_callback' => function () {
163-
return current_user_can( 'manage_options' );
164-
},
165-
)
166-
);
167-
168144
register_rest_route(
169145
'jetpack-protect/v1',
170146
'waf-upgrade-seen',
@@ -384,7 +360,6 @@ public static function api_get_waf() {
384360
array(
385361
'wafSupported' => Waf_Runner::is_supported_environment(),
386362
'currentIp' => IP_Utils::get_ip(),
387-
'isSeen' => Jetpack_Protect::get_waf_seen_status(),
388363
'upgradeIsSeen' => Jetpack_Protect::get_waf_upgrade_seen_status(),
389364
'displayUpgradeBadge' => Jetpack_Protect::get_waf_upgrade_badge_display_status(),
390365
'isEnabled' => Waf_Runner::is_enabled(),
@@ -395,24 +370,6 @@ public static function api_get_waf() {
395370
);
396371
}
397372

398-
/**
399-
* Get WAF "Seen" status for the API endpoint
400-
*
401-
* @return bool Whether the current user has viewed the WAF screen.
402-
*/
403-
public static function api_get_waf_seen_status() {
404-
return Jetpack_Protect::get_waf_seen_status();
405-
}
406-
407-
/**
408-
* Set WAF "Seen" status for the API endpoint
409-
*
410-
* @return bool True if seen status updated to true, false on failure.
411-
*/
412-
public static function api_set_waf_seen_status() {
413-
return Jetpack_Protect::set_waf_seen_status();
414-
}
415-
416373
/**
417374
* Get WAF Upgrade "Seen" Status for the API endpoint
418375
*

‎projects/plugins/protect/src/js/components/admin-page/index.jsx

+1-13
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ import { useEffect } from 'react';
99
import { useNavigate } from 'react-router-dom';
1010
import useNotices from '../../hooks/use-notices';
1111
import useProtectData from '../../hooks/use-protect-data';
12-
import useWafData from '../../hooks/use-waf-data';
1312
import Notice from '../notice';
1413
import Tabs, { Tab } from '../tabs';
1514
import styles from './styles.module.scss';
1615

1716
const AdminPage = ( { children } ) => {
1817
const { notice } = useNotices();
1918
const { isRegistered } = useConnection();
20-
const { isSeen: wafSeen } = useWafData();
2119
const navigate = useNavigate();
2220
const {
2321
counts: {
@@ -58,17 +56,7 @@ const AdminPage = ( { children } ) => {
5856
</span>
5957
}
6058
/>
61-
<Tab
62-
link="/firewall"
63-
label={
64-
<>
65-
{ __( 'Firewall', 'jetpack-protect' ) }
66-
{ wafSeen === false && (
67-
<span className={ styles.badge }>{ __( 'New', 'jetpack-protect' ) }</span>
68-
) }
69-
</>
70-
}
71-
/>
59+
<Tab link="/firewall" label={ __( 'Firewall', 'jetpack-protect' ) } />
7260
</Tabs>
7361
</Container>
7462
{ children }

‎projects/plugins/protect/src/js/data/waf/use-waf-seen-mutation.ts

-21
This file was deleted.

‎projects/plugins/protect/src/js/routes/firewall/index.jsx

-14
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { useCallback, useEffect, useState, useMemo } from 'react';
1717
import AdminPage from '../../components/admin-page';
1818
import Textarea from '../../components/textarea';
1919
import { FREE_PLUGIN_SUPPORT_URL, PAID_PLUGIN_SUPPORT_URL } from '../../constants';
20-
import useWafSeenMutation from '../../data/waf/use-waf-seen-mutation';
2120
import useWafUpgradeSeenMutation from '../../data/waf/use-waf-upgrade-seen-mutation';
2221
import useAnalyticsTracks from '../../hooks/use-analytics-tracks';
2322
import usePlan from '../../hooks/use-plan';
@@ -43,7 +42,6 @@ const FirewallPage = () => {
4342
},
4443
currentIp,
4544
isEnabled: isWafModuleEnabled,
46-
isSeen,
4745
upgradeIsSeen,
4846
displayUpgradeBadge,
4947
wafSupported,
@@ -60,7 +58,6 @@ const FirewallPage = () => {
6058
const { hasPlan } = usePlan();
6159
const { upgradePlan } = usePlan( { redirectUrl: `${ ADMIN_URL }#/firewall` } );
6260
const { recordEvent } = useAnalyticsTracks();
63-
const wafSeenMutation = useWafSeenMutation();
6461
const wafUpgradeSeenMutation = useWafUpgradeSeenMutation();
6562
const { automaticRulesLastUpdated } = stats;
6663

@@ -212,17 +209,6 @@ const FirewallPage = () => {
212209
}
213210
}, [ jetpackWafIpBlockList, jetpackWafIpAllowList, isUpdating ] );
214211

215-
/**
216-
* "WAF Seen" useEffect()
217-
*/
218-
useEffect( () => {
219-
if ( isSeen ) {
220-
return;
221-
}
222-
223-
wafSeenMutation.mutate();
224-
}, [ isSeen, wafSeenMutation ] );
225-
226212
// Track view for Protect WAF page.
227213
useAnalyticsTracks( {
228214
pageViewEventName: 'protect_waf',

‎projects/plugins/protect/src/js/types/waf.ts

-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ export type WafStatus = {
1616
/** Whether the "waf" module is enabled. */
1717
isEnabled: boolean;
1818

19-
/** Whether the current user viewed the firewall UI. */
20-
isSeen: boolean;
21-
2219
/** Stats. */
2320
stats: boolean;
2421

0 commit comments

Comments
 (0)
Please sign in to comment.