Skip to content

Commit

Permalink
Merge branch 'release/8.0.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
BracketSpaceWorker committed Jan 27, 2022
2 parents 7f80b74 + 17c8c3b commit 4bc26b1
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 167 deletions.
2 changes: 1 addition & 1 deletion notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Description: Customisable email and webhook notifications with powerful developer friendly API for custom triggers and notifications. Send alerts easily.
* Author: BracketSpace
* Author URI: https://bracketspace.com
* Version: 8.0.9
* Version: 8.0.10
* License: GPL3
* Text Domain: notification
* Domain Path: /languages
Expand Down
130 changes: 0 additions & 130 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -985,21 +985,6 @@ parameters:
count: 2
path: src/Cli/DumpHooks.php

-
message: "#^Call to method get_actions\\(\\) on an unknown class BracketSpace\\\\Notification\\\\Core\\\\Triggerable\\.$#"
count: 1
path: src/Core/Binder.php

-
message: "#^Parameter \\#1 \\$trigger of class BracketSpace\\\\Notification\\\\Core\\\\Runner constructor expects BracketSpace\\\\Notification\\\\Interfaces\\\\Triggerable, BracketSpace\\\\Notification\\\\Core\\\\Triggerable given\\.$#"
count: 1
path: src/Core/Binder.php

-
message: "#^Parameter \\$triggers of method BracketSpace\\\\Notification\\\\Core\\\\Binder\\:\\:bind\\(\\) has invalid typehint type BracketSpace\\\\Notification\\\\Core\\\\Triggerable\\.$#"
count: 2
path: src/Core/Binder.php

-
message: "#^Method BracketSpace\\\\Notification\\\\Core\\\\Cron\\:\\:register_intervals\\(\\) has parameter \\$intervals with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -1910,21 +1895,6 @@ parameters:
count: 1
path: src/Defaults/Trigger/Post/PostAdded.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostAdded\\:\\:\\$publishing_user \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostAdded.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$author \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostAdded.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$last_editor \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostAdded.php

-
message: "#^Access to an undefined property object\\:\\:\\$ID\\.$#"
count: 1
Expand All @@ -1950,21 +1920,6 @@ parameters:
count: 1
path: src/Defaults/Trigger/Post/PostApproved.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostApproved\\:\\:\\$approving_user \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostApproved.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$author \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostApproved.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$last_editor \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostApproved.php

-
message: "#^Access to an undefined property object\\:\\:\\$ID\\.$#"
count: 1
Expand All @@ -1990,21 +1945,6 @@ parameters:
count: 1
path: src/Defaults/Trigger/Post/PostDrafted.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostDrafted\\:\\:\\$publishing_user \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostDrafted.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$author \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostDrafted.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$last_editor \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostDrafted.php

-
message: "#^Access to an undefined property object\\:\\:\\$ID\\.$#"
count: 1
Expand All @@ -2030,16 +1970,6 @@ parameters:
count: 1
path: src/Defaults/Trigger/Post/PostPending.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$author \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostPending.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$last_editor \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostPending.php

-
message: "#^Access to an undefined property object\\:\\:\\$ID\\.$#"
count: 1
Expand All @@ -2065,21 +1995,6 @@ parameters:
count: 1
path: src/Defaults/Trigger/Post/PostPublished.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostPublished\\:\\:\\$publishing_user \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostPublished.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$author \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostPublished.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$last_editor \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostPublished.php

-
message: "#^Access to an undefined property object\\:\\:\\$ID\\.$#"
count: 1
Expand All @@ -2105,21 +2020,6 @@ parameters:
count: 1
path: src/Defaults/Trigger/Post/PostScheduled.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostScheduled\\:\\:\\$scheduling_user \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostScheduled.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$author \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostScheduled.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$last_editor \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostScheduled.php

