loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Prevent NPE due to missing repo in regression in #17551 (#17697)

authored by

zeripath and committed by
GitHub
878c2ce6 1f1ae571

+14 -2
+14 -2
models/issue.go
··· 1928 1928 1929 1929 // Get Blocked By Dependencies, aka all issues this issue is blocked by. 1930 1930 func (issue *Issue) getBlockedByDependencies(e db.Engine) (issueDeps []*DependencyInfo, err error) { 1931 - return issueDeps, e. 1931 + err = e. 1932 1932 Table("issue"). 1933 1933 Join("INNER", "repository", "repository.id = issue.repo_id"). 1934 1934 Join("INNER", "issue_dependency", "issue_dependency.dependency_id = issue.id"). ··· 1936 1936 // sort by repo id then created date, with the issues of the same repo at the beginning of the list 1937 1937 OrderBy("CASE WHEN issue.repo_id = " + strconv.FormatInt(issue.RepoID, 10) + " THEN 0 ELSE issue.repo_id END, issue.created_unix DESC"). 1938 1938 Find(&issueDeps) 1939 + 1940 + for _, depInfo := range issueDeps { 1941 + depInfo.Issue.Repo = &depInfo.Repository 1942 + } 1943 + 1944 + return issueDeps, err 1939 1945 } 1940 1946 1941 1947 // Get Blocking Dependencies, aka all issues this issue blocks. 1942 1948 func (issue *Issue) getBlockingDependencies(e db.Engine) (issueDeps []*DependencyInfo, err error) { 1943 - return issueDeps, e. 1949 + err = e. 1944 1950 Table("issue"). 1945 1951 Join("INNER", "repository", "repository.id = issue.repo_id"). 1946 1952 Join("INNER", "issue_dependency", "issue_dependency.issue_id = issue.id"). ··· 1948 1954 // sort by repo id then created date, with the issues of the same repo at the beginning of the list 1949 1955 OrderBy("CASE WHEN issue.repo_id = " + strconv.FormatInt(issue.RepoID, 10) + " THEN 0 ELSE issue.repo_id END, issue.created_unix DESC"). 1950 1956 Find(&issueDeps) 1957 + 1958 + for _, depInfo := range issueDeps { 1959 + depInfo.Issue.Repo = &depInfo.Repository 1960 + } 1961 + 1962 + return issueDeps, err 1951 1963 } 1952 1964 1953 1965 // BlockedByDependencies finds all Dependencies an issue is blocked by