Skip to content

Commit

Permalink
Adds entries without is_approved meta to the list of unapproved (#2248)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcasual authored Jan 8, 2025
2 parents ffb0d88 + c5563cc commit b8c6672
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions includes/class-admin-approve-entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,15 @@ public function filter_links_entry_list( $filter_links = array(), $form = array(
);

$field_filters_unapproved = array(
'mode' => 'any',
array(
'key' => GravityView_Entry_Approval::meta_key,
'value' => GravityView_Entry_Approval_Status::UNAPPROVED,
),
array(
'key' => GravityView_Entry_Approval::meta_key,
'value' => '',
),
);

$approved_count = $disapproved_count = $unapproved_count = 0;
Expand Down
4 changes: 3 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h
* Fatal error when searching entries by approval status in Views joined with another form using the Multiple Forms extension.
* Some merge tag modifiers (e.g., `maxwords`) were not being processed.

#### ✨ Improved
* Entries added via the Gravity Forms API or while GravityView is inactive can now be filtered using the "Unapproved" status on the Entries page.

= 2.33.2 on December 31, 2024 =

This update removes debugging code from the Entry Notes field.

#### 🐛 Fixed

* Debugging code being shown in the Entry Notes field output.
* Output of the User Activation field not being sanitized.

Expand Down
32 changes: 32 additions & 0 deletions tests/unit-tests/GravityView_Entry_Approval_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,36 @@ public function test_update_bulk() {
$this->assertFalse( GravityView_Entry_Approval::update_bulk( range( 20000, 20010 ), GravityView_Entry_Approval_Status::APPROVED, $this->form_id ), 'Should have returned false; Invalid entry IDs' );
}

public function test_entry_list_filter_links() {
// Discussion: https://gravitykit.slack.com/archives/C727B06MB/p1736354374221989
$this->markTestSkipped('Flaky test due to $wpdb sometimes returning empty results');

$form = $this->factory->form->create_and_get();

$entry = $this->factory->entry->create_and_get( [ 'form_id' => $form['id'] ] );

$approve_entries = new class extends GravityView_Admin_ApproveEntries { };

$filter_links = $approve_entries->filter_links_entry_list( [], $form );

$this->assertEquals( 0, $filter_links[0]['count'] );
$this->assertEquals( 0, $filter_links[1]['count'] );
$this->assertEquals( 1, $filter_links[2]['count'] );

GravityView_Entry_Approval::update_approved( $entry['id'], GravityView_Entry_Approval_Status::APPROVED, $form['id'] );

$filter_links = $approve_entries->filter_links_entry_list( [], $form );

$this->assertEquals( 1, $filter_links[0]['count'] );
$this->assertEquals( 0, $filter_links[1]['count'] );
$this->assertEquals( 0, $filter_links[2]['count'] );

GravityView_Entry_Approval::update_approved( $entry['id'], GravityView_Entry_Approval_Status::DISAPPROVED, $form['id'] );

$filter_links = $approve_entries->filter_links_entry_list( [], $form );

$this->assertEquals( 0, $filter_links[0]['count'] );
$this->assertEquals( 1, $filter_links[1]['count'] );
$this->assertEquals( 0, $filter_links[2]['count'] );
}
}

0 comments on commit b8c6672

Please sign in to comment.