Fix notification: --all dont relay on a repo #159

Merged
6543 merged 2 commits from 6543/tea:fix_notify-outside-repo into master 2020-07-20 03:09:38 +00:00
2 changed files with 7 additions and 5 deletions

View File

@ -197,6 +197,9 @@ func curGitRepoPath(path string) (*Login, string, error) {
} else {
repo, err = git.RepoFromPath(path)
}
if err != nil {
return nil, "", err
}
gitConfig, err := repo.Config()
if err != nil {
return nil, "", err

View File

@ -46,9 +46,6 @@ var CmdNotifications = cli.Command{
}
func runNotifications(ctx *cli.Context) error {
login, owner, repo := initCommand()
client := login.Client()
var news []*gitea.NotificationThread
var err error
@ -58,11 +55,13 @@ func runNotifications(ctx *cli.Context) error {
}
if ctx.Bool("all") {
news, err = client.ListNotifications(gitea.ListNotificationOptions{
login := initCommandLoginOnly()
news, err = login.Client().ListNotifications(gitea.ListNotificationOptions{
ListOptions: listOpts,
})
} else {
news, err = client.ListRepoNotifications(owner, repo, gitea.ListNotificationOptions{
login, owner, repo := initCommand()
news, err = login.Client().ListRepoNotifications(owner, repo, gitea.ListNotificationOptions{
ListOptions: listOpts,
})
}