Skip to content

Commit 37c411e

Browse files
committed
Updated liniting rules
1 parent 0b4c155 commit 37c411e

File tree

4 files changed

+280
-11
lines changed

4 files changed

+280
-11
lines changed

modules/dist/notifications.build.js

Lines changed: 267 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/notifications/lib/notifications.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@
3939
font-size: 12px;
4040
}
4141

42-
.ef-post_following_list li .ef-user-subscribe-actions {
43-
float: right;
44-
margin-top: 5px;
45-
}
46-
4742
.ef-post_following_list li .ef-user-list-badges {
4843
margin-top: 10px;
4944
}

modules/notifications/lib/notifications.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,18 @@ jQuery( document ).ready( function( $ ) {
7676
post_id: jQuery( '#post_ID' ).val(),
7777
};
7878

79-
const toggleWarningBadges = function( container, response ) {
79+
const toggleWarningBadges = function( container, { userHasNoAccess, userHasNoEmail } ) {
8080
const $el = jQuery( container ).parent();
8181
const $badgesContainer = $el.closest( 'li' ).find( '.ef-user-list-badges' );
82+
8283
// "No Access" If this user was flagged as not having access
83-
const userHasNoAccess = response.data.subscribers_with_no_access.includes( parseInt( jQuery( container ).val(), 10 ) );
8484
if ( userHasNoAccess ) {
8585
addBadgeToEl( $badgesContainer, BADGES.NO_ACCESS );
8686
} else {
8787
removeBadgeFromEl( $badgesContainer, BADGES.NO_ACCESS );
8888
}
8989

9090
// "No Email" If this user was flagged as not having an email
91-
const userHasNoEmail = response.data.subscribers_with_no_email.includes( parseInt( jQuery( container ).val(), 10 ) );
9291
if ( userHasNoEmail ) {
9392
addBadgeToEl( $badgesContainer, BADGES.NO_EMAIL );
9493
} else {
@@ -140,11 +139,19 @@ jQuery( document ).ready( function( $ ) {
140139
success: function( response ) {
141140
// Toggle the warning badges ("No Access" and "No Email") to signal the user won't receive notifications
142141
if ( undefined !== response.data ) {
143-
toggleWarningBadges( jQuery( parentThis ), response );
142+
const userHasNoAccess = response.data.subscribers_with_no_access.includes( parseInt( jQuery( container ).val(), 10 ) );
143+
const userHasNoEmail = response.data.subscribers_with_no_email.includes( parseInt( jQuery( container ).val(), 10 ) );
144+
145+
toggleWarningBadges( jQuery( parentThis ), { userHasNoAccess, userHasNoEmail } );
144146
}
145147

146148
// Green 40% by default
147-
const backgroundHighlightColor = '#90d296';
149+
let backgroundHighlightColor = '#90d296';
150+
151+
if ( userHasNoAccess || userHasNoEmail ) {
152+
// Red 40% if there's a warning
153+
backgroundHighlightColor = "#ea8484";
154+
}
148155

149156
const backgroundColor = 'transparent';
150157
jQuery( parentThis.parents( 'label' ) )

modules/user-groups/user-groups.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ function usergroups_select_form( $selected = array(), $args = null ) {
773773
?>
774774
<li>
775775
<label for="<?php echo $input_id . esc_attr( $usergroup->term_id ); ?>" title="<?php echo esc_attr($usergroup->description) ?>">
776-
<div class="ef-user-subscribe-actions">
776+
<div class="ef-user-subscribe-action">
777777
<input type="checkbox" id="<?php echo esc_attr( $input_id . $usergroup->term_id ) ?>" name="<?php echo esc_attr( $input_id )?>[]" value="<?php echo esc_attr( $usergroup->term_id ) ?>"<?php echo $checked ?> />
778778
</div>
779779
<span class="ef-usergroup_name"><?php echo esc_html( $usergroup->name ); ?></span>

0 commit comments

Comments
 (0)