Skip to content
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

Implementation of discord webhook #2402

Merged
merged 5 commits into from
Aug 28, 2017
Merged

Conversation

lunny
Copy link
Member

@lunny lunny commented Aug 26, 2017

will fix #2191

@lunny lunny added type/feature Completely new functionality. Can only be merged if feature freeze is not active. pr/wip This PR is not ready for review labels Aug 26, 2017
@lunny lunny added this to the 1.3.0 milestone Aug 26, 2017

"code.gitea.io/git"
api "code.gitea.io/sdk/gitea"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this empty line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above is other packages on gitea, below is submodule on gitea repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case they should be in the other order.

builtin
local package
external package

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkcsoft done.

@lunny lunny changed the title [WIP] implementation of discord webhook Implementation of discord webhook Aug 26, 2017
@lunny lunny removed the pr/wip This PR is not ready for review label Aug 26, 2017
case DISCORD:
payloader, err = GetDiscordPayload(p, event, w.Meta)
if err != nil {
return fmt.Errorf("GetSlackPayload: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discord, not Slack

}

var (
successColor = color("#1ac600")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you add the # when it's anyway removed within the color function?

failedColor = color("#ff3232")
)

// SetSecret sets the slack secret
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slack?

func (p *DiscordPayload) SetSecret(_ string) {}

// JSONPayload Marshals the SlackPayload to json
func (p *DiscordPayload) JSONPayload() ([]byte, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slack?

}, nil
}

// GetDiscordPayload converts a slack webhook into a SlackPayload
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slack?


discord := &DiscordMeta{}
if err := json.Unmarshal([]byte(meta), &discord); err != nil {
return s, errors.New("GetSlackPayload meta json:" + err.Error())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slack?

@@ -183,6 +183,19 @@ func (f *NewSlackHookForm) Validate(ctx *macaron.Context, errs binding.Errors) b
return validate(errs, ctx.Data, f, ctx.Locale)
}

// NewDiscordHookForm form for creating slack hook
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slack?

@@ -443,6 +503,48 @@ func SlackHooksEditPost(ctx *context.Context, form auth.NewSlackHookForm) {
ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
}

// DiscordHooksEditPost response for editing slack hook
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slack?

<input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required>
</div>
<div class="field">
<label for="username">{{.i18n.Tr "repo.settings.slack_username"}}</label>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slack?

</div>
<div class="field">
<label for="icon_url">{{.i18n.Tr "repo.settings.slack_icon_url"}}</label>
<input id="icon_url" name="icon_url" value="{{.DiscordHook.IconURL}}" placeholder="e.g. https://example.com/img/favicon.png">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slack?

@lunny
Copy link
Member Author

lunny commented Aug 27, 2017

@tboerger done.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 27, 2017
@tboerger
Copy link
Member

LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 27, 2017
@lunny
Copy link
Member Author

lunny commented Aug 28, 2017

rebased.

@bkcsoft
Copy link
Member

bkcsoft commented Aug 28, 2017

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 28, 2017
@bkcsoft
Copy link
Member

bkcsoft commented Aug 28, 2017

@lunny (or any merger) Please squash the commits into 1 commit

@lunny lunny merged commit ced50e0 into go-gitea:master Aug 28, 2017
@lunny lunny deleted the lunny/webhook_discord branch August 28, 2017 12:45
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change webhook format for Discord compatibility
4 participants