Skip to content

Commit

Permalink
PISTON-1289: Changed the var name from
Browse files Browse the repository at this point in the history
should_create_caller_id_name_if_undefined to
should_create_caller_id
  • Loading branch information
bradfordben committed Aug 12, 2021
1 parent 6ff6053 commit 92b4407
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 15 deletions.
2 changes: 1 addition & 1 deletion applications/crossbar/doc/ref/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Key | Description | Type | Default | Required | Support Level
`ringtones.external` | The alert info SIP header added when the call is from internal sources | `string(0..256)` | | `false` |
`ringtones.internal` | The alert info SIP header added when the call is from external sources | `string(0..256)` | | `false` |
`ringtones` | Ringtone Parameters | `object()` | `{}` | `false` |
`should_create_caller_id_name_if_undefined` | Create the users caller id name from the first and last name fields if no caller id is defined | `boolean()` | | `false` |
`should_create_caller_id` | Create the users caller id name from the first and last name fields if no caller id is defined | `boolean()` | | `false` |
`timezone` | User's timezone | `string()` | | `false` | `supported`
`username` | The GUI login username - alpha-numeric, dashes, at symbol, periods, plusses, and underscores allowed | `string(1..256)` | | `false` | `supported`
`verified` | Determines if the user has been verified | `boolean()` | `false` | `false` |
Expand Down
2 changes: 1 addition & 1 deletion applications/crossbar/doc/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Key | Description | Type | Default | Required | Support Level
`ringtones.external` | The alert info SIP header added when the call is from internal sources | `string(0..256)` | | `false` |
`ringtones.internal` | The alert info SIP header added when the call is from external sources | `string(0..256)` | | `false` |
`ringtones` | Ringtone Parameters | `object()` | `{}` | `false` |
`should_create_caller_id_name_if_undefined` | Create the users caller id name from the first and last name fields if no caller id is defined | `boolean()` | | `false` |
`should_create_caller_id` | Create the users caller id name from the first and last name fields if no caller id is defined | `boolean()` | | `false` |
`timezone` | User's timezone | `string()` | | `false` | `supported`
`username` | The GUI login username - alpha-numeric, dashes, at symbol, periods, plusses, and underscores allowed | `string(1..256)` | | `false` | `supported`
`verified` | Determines if the user has been verified | `boolean()` | `false` | `false` |
Expand Down
2 changes: 1 addition & 1 deletion applications/crossbar/priv/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -36933,7 +36933,7 @@
},
"type": "object"
},
"should_create_caller_id_name_if_undefined": {
"should_create_caller_id": {
"description": "Create the users caller id name from the first and last name fields if no caller id is defined",
"type": "boolean"
},
Expand Down
2 changes: 1 addition & 1 deletion applications/crossbar/priv/couchdb/schemas/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
},
"type": "object"
},
"should_create_caller_id_name_if_undefined": {
"should_create_caller_id": {
"description": "Create the users caller id name from the first and last name fields if no caller id is defined",
"type": "boolean"
},
Expand Down
36 changes: 27 additions & 9 deletions core/kazoo_documents/src/kzd_users.erl.src
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
-export([ringtones/1, ringtones/2, set_ringtones/2]).
-export([ringtones_external/1, ringtones_external/2, set_ringtones_external/2]).
-export([ringtones_internal/1, ringtones_internal/2, set_ringtones_internal/2]).
-export([should_create_caller_id_name_if_undefined/1, should_create_caller_id_name_if_undefined/2, set_should_create_caller_id_name_if_undefined/2]).
-export([should_create_caller_id/1, should_create_caller_id/2, set_should_create_caller_id/2]).
-export([timezone/1, timezone/2, set_timezone/2]).
-export([username/1, username/2, set_username/2]).
-export([verified/1, verified/2, set_verified/2]).
Expand Down Expand Up @@ -664,17 +664,35 @@ ringtones_internal(Doc, Default) ->
set_ringtones_internal(Doc, RingtonesInternal) ->
kz_json:set_value([<<"ringtones">>, <<"internal">>], RingtonesInternal, Doc).

<<<<<<< HEAD
-spec should_create_caller_id_name_if_undefined(doc()) -> kz_term:api_boolean().
should_create_caller_id_name_if_undefined(Doc) ->
should_create_caller_id_name_if_undefined(Doc, 'undefined').

-spec should_create_caller_id_name_if_undefined(doc(), Default) -> boolean() | Default.
should_create_caller_id_name_if_undefined(Doc, Default) ->
kz_json:get_boolean_value([<<"should_create_caller_id_name_if_undefined">>], Doc, Default).

-spec set_should_create_caller_id_name_if_undefined(doc(), boolean()) -> doc().
set_should_create_caller_id_name_if_undefined(Doc, ShouldCreateCallerIdNameIfUndefined) ->
kz_json:set_value([<<"should_create_caller_id_name_if_undefined">>], ShouldCreateCallerIdNameIfUndefined, Doc).
=======
-spec seat_type(doc()) -> binary().
seat_type(Doc) ->
seat_type(Doc, <<"default">>).

-spec seat_type(doc(), Default) -> binary() | Default.
seat_type(Doc, Default) ->
kz_json:get_binary_value([<<"seat_type">>], Doc, Default).

-spec set_seat_type(doc(), binary()) -> doc().
set_seat_type(Doc, SeatType) ->
kz_json:set_value([<<"seat_type">>], SeatType, Doc).

-spec should_create_caller_id(doc()) -> kz_term:api_boolean().
should_create_caller_id(Doc) ->
should_create_caller_id(Doc, 'undefined').
>>>>>>> 519000b0ec... PISTON-1289: Changed the var name from

-spec should_create_caller_id(doc(), Default) -> boolean() | Default.
should_create_caller_id(Doc, Default) ->
kz_json:get_boolean_value([<<"should_create_caller_id">>], Doc, Default).

-spec set_should_create_caller_id(doc(), boolean()) -> doc().
set_should_create_caller_id(Doc, ShouldCreateCallerId) ->
kz_json:set_value([<<"should_create_caller_id">>], ShouldCreateCallerId, Doc).

-spec timezone(doc()) -> kz_term:api_binary().
timezone(Doc) ->
Expand Down
4 changes: 2 additions & 2 deletions core/kazoo_endpoint/src/kz_endpoint.erl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

-define(RECORDING_ARGS(Call, Data), [kapps_call:clear_helpers(Call), Data]).

-define(SHOULD_CREATE_CALLER_ID_NAME_IF_UNDEFINED(UserJObj), kzd_users:should_create_caller_id_name_if_undefined(UserJObj, 'true')).
-define(SHOULD_CREATE_CALLER_ID(UserJObj), kzd_users:should_create_caller_id(UserJObj, 'true')).

-type sms_route() :: {binary(), kz_term:proplist()}.
-type sms_routes() :: [sms_route(), ...].
Expand Down Expand Up @@ -502,7 +502,7 @@ merge_value(Key, Account, Endpoint, Owner) ->
caller_id_owner_attr(Owner) ->
OwnerAttr = kz_json:get_json_value(<<"caller_id">>, Owner, kz_json:new()),
L = [<<"internal">>, <<"name">>],
case ?SHOULD_CREATE_CALLER_ID_NAME_IF_UNDEFINED(Owner)
case ?SHOULD_CREATE_CALLER_ID(Owner)
andalso not kz_json:is_defined(L, OwnerAttr) of
'true' ->
lager:debug("creating caller id name from users first and last name"),
Expand Down

0 comments on commit 92b4407

Please sign in to comment.