From 9fb3a51baa0d53b0e3735f40ea9df8349c655363 Mon Sep 17 00:00:00 2001 From: ideclon UK Date: Tue, 7 Feb 2023 15:36:50 +0000 Subject: [PATCH] Expose Discord ID to API Changelog: added --- app/services/users/build_service.rb | 1 + doc/api/users.md | 8 ++++++++ lib/api/entities/user.rb | 2 +- lib/api/users.rb | 1 + spec/lib/api/entities/user_spec.rb | 2 +- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/services/users/build_service.rb b/app/services/users/build_service.rb index 064bf132d3daf1..289a8097525a1c 100644 --- a/app/services/users/build_service.rb +++ b/app/services/users/build_service.rb @@ -163,6 +163,7 @@ def admin_create_params :skype, :theme_id, :twitter, + :discord, :username, :website_url, :private_profile, diff --git a/doc/api/users.md b/doc/api/users.md index d6a4604cf511f7..4ecb3d48c0fbf1 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -142,6 +142,7 @@ GET /users "skype": "", "linkedin": "", "twitter": "", + "discord": "", "website_url": "", "organization": "", "job_title": "", @@ -183,6 +184,7 @@ GET /users "skype": "", "linkedin": "", "twitter": "", + "discord": "", "website_url": "", "organization": "", "job_title": "", @@ -319,6 +321,7 @@ Parameters: "skype": "", "linkedin": "", "twitter": "", + "discord": "", "website_url": "", "organization": "", "job_title": "Operations Specialist", @@ -365,6 +368,7 @@ Example Responses: "skype": "", "linkedin": "", "twitter": "", + "discord": "", "website_url": "", "organization": "", "job_title": "Operations Specialist", @@ -508,6 +512,7 @@ Parameters: | `skype` | No | Skype ID | | `theme_id` | No | GitLab theme for the user (for more information, see the [user preference documentation](../user/profile/preferences.md#navigation-theme) for more information) | | `twitter` | No | Twitter account | +| `discord` | No | Discord account | | `username` | Yes | Username | | `view_diffs_file_by_file` | No | Flag indicating the user sees only one file diff per page | | `website_url` | No | Website URL | @@ -558,6 +563,7 @@ Parameters: | `skype` | No | Skype ID | | `theme_id` | No | GitLab theme for the user (for more information, see the [user preference documentation](../user/profile/preferences.md#navigation-theme) for more information) | | `twitter` | No | Twitter account | +| `discord` | No | Discord account | | `username` | No | Username | | `view_diffs_file_by_file` | No | Flag indicating the user sees only one file diff per page | | `website_url` | No | Website URL | @@ -626,6 +632,7 @@ GET /user "skype": "", "linkedin": "", "twitter": "", + "discord": "", "website_url": "", "organization": "", "job_title": "", @@ -690,6 +697,7 @@ Parameters: "skype": "", "linkedin": "", "twitter": "", + "discord": "", "website_url": "", "organization": "", "job_title": "", diff --git a/lib/api/entities/user.rb b/lib/api/entities/user.rb index a86039b856a1b0..884f0f75d7ae5d 100644 --- a/lib/api/entities/user.rb +++ b/lib/api/entities/user.rb @@ -7,7 +7,7 @@ class User < UserBasic include TimeZoneHelper expose :created_at, if: ->(user, opts) { Ability.allowed?(opts[:current_user], :read_user_profile, user) } - expose :bio, :location, :public_email, :skype, :linkedin, :twitter, :website_url, :organization, :job_title, :pronouns + expose :bio, :location, :public_email, :skype, :linkedin, :twitter, :discord, :website_url, :organization, :job_title, :pronouns expose :bot?, as: :bot expose :work_information do |user| work_information(user) diff --git a/lib/api/users.rb b/lib/api/users.rb index 6e9dc22cf86c57..cc7eb63798a70a 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -46,6 +46,7 @@ def reorder_users(users) optional :skype, type: String, desc: 'The Skype username' optional :linkedin, type: String, desc: 'The LinkedIn username' optional :twitter, type: String, desc: 'The Twitter username' + optional :discord, type: String, desc: 'The Discord user ID' optional :website_url, type: String, desc: 'The website of the user' optional :organization, type: String, desc: 'The organization of the user' optional :projects_limit, type: Integer, desc: 'The number of projects a user can create' diff --git a/spec/lib/api/entities/user_spec.rb b/spec/lib/api/entities/user_spec.rb index 407f2894f016be..3094fc748c9671 100644 --- a/spec/lib/api/entities/user_spec.rb +++ b/spec/lib/api/entities/user_spec.rb @@ -18,7 +18,7 @@ # UserBasic :state, :avatar_url, :web_url, # User - :created_at, :bio, :location, :public_email, :skype, :linkedin, :twitter, + :created_at, :bio, :location, :public_email, :skype, :linkedin, :twitter, :discord, :website_url, :organization, :job_title, :pronouns, :bot, :work_information, :followers, :following, :is_followed, :local_time ) -- GitLab