go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.1k stars 5.41k forks source link

MSTeams Webhook wrong Release URL #23121

Open DanieleSky opened 1 year ago

DanieleSky commented 1 year ago

Description

Hi, I've implemented a webhook from Gitea to MS Teams that is triggered when a new release is published. All works but the link on button "View in Gitea" is the link of the API and not the WebUI.

For example: image

Shouldn't be http://gitea.dinamoretail.lan/Var4Retail/Dinamo.Web.API.ReteVendita/releases/tag/v0.10.1 ?

Thanks

Gitea Version

1.18.0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

We are running Gitea from binary on Debian 11

Database

MySQL

delvh commented 1 year ago

Hmm… I'm not sure, but isn't that intended behavior? I mean, I can somewhat see why both are needed. Additionally, changing the current behavior would be breaking for anyone else who already relies on the webhook providing the API URL…

DanieleSky commented 1 year ago

OK, I understand your point of view. But as user, I would like to click on the link "view in gitea" and view the UI not the api. Is possible to add a setting ex "Link type" where the user can select if the link "view in gitea" will be a API url o UI url?

lunny commented 1 year ago

Maybe we can add an extra html_url in the json.

DanieleSky commented 1 year ago

Hi @lunny but in this case the button "view in gitea" will use the html_url? I think that the best solution is a webhook parameter where the user can specify if the button "view in gitea" will use the api_url or the html_url. What do you think? image

fitithw commented 1 year ago

I've noticed the same issue with Discord Release Webhook and I'd argue in favor of changing it to WebUI link:

  1. It's inconsistent with other hooks, all the other hooks' links point to WebUI, release hook is the odd one out with the API call link. See tests for Discord, Teams, Dingtalk.
  2. It's inconsistent with other webhook clients (Slack, Matrix, Telegram) which use link formatters to construct the release WebUI link.
  3. These are messaging platforms, not API pipeline handlers*, I expect "browser friendly" content from a clickable link in a message/notification, not a raw API call returning JSON with "Only signed in user is allowed to call APIs." (even though I'm signed in in the browser :eyes:). Just like I expect the link in "New comment on pull request" notification to point to a comment in the WebUI.
  4. Even RSS feeds only have WebUI links.

* Of course, you could use them like that with bots scanning messages, but I feel that's custom webhook territory, not something for basic out of the box notifications, and even then you would probably hide it in message metadata instead of putting it in the message title link.

kaedros commented 1 year ago

I also understand with colleagues that html_url (WebUI) is more usual. I realized that in the last version it is present but I can't choose to use it in the link.