Skip to content

[4.0] Reduced duplicated code in ProfileModel.#30194

Merged
wilsonge merged 1 commit intojoomla:4.0-devfrom
Harmageddon:profile-model-duplicated-code
Jul 29, 2020
Merged

[4.0] Reduced duplicated code in ProfileModel.#30194
wilsonge merged 1 commit intojoomla:4.0-devfrom
Harmageddon:profile-model-duplicated-code

Conversation

@Harmageddon
Copy link
Copy Markdown
Contributor

As mentioned in #30152 (comment), the method ProfileModel::save is mostly a copy of its parent UserModel::save. This is going to lead to problems (just like the issue fixed in #30152), because every time someone changes the method UserModel::save, they need to remember about ProfileModel and might need to include the same change there.

Summary of Changes

By calling the parent method, code duplication is reduced. As the form in the profile view is a reduced form of the user edit form, some values need to be changed, because the validation inside UserModel::save would fail otherwise.

Testing Instructions

  1. Log in to backend with an account with "Manager" permissions.
  2. Edit your profile by clicking on "User Menu" (top right) - "Edit Account", change something and save.
  3. Make sure everything regarding changing the profile works.
  4. Log in to backend with an account with "Administrator" permissions (not Super User!).
  5. Edit your profile by clicking on "User Menu" (top right) - "Edit Account", change something and save.
  6. Make sure everything regarding changing the profile works.
  7. Navigate to "Users - Manage".
  8. Edit your own account there, change something, save.
  9. Edit another account there, change something, save.
  10. Make sure everything regarding editing user accounts works.
  11. Log in to backend with an account with "Super User" permissions. Repeat steps 5-10.

Expected result AFTER applying this Pull Request

Everything should still work like before.

Documentation Changes Required

None

/cc @SharkyKZ

@richard67 richard67 changed the title Reduced duplicated code in ProfileModel. [4.0] Reduced duplicated code in ProfileModel. Jul 26, 2020
@ChristineWk
Copy link
Copy Markdown

I have tested this item ✅ successfully on 5b5c43d


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

1 similar comment
@bonzani
Copy link
Copy Markdown

bonzani commented Jul 26, 2020

I have tested this item ✅ successfully on 5b5c43d


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

@Quy Quy removed the PR-4.0-dev label Jul 26, 2020
@Quy
Copy link
Copy Markdown
Contributor

Quy commented Jul 26, 2020

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jul 26, 2020
@Quy Quy added the PR-4.0-dev label Jul 26, 2020
@wilsonge wilsonge merged commit 3bbd934 into joomla:4.0-dev Jul 29, 2020
@wilsonge
Copy link
Copy Markdown
Contributor

Thanks!

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jul 29, 2020
@zero-24 zero-24 added this to the Joomla 4.0 milestone Jul 29, 2020
sakiss pushed a commit to sakiss/joomla-cms that referenced this pull request Oct 16, 2020
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.

7 participants