-
Notifications
You must be signed in to change notification settings - Fork 1
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 newly messages #26
base: master
Are you sure you want to change the base?
Conversation
foreach ( $messages as $message ) { | ||
|
||
// Mark as read. | ||
$message->set_read( 1 )->save_read(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use true/false or maybe we map this flag to a hacky field like comment_karma? Then it's ok to leave it as is
$response = []; | ||
|
||
// Set output. | ||
$output = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output should be rendered only if the _render parameter is passed, because this is not the main purpose of REST actions (to render HTML), just a temporary workaround until we move to Vue.js
The action should return something (e.g. messages as arrays in "data") with an extra "html" parameter if _render is sent with the request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is how it already works, if you scroll down - you'll see that there is condition to check if output variable is not empty
'template' => 'message_view_block', | ||
|
||
'context' => [ | ||
'message' => Models\Message::query()->get_by_id( $message->get_id() ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why querying message again, or the initial object is not complete in some way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, initial object sent date is NULL
No description provided.