-
message: "#^Access to an undefined property object\\:\\:\\$ID\\.$#"
count: 1
Expand All @@ -2145,21 +2045,6 @@ parameters:
count: 1
path: src/Defaults/Trigger/Post/PostTrashed.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrashed\\:\\:\\$trashing_user \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostTrashed.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$author \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostTrashed.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$last_editor \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostTrashed.php

-
message: "#^Cannot access property \\$name on string\\|WP_Taxonomy\\.$#"
count: 1
Expand All @@ -2170,21 +2055,6 @@ parameters:
count: 1
path: src/Defaults/Trigger/Post/PostTrigger.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$author \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostUpdated.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostTrigger\\:\\:\\$last_editor \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostUpdated.php

-
message: "#^Property BracketSpace\\\\Notification\\\\Defaults\\\\Trigger\\\\Post\\\\PostUpdated\\:\\:\\$updating_user \\(WP_User\\) does not accept WP_User\\|false\\.$#"
count: 1
path: src/Defaults/Trigger/Post/PostUpdated.php

-
message: "#^Cannot access property \\$user_id on WP_User_Request\\|false\\.$#"
count: 1
Expand Down
9 changes: 8 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: notification, bracketspace, Kubitomakita, tomaszadamowicz, insejn,
Tags: notification, notify, alert, email, mail, webhook, API, developer, framework
Requires at least: 4.9
Tested up to: 5.8
Stable tag: 8.0.9
Stable tag: 8.0.10
Requires PHP: 7.0
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Expand Down Expand Up @@ -302,6 +302,13 @@ Yes! We're offering a [custom plugin development](https://bracketspace.com/custo

== Changelog ==

= 8.0.10 =

* [Fixed] User logout trigger. In WordPress 5.5 the context is set properly.
* [Fixed] Issue with persistent Trigger state if two or more actions assigned to the same trigger were called.
* [Changed] Carrier's recipients field is now returned with resolved data if available.
* [Added] Post Published privately trigger.

= 8.0.9 =

