Fix RocketChat webhook #9908
Labels
No Label
backport/done
backport/v1.0
backport/v1.1
backport/v1.10
backport/v1.11
backport/v1.12
backport/v1.13
backport/v1.14
backport/v1.15
backport/v1.2
backport/v1.3
backport/v1.4
backport/v1.5
backport/v1.6
backport/v1.7
backport/v1.8
backport/v1.9
bounty
changelog
dependencies
frontport/done
frontport/main
good first issue
Hacktoberfest
hacktoberfest-accepted
in progress
kind/api
kind/breaking
kind/bug
kind/build
kind/deployment
kind/deprecated
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/misc
kind/moderation
kind/package
kind/proposal
kind/question
kind/refactor
kind/regression
kind/security
kind/summary
kind/testing
kind/translation
kind/ui
kind/upstream-related
kind/usability
kind/ux
lgtm/done
lgtm/need 1
lgtm/need 2
performance/bigrepo
performance/cpu
performance/memory
performance/speed
priority/critical
priority/low
priority/maybe
priority/medium
proposal/rejected
reviewed/confirmed
reviewed/duplicate
reviewed/fixed
reviewed/invalid
reviewed/not-a-bug
reviewed/wontfix
skip-changelog
stale
status/blocked
status/needs-feedback
status/wip
theme/2fa
theme/authentication
theme/avatar
theme/backup-restore
theme/docker
theme/federation
theme/issues
theme/kanban
theme/markdown
theme/migration
theme/mobile
theme/pr
theme/signing
theme/sqlite
theme/timetracker
theme/webhook
theme/wiki
No Milestone
No project
No Assignees
3 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: lunny/gitea#9908
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "rocketchat"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #9899
I'm fairly certain this should fix rocket chat webhooks for push actions.I do not have a rocket chat instance to confirm on, however, so this PR should probably not be accepted until someone can confirm.Turns out rocket chat has a free cloud trial, so I can confirm it works.
I also just removed attachments altogether for repo create/delete event, as it was always blank. 🤷♂️
(Repo event) With blank attachment
(Repo event) Without
(Push event) Rocket Chat
(Repo events and push event) Slack
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
An URL for a title? I expected some plain text (https://api.slack.com/reference/messaging/attachments).
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
Do you have a suggestion for that text? Other payloads have issue titles or some such, but I didn't know of a good one for this, unless I just re-use
x new commits pushed
or something.@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
No idea, but if the attachment links to the repo itself (which is weird, maybe?), perhaps the repo name should be used?
I'm under the impression that it should better to remove the property from the payload when empty rather than sending improper data. ?
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
I'd agree with not sending anything, but that seems to be what caused the bug for whatever reason.
It could be repo name, but even that is sort of dupe data. Better than a URL, though? ?
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
I'm not a webhook user; not even a Slack user, so please take my opinion with a grain of salt. From what I read from the docs, I think we're using the attachment section to produce a "Read more" action. It looks like it should not have a link at all, and if any title, it should be.... "More details" or something like that (but it would be redundant because I bet Slack already gives you the "Read more").
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
Bars on my screenshots above, "see more" works in RC but possibly not Slack, since RC allows you to hide it but Slack appears to show all of it no matter what
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
But I am also not a Slack or RC user, I just have some workspaces for testing webhooks lately.
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
https://api.slack.com/messaging/composing/layouts#when-to-use-attachments
So I guess it depends on the client.
One query, but otherwise lgtm.
Is this right?
@zeripath Yeah, if you look at the images all this used to do was add an attachment with no actual content, just a title with the repo URL (which is already part of
repoLink
)It also broke the hook for delete events because title was only ever given a value here.
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
For the record I am not against changing this, I just really can't think of a good title.
An empty title would break the webhook (at least for RC, not sure about Slack or mattermost)
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
Why not open it up as an option with a default? Maybe more trouble than it's worth?
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
Since it only applies to this payload, I don't know that it would be worth it.
Other payloads have something meaningful for this title.
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
What about "details"? The problem is of course l10n....
Anyway, I'm not in the least against leaving it like this if nobody complains. ?
@ -232,8 +232,10 @@ func getSlackPushPayload(p *api.PushPayload, slack *SlackMeta) (*SlackPayload, e
Username: slack.Username,
Agreed. Maybe it can be updated in future PR.