integrations/git: Allow users to specify a stream for notifications.
Previously, all notifications went to "commits", now users can modify the constant at the top to change that.
This commit is contained in:
parent
345666ca58
commit
5f20512601
|
@ -22,6 +22,9 @@
|
||||||
|
|
||||||
from typing import Dict, Text, Optional
|
from typing import Dict, Text, Optional
|
||||||
|
|
||||||
|
# Name of the stream to send notifications to, default is "commits"
|
||||||
|
STREAM_NAME = 'commits'
|
||||||
|
|
||||||
# Change these values to configure authentication for the plugin
|
# Change these values to configure authentication for the plugin
|
||||||
ZULIP_USER = "git-bot@example.com"
|
ZULIP_USER = "git-bot@example.com"
|
||||||
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
||||||
|
@ -44,7 +47,7 @@ ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
||||||
def commit_notice_destination(repo, branch, commit):
|
def commit_notice_destination(repo, branch, commit):
|
||||||
# type: (Text, Text, Text) -> Optional[Dict[Text, Text]]
|
# type: (Text, Text, Text) -> Optional[Dict[Text, Text]]
|
||||||
if branch in ["master", "test-post-receive"]:
|
if branch in ["master", "test-post-receive"]:
|
||||||
return dict(stream = "commits",
|
return dict(stream = STREAM_NAME,
|
||||||
subject = u"%s" % (branch,))
|
subject = u"%s" % (branch,))
|
||||||
|
|
||||||
# Return None for cases where you don't want a notice sent
|
# Return None for cases where you don't want a notice sent
|
||||||
|
|
Loading…
Reference in a new issue