* [Fixed] Merge Tags resolver problem caused by overriding the processed trigger instance.
Expand Down
6 changes: 5 additions & 1 deletion src/Abstracts/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ public function get_recipients_field() {
$field = $closure();

// Setup the field data if it's available.
$this->set_field_data( $field, $this->recipients_data );
if ( ! empty( $this->recipients_resolved_data ) ) {
$this->set_field_data( $field, $this->recipients_resolved_data );
} else {
$this->set_field_data( $field, $this->recipients_data );
}

return $field;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Core/Binder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace BracketSpace\Notification\Core;

use BracketSpace\Notification\Interfaces\Triggerable;

/**
* Binder class
*/
Expand All @@ -31,7 +33,7 @@ public static function bind( $triggers ) {
foreach ( $trigger->get_actions() as $action ) {
add_action(
$action['tag'],
[ new Runner( $trigger ), 'run' ],
[ new Runner( clone $trigger ), 'run' ],
$action['priority'],
$action['accepted_args']
);
Expand Down
6 changes: 3 additions & 3 deletions src/Defaults/Trigger/Post/PostAdded.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PostAdded extends PostTrigger {
/**
* Post publishing user object
*
* @var \WP_User
* @var \WP_User|false
*/
public $publishing_user;

Expand Down Expand Up @@ -90,8 +90,8 @@ public function context( $post_id, $post, $update ) {
// WP_Post object.
$this->{ $this->post_type } = $post;

$this->author = get_userdata( $this->{ $this->post_type }->post_author );
$this->last_editor = get_userdata( get_post_meta( $this->{ $this->post_type }->ID, '_edit_last', true ) );
$this->author = get_userdata( (int) $this->{ $this->post_type }->post_author );
$this->last_editor = get_userdata( (int) get_post_meta( $this->{ $this->post_type }->ID, '_edit_last', true ) );
$this->publishing_user = get_userdata( get_current_user_id() );

$this->{ $this->post_type . '_creation_datetime' } = strtotime( $this->{ $this->post_type }->post_date_gmt );
Expand Down
6 changes: 3 additions & 3 deletions src/Defaults/Trigger/Post/PostApproved.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PostApproved extends PostTrigger {
/**
* Post approving user object
*
* @var \WP_User
* @var \WP_User|false
*/
public $approving_user;

Expand Down Expand Up @@ -74,8 +74,8 @@ public function context( $post ) {

$this->{ $this->post_type } = $post;

$this->author = get_userdata( $this->{ $this->post_type }->post_author );
$this->last_editor = get_userdata( get_post_meta( $this->{ $this->post_type }->ID, '_edit_last', true ) );
$this->author = get_userdata( (int) $this->{ $this->post_type }->post_author );
$this->last_editor = get_userdata( (int) get_post_meta( $this->{ $this->post_type }->ID, '_edit_last', true ) );
$this->approving_user = get_userdata( get_current_user_id() );

$this->{ $this->post_type . '_creation_datetime' } = strtotime( $this->{ $this->post_type }->post_date_gmt );
Expand Down
6 changes: 3 additions & 3 deletions src/Defaults/Trigger/Post/PostDrafted.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PostDrafted extends PostTrigger {
/**
* Post publishing user object
*
* @var \WP_User
* @var \WP_User|false
*/
public $publishing_user;

Expand Down Expand Up @@ -84,8 +84,8 @@ public function context( $new_status, $old_status, $post ) {

$this->{ $this->post_type } = $post;

$this->author = get_userdata( $this->{ $this->post_type }->post_author );
$this->last_editor = get_userdata( get_post_meta( $this->{ $this->post_type }->ID, '_edit_last', true ) );
$this->author = get_userdata( (int) $this->{ $this->post_type }->post_author );
$this->last_editor = get_userdata( (int) get_post_meta( $this->{ $this->post_type }->ID, '_edit_last', true ) );
$this->publishing_user = get_userdata( get_current_user_id() );

$this->{ $this->post_type . '_creation_datetime' } = strtotime( $this->{ $this->post_type }->post_date_gmt );
Expand Down
4 changes: 2 additions & 2 deletions src/Defaults/Trigger/Post/PostPending.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public function context( $new_status, $old_status, $post ) {

$this->{ $this->post_type } = $post;

$this->author = get_userdata( $this->{ $this->post_type }->post_author );
$this->last_editor = get_userdata( get_post_meta( $this->{ $this->post_type }->ID, '_edit_last', true ) );
$this->author = get_userdata( (int) $this->{ $this->post_type }->post_author );
$this->last_editor = get_userdata( (int) get_post_meta( $this->{ $this->post_type }->ID, '_edit_last', true ) );

$this->{ $this->post_type . '_creation_datetime' } = strtotime( $this->{ $this->post_type }->post_date_gmt );
$this->{ $this->post_type . '_modification_datetime' } = strtotime( $this->{ $this->post_type }->post_modified_gmt );
Expand Down
6 changes: 3 additions & 3 deletions src/Defaults/Trigger/Post/PostPublished.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PostPublished extends PostTrigger {
/**
* Post publishing user object
*
* @var \WP_User
* @var \WP_User|false
*/
public $publishing_user;

Expand Down Expand Up @@ -87,8 +87,8 @@ public function context( $new_status, $old_status, $post ) {

$this->{ $this->post_type } = $post;

$this->author = get_userdata( $this->{ $this->post_type }->post_author );
$this->last_editor = get_userdata( get_post_meta( $this->{ $this->post_type }->ID, '_edit_last', true ) );
$this->author = get_userdata( (int) $this->{ $this->post_type }->post_author );
$this->last_editor = get_userdata( (int) get_post_meta( $this->{ $this->post_type }->ID, '_edit_last', true ) );
$this->publishing_user = get_userdata( get_current_user_id() );

$this->{ $this->post_type . '_creation_datetime' } = strtotime( $this->{ $this->post_type }->post_date_gmt );
Expand Down
Loading

0 comments on commit 4bc26b1

Please sign in to comment.