@@ -224,7 +224,7 @@ namespace eval ::jira {
224
224
$postdata map_open string body string $argarray(body)
225
225
226
226
$postdata map_key author map_open
227
- $postdata map_key name string $author(name )
227
+ $postdata map_key name string $author(displayName )
228
228
$postdata map_close
229
229
230
230
$postdata map_close
@@ -414,14 +414,14 @@ namespace eval ::jira {
414
414
}
415
415
416
416
#
417
- # Given an issue identifier (eg ("JIRA-123") and a username , assign the issue
418
- # to the user. To unassign an issue, pass the username as an empty string.
417
+ # Given an issue identifier (eg ("JIRA-123") and a JIRA account ID , assign the issue
418
+ # to the user. To unassign an issue, pass the account ID as an empty string.
419
419
# Returns 0 or 1 indicating whether the assignment was successful, and any
420
420
# data returned from the API endpoint is stored in _result.
421
421
#
422
422
# See https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-assign
423
423
#
424
- proc assignIssue {issueID username _result} {
424
+ proc assignIssue {issueID accountId _result} {
425
425
upvar 1 $_result result
426
426
unset -nocomplain result
427
427
@@ -431,10 +431,10 @@ namespace eval ::jira {
431
431
432
432
$postdata map_open
433
433
434
- if {$username eq " " } {
435
- $postdata map_key name null
434
+ if {$accountId eq " " } {
435
+ $postdata map_key accountId null
436
436
} else {
437
- $postdata map_key name string $username
437
+ $postdata map_key accountId string $accountId
438
438
}
439
439
440
440
$postdata map_close
@@ -503,24 +503,15 @@ namespace eval ::jira {
503
503
return 0
504
504
}
505
505
}
506
-
507
- #
508
- # Given a username (eg "fred"), get user data and store in _result
506
+
509
507
#
510
- # See https://docs.atlassian.com/jira/REST/cloud/#api/2/user-getUser
508
+ # Get info on the currenty-logged-in user. User data will be stored in _result.
511
509
#
512
- proc getUser {key _result args} {
513
- ::jira::parse_args args argarray
510
+ proc getCurrentUser {_result} {
514
511
upvar 1 $_result result
515
512
unset -nocomplain result
516
-
517
- if {$key == " " } {
518
- set url " [ ::jira::baseurl] /rest/api/2/myself"
519
- } else {
520
- set url " [ ::jira::baseurl] /rest/api/2/user?username=$key "
521
- }
522
-
523
-
513
+
514
+ set url " [ ::jira::baseurl] /rest/api/2/myself"
524
515
if {[::jira::raw $url GET json]} {
525
516
array set result [::yajl::json2dict $json(data) ]
526
517
return 1
@@ -541,7 +532,7 @@ namespace eval ::jira {
541
532
upvar 1 $_result result
542
533
unset -nocomplain result
543
534
544
- set url " [ ::jira::baseurl] /rest/api/2/user/search?username =$email "
535
+ set url " [ ::jira::baseurl] /rest/api/2/user/search?query =$email "
545
536
546
537
if {[::jira::raw $url GET json]} {
547
538
set rawdata [::yajl::json2dict $json(data) ]
@@ -806,7 +797,7 @@ namespace eval ::jira {
806
797
#
807
798
# Parse user JSON and generate basic BasicUser JSON.
808
799
#
809
- proc parseBasicUser {key _result args} {
800
+ proc parseBasicUser {email _result args} {
810
801
::jira::parse_args args argarray
811
802
812
803
upvar 1 $_result result
@@ -816,10 +807,14 @@ namespace eval ::jira {
816
807
array set result $argarray(userDefinition)
817
808
return
818
809
}
810
+
811
+ if {$email eq " " } {
812
+ ::jira::getCurrentUser getUserResult
813
+ } else {
814
+ ::jira::getUserByEmail $email getUserResult
815
+ }
819
816
820
- ::jira::getUser $key getUserResult
821
-
822
- set keyMap [list self name displayName active]
817
+ set keyMap [list self displayName active]
823
818
824
819
foreach key $keyMap {
825
820
set result($key ) $getUserResult($key)
0 commit comments