Skip to content

Commit

Permalink
[MI-2582]:Fixed review comments for github issue mattermost#613 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kshitij-Katiyar authored Jan 9, 2023
1 parent 7ab3af2 commit 862efaa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
9 changes: 3 additions & 6 deletions server/plugin/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,6 @@ func (p *Plugin) getUnreadsData(c *UserContext) []*FilteredNotification {
}

func (p *Plugin) getReviewsData(c *UserContext) []*github.Issue {
var issue []*github.Issue
config := p.getConfiguration()

githubClient := p.githubConnectUser(c.Context.Ctx, c.GHInfo)
Expand All @@ -714,14 +713,13 @@ func (p *Plugin) getReviewsData(c *UserContext) []*github.Issue {
result, _, err := githubClient.Search.Issues(c.Ctx, query, &github.SearchOptions{})
if err != nil {
c.Log.WithError(err).With(logger.LogContext{"query": query}).Warnf("Failed to search for review")
return issue
return []*github.Issue{}
}

return result.Issues
}

func (p *Plugin) getYourPrsData(c *UserContext) []*github.Issue {
var issue []*github.Issue
config := p.getConfiguration()

githubClient := p.githubConnectUser(c.Context.Ctx, c.GHInfo)
Expand All @@ -731,7 +729,7 @@ func (p *Plugin) getYourPrsData(c *UserContext) []*github.Issue {
result, _, err := githubClient.Search.Issues(c.Ctx, query, &github.SearchOptions{})
if err != nil {
c.Log.WithError(err).With(logger.LogContext{"query": query}).Warnf("Failed to search for PRs")
return issue
return []*github.Issue{}
}

return result.Issues
Expand Down Expand Up @@ -980,7 +978,6 @@ func (p *Plugin) createIssueComment(c *UserContext, w http.ResponseWriter, r *ht
}

func (p *Plugin) getYourAssignmentsData(c *UserContext) []*github.Issue {
var issue []*github.Issue
config := p.getConfiguration()

githubClient := p.githubConnectUser(c.Context.Ctx, c.GHInfo)
Expand All @@ -990,7 +987,7 @@ func (p *Plugin) getYourAssignmentsData(c *UserContext) []*github.Issue {
result, _, err := githubClient.Search.Issues(c.Ctx, query, &github.SearchOptions{})
if err != nil {
c.Log.WithError(err).With(logger.LogContext{"query": query}).Warnf("Failed to search for assignments")
return issue
return []*github.Issue{}
}

return result.Issues
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/sidebar_buttons/sidebar_buttons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class SidebarButtons extends React.PureComponent {
}

this.setState({refreshing: true});
await Promise.resolve(this.props.actions.getSidebarContent());
await this.props.actions.getSidebarContent();
this.setState({refreshing: false});
}

Expand Down
14 changes: 7 additions & 7 deletions webapp/src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ import {combineReducers} from 'redux';
import ActionTypes from '../action_types';
import Constants from '../constants';

const defaultSidebarContent = {
reviews: [],
prs: [],
assignments: [],
unreads: [],
};

function connected(state = false, action) {
switch (action.type) {
case ActionTypes.RECEIVED_CONNECTED:
Expand Down Expand Up @@ -93,6 +86,13 @@ function reviewsDetails(state = [], action) {
}
}

const defaultSidebarContent = {
reviews: [],
prs: [],
assignments: [],
unreads: [],
};

function sidebarContent(state = defaultSidebarContent, action) {
switch (action.type) {
case ActionTypes.RECEIVED_SIDEBAR_CONTENT:
Expand Down

0 comments on commit 862efaa

Please sign in to comment.