mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
Fix wrong display of recently pushed notification (#25812)
There's a bug in #25715: If user pushed a commit into another repo with same branch name, the no-related repo will display the recently pushed notification incorrectly. It is simple to fix this, we should match the repo id in the sql query.  The latest commit is 2 weeks ago.  The notification comes from another repo with same branch name:  After: In forked repo:  New PR Link will redirect to the original repo:  In the original repo:  New PR Link:  In the same repo:  New PR Link:  08/15 Update: Follow #26257, added permission check and logic fix mentioned in https://github.com/go-gitea/gitea/pull/26257#discussion_r1294085203 2024/04/25 Update: Fix #30611 --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -29,6 +29,7 @@ func TestUserOrgs(t *testing.T) {
|
||||
|
||||
org3 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "org3"})
|
||||
org17 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "org17"})
|
||||
org35 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "private_org35"})
|
||||
|
||||
assert.Equal(t, []*api.Organization{
|
||||
{
|
||||
@@ -55,6 +56,18 @@ func TestUserOrgs(t *testing.T) {
|
||||
Location: "",
|
||||
Visibility: "public",
|
||||
},
|
||||
{
|
||||
ID: 35,
|
||||
Name: org35.Name,
|
||||
UserName: org35.Name,
|
||||
FullName: org35.FullName,
|
||||
Email: org35.Email,
|
||||
AvatarURL: org35.AvatarLink(db.DefaultContext),
|
||||
Description: "",
|
||||
Website: "",
|
||||
Location: "",
|
||||
Visibility: "private",
|
||||
},
|
||||
}, orgs)
|
||||
|
||||
// user itself should get it's org's he is a member of
|
||||
@@ -102,6 +115,7 @@ func TestMyOrgs(t *testing.T) {
|
||||
DecodeJSON(t, resp, &orgs)
|
||||
org3 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "org3"})
|
||||
org17 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "org17"})
|
||||
org35 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "private_org35"})
|
||||
|
||||
assert.Equal(t, []*api.Organization{
|
||||
{
|
||||
@@ -128,5 +142,17 @@ func TestMyOrgs(t *testing.T) {
|
||||
Location: "",
|
||||
Visibility: "public",
|
||||
},
|
||||
{
|
||||
ID: 35,
|
||||
Name: org35.Name,
|
||||
UserName: org35.Name,
|
||||
FullName: org35.FullName,
|
||||
Email: org35.Email,
|
||||
AvatarURL: org35.AvatarLink(db.DefaultContext),
|
||||
Description: "",
|
||||
Website: "",
|
||||
Location: "",
|
||||
Visibility: "private",
|
||||
},
|
||||
}, orgs)
|
||||
}
|
||||
|
Reference in New Issue
Block a user