Move webhook logic from api layer to app layer (#5527)

* Move webhook logic from api layer to app layer

* Consolidate error messages

* Fix permission check and unit test
Этот коммит содержится в:
Joram Wilander
2017-02-28 04:31:53 -05:00
коммит произвёл George Goldberg
родитель cef5028cbe
Коммит 76fa840b52
5 изменённых файлов: 453 добавлений и 460 удалений

Просмотреть файл

@@ -2692,23 +2692,15 @@
"translation": "team hub stopping for teamId=%v"
},
{
"id": "api.webhook.create_incoming.disabled.app_error",
"id": "api.incoming_webhook.disabled.app_errror",
"translation": "Incoming webhooks have been disabled by the system admin."
},
{
"id": "api.webhook.update_incoming.disabled.app_error",
"translation": "Incoming webhooks have been disabled by the system admin."
},
{
"id": "api.webhook.update_incoming.permissions.app_error",
"translation": "Invalid permissions to update incoming webhook"
},
{
"id": "api.webhook.team_mismatch.app_error",
"translation": "Cannot update webhook across teams"
},
{
"id": "api.webhook.create_outgoing.disabled.app_error",
"id": "api.outgoing_webhook.disabled.app_error",
"translation": "Outgoing webhooks have been disabled by the system admin."
},
{
@@ -2728,49 +2720,25 @@
"translation": "Either trigger_words or channel_id must be set"
},
{
"id": "api.webhook.update_outgoing.disabled.app_error",
"translation": "Outgoing webhooks have been disabled by the system admin."
},
{
"id": "api.webhook.update_outgoing.intersect.app_error",
"translation": "Outgoing webhooks from the same channel cannot have the same trigger words/callback URLs."
"id": "api.webhook.delete_incoming.permissions.app_errror",
"translation": "Invalid permissions to delete incoming webhook"
},
{
"id": "api.webhook.update_outgoing.not_open.app_error",
"translation": "Outgoing webhooks can only be updated to public channels."
},
{
"id": "api.webhook.update_outgoing.permissions.app_error",
"translation": "Invalid permissions to update outgoing webhook."
"id": "api.webhook.update_outgoing.intersect.app_error",
"translation": "Outgoing webhooks from the same channel cannot have the same trigger words/callback URLs."
},
{
"id": "api.webhook.update_outgoing.triggers.app_error",
"translation": "Either trigger_words or channel_id must be set"
},
{
"id": "api.webhook.delete_incoming.disabled.app_error",
"translation": "Incoming webhooks have been disabled by the system admin."
},
{
"id": "api.webhook.delete_incoming.permissions.app_error",
"translation": "Invalid permissions to delete incoming webhook"
},
{
"id": "api.webhook.delete_outgoing.disabled.app_error",
"translation": "Outgoing webhooks have been disabled by the system admin."
},
{
"id": "api.webhook.delete_outgoing.permissions.app_error",
"translation": "Invalid permissions to delete outgoing webhook"
},
{
"id": "api.webhook.get_incoming.disabled.app_error",
"translation": "Incoming webhooks have been disabled by the system admin."
},
{
"id": "api.webhook.get_outgoing.disabled.app_error",
"translation": "Outgoing webhooks have been disabled by the system admin."
},
{
"id": "api.webhook.incoming.debug",
"translation": "Incoming webhook received. Content="
@@ -2783,10 +2751,6 @@
"id": "api.webhook.init.debug",
"translation": "Initializing webhook API routes"
},
{
"id": "api.webhook.regen_outgoing_token.disabled.app_error",
"translation": "Outgoing webhooks have been disabled by the system admin."
},
{
"id": "api.webhook.regen_outgoing_token.permissions.app_error",
"translation": "Invalid permissions to regenerate outgoing webhook token"