{"action":"created","comment":{"url":"https://api.github.com/repos/gogits/gogs/pulls/comments/77080349","id":77080349,"diff_hunk":"@@ -282,26 +271,87 @@ func Issues(ctx *context.Context) {\n \t\treturn\n \t}\n \n-\t// Get posters and repository.\n-\tfor i := range issues {\n-\t\tissues[i].Repo, err = models.GetRepositoryByID(issues[i].RepoID)\n+\tvar filterIssues []*models.Issue\n+\tif filterMode == models.FM_ASSIGN {\n+\t\tfilterIssues = assignedIssues\n+\t} else if filterMode == models.FM_CREATE {\n+\t\tfilterIssues = createdIssues\n+\t} else {\n+\t\tfilterIssues = yourIssues\n+\t}\n+\n+\tshowRepos    := make([]*models.Repository, 0, len(filterIssues))\n+\tshowReposSet := make(map[int64]bool)\n+\n+\tif repoID > 0 {\n+\t\trepo, err := models.GetRepositoryByID(repoID)\n+\t\tif err != nil {\n+\t\t\tctx.Handle(500, \"GetRepositoryByID\", fmt.Errorf(\"[#%d]%v\", repoID, err))\n+\t\t\treturn\n+\t\t}\n+\n+\t\tif err = repo.GetOwner(); err != nil {\n+\t\t\tctx.Handle(500, \"GetOwner\", fmt.Errorf(\"[#%d]%v\", repoID, err))\n+\t\t\treturn\n+\t\t}\n+\n+\t\tshowReposSet[repoID] = true\n+\t\tshowRepos            = append(showRepos, repo)\n+\t}\n+\n+\tshowIssues   := make([]*models.Issue, 0, len(filterIssues))\n+\tfor _, issue := range filterIssues {\n+\t\t// Check if we want to show this issue.\n+\t\tif (issue.IsClosed != isShowClosed) ||\n+\t\t(repoID > 0 && repoID != issue.RepoID) {\n+\t\t\tcontinue\n+\t\t}\n+\n+\t\t// Get Repository data.\n+\t\tissue.Repo, err = models.GetRepositoryByID(issue.RepoID)\n \t\tif err != nil {\n-\t\t\tctx.Handle(500, \"GetRepositoryByID\", fmt.Errorf(\"[#%d]%v\", issues[i].ID, err))\n+\t\t\tctx.Handle(500, \"GetRepositoryByID\", fmt.Errorf(\"[#%d]%v\", issue.RepoID, err))\n \t\t\treturn\n \t\t}\n \n-\t\tif err = issues[i].Repo.GetOwner(); err != nil {\n-\t\t\tctx.Handle(500, \"GetOwner\", fmt.Errorf(\"[#%d]%v\", issues[i].ID, err))\n+\t\t// Get Owner data.\n+\t\tif err = issue.Repo.GetOwner(); err != nil {\n+\t\t\tctx.Handle(500, \"GetOwner\", fmt.Errorf(\"[#%d]%v\", issue.RepoID, err))\n \t\t\treturn\n \t\t}\n+\n+\t\t// Append to list of issues and repos.\n+\t\tshowIssues  = append(showIssues, issue)\n+\t\tif filterMode == models.FM_YOUR_REPOSITORIES {\n+\t\t\t// Use a map to make sure we don't add the same Repository twice.\n+\t\t\t_, ok := showReposSet[issue.RepoID]\n+\t\t\tif !ok {\n+\t\t\t\tshowReposSet[issue.RepoID] = true\n+\t\t\t\t// Append to list of shown Repositories.\n+\t\t\t\tshowRepos                  = append(showRepos, issue.Repo)\n+\t\t\t}\n+\t\t}\n \t}\n-\tctx.Data[\"Issues\"] = issues\n \n-\tctx.Data[\"IssueStats\"] = issueStats\n-\tctx.Data[\"ViewType\"] = viewType\n-\tctx.Data[\"SortType\"] = sortType\n-\tctx.Data[\"RepoID\"] = repoID\n+\tvar issueStats *models.IssueStats\n+\tif filterMode == models.FM_YOUR_REPOSITORIES {\n+\t\tissueStats = models.GetUserIssueStats(repoID, ctxUser.ID, userRepoIDs, filterMode, isPullList)\n+\t} else {\n+\t\tissueStats = models.GetUserIssueStats(repoID, ctxUser.ID, nil, filterMode, isPullList)\n+\t}\n+\tissueStats.YourRepositoriesCount = int64(len(yourIssues))","path":"routers/user/home.go","position":225,"original_position":225,"commit_id":"2761891b73fc0a150c222521f1cc437998892230","original_commit_id":"2761891b73fc0a150c222521f1cc437998892230","user":{"login":"hgaiser","id":716138,"avatar_url":"https://avatars.githubusercontent.com/u/716138?v=3","gravatar_id":"","url":"https://api.github.com/users/hgaiser","html_url":"https://github.com/hgaiser","followers_url":"https://api.github.com/users/hgaiser/followers","following_url":"https://api.github.com/users/hgaiser/following{/other_user}","gists_url":"https://api.github.com/users/hgaiser/gists{/gist_id}","starred_url":"https://api.github.com/users/hgaiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgaiser/subscriptions","organizations_url":"https://api.github.com/users/hgaiser/orgs","repos_url":"https://api.github.com/users/hgaiser/repos","events_url":"https://api.github.com/users/hgaiser/events{/privacy}","received_events_url":"https://api.github.com/users/hgaiser/received_events","type":"User","site_admin":false},"body":"Right, but then filtered on for example assignee in the case of \"Assigned to you\", so total number of open issues assigned to you at that moment.","created_at":"2016-08-31T21:50:13Z","updated_at":"2016-08-31T21:50:13Z","html_url":"https://github.com/gogits/gogs/pull/3560#discussion_r77080349","pull_request_url":"https://api.github.com/repos/gogits/gogs/pulls/3560","_links":{"self":{"href":"https://api.github.com/repos/gogits/gogs/pulls/comments/77080349"},"html":{"href":"https://github.com/gogits/gogs/pull/3560#discussion_r77080349"},"pull_request":{"href":"https://api.github.com/repos/gogits/gogs/pulls/3560"}}},"pull_request":{"url":"https://api.github.com/repos/gogits/gogs/pulls/3560","id":83482724,"html_url":"https://github.com/gogits/gogs/pull/3560","diff_url":"https://github.com/gogits/gogs/pull/3560.diff","patch_url":"https://github.com/gogits/gogs/pull/3560.patch","issue_url":"https://api.github.com/repos/gogits/gogs/issues/3560","number":3560,"state":"open","locked":false,"title":"Fix assigned/created issues in dashboard.","user":{"login":"hgaiser","id":716138,"avatar_url":"https://avatars.githubusercontent.com/u/716138?v=3","gravatar_id":"","url":"https://api.github.com/users/hgaiser","html_url":"https://github.com/hgaiser","followers_url":"https://api.github.com/users/hgaiser/followers","following_url":"https://api.github.com/users/hgaiser/following{/other_user}","gists_url":"https://api.github.com/users/hgaiser/gists{/gist_id}","starred_url":"https://api.github.com/users/hgaiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgaiser/subscriptions","organizations_url":"https://api.github.com/users/hgaiser/orgs","repos_url":"https://api.github.com/users/hgaiser/repos","events_url":"https://api.github.com/users/hgaiser/events{/privacy}","received_events_url":"https://api.github.com/users/hgaiser/received_events","type":"User","site_admin":false},"body":"This pull requests adds functionality to the Issues and Pull Requests view in the Dashboard. Previously these pages would only show Issues / Pull Requests placed in repositories **owned** by the user. This pull request changes the functionality of the \"Assigned to you\" and \"Created by you\" filters. These filters now show Issues / Pull Requests you are assigned to or you created from **any** repository. Issues related to this pull request are:\r\n\r\n~~https://github.com/gogits/gogs/issues/3511~~\r\nhttps://github.com/gogits/gogs/issues/1820\r\n~~https://github.com/gogits/gogs/issues/2202~~\r\nhttps://github.com/gogits/gogs/issues/1580\r\n~~https://github.com/gogits/gogs/issues/2518~~\r\n~~https://github.com/gogits/gogs/issues/2865~~\r\n~~https://github.com/gogits/gogs/issues/3052~~\r\n~~https://github.com/gogits/gogs/issues/3132~~\r\n\r\nFeedback on this Pull Request is appreciated, as I understand it there are strict guidelines ;)","created_at":"2016-08-31T16:09:29Z","updated_at":"2016-08-31T21:50:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ef524f0e6751ba4e44bed5a2360baa2da354d0c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/gogits/gogs/pulls/3560/commits","review_comments_url":"https://api.github.com/repos/gogits/gogs/pulls/3560/comments","review_comment_url":"https://api.github.com/repos/gogits/gogs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gogits/gogs/issues/3560/comments","statuses_url":"https://api.github.com/repos/gogits/gogs/statuses/2761891b73fc0a150c222521f1cc437998892230","head":{"label":"delftrobotics-forks:organizations-issues-dashboard","ref":"organizations-issues-dashboard","sha":"2761891b73fc0a150c222521f1cc437998892230","user":{"login":"delftrobotics-forks","id":21259075,"avatar_url":"https://avatars.githubusercontent.com/u/21259075?v=3","gravatar_id":"","url":"https://api.github.com/users/delftrobotics-forks","html_url":"https://github.com/delftrobotics-forks","followers_url":"https://api.github.com/users/delftrobotics-forks/followers","following_url":"https://api.github.com/users/delftrobotics-forks/following{/other_user}","gists_url":"https://api.github.com/users/delftrobotics-forks/gists{/gist_id}","starred_url":"https://api.github.com/users/delftrobotics-forks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delftrobotics-forks/subscriptions","organizations_url":"https://api.github.com/users/delftrobotics-forks/orgs","repos_url":"https://api.github.com/users/delftrobotics-forks/repos","events_url":"https://api.github.com/users/delftrobotics-forks/events{/privacy}","received_events_url":"https://api.github.com/users/delftrobotics-forks/received_events","type":"Organization","site_admin":false},"repo":{"id":66947973,"name":"gogs","full_name":"delftrobotics-forks/gogs","owner":{"login":"delftrobotics-forks","id":21259075,"avatar_url":"https://avatars.githubusercontent.com/u/21259075?v=3","gravatar_id":"","url":"https://api.github.com/users/delftrobotics-forks","html_url":"https://github.com/delftrobotics-forks","followers_url":"https://api.github.com/users/delftrobotics-forks/followers","following_url":"https://api.github.com/users/delftrobotics-forks/following{/other_user}","gists_url":"https://api.github.com/users/delftrobotics-forks/gists{/gist_id}","starred_url":"https://api.github.com/users/delftrobotics-forks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delftrobotics-forks/subscriptions","organizations_url":"https://api.github.com/users/delftrobotics-forks/orgs","repos_url":"https://api.github.com/users/delftrobotics-forks/repos","events_url":"https://api.github.com/users/delftrobotics-forks/events{/privacy}","received_events_url":"https://api.github.com/users/delftrobotics-forks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/delftrobotics-forks/gogs","description":"Gogs (Go Git Service) is a painless self-hosted Git service.","fork":true,"url":"https://api.github.com/repos/delftrobotics-forks/gogs","forks_url":"https://api.github.com/repos/delftrobotics-forks/gogs/forks","keys_url":"https://api.github.com/repos/delftrobotics-forks/gogs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/delftrobotics-forks/gogs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/delftrobotics-forks/gogs/teams","hooks_url":"https://api.github.com/repos/delftrobotics-forks/gogs/hooks","issue_events_url":"https://api.github.com/repos/delftrobotics-forks/gogs/issues/events{/number}","events_url":"https://api.github.com/repos/delftrobotics-forks/gogs/events","assignees_url":"https://api.github.com/repos/delftrobotics-forks/gogs/assignees{/user}","branches_url":"https://api.github.com/repos/delftrobotics-forks/gogs/branches{/branch}","tags_url":"https://api.github.com/repos/delftrobotics-forks/gogs/tags","blobs_url":"https://api.github.com/repos/delftrobotics-forks/gogs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/delftrobotics-forks/gogs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/delftrobotics-forks/gogs/git/refs{/sha}","trees_url":"https://api.github.com/repos/delftrobotics-forks/gogs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/delftrobotics-forks/gogs/statuses/{sha}","languages_url":"https://api.github.com/repos/delftrobotics-forks/gogs/languages","stargazers_url":"https://api.github.com/repos/delftrobotics-forks/gogs/stargazers","contributors_url":"https://api.github.com/repos/delftrobotics-forks/gogs/contributors","subscribers_url":"https://api.github.com/repos/delftrobotics-forks/gogs/subscribers","subscription_url":"https://api.github.com/repos/delftrobotics-forks/gogs/subscription","commits_url":"https://api.github.com/repos/delftrobotics-forks/gogs/commits{/sha}","git_commits_url":"https://api.github.com/repos/delftrobotics-forks/gogs/git/commits{/sha}","comments_url":"https://api.github.com/repos/delftrobotics-forks/gogs/comments{/number}","issue_comment_url":"https://api.github.com/repos/delftrobotics-forks/gogs/issues/comments{/number}","contents_url":"https://api.github.com/repos/delftrobotics-forks/gogs/contents/{+path}","compare_url":"https://api.github.com/repos/delftrobotics-forks/gogs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/delftrobotics-forks/gogs/merges","archive_url":"https://api.github.com/repos/delftrobotics-forks/gogs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/delftrobotics-forks/gogs/downloads","issues_url":"https://api.github.com/repos/delftrobotics-forks/gogs/issues{/number}","pulls_url":"https://api.github.com/repos/delftrobotics-forks/gogs/pulls{/number}","milestones_url":"https://api.github.com/repos/delftrobotics-forks/gogs/milestones{/number}","notifications_url":"https://api.github.com/repos/delftrobotics-forks/gogs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/delftrobotics-forks/gogs/labels{/name}","releases_url":"https://api.github.com/repos/delftrobotics-forks/gogs/releases{/id}","deployments_url":"https://api.github.com/repos/delftrobotics-forks/gogs/deployments","created_at":"2016-08-30T14:25:18Z","updated_at":"2016-08-30T14:25:21Z","pushed_at":"2016-08-31T16:13:29Z","git_url":"git://github.com/delftrobotics-forks/gogs.git","ssh_url":"git@github.com:delftrobotics-forks/gogs.git","clone_url":"https://github.com/delftrobotics-forks/gogs.git","svn_url":"https://github.com/delftrobotics-forks/gogs","homepage":"https://gogs.io","size":75043,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gogits:develop","ref":"develop","sha":"c2afdf2192b9f0287968e29160e30a45a3ff1339","user":{"login":"gogits","id":6656686,"avatar_url":"https://avatars.githubusercontent.com/u/6656686?v=3","gravatar_id":"","url":"https://api.github.com/users/gogits","html_url":"https://github.com/gogits","followers_url":"https://api.github.com/users/gogits/followers","following_url":"https://api.github.com/users/gogits/following{/other_user}","gists_url":"https://api.github.com/users/gogits/gists{/gist_id}","starred_url":"https://api.github.com/users/gogits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gogits/subscriptions","organizations_url":"https://api.github.com/users/gogits/orgs","repos_url":"https://api.github.com/users/gogits/repos","events_url":"https://api.github.com/users/gogits/events{/privacy}","received_events_url":"https://api.github.com/users/gogits/received_events","type":"Organization","site_admin":false},"repo":{"id":16752620,"name":"gogs","full_name":"gogits/gogs","owner":{"login":"gogits","id":6656686,"avatar_url":"https://avatars.githubusercontent.com/u/6656686?v=3","gravatar_id":"","url":"https://api.github.com/users/gogits","html_url":"https://github.com/gogits","followers_url":"https://api.github.com/users/gogits/followers","following_url":"https://api.github.com/users/gogits/following{/other_user}","gists_url":"https://api.github.com/users/gogits/gists{/gist_id}","starred_url":"https://api.github.com/users/gogits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gogits/subscriptions","organizations_url":"https://api.github.com/users/gogits/orgs","repos_url":"https://api.github.com/users/gogits/repos","events_url":"https://api.github.com/users/gogits/events{/privacy}","received_events_url":"https://api.github.com/users/gogits/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gogits/gogs","description":"Gogs (Go Git Service) is a painless self-hosted Git service.","fork":false,"url":"https://api.github.com/repos/gogits/gogs","forks_url":"https://api.github.com/repos/gogits/gogs/forks","keys_url":"https://api.github.com/repos/gogits/gogs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gogits/gogs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gogits/gogs/teams","hooks_url":"https://api.github.com/repos/gogits/gogs/hooks","issue_events_url":"https://api.github.com/repos/gogits/gogs/issues/events{/number}","events_url":"https://api.github.com/repos/gogits/gogs/events","assignees_url":"https://api.github.com/repos/gogits/gogs/assignees{/user}","branches_url":"https://api.github.com/repos/gogits/gogs/branches{/branch}","tags_url":"https://api.github.com/repos/gogits/gogs/tags","blobs_url":"https://api.github.com/repos/gogits/gogs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gogits/gogs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gogits/gogs/git/refs{/sha}","trees_url":"https://api.github.com/repos/gogits/gogs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gogits/gogs/statuses/{sha}","languages_url":"https://api.github.com/repos/gogits/gogs/languages","stargazers_url":"https://api.github.com/repos/gogits/gogs/stargazers","contributors_url":"https://api.github.com/repos/gogits/gogs/contributors","subscribers_url":"https://api.github.com/repos/gogits/gogs/subscribers","subscription_url":"https://api.github.com/repos/gogits/gogs/subscription","commits_url":"https://api.github.com/repos/gogits/gogs/commits{/sha}","git_commits_url":"https://api.github.com/repos/gogits/gogs/git/commits{/sha}","comments_url":"https://api.github.com/repos/gogits/gogs/comments{/number}","issue_comment_url":"https://api.github.com/repos/gogits/gogs/issues/comments{/number}","contents_url":"https://api.github.com/repos/gogits/gogs/contents/{+path}","compare_url":"https://api.github.com/repos/gogits/gogs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gogits/gogs/merges","archive_url":"https://api.github.com/repos/gogits/gogs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gogits/gogs/downloads","issues_url":"https://api.github.com/repos/gogits/gogs/issues{/number}","pulls_url":"https://api.github.com/repos/gogits/gogs/pulls{/number}","milestones_url":"https://api.github.com/repos/gogits/gogs/milestones{/number}","notifications_url":"https://api.github.com/repos/gogits/gogs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gogits/gogs/labels{/name}","releases_url":"https://api.github.com/repos/gogits/gogs/releases{/id}","deployments_url":"https://api.github.com/repos/gogits/gogs/deployments","created_at":"2014-02-12T01:57:08Z","updated_at":"2016-08-31T20:26:01Z","pushed_at":"2016-08-31T21:22:57Z","git_url":"git://github.com/gogits/gogs.git","ssh_url":"git@github.com:gogits/gogs.git","clone_url":"https://github.com/gogits/gogs.git","svn_url":"https://github.com/gogits/gogs","homepage":"https://gogs.io","size":87929,"stargazers_count":15380,"watchers_count":15380,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1645,"mirror_url":null,"open_issues_count":375,"forks":1645,"open_issues":375,"watchers":15380,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gogits/gogs/pulls/3560"},"html":{"href":"https://github.com/gogits/gogs/pull/3560"},"issue":{"href":"https://api.github.com/repos/gogits/gogs/issues/3560"},"comments":{"href":"https://api.github.com/repos/gogits/gogs/issues/3560/comments"},"review_comments":{"href":"https://api.github.com/repos/gogits/gogs/pulls/3560/comments"},"review_comment":{"href":"https://api.github.com/repos/gogits/gogs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gogits/gogs/pulls/3560/commits"},"statuses":{"href":"https://api.github.com/repos/gogits/gogs/statuses/2761891b73fc0a150c222521f1cc437998892230"}}}}
{"actor":{"display_login":"hgaiser"}}