mattermost/api/v4/source
Julien Tant bcc395d139
[MM-62552] Custom Profile Attributes: use json.RawMessage for the value. (#29989)
* refactor: Move property value sanitization to model layer

* feat: Add value sanitization for custom profile attributes

* refactor: Update custom profile attributes to use json.RawMessage

* refactor: Update patchCustomProfileAttribute to handle json.RawMessage directly

* refactor: Refactor custom profile attributes handler with improved validation

* refactor: Rename `patchCustomProfileAttribute` to `patchCPAValues`

* refactor: Replace ReturnJSON with json.NewEncoder and add error logging

* feat: Add encoding/json import to property_value.go

* refactor: Update property value tests to use json.RawMessage

* fix: Convert string value to json.RawMessage in property value test

* fix: Convert string literals to json.RawMessage in property value tests

* fix: Add missing encoding/json import in custom_profile_attributes.go

* fix: Preserve JSON RawMessage type in listCPAValues function

* fix: Update custom profile attributes test to use json.RawMessage

* feat: Add json import to custom_profile_attributes_test.go

* refactor: Update ListCPAValues and PatchCPAValues to use json.RawMessage

* refactor: Rename `actualValue` to `updatedValue` in custom profile attributes test

* refactor: Improve user permission and audit logging for custom profile attributes patch

* refactor: Optimize CPA field lookup by using ListCPAFields() and map

* fix: Correct user ID reference in custom profile attributes patch endpoint

* refactor: Change patchCPAValues to use map[string]json.RawMessage for results

* refactor: format and fix tests

* test: Add comprehensive unit tests for sanitizePropertyValue function

* test: Add test case for invalid property value type

* feat: Use `model.NewId()` to generate valid IDs in custom profile attributes tests

* refactor: Replace hardcoded IDs with dynamic variables in custom profile attributes test

* refactor: restore variable name

* refactor: drop undesired changes

* chore: refresh app layers

* feat: Update API definition to support string or string array values for custom profile attributes

* test: Add test cases for multiselect custom profile attribute values

* test: Add tests for multiselect custom profile attribute values

* test: Isolate array value test in separate t.Run

* test: Add test case for multiselect array values in custom profile attributes

* refactor: Move array value test from TestCreateCPAField to TestPatchCPAValue

* test: Update custom profile attributes test assertions

* test: add test case for handling array values in GetCPAValue

* test: Add array value tests for property value store

* refactor(store): no need to convert to json the rawmessage

* chore: lint

* i18n

* use model to interface with sqlx

* fix: Allow empty strings for text, date, and select profile attributes

* refactor: Filter out empty strings in multiselect and multiuser fields

* refactor: Update multiuser field sanitization to validate and error on invalid IDs

* refactor: Simplify sanitizePropertyValue function with reduced code duplication

* fix: Allow empty user ID in custom profile attribute sanitization

* refactor: Convert comment-based subtests to nested t.Run in TestSanitizePropertyValue

* refactor: Convert comment-based subtests to nested t.Run tests in TestSanitizePropertyValue

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2025-02-05 17:21:22 +00:00
..
actions.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
bleve.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
bookmarks.yaml Channel Bookmarks (#25449) 2024-03-12 08:36:05 -06:00
bots.yaml [MM-57966]Centralize the 200 maximum page size cap for the per_page parameter and remove individual mentions from API endpoint documentation (#26859) 2024-04-25 21:18:25 +05:30
brand.yaml Updated API Code Samples (#24141) 2023-08-03 12:45:10 -03:00
channels.yaml Excludes remote channels from channel search (#28708) 2024-10-18 07:41:24 -06:00
cloud.yaml [CLD-6678] Various improvements for IP filtering feature (#25485) 2023-11-28 09:09:50 -05:00
cluster.yaml Update /api/v4/cluster/status docs (#28189) 2024-09-16 17:51:51 +02:00
commands.yaml Updated API Code Samples (#24141) 2023-08-03 12:45:10 -03:00
compliance.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
custom_profile_attributes.yaml [MM-62552] Custom Profile Attributes: use json.RawMessage for the value. (#29989) 2025-02-05 17:21:22 +00:00
dataretention.yaml [MM-57966]Centralize the 200 maximum page size cap for the per_page parameter and remove individual mentions from API endpoint documentation (#26859) 2024-04-25 21:18:25 +05:30
definitions.yaml Custom profile attributes field endpoints (#29662) 2025-01-13 18:12:38 +01:00
elasticsearch.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
emoji.yaml Add documentation for get emojis by names API (#24983) 2023-10-17 15:09:26 -04:00
exports.yaml Updated API Code Samples (#24141) 2023-08-03 12:45:10 -03:00
files.yaml [MM-51201/MM-60406/MM-60404] CrossTeam Search posts and files (#28478) 2024-11-21 13:40:46 -07:00
groups.yaml Fixed API return type in documentation (#28984) 2024-11-19 10:29:17 +01:00
imports.yaml Updated API Code Samples (#24141) 2023-08-03 12:45:10 -03:00
introduction.yaml Add 'metrics' tag to /api/v4/client_perf endpoint (#29612) 2025-01-14 09:24:31 +00:00
ip_filters.yaml [CLD-6324] Cloud IP Filtering (#24726) 2023-11-14 09:12:04 -05:00
jobs.yaml [MM-56074] mmctl job commands (#26855) 2024-06-17 12:07:05 -04:00
ldap.yaml [MM-57966]Centralize the 200 maximum page size cap for the per_page parameter and remove individual mentions from API endpoint documentation (#26859) 2024-04-25 21:18:25 +05:30
limits.yaml Added post limit warning (#26793) 2024-04-18 11:50:30 +05:30
logs.yaml MM-57013 Added download button for downloading logs from server logs page in system console (#26389) 2024-06-24 14:05:23 -04:00
metrics.yaml Add 'metrics' tag to /api/v4/client_perf endpoint (#29612) 2025-01-14 09:24:31 +00:00
oauth.yaml Updated API Code Samples (#24141) 2023-08-03 12:45:10 -03:00
outgoing_oauth_connections.yaml Webapp - Outgoing OAuth Connections (#25507) 2024-02-09 14:49:49 -05:00
permissions.yaml Remove deprecated function (#27605) 2024-07-17 16:02:39 -06:00
plugins.yaml Updated API Code Samples (#24141) 2023-08-03 12:45:10 -03:00
posts.yaml Feature edit attachments (#29769) 2025-01-13 18:16:56 +05:30
preferences.yaml MM 55199 Limit User Preferences (#25579) 2024-02-01 15:33:24 -07:00
reactions.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
remoteclusters.yaml MM-61032: Add default_team_id to accept invite flow (#28841) 2024-10-18 12:26:38 +02:00
reports.yaml [MM-62398] Fix /api/v4/reports/users/export api docs (#29750) 2025-01-13 09:42:16 +01:00
roles.yaml Updated API Code Samples (#24141) 2023-08-03 12:45:10 -03:00
saml.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
scheduled_post.yaml Feature scheduled messages (#28932) 2024-11-04 11:39:35 +05:30
schemes.yaml Update schemes.yaml (#29502) 2024-12-12 12:19:09 +01:00
service_terms.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
sharedchannels.yaml MM-58349: Shared Channels in System Console (#28116) 2024-10-09 07:53:19 -05:00
status.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
system.yaml [MM-59503] export: enable exporting configuration with mmctl (#28412) 2024-12-17 10:23:52 +01:00
teams.yaml add missing query parameters to GetTeamMembers API doc (#27106) 2024-05-28 10:06:47 -06:00
uploads.yaml Updated API Code Samples (#24141) 2023-08-03 12:45:10 -03:00
usage.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
users.yaml Remove the CPA query parameter for the user profile endpoint (#29852) 2025-01-14 16:35:00 +00:00
webhooks.yaml [GH-26715] Added Pagination Support for IncomingWebHooks (#27502) 2024-08-09 16:44:22 -04:00