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] Improve message when author is deleted #40269

Draft
wants to merge 2 commits into
base: 4.4-dev
Choose a base branch
from

Conversation

chmst
Copy link
Contributor

@chmst chmst commented Mar 31, 2023

Pull Request for Issue # .

Summary of Changes

If a user record has been deleted his articles cannot be stored any more. Now the message says what the user can do to solve the problem.

Testing Instructions

Simplest way:
Open #__content table and change the created_by id of an article to a non-existing userId.
Then try to change this article in the backend.

Actual result BEFORE applying this Pull Request

grafik

Expected result AFTER applying this Pull Request

grafik

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-4.3-dev labels Mar 31, 2023
@chmst chmst added the Small A PR which only has a small change label Mar 31, 2023
@brianteeman
Copy link
Contributor

This works correctly for the author field

However it displays the same message for the modified field. That one cannot be corrected as its readonly. Just saving the article fixes that one.

@Fedik
Copy link
Member

Fedik commented Mar 31, 2023

This is general message, which comes from User class, anytime it cannot find a user

Log::add(Text::sprintf('JLIB_USER_ERROR_UNABLE_TO_LOAD_USER', $id), Log::WARNING, 'jerror');

To me, this message should not be show up, maximum just logged. But in past someone complain "that it is right to show it up". I do not remember detail anymore :)

@chmst
Copy link
Contributor Author

chmst commented Mar 31, 2023

There were long discussions and and as long as we don't have a solution how to process deletion of users, We could only improve the message.
BTW: my opinion is: Don't allow to delete userentries, just trash and make anonymous.

@brianteeman thanks, I did not see that. So me need different messages for different cases.

@Fedik It always looks likee a bug when it is not possible to save an article. So the user must know why. It looks more as an error than a warning

@brianteeman
Copy link
Contributor

So me need different messages for different cases.

yeah - thats what I am thinking

@Fedik
Copy link
Member

Fedik commented Mar 31, 2023

It always looks likee a bug when it is not possible to save an article.

Yeah I understood. I think it can be a message for each user field. Kind of:

<field
  name="created_by"
  type="user"
  label="COM_CONTENT_FIELD_CREATED_BY_LABEL"
  validate="UserId"
  message="A valid User ID is required, please make sure User is selected."
/>

Or globaly, throw an exception here:

return (bool) $db->setQuery($query)->loadResult();

if (!$db->setQuery($query)->loadResult()) {
 throw new RuntimeException('Blablabla user id is wrong');
}
return true;

Both approaches can work, but first one allow to have a specific message per form field.

@chmst
Copy link
Contributor Author

chmst commented Mar 31, 2023

A rule on the field looks good.
I ask myself why we need to check the modified_id? It is overwritten by the current users id on save and has no relevance on other places. Or am I missing something?

@brianteeman
Copy link
Contributor

A rule on the field looks good.

Agreed - a nice solution that allows better error messages

I ask myself why we need to check the modified_id? It is overwritten by the current users id on save and has no relevance on other places. Or am I missing something?

It might be useful to know that the last person who modified the content is no longer an active member. But only as an information.

@Fedik
Copy link
Member

Fedik commented Mar 31, 2023

The rule already in that form (I copied form there), only need to add an attribute message="Blabla validation error"

@toivo
Copy link
Contributor

toivo commented Apr 4, 2023

I have tested this item ✅ successfully on 8b32598

Tested succcessfully in Joomla 4.3.0-rc3-dev of 4 April using PHP 8.1.16


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

@chmst
Copy link
Contributor Author

chmst commented Apr 4, 2023

Sorry to say that but this pr is not ready and I set it to draft. The messag is misleading if the modified_by user is deleted.

@chmst chmst marked this pull request as draft April 4, 2023 06:08
@Hackwar Hackwar added the bug label Apr 8, 2023
@HLeithner HLeithner changed the base branch from 4.3-dev to 4.4-dev September 30, 2023 22:44
@HLeithner
Copy link
Member

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

@HLeithner HLeithner changed the title [UX] Improve message when author is deleted [4.4] Improve message when author is deleted Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Language Change This is for Translators PR-4.4-dev Small A PR which only has a small change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants