Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data to notification #90

Merged
merged 3 commits into from
Jul 9, 2019
Merged

Conversation

mattheu
Copy link
Member

@mattheu mattheu commented Jul 8, 2019

Here is some POC code to add data to the notification itself (instead of or in addition to action data...)

Mostly just getting my head around the internals of this plugin so needs a bit more work - but wanted to share.

@mattheu
Copy link
Member Author

mattheu commented Jul 8, 2019

Oh another thing I added here is a timestamp, which I think would be useful to include in this.

Copy link
Contributor

@roborourke roborourke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious whether it's worth going straight for #89 at this juncture. These are useful additions though. I'm thinking what I mention in my last comment on #88 would be handy too

inc/class-workflow.php Outdated Show resolved Hide resolved
lib/destinations/dashboard.php Outdated Show resolved Hide resolved
Copy link
Contributor

@shadyvb shadyvb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use a new type property while we’re here, otherwise no blockers, will need more work on sanitisation once merged.

inc/class-workflow.php Show resolved Hide resolved
@@ -211,14 +218,16 @@ function sanitize_notification( $notification ) {
*/
$data_sanitization_fn = apply_filters( 'hm.workflows.action.data.sanitizer', 'sanitize_text_field' );

if ( ! is_callable( $data_sanitization_fn ) ) {
if ( ! $data_sanitization_fn || ! is_callable( $data_sanitization_fn ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably make use of the enhancements Rob suggested, where a more thorough function is checking object items based on the value type. It needs some work on the original ticket anyway, and probably then some.

@shadyvb shadyvb mentioned this pull request Jul 9, 2019
2 tasks
@shadyvb
Copy link
Contributor

shadyvb commented Jul 9, 2019

Continuing work on this as part of #88, will tackle all the feedback here.

@shadyvb shadyvb merged commit b8b1002 into dynamic-action-data Jul 9, 2019
@shadyvb shadyvb deleted the dynamic-notification-data branch July 9, 2019 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants