Skip to content

Add user blocking #29028

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

Merged
merged 23 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4e7b8e1
Add user blocks.
KN4CK3R Jan 29, 2024
9cafd97
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R Jan 30, 2024
81e8bfa
Add web part.
KN4CK3R Feb 1, 2024
df59f17
Add docs.
KN4CK3R Feb 2, 2024
983ab22
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R Feb 2, 2024
b89c51a
Add more tests.
KN4CK3R Feb 2, 2024
701bdc9
Fix test.
KN4CK3R Feb 2, 2024
8c5732c
Use `show-modal`.
KN4CK3R Feb 2, 2024
e6a4e5c
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R Feb 2, 2024
b57c1f4
Update docs/content/usage/blocking-users.en-us.md
KN4CK3R Feb 3, 2024
43d2e66
Add missing migration.
KN4CK3R Feb 5, 2024
deacef9
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R Feb 5, 2024
5099747
Add suggestions.
KN4CK3R Feb 6, 2024
3d8e1b9
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R Feb 6, 2024
3af664d
Do not block actions by repository admins.
KN4CK3R Feb 8, 2024
28da385
Merge branch 'main' into feature-user-block
KN4CK3R Feb 11, 2024
211cf09
Merge branch 'feature-user-block' of https://github.com/KN4CK3R/gitea…
KN4CK3R Feb 24, 2024
576e6b4
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R Feb 24, 2024
6c9c584
Change update method.
KN4CK3R Feb 24, 2024
30f5bdd
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R Feb 28, 2024
4429f95
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R Mar 2, 2024
75ea916
Merge branch 'main' into feature-user-block
GiteaBot Mar 4, 2024
eb8525b
Merge branch 'main' into feature-user-block
GiteaBot Mar 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add suggestions.
  • Loading branch information
KN4CK3R committed Feb 6, 2024
commit 509974792ed9e2fa19d528a0a2062050e8965d4e
5 changes: 3 additions & 2 deletions docs/content/usage/blocking-users.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ menu:
Gitea supports blocking of users to restrict how they can interact with you and your content.

You can block a user in your account settings, from the user's profile or from comments created by the user.
The user is not directly notified about the block.
The user is not directly notified about the block, but they can notice they are blocked when they attempt to interact with you.
Organization owners can block anyone who is not a member of the organization too.
If a blocked user has admin permissions, they can still perform all actions even if blocked.

### When you block a user

Expand All @@ -31,7 +32,7 @@ Organization owners can block anyone who is not a member of the organization too
- your stars are removed from their repositories
- the user stops watching your repositories
- you stop watching their repositories
- the issue assignments are removed from your repositories
- the user's issue assignments are removed from your repositories
- your issue assignments are removed from their repositories
- the user is removed as a collaborator on your repositories
- you are removed as a collaborator on their repositories
Expand Down
5 changes: 3 additions & 2 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,7 @@ issues.new.clear_assignees = Clear assignees
issues.new.no_assignees = No Assignees
issues.new.no_reviewers = No reviewers
issues.new.blocked_user = Cannot create issue because you are blocked by the repository owner.
issues.edit.blocked_user = Cannot edit content because you are blocked by the poster or repository owner.
issues.choose.get_started = Get Started
issues.choose.open_external_link = Open
issues.choose.blank = Default
Expand Down Expand Up @@ -1520,7 +1521,7 @@ issues.close_comment_issue = Comment and Close
issues.reopen_issue = Reopen
issues.reopen_comment_issue = Comment and Reopen
issues.create_comment = Comment
issues.comment.blocked_user = Cannot create comment because you are blocked by the poster or repository owner.
issues.comment.blocked_user = Cannot create or edit comment because you are blocked by the poster or repository owner.
issues.closed_at = `closed this issue <a id="%[1]s" href="#%[1]s">%[2]s</a>`
issues.reopened_at = `reopened this issue <a id="%[1]s" href="#%[1]s">%[2]s</a>`
issues.commit_ref_at = `referenced this issue from a commit <a id="%[1]s" href="#%[1]s">%[2]s</a>`
Expand Down Expand Up @@ -1719,7 +1720,7 @@ compare.compare_head = compare

pulls.desc = Enable pull requests and code reviews.
pulls.new = New Pull Request
pulls.new.blocked_user = Cannot create issue because you are blocked by the repository owner.
pulls.new.blocked_user = Cannot create pull request because you are blocked by the repository owner.
pulls.view = View Pull Request
pulls.compare_changes = New Pull Request
pulls.allow_edits_from_maintainers = Allow edits from maintainers
Expand Down
8 changes: 6 additions & 2 deletions routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,7 @@ func UpdateIssueContent(ctx *context.Context) {

if err := issue_service.ChangeContent(ctx, issue, ctx.Doer, ctx.Req.FormValue("content")); err != nil {
if errors.Is(err, user_model.ErrBlockedUser) {
ctx.Error(http.StatusForbidden)
ctx.JSONError(ctx.Tr("repo.issues.edit.blocked_user"))
} else {
ctx.ServerError("ChangeContent", err)
}
Expand Down Expand Up @@ -3163,7 +3163,11 @@ func UpdateCommentContent(ctx *context.Context) {
return
}
if err = issue_service.UpdateComment(ctx, comment, ctx.Doer, oldContent); err != nil {
ctx.ServerError("UpdateComment", err)
if errors.Is(err, user_model.ErrBlockedUser) {
ctx.JSONError(ctx.Tr("repo.issues.comment.blocked_user"))
} else {
ctx.ServerError("UpdateComment", err)
}
return
}

Expand Down