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

Add activity visibility options #29306

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

zokkis
Copy link
Contributor

@zokkis zokkis commented Feb 21, 2024

Add options to which actions are shown (relates to #21585)

before:
image

after:
image

image


Missing

  • api changes
  • db migration
  • extends this to all actions
  • show private contributions in feed

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 21, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 21, 2024
@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 22, 2024
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/migrations labels Feb 22, 2024
@zokkis zokkis marked this pull request as ready for review February 22, 2024 03:18
@yp05327
Copy link
Contributor

yp05327 commented Feb 22, 2024

image
Maybe it is better to change the location.

@6543

This comment was marked as off-topic.

@zokkis

This comment was marked as off-topic.

@6543

This comment was marked as off-topic.

@6543

This comment was marked as off-topic.

@zokkis zokkis requested a review from yp05327 March 3, 2024 11:11
@@ -77,6 +77,27 @@ func IsOrganizationMember(ctx context.Context, orgID, uid int64) (bool, error) {
Exist()
}

// IsOrganizationsMember returns a map with key of orgID and value is true if given user is member of organization.
func IsOrganizationsMember(ctx context.Context, orgIDs []int64, uid int64) (map[int64]bool, error) {
Copy link
Contributor

@yp05327 yp05327 Mar 5, 2024

Choose a reason for hiding this comment

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

The permission of organization is complex. Not all users can see all repos of the org.
e.g. a member in a team which has no repo access, then members can also see the actions of some private repos they can not access.
image

Not sure whether we need to consider this case, but actually it exists.
And maybe we can add some integration tests for checking all cases of different permissions.

@silverwind
What's your idea about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any updates?

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 1, 2024
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files and removed modifies/migrations labels Apr 1, 2024
@yp05327
Copy link
Contributor

yp05327 commented Apr 10, 2024

DB migration is necessary, plz add it.

@zokkis
Copy link
Contributor Author

zokkis commented Apr 14, 2024

DB migration is necessary, plz add it.

Yes, but I wait for any updates on https://github.com/go-gitea/gitea/pull/29306/files/583357a10b4760a2e2c57e69c0bdd9ad55a3aaf5#r1512068444
Or isn't it a blocker anymore?

@wxiaoguang
Copy link
Contributor

Yes, but I wait for any updates on https://github.com/go-gitea/gitea/pull/29306/files/583357a10b4760a2e2c57e69c0bdd9ad55a3aaf5#r1512068444 Or isn't it a blocker anymore?

I think it needs enough tests to show and ensure the expected behaviors, and make sure the logic won't break by future changes. The tests could also answer the question in that comment.

@zokkis zokkis changed the title Add actions visibility options Add activity visibility options Apr 14, 2024
@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 14, 2024
@zokkis
Copy link
Contributor Author

zokkis commented Apr 14, 2024

if this is ok for @wxiaoguang and @yp05327 then I will add the migration

}

// String provides the mode string of the visibility type (public, all, none)
func (vt ActivityVisibility) String() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this "String" method really used? I think it only causes problems. For example: it's impossible to render the value directly into template.

So IMO either:

  • Remove such "String" method, and then just output the int value into template directly
  • Or if it is really needed, name it to "ToString" or something else, do not make it a "Stringer"

@wxiaoguang
Copy link
Contributor

if this is ok for @wxiaoguang and @yp05327 then I will add the migration

Would there be some tests to test the new behavior?

@yp05327
Copy link
Contributor

yp05327 commented Apr 15, 2024

Yes, but I wait for any updates on https://github.com/go-gitea/gitea/pull/29306/files/583357a10b4760a2e2c57e69c0bdd9ad55a3aaf5#r1512068444 Or isn't it a blocker anymore?

I have tested it manually at that time. And I found this issue. IMO, it is a bug.
But I have no time to check it again. As @wxiaoguang 's suggestion, tests can easily do that all the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/translation size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants