Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5 erp5
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 140
    • Merge requests 140
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !273

Merged
Created May 19, 2017 by Jérome Perrin@jeromeOwner

Create user preference only when user configure preferences

  • Overview 1
  • Commits 9
  • Changes 28

To make it easier for users to change their preferences, so that they do not have to create the preference themselves, we tried to pre-create a user preference ready to be configured for each user.

It was 59860df3 : an interaction to create a user preference on Person.setReference which is more or less the time when this person become a user ( but not really - this was already a weakness of this approach).

This calls Person_createUserPreference that initialize the preference by introspecting the assignments of the person. This already had a problem that it was working only if the assignments were created before the reference was set on the person.

With the new user management introduced in !185 (merged) this interaction moved to Person.setUserId, which is called in Person's init script. This had the following problems:

  • All persons have a user id, so all persons have a preference. For sites with many persons that are not actually users, this create useless preferences.
  • During init, person does not have assignments yet, so Person_createUserPreference could not use information from assignment to create preference.

The suggested change is to create the preference only when the user click on Edit my preferences button.

This is done by adding a new portal_preferences.getActiveUserPreference method that returns the active user preference and create it if not already existing, this way we do not have to put logic in the user interface scripts.

All Edit my preferences links should use it like it was done in f62e6651

The person_interaction_workflow was completely remove, as the other interaction it was containing - clearCache when deleting the person - was useless . We had to adjust a few tests that was passing thanks to this interaction.

/cc @gabriel @vpelletier @kazuhiko @tc

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: create_user_preference_when_accessed
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7