mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-18 20:23:28 +02:00
username-deprecation: use email and display names
this commit deprecates the searching ability by username and instructs user to provide email or display names in commands. the username parameter has been deprecated completely from v2 and v3 api Signed-off-by: ldelossa <ldelossa@redhat.com>
This commit is contained in:
committed by
Louis DeLosSantos
parent
36e2a914cd
commit
6a27e28c61
+2
-2
@@ -43,7 +43,7 @@ func CmdAssignUsage(cmd *kingpin.CmdClause, opts *AssignOptions) error {
|
||||
return nil
|
||||
}).Bool()
|
||||
cmd.Arg("ISSUE", "issue to assign").Required().StringVar(&opts.Issue)
|
||||
cmd.Arg("ASSIGNEE", "user to assign to issue").StringVar(&opts.Assignee)
|
||||
cmd.Arg("ASSIGNEE", "email or display name of user to assign to issue").StringVar(&opts.Assignee)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func CmdAssign(o *oreo.Client, globals *jiracli.GlobalOptions, opts *AssignOptio
|
||||
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
|
||||
if opts.Assignee != "" && opts.Assignee != "-1" {
|
||||
users, err := jira.UserSearch(o, globals.Endpoint.Value, &jira.UserSearchOptions{
|
||||
Username: opts.Assignee,
|
||||
Query: opts.Assignee,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -180,20 +180,6 @@ func fixUserField(ua jira.HttpClient, endpoint string, userField map[string]inte
|
||||
return nil
|
||||
}
|
||||
|
||||
if username, ok := userField["name"].(string); ok {
|
||||
users, err := jira.UserSearch(ua, endpoint, &jira.UserSearchOptions{
|
||||
Username: username,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(users) != 1 {
|
||||
return fmt.Errorf("Found %d accounts for username %q", len(users), username)
|
||||
}
|
||||
userField["accountId"] = users[0].AccountID
|
||||
return nil
|
||||
}
|
||||
|
||||
queryName, ok := userField["displayName"].(string)
|
||||
if !ok {
|
||||
queryName, ok = userField["emailAddress"].(string)
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ func CmdTakeRegistry() *jiracli.CommandRegistryEntry {
|
||||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
||||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project)
|
||||
if opts.Assignee == "" {
|
||||
opts.Assignee = globals.User.Value
|
||||
opts.Assignee = globals.Login.Value
|
||||
}
|
||||
return CmdAssign(o, globals, &opts)
|
||||
},
|
||||
|
||||
+3
-3
@@ -53,7 +53,7 @@ func CmdWatchUsage(cmd *kingpin.CmdClause, opts *WatchOptions) error {
|
||||
return nil
|
||||
}).Bool()
|
||||
cmd.Arg("ISSUE", "issue to add watcher").Required().StringVar(&opts.Issue)
|
||||
cmd.Arg("WATCHER", "username of watcher to add to issue").StringVar(&opts.Watcher)
|
||||
cmd.Arg("WATCHER", "email or display name of watcher to add to issue").StringVar(&opts.Watcher)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func CmdWatchUsage(cmd *kingpin.CmdClause, opts *WatchOptions) error {
|
||||
// with the 'remove' flag)
|
||||
func CmdWatch(o *oreo.Client, globals *jiracli.GlobalOptions, opts *WatchOptions) error {
|
||||
if opts.Watcher == "" {
|
||||
opts.Watcher = globals.User.Value
|
||||
opts.Watcher = globals.Login.Value
|
||||
}
|
||||
|
||||
if globals.JiraDeploymentType.Value == "" {
|
||||
@@ -74,7 +74,7 @@ func CmdWatch(o *oreo.Client, globals *jiracli.GlobalOptions, opts *WatchOptions
|
||||
|
||||
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
|
||||
users, err := jira.UserSearch(o, globals.Endpoint.Value, &jira.UserSearchOptions{
|
||||
Username: opts.Watcher,
|
||||
Query: opts.Watcher,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user