-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
base: 4.4-dev
Are you sure you want to change the base?
Conversation
@@ -349,6 +349,7 @@ public function save($data) | |||
|
|||
if (isset($table->$key)) { | |||
$this->setState($this->getName() . '.id', $table->$key); | |||
$this->__state_set = true; |
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 looks wrong. Also feels awfully like we're going to break something in the backend too. Why is this required?
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.
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
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.
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
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.
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
This pull request has been automatically rebased to 4.4-dev. |
POST and PATCH messages works just noticed |
testing joomla#41017 user_id_from was lost Thank you - no idea why this happened...
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. |
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
Test sending and receiving Message to other administrators in the backend
Do your own API calls on Message creating and editing
or use my Postman collection https://github.com/MacJoom/j4x-api-collection Section 7.1
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