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

[4.4] Messages api issue - the webservices API for creating and patching messages is not working #41017

Open
wants to merge 10 commits into
base: 4.4-dev
Choose a base branch
from

Conversation

MacJoom
Copy link
Contributor

@MacJoom MacJoom commented Jun 22, 2023

Pull Request for Issue # .
Creating (POST) and editing messages (PATCH) does not work
See https://docs.joomla.org/J4.x:Joomla_Core_APIs - Section Messages, creating and editing messages

Summary of Changes

messages.xml - add message_id to form so it can be passed as valid data
MessageModel - set the message_id key to the input
MessageModel - enable actions on sent and received messages

Testing Instructions

Actual result BEFORE applying this Pull Request

Backend: works

API: Creating and editing messages fails

Expected result AFTER applying this Pull Request

Backend: works

API: Creating and editing messages works

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • [ x] No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • [ x] No documentation changes for manual.joomla.org needed

@@ -349,6 +349,7 @@ public function save($data)

if (isset($table->$key)) {
$this->setState($this->getName() . '.id', $table->$key);
$this->__state_set = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks wrong. Also feels awfully like we're going to break something in the backend too. Why is this required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we do not set __state_set to true then it is cleared later on - and the id is lost. Just out of debugging. I tested the backend and it still works - but that may be thats because there is no possibility to actually edit a message in the backend - while in the api there is this possibility

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually looking closer in to the code, it might be better to check in the populateState if there is an id already set and not overwrite it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the setState only works at this stage when __state_set is set to true, otherwise it will overwritten by populateState. Cleaner solution is to set the key in the input

@MacJoom MacJoom marked this pull request as draft June 23, 2023 18:52
@MacJoom MacJoom marked this pull request as ready for review June 25, 2023 15:49
@Fedik Fedik added the bug label Sep 24, 2023
@HLeithner HLeithner changed the base branch from 4.3-dev to 4.4-dev September 30, 2023 22:43
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 4.4-dev.

@alikon
Copy link
Contributor

alikon commented Oct 8, 2023

POST and PATCH messages works just noticed user_id_from was lost see MacJoom#2

testing joomla#41017 user_id_from was lost
Thank you - no idea why this happened...
@alikon
Copy link
Contributor

alikon commented Oct 9, 2023

I have tested this item ✅ successfully on 32f12ca


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41017.

@laoneo laoneo self-assigned this Nov 4, 2023
@laoneo laoneo added this to the Joomla! 4.4.1 milestone Nov 4, 2023
@bembelimen bembelimen modified the milestones: Joomla! 4.4.1, 4.4.2 Nov 29, 2023
@MacJoom MacJoom removed this from the Joomla! 4.4.2 milestone Jan 10, 2024
@MacJoom MacJoom added this to the Joomla 4.4.3 milestone Jan 10, 2024
@laoneo laoneo removed this from the Joomla 4.4.3 milestone Feb 19, 2024
@laoneo
Copy link
Member

laoneo commented Feb 23, 2024

@MacJoom and @wilsonge can you guys come to an agreement here?

@HLeithner HLeithner changed the title Messages api issue - the webservices API for creating and patching messages is not working [4.4] Messages api issue - the webservices API for creating and patching messages is not working Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants