Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give organisation members access to organisation feeds #33508

Merged
merged 8 commits into from
Mar 15, 2025
Merged

Conversation

job79
Copy link
Contributor

@job79 job79 commented Feb 5, 2025

Currently the organisation feed only includes items for public repositories (for non-administrators). This pull requests adds notifications from private repositories to the organisation-feed (for accounts that have access to the organisation).

Feed-items only get shown for repositories where the users team(s) should have access to, this filtering seems to get done by some existing code.

Needs some tests, but am unsure where/how to add them.

Before:
image

After:
image

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 5, 2025
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 5, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Feb 5, 2025
@wxiaoguang
Copy link
Contributor

Needs some tests, but am unsure where/how to add them.

Hmm yes ..... I guess it does need tests (and yes it's not that easy to write one ......) 🤣

@job79 job79 marked this pull request as draft February 13, 2025 09:48
@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 16, 2025
@job79
Copy link
Contributor Author

job79 commented Mar 15, 2025

Can I get some help with the unit tests? I am receiving the following error but don't understand what is going wrong.

Error Trace:	/home/runner/work/gitea/gitea/models/unittest/testdb.go:203
		/home/runner/work/gitea/gitea/routers/web/feed/profile_test.go:21
Error:      	Received unexpected error:
            	failed to load fixtures from /home/runner/work/gitea/gitea/models/fixtures/action_artifact.yml: no such table: action_artifact
Test:       	TestCheckGetOrgFeedsAsOrgMember

Adding a unit test from another package to the feed package fixes the issue, but I have absolutely no idea why. It doesn't even seem to execute before the other tests.

diff --git a/routers/web/feed/profile_test.go b/routers/web/feed/profile_test.go
index 84e6a82c35..50dc7abc8c 100644
--- a/routers/web/feed/profile_test.go
+++ b/routers/web/feed/profile_test.go
@@ -8,6 +8,7 @@ import (
        "code.gitea.io/gitea/models/unittest"
        user_model "code.gitea.io/gitea/models/user"
        "code.gitea.io/gitea/routers/web/feed"
+       "code.gitea.io/gitea/routers/web/org"
        "code.gitea.io/gitea/services/contexttest"
 
        "github.com/stretchr/testify/assert"
@@ -38,3 +39,9 @@ func TestCheckGetOrgFeedsAsNonOrgMember(t *testing.T) {
        feed.ShowUserFeedAtom(ctx)
        assert.NotContains(t, resp.Body.String(), "<entry>") // Should not contain any entries
 }
+
+func TestAddingThisTestFixesTheIssue(t *testing.T) {
+       unittest.PrepareTestEnv(t)
+       ctx, _ := contexttest.MockContext(t, "user2/-/projects/4/4")
+       org.CheckProjectColumnChangePermissions(ctx) // <- removing this line makes all tests fail
+}

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 15, 2025
@wxiaoguang wxiaoguang marked this pull request as ready for review March 15, 2025 12:22
Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tests should work without any problem now.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 15, 2025
@wxiaoguang wxiaoguang added this to the 1.24.0 milestone Mar 15, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 15, 2025
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 15, 2025
@lunny lunny enabled auto-merge (squash) March 15, 2025 17:24
@lunny lunny merged commit 30b1394 into go-gitea:main Mar 15, 2025
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 15, 2025
@job79
Copy link
Contributor Author

job79 commented Mar 15, 2025

I think the tests should work without any problem now.

Thank you!

zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 17, 2025
* giteaofficial/main: (23 commits)
  [skip ci] Updated translations via Crowdin
  Update tool dependencies (go-gitea#33907)
  Move hooks function to gitrepo and reduce expose repopath (go-gitea#33890)
  Replace text-align classes with tailwind (go-gitea#33905)
  Simplify secure context check (go-gitea#33906)
  Update JS and PY deps, misc tweaks (go-gitea#33903)
  Refactor functions to reduce repopath expose (go-gitea#33892)
  Move git references checking to gitrepo packages to reduce expose of repository path (go-gitea#33891)
  [skip ci] Updated translations via Crowdin
  Add missing translation (go-gitea#33900)
  Give organisation members access to organisation feeds (go-gitea#33508)
  Add lock for a repository pull mirror (go-gitea#33876)
  Fix cannot delete runners via the modal dialog (go-gitea#33895)
  Add file tree to file view page (go-gitea#32721)
  [skip ci] Updated translations via Crowdin
  Feature: Ephemeral action runners (go-gitea#33570)
  Add abstraction layer to delete repository from disk (go-gitea#33879)
  Make SearchMode have default value and add comments (go-gitea#33863)
  Fix maven panic when no package exists (go-gitea#33888)
  Add old svg class name to git entry icon (go-gitea#33884)
  ...

# Conflicts:
#	templates/repo/wiki/revision.tmpl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants