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 newly messages #26

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Add newly messages #26

wants to merge 10 commits into from

Conversation

kuznev
Copy link
Contributor

@kuznev kuznev commented Jul 8, 2024

No description provided.

foreach ( $messages as $message ) {

// Mark as read.
$message->set_read( 1 )->save_read();
Copy link
Owner

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 = '';
Copy link
Owner

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

Copy link
Contributor

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() ),
Copy link
Owner

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?

Copy link
Contributor

@PaulAlyokhin PaulAlyokhin Jul 10, 2024

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

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