-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
[RTM] Warn if another user has edited a record #809
Conversation
Thank you very much. |
if ($intLatestVersion !== null && isset($arrRecords[$this->strTable][$this->intId]) && $intLatestVersion > ($arrRecords[$this->strTable][$this->intId] + 1)) | ||
{ | ||
\Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['versionWarning'], ($intLatestVersion - 1), $arrRecords[$this->strTable][$this->intId])); | ||
$this->reload(); |
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.
When I read the code, the process is as follows: If somebody saved a new version until I hit the save button, it will reload and show the message but it will not store my data to the database. Is that correct?
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.
I think saving is already done at this point.
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.
Ah, I see. So it does actually not prevent you from overriding the values but it just tells you that you did override it. That's fine for me I guess.
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 overridden values are still available via the versions dropdown, so it should be fine I think.
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.
No, that's wrong (of course). It just prevents any redirects so the user stays on the same page and actually sees the error message.
This implementation relies on the session, so if the same user (or another users logged in with the same account) edits the same element, the warning is not shown. Wouldn’t it be better to use a hidden field in the edit form instead of the |
I think that would be really cool. It also reduces session noise. |
I have reworked the implementation to use a hidden field instead of the session. |
This PR implements contao/core#8412.