fix(web): forbid blocked users from reopening issues (#7010)

Closes https://codeberg.org/forgejo/forgejo/issues/6841.

Signed-off-by: Litchi Pi <litchi.pi@proton.me>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7010
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Litchi Pi <litchi.pi@proton.me>
Co-committed-by: Litchi Pi <litchi.pi@proton.me>
This commit is contained in:
Litchi Pi 2025-03-01 12:39:52 +00:00 committed by 0ko
parent ac08fc5b40
commit 9dd47d932f
6 changed files with 69 additions and 4 deletions

View file

@ -253,6 +253,12 @@ func TestBlockActions(t *testing.T) {
DecodeJSON(t, resp, &errorResp)
assert.EqualValues(t, expectedMessage, errorResp.Error)
req = NewRequest(t, "GET", issue10URL)
resp = session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
msg := htmlDoc.doc.Find("div .warning").Text()
assert.Contains(t, msg, "You cannot comment on this issue because you are blocked")
})
t.Run("Blocked by issue poster", func(t *testing.T) {
@ -274,6 +280,12 @@ func TestBlockActions(t *testing.T) {
DecodeJSON(t, resp, &errorResp)
assert.EqualValues(t, expectedMessage, errorResp.Error)
req = NewRequest(t, "GET", issue10URL)
resp = session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
msg := htmlDoc.doc.Find("div .warning").Text()
assert.Contains(t, msg, "You cannot comment on this issue because you are blocked")
})
})