Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/plugin/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ func (p *Plugin) getConnected(c *Context, w http.ResponseWriter, r *http.Request
}

info, err := p.getGitHubUserInfo(c.UserID)
if err != nil {
if err != nil && err.ID != apiErrorIDNotConnected {
c.Log.WithError(err).Errorf("failed to get GitHub user info")
p.writeAPIError(w, &APIErrorResponse{Message: fmt.Sprintf("failed to get GitHub user info. %s", err.Message), StatusCode: err.StatusCode})
return
Expand Down
4 changes: 3 additions & 1 deletion server/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@ func (p *Plugin) sendRefreshEvent(userID string) {

info, apiErr := p.getGitHubUserInfo(context.UserID)
if apiErr != nil {
p.client.Log.Warn("Failed to get github user info", "error", apiErr.Error())
if apiErr.ID != apiErrorIDNotConnected {
p.client.Log.Debug("Failed to get github user info", "error", apiErr.Error())
}
return
}

Expand Down
8 changes: 0 additions & 8 deletions server/plugin/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ func TestHandleCommentMentionNotification(t *testing.T) {
mockAPI.On("GetDirectChannel", "otherUserID", "mockBotID").Return(&model.Channel{Id: "mockChannelID"}, nil).Times(1)
mockAPI.On("CreatePost", mock.Anything).Return(nil, &model.AppError{Message: "error creating post"}).Times(1)
mockAPI.On("LogWarn", "Error creating mention post", "error", "error creating post").Times(1)
mockAPI.On("LogWarn", "Failed to get github user info", "error", "Must connect user account to GitHub first.").Times(1)
},
},
{
Expand All @@ -526,7 +525,6 @@ func TestHandleCommentMentionNotification(t *testing.T) {
})).Return(nil).Times(1)
mockAPI.On("GetDirectChannel", "otherUserID", "mockBotID").Return(&model.Channel{Id: "mockChannelID"}, nil).Times(1)
mockAPI.On("CreatePost", mock.Anything).Return(&model.Post{}, nil).Times(1)
mockAPI.On("LogWarn", "Failed to get github user info", "error", "Must connect user account to GitHub first.")
},
},
}
Expand Down Expand Up @@ -609,7 +607,6 @@ func TestHandleCommentAuthorNotification(t *testing.T) {
})).Return(nil).Times(1)
mockAPI.On("GetDirectChannel", "authorUserID", "mockBotID").Return(&model.Channel{Id: "mockChannelID"}, nil).Times(1)
mockAPI.On("CreatePost", mock.Anything).Return(&model.Post{}, nil, &model.AppError{Message: "error creating post"}).Times(1)
mockAPI.On("LogWarn", "Failed to get github user info", "error", "Must connect user account to GitHub first.").Times(1)
},
},
{
Expand All @@ -628,7 +625,6 @@ func TestHandleCommentAuthorNotification(t *testing.T) {
_, ok := val.(**GitHubUserInfo)
return ok
})).Return(nil).Times(1)
mockAPI.On("LogWarn", "Failed to get github user info", "error", "Must connect user account to GitHub first.").Times(1)
mockAPI.On("GetDirectChannel", "authorUserID", "mockBotID").Return(&model.Channel{Id: "mockChannelID"}, nil).Times(1)
mockAPI.On("CreatePost", mock.Anything).Return(&model.Post{}, nil).Times(1)
},
Expand Down Expand Up @@ -774,7 +770,6 @@ func TestHandlePullRequestNotification(t *testing.T) {
})).Return(nil).Times(1)
mockAPI.On("GetDirectChannel", "authorUserID", "mockBotID").Return(&model.Channel{Id: "mockChannelID"}, nil)
mockAPI.On("CreatePost", mock.Anything).Return(&model.Post{}, nil).Times(1)
mockAPI.On("LogWarn", "Failed to get github user info", "error", "Must connect user account to GitHub first.").Times(1)
},
},
{
Expand Down Expand Up @@ -806,7 +801,6 @@ func TestHandlePullRequestNotification(t *testing.T) {
_, ok := val.(**GitHubUserInfo)
return ok
})).Return(nil).Times(1)
mockAPI.On("LogWarn", "Failed to get github user info", "error", "Must connect user account to GitHub first.").Times(1)
},
},
{
Expand All @@ -823,7 +817,6 @@ func TestHandlePullRequestNotification(t *testing.T) {
_, ok := val.(**GitHubUserInfo)
return ok
})).Return(nil).Times(1)
mockAPI.On("LogWarn", "Failed to get github user info", "error", "Must connect user account to GitHub first.").Times(1)
},
},
{
Expand Down Expand Up @@ -990,7 +983,6 @@ func TestHandlePullRequestReviewNotification(t *testing.T) {
_, ok := val.(**GitHubUserInfo)
return ok
})).Return(nil).Times(1)
mockAPI.On("LogWarn", "Failed to get github user info", "error", "Must connect user account to GitHub first.")
},
},
}
Expand Down
Loading