Changeset 12959
- Timestamp:
- 10/31/2023 08:16:50 PM (2 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory
- Files:
-
- 2 edited
-
assets/css/admin.css (modified) (1 diff)
-
inc/moderation.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/assets/css/admin.css
r12957 r12959 19 19 margin-right: 4px; 20 20 } 21 .photos-flagged li.very_likely, 22 .photos-flagged li.likely { 21 .photos-flagged li.very_likely { 23 22 background-color: #AA0000; 24 23 } 24 .photos-flagged li.likely { 25 background-color: darkorange; 26 } 25 27 .photos-flagged li.possible { 26 background-color: darkorange;28 background-color: goldenrod; 27 29 } 28 30 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/moderation.php
r12869 r12959 22 22 /** 23 23 * The threshold percentage of the number of rejections relative to the 24 * number of approvals at which the user should be flagged as a warning25 * (in orange). Should be a lower value than24 * number of approvals+rejections at which the user should be flagged as a warning 25 * (in yellow). Should be a lower value than 26 26 * `FLAG_REJECTION_ALERT_THRESHOLD_PERCENTAGE`. 27 27 * 28 28 * @var float 29 29 */ 30 const FLAG_REJECTION_WARNING_THRESHOLD_PERCENTAGE = 0.1 ;30 const FLAG_REJECTION_WARNING_THRESHOLD_PERCENTAGE = 0.15; 31 31 32 32 /** 33 33 * The threshold percentage of the number of rejections relative to the 34 * number of approvals at which the user should be flagged as an alert34 * number of approvals+rejections at which the user should be flagged as an alert 35 35 * (in red) rather than a warning (in orange). Should be a higher value than 36 36 * `FLAG_REJECTION_WARNING_THRESHOLD_PERCENTAGE`. … … 38 38 * @var float 39 39 */ 40 const FLAG_REJECTION_ALERT_THRESHOLD_PERCENTAGE = 0.25; 40 const FLAG_REJECTION_ALERT_THRESHOLD_PERCENTAGE = 0.30; 41 42 /** 43 * The threshold percentage of the number of rejections relative to the 44 * number of approvals+rejections at which the user should be flagged as 45 * critical rather than an alert. Should be a higher value than 46 * `FLAG_REJECTION_ALERT_THRESHOLD_PERCENTAGE`. 47 * 48 * @var float 49 */ 50 const FLAG_REJECTION_CRITICAL_THRESHOLD_PERCENTAGE = 0.50; 41 51 42 52 /** … … 619 629 620 630 if ( $rejections_count > 0 ) { 621 $rejections_level = ''; 631 $rejections_level = $message = ''; 632 633 $rejections_percentage = $rejections_count / ( $rejections_count + $published_photos_count ); 622 634 623 635 // A user with more rejections than approvals should be an alert. 624 if ( $rejections_count > =$published_photos_count ) {636 if ( $rejections_count > $published_photos_count ) { 625 637 $rejections_level = 'very_likely'; 638 $message = __( 'more rejections than approvals', 'wporg-photos' ); 626 639 } 627 640 // Specify as alert or warning based on count relative to alert threshold. 628 641 else { 629 $reject_pct = $rejections_count / $published_photos_count; 630 if ( $reject_pct >= self::FLAG_REJECTION_ALERT_THRESHOLD_PERCENTAGE ) { 642 if ( $rejections_percentage >= self::FLAG_REJECTION_CRITICAL_THRESHOLD_PERCENTAGE ) { 631 643 $rejections_level = 'very_likely'; 644 $message = __( 'very high rejection rate (<strong>%d%%</strong>)', 'wporg-photos' ); 632 645 } 633 elseif ( $reject_pct >= self::FLAG_REJECTION_WARNING_THRESHOLD_PERCENTAGE ) { 646 elseif ( $rejections_percentage >= self::FLAG_REJECTION_ALERT_THRESHOLD_PERCENTAGE ) { 647 $rejections_level = 'likely'; 648 $message = __( 'high rejection rate (<strong>%d%%</strong>)', 'wporg-photos' ); 649 } 650 elseif ( $rejections_percentage >= self::FLAG_REJECTION_WARNING_THRESHOLD_PERCENTAGE ) { 634 651 $rejections_level = 'possible'; 652 $message = __( 'rejection rate (<strong>%d%%</strong>)', 'wporg-photos' ); 635 653 } 636 654 } 637 655 638 if ( $rejections_level ) {639 $flags[ sprintf( 'has rejections (<strong>%d</strong>)', $rejections_count) ] = $rejections_level;656 if ( $rejections_level && $message ) { 657 $flags[ sprintf( $message, round( $rejections_percentage * 100 , 0 ) ) ] = $rejections_level; 640 658 } 641 659 }
Note: See TracChangeset
for help on using the changeset viewer.