Skip to content

Commit

Permalink
Merge branch 'main' into fix/add-query-args
Browse files Browse the repository at this point in the history
* main:
  Disable on post or page list view screens in the admin
  Reformat code
  perform easy/auto lint fixes in test file
  run with synchronize
  add nvmrc file
  add brand plugin test workflow
  Update URL for Satis
  • Loading branch information
circlecube committed Jan 16, 2024
2 parents 4341019 + a45df51 commit 39e8c02
Show file tree
Hide file tree
Showing 5 changed files with 262 additions and 169 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/brand-plugin-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build and Test Module Updates in Brand Plugins
on:
pull_request:
types: [ opened, reopened, ready_for_review, synchronize ]
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
steps:

- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

bluehost:
name: Bluehost Build and Test
needs: setup
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
with:
module-repo: ${{ github.repository }}
module-branch: ${{ needs.setup.outputs.branch }}
plugin-repo: 'bluehost/bluehost-wordpress-plugin'
secrets: inherit

hostgator:
name: HostGator Build and Test
needs: setup
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
with:
module-repo: ${{ github.repository }}
module-branch: ${{ needs.setup.outputs.branch }}
plugin-repo: 'newfold-labs/wp-plugin-hostgator'
secrets: inherit

web:
name: Web.com Build and Test
needs: setup
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
with:
module-repo: ${{ github.repository }}
module-branch: ${{ needs.setup.outputs.branch }}
plugin-repo: 'newfold-labs/wp-plugin-web'
secrets: inherit

crazydomains:
name: Crazy Domains Build and Test
needs: setup
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
with:
module-repo: ${{ github.repository }}
module-branch: ${{ needs.setup.outputs.branch }}
plugin-repo: 'newfold-labs/wp-plugin-crazy-domains'
secrets: inherit

mojo:
name: Mojo Build and Test
needs: setup
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
with:
module-repo: ${{ github.repository }}
module-branch: ${{ needs.setup.outputs.branch }}
plugin-repo: 'newfold-labs/wp-plugin-mojo'
secrets: inherit
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A module for managing Newfold in-site notifications.
### 1. Add the Newfold Satis to your `composer.json`.

```bash
composer config repositories.newfold composer https://newfold.github.io/satis
composer config repositories.newfold composer https://newfold-labs.github.io/satis
```

### 2. Require the `newfold-labs/wp-module-notifications` package.
Expand Down
27 changes: 16 additions & 11 deletions includes/AdminNotices.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,26 @@ public static function maybeRenderAdminNotices() {
return;
}

// Bail if we're on a post or page list view in the admin
if ( $screen->base === 'edit' ) {
return;
}

// Handle realtime notifications
if ( 'plugin-install' === $screen->id ) {
?>
<style>
.newfold-realtime-notice {
margin: 5px 0 15px 0;
}
</style>
<style>
.newfold-realtime-notice {
margin: 5px 0 15px 0;
}
</style>
<?php
}

$page = str_replace( admin_url(), '', Url::getCurrentUrl() );
$notifications = new NotificationsRepository( false );
$collection = $notifications->collection();

// Constant container for admin notices
self::openContainer();

Expand All @@ -45,17 +50,17 @@ public static function maybeRenderAdminNotices() {
function ( Notification $notification ) use ( $page ) {
if ( $notification->shouldShow( 'wp-admin-notice', array( 'page' => $page ) ) ) {
?>
<div class="newfold-notice" data-id="<?php echo esc_attr( $notification->id ); ?>">
<div class="newfold-notice" data-id="<?php echo esc_attr( $notification->id ); ?>">
<?php echo $notification->content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</div>
<?php
}
}
);
}

self::closeContainer();

self::adminScripts();

}
Expand All @@ -78,8 +83,8 @@ public static function closeContainer() {
/**
* Handle scripts
*/
public static function adminScripts(){
public static function adminScripts() {

// Handle realtime notifications
$screen = get_current_screen();
if ( 'plugin-install' === $screen->id ) {
Expand Down
Loading

0 comments on commit 39e8c02

Please sign in to comment.