mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
integrations: Move get_setup_webhook_message to common.py.
Move `get_setup_webhook_message` to `zerver/lib/webhooks/common.py` so multiple integrations can use this rather than just those which import `zerver/lib/webhooks/git.py`. Also added the documentation for this.
This commit is contained in:
@@ -54,9 +54,6 @@ PULL_REQUEST_OR_ISSUE_MESSAGE_TEMPLATE_WITH_TITLE = (
|
||||
PULL_REQUEST_OR_ISSUE_ASSIGNEE_INFO_TEMPLATE = "(assigned to {assignee})"
|
||||
PULL_REQUEST_BRANCH_INFO_TEMPLATE = "from `{target}` to `{base}`"
|
||||
|
||||
SETUP_MESSAGE_TEMPLATE = "{integration} webhook has been successfully configured"
|
||||
SETUP_MESSAGE_USER_PART = " by {user_name}"
|
||||
|
||||
CONTENT_MESSAGE_TEMPLATE = "\n~~~ quote\n{message}\n~~~"
|
||||
|
||||
COMMITS_COMMENT_MESSAGE_TEMPLATE = "{user_name} {action} on [{sha}]({url})"
|
||||
@@ -225,14 +222,6 @@ def get_pull_request_event_message(
|
||||
return main_message.rstrip()
|
||||
|
||||
|
||||
def get_setup_webhook_message(integration: str, user_name: Optional[str] = None) -> str:
|
||||
content = SETUP_MESSAGE_TEMPLATE.format(integration=integration)
|
||||
if user_name:
|
||||
content += SETUP_MESSAGE_USER_PART.format(user_name=user_name)
|
||||
content = f"{content}."
|
||||
return content
|
||||
|
||||
|
||||
def get_issue_event_message(
|
||||
user_name: str,
|
||||
action: str,
|
||||
|
||||
Reference in New Issue
Block a user