From 532383d7ddca2eeed37d2af20cd91f2824fc9cc7 Mon Sep 17 00:00:00 2001
From: zeripath <art27@cantab.net>
Date: Fri, 24 Dec 2021 13:47:42 +0000
Subject: [PATCH] When attempting to subscribe other user to issue report why
 access denied (#18091)

Fix #18090

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
---
 routers/api/v1/repo/issue_subscription.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/routers/api/v1/repo/issue_subscription.go b/routers/api/v1/repo/issue_subscription.go
index ff305c4877..9c6b4e4647 100644
--- a/routers/api/v1/repo/issue_subscription.go
+++ b/routers/api/v1/repo/issue_subscription.go
@@ -5,6 +5,7 @@
 package repo
 
 import (
+	"fmt"
 	"net/http"
 
 	"code.gitea.io/gitea/models"
@@ -128,7 +129,7 @@ func setIssueSubscription(ctx *context.APIContext, watch bool) {
 
 	//only admin and user for itself can change subscription
 	if user.ID != ctx.User.ID && !ctx.User.IsAdmin {
-		ctx.Error(http.StatusForbidden, "User", nil)
+		ctx.Error(http.StatusForbidden, "User", fmt.Errorf("%s is not permitted to change subscriptions for %s", ctx.User.Name, user.Name))
 		return
 	}