Backend changes to add User Job Title
What does this MR do?
This MR adds support for User Job title to be used in User Profile pages.
- Adds a new column
job_title
in users table - Controller changes to permit and save
job_title
. UI related changes for this column to be added in !25155 (merged) - Ability to retrieve
job_title
through User apis - Updates api documentation
Test cases:
Workflow | Expected | Status |
---|---|---|
User updates job_title through Settings page | Stores job_title in db | |
User visits Settings page | Display job_title if present | |
User retrieve api: /api/v4/users/1
|
Return 'job_title' value as appropriate |
Closes #207043 (closed)
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Merge request reports
Activity
changed milestone to %12.9
added backend database groupspaces DEPRECATED typefeature labels
mentioned in merge request !25155 (merged)
added databasereview pending label
1 Message This merge request adds or changes files that require a review from the Database team. This merge request requires a database review. To make sure these changes are reviewed, take the following steps:
- Ensure the merge request has database and databasereview pending labels. If the merge request modifies database files, Danger will do this for you.
- Prepare your MR for database review according to the docs.
- Assign and mention the database reviewer suggested by Reviewer Roulette.
The following files require a review from the Database team:
db/migrate/20200227165129_create_user_details.rb
db/schema.rb
Reviewer roulette
Changes that require review have been detected! A merge request is normally reviewed by both a reviewer and a maintainer in its primary category (e.g. frontend or backend), and by a maintainer in all other categories.
To spread load more evenly across eligible reviewers, Danger has randomly picked a candidate for each review slot. Feel free to override this selection if you think someone else would be better-suited, or the chosen person is unavailable.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines.
Once you've decided who will review this merge request, mention them as you normally would! Danger does not (yet?) automatically notify them for you.
Category Reviewer Maintainer backend Vasilii Iakliushin ( @vyaklushin
)Stan Hu ( @stanhu
)database Steve Abrams ( @sabrams
)Adam Hegyi ( @ahegyi
)Generated by
DangerEdited by 🤖 GitLab Bot 🤖added 244 commits
-
b2feece2...bb40d720 - 242 commits from branch
master
- 94d4d36d - Added user job title to users table
- 53e1f555 - Schema changes for new column
-
b2feece2...bb40d720 - 242 commits from branch
added 1 commit
- 02a2e28f - Acceptance criteria for user specified job title
marked the checklist item Changelog entry as completed
marked the checklist item Documentation (if required) as completed
added 286 commits
-
4f48a914...5cb5db19 - 285 commits from branch
master
- 141cee51 - Added user job title to users table
-
4f48a914...5cb5db19 - 285 commits from branch
- Resolved by Aishwarya Subramanian
assigned to @pshutsin and @sabrams and unassigned @asubramanian1
added databasereviewed label and removed databasereview pending label
The database updates LGTM @asubramanian1, @ahegyi would you take a look for the maintainer review?
- Resolved by Aishwarya Subramanian
- Resolved by Aishwarya Subramanian
assigned to @asubramanian1 and unassigned @jarka
- Resolved by Aishwarya Subramanian
- Resolved by Aishwarya Subramanian
- Resolved by Aishwarya Subramanian
Thanks @asubramanian1, left a few questions.
Generally I'd like to avoid adding more DB columns to
users
table. The table grows rapidly (column and record count). Most of the columns are used quite rarely, however we still have to load them from the DB and allocate ruby objects for them whenever we useUser.find
.job_title
would be used only at a few places and each of them are quite "simple":- Popover (JSON request per user)
- User's profile page (HTML)
- API: singular (show) and collection (index) requests
Similar MR: !20254 (comment 281455431)
I already started working on a migration (!25519 (closed)), however it might take a while and I don't want to be a blocker...
My proposal:
Create a new table
user_details
, you can just take the migration from my MR and add only two fields:user_id
andjob_title
. On the application level we could use delegation to assign the form value to theuser_detail
association. I think we do something similar withuser_preference
association.What do you think?
Edited by Adam Hegyi
unassigned @ahegyi
added 1 commit
- 0189654c - Apply suggestion to spec/requests/api/users_spec.rb
added 1 commit
- d1fcd333 - Apply suggestion to spec/requests/api/users_spec.rb
added 351 commits
-
58f28f18...5df860df - 349 commits from branch
master
- 7d6bac8d - Added user job title to users table
- 40f3d568 - Addressed review comments
-
58f28f18...5df860df - 349 commits from branch
added 13 commits
-
40f3d568...9f6463d2 - 11 commits from branch
master
- 84913857 - Added user job title to users table
- afab31cc - Addressed review comments
-
40f3d568...9f6463d2 - 11 commits from branch
- Resolved by Aishwarya Subramanian
assigned to @ahegyi and unassigned @asubramanian1
marked the checklist item Code review guidelines as completed
- Resolved by Aishwarya Subramanian
- Resolved by Aishwarya Subramanian
assigned to @asubramanian1
added 163 commits
-
23e41d35...22d65400 - 161 commits from branch
master
- 6070a1db - Added user job title to users table
- a9d9d2a7 - Addressed review comments
-
23e41d35...22d65400 - 161 commits from branch
unassigned @asubramanian1
- Resolved by Aishwarya Subramanian
- Resolved by Aishwarya Subramanian
- Resolved by Aishwarya Subramanian
assigned to @asubramanian1 and unassigned @ahegyi
- Resolved by Aishwarya Subramanian
Thanks @ahegyi, I have addressed the latest comments. Lmk how you feel about the response on the error rendering.
assigned to @ahegyi and unassigned @asubramanian1
added databaseapproved label and removed databasereviewed label
assigned to @asubramanian1
unassigned @ahegyi
- Resolved by Jarka Košanová
@jarka: Would you mind doing a final review/merge? Please note few database changes have been made since you last reviewed. Thank you!
assigned to @jarka and unassigned @asubramanian1
- Resolved by Aishwarya Subramanian
assigned to @asubramanian1 and unassigned @jarka
assigned to @jarka and unassigned @asubramanian1
enabled an automatic merge when the pipeline for 8bd9ab21 succeeds
Thanks @asubramanian1 . MWPS set.
mentioned in commit 61cec768
added workflowstaging label
added workflowcanary label and removed workflowstaging label
added workflowproduction label and removed workflowcanary label
mentioned in issue #24072 (closed)