-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
refactor webhook *NewPost #20729
refactor webhook *NewPost #20729
Conversation
Codecov Report
@@ Coverage Diff @@
## main #20729 +/- ##
=======================================
Coverage ? 47.03%
=======================================
Files ? 980
Lines ? 136070
Branches ? 0
=======================================
Hits ? 64006
Misses ? 64215
Partials ? 7849
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the properties with default values but that's just my personal preference.
Wait , there seems to be 2 |
@6543 since you advised removing, I actually removed
Since this is now a one-line function, I think copying is better than importing in this case: func isValidSlackChannel(name string) bool {
return name != "" && name != "#"
} |
@wxiaoguang you are right. Let me move the |
Webhook Auth header is wip at #20267, by the way. |
. |
* refactor webhook *NewPost * remove empty values * always show errs.Message * remove utils.IsValidSlackChannel * move IsValidSlackChannel to services/webhook package * binding: handle empty Message case * make IsValidSlackChannel more strict
Hi, this is a bit of yak-shaving: I wanted to add an
Authorization
Header to the webhooks. While working around the forms, I saw that the same code was repeated 11 times, I thought that it would be a good idea to refactor it before modifying it.So here is a PR to refactor all
*NewPost
functions into acreateWebhook
function.I did some minor modifications to Slack error handling, so that it doesn't need special code.
I am looking forward to your feedback!