PLT-5900 Removed automatic configuration of SiteURL (#5952)
* Revert "PLT-5765 Passed SiteURL to SendNotifications (#5705)"
This reverts commit a8e68bd890.
* Removed automatic configuration of SiteURL
* Reverted unintentional config changes
* Updated help text
* Added link to docs in Site URL warning
* Fixed merge conflict
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
3a79e451ff
Коммит
c7bdce8a66
@@ -24,7 +24,7 @@ const (
|
||||
TRIGGERWORDS_STARTSWITH = 1
|
||||
)
|
||||
|
||||
func handleWebhookEvents(post *model.Post, team *model.Team, channel *model.Channel, user *model.User, siteURL string) *model.AppError {
|
||||
func handleWebhookEvents(post *model.Post, team *model.Team, channel *model.Channel, user *model.User) *model.AppError {
|
||||
if !utils.Cfg.ServiceSettings.EnableOutgoingWebhooks {
|
||||
return nil
|
||||
}
|
||||
@@ -107,7 +107,7 @@ func handleWebhookEvents(post *model.Post, team *model.Team, channel *model.Chan
|
||||
respProps := model.MapFromJson(resp.Body)
|
||||
|
||||
if text, ok := respProps["text"]; ok {
|
||||
if _, err := CreateWebhookPost(hook.CreatorId, hook.TeamId, post.ChannelId, text, respProps["username"], respProps["icon_url"], post.Props, post.Type, siteURL); err != nil {
|
||||
if _, err := CreateWebhookPost(hook.CreatorId, hook.TeamId, post.ChannelId, text, respProps["username"], respProps["icon_url"], post.Props, post.Type); err != nil {
|
||||
l4g.Error(utils.T("api.post.handle_webhook_events_and_forget.create_post.error"), err)
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@ func handleWebhookEvents(post *model.Post, team *model.Team, channel *model.Chan
|
||||
return nil
|
||||
}
|
||||
|
||||
func CreateWebhookPost(userId, teamId, channelId, text, overrideUsername, overrideIconUrl string, props model.StringInterface, postType string, siteURL string) (*model.Post, *model.AppError) {
|
||||
func CreateWebhookPost(userId, teamId, channelId, text, overrideUsername, overrideIconUrl string, props model.StringInterface, postType string) (*model.Post, *model.AppError) {
|
||||
// parse links into Markdown format
|
||||
linkWithTextRegex := regexp.MustCompile(`<([^<\|]+)\|([^>]+)>`)
|
||||
text = linkWithTextRegex.ReplaceAllString(text, "[${2}](${1})")
|
||||
@@ -159,7 +159,7 @@ func CreateWebhookPost(userId, teamId, channelId, text, overrideUsername, overri
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := CreatePost(post, teamId, false, siteURL); err != nil {
|
||||
if _, err := CreatePost(post, teamId, false); err != nil {
|
||||
return nil, model.NewLocAppError("CreateWebhookPost", "api.post.create_webhook_post.creating.app_error", nil, "err="+err.Message)
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ func RegenOutgoingWebhookToken(hook *model.OutgoingWebhook) (*model.OutgoingWebh
|
||||
}
|
||||
}
|
||||
|
||||
func HandleIncomingWebhook(hookId string, req *model.IncomingWebhookRequest, siteURL string) *model.AppError {
|
||||
func HandleIncomingWebhook(hookId string, req *model.IncomingWebhookRequest) *model.AppError {
|
||||
if !utils.Cfg.ServiceSettings.EnableIncomingWebhooks {
|
||||
return model.NewAppError("HandleIncomingWebhook", "web.incoming_webhook.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
@@ -514,7 +514,7 @@ func HandleIncomingWebhook(hookId string, req *model.IncomingWebhookRequest, sit
|
||||
return model.NewAppError("HandleIncomingWebhook", "web.incoming_webhook.permissions.app_error", nil, "", http.StatusForbidden)
|
||||
}
|
||||
|
||||
if _, err := CreateWebhookPost(hook.UserId, hook.TeamId, channel.Id, text, overrideUsername, overrideIconUrl, req.Props, webhookType, siteURL); err != nil {
|
||||
if _, err := CreateWebhookPost(hook.UserId, hook.TeamId, channel.Id, text, overrideUsername, overrideIconUrl, req.Props, webhookType); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user