File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -47,16 +47,17 @@ public function boot(): void
4747 public function onInit (): void
4848 {
4949 $ tracking = ! $ this ->trackingRules ->hasExcludedIp ();
50+ $ excludedRole = $ this ->trackingRules ->hasExcludedUserRole ();
5051
5152 if ($ tracking && $ this ->settings ->get (SettingName::NOSCRIPT )) {
5253 AddNoScriptTag::register ();
5354 }
5455
55- if (! $ this -> trackingRules -> hasExcludedUserRole () ) {
56+ if (! $ excludedRole ) {
5657 AddInactiveComment::register ();
5758 }
5859
59- if ($ tracking ) {
60+ if ($ tracking && ! $ excludedRole ) {
6061 $ this ->scripts ->push (new AnalyticsScript );
6162 } else {
6263 $ this ->scripts ->push (new InactiveScript );
Original file line number Diff line number Diff line change 66
77const SA_ADMIN_NOTICE = '<!-- Simple Analytics: Not logging requests from admins --> ' ;
88const SA_DEFAULT_SCRIPT = 'src="https://scripts.simpleanalyticscdn.com/latest.js"></script> ' ;
9+ const SA_INACTIVE_ADMIN_SCRIPT = 'resources/js/inactive.js"></script> ' ;
10+
911const WP_PLUGIN_ROW_SELECTOR = 'tr[data-slug="simpleanalytics"] ' ;
1012const WP_ACTIVATE_PLUGIN_SELECTOR = '#activate-simpleanalytics ' ;
1113const WP_DEACTIVATE_PLUGIN_SELECTOR = '#deactivate-simpleanalytics ' ;
2830
2931it ('adds a comment when an authenticated user visits ' , function () {
3032 $ homePage = asAdmin ()->navigate ('http://localhost:8100 ' );
31- expect ($ homePage ->content ())->dump ()->toContain (SA_ADMIN_NOTICE );
32- $ homePage ->assertNoConsoleLogs ();
33+
34+ expect ($ homePage ->content ())->dump ()
35+ ->toContain (SA_ADMIN_NOTICE )
36+ ->toContain (SA_INACTIVE_ADMIN_SCRIPT );
3337});
You can’t perform that action at this time.
0 commit comments