mirror of https://github.com/zulip/zulip.git
enterprise: Add option to forward feedback to an email address.
(imported from commit 0ac9bb0427aeba60a8004953fedfdfdc6bbb587c)
This commit is contained in:
parent
01f141e2b6
commit
f59fb53662
|
@ -18,6 +18,7 @@ from zerver.decorator import JsonableError
|
|||
from zerver.lib.socket import req_redis_key
|
||||
from confirmation.models import Confirmation
|
||||
from django.db import reset_queries
|
||||
from django.core.mail import EmailMessage
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
@ -217,16 +218,27 @@ def make_feedback_client():
|
|||
@assign_queue('feedback_messages')
|
||||
class FeedbackBot(QueueProcessingWorker):
|
||||
def start(self):
|
||||
self.staging_client = make_feedback_client()
|
||||
self.staging_client._register(
|
||||
if settings.FEEDBACK_EMAIL is None:
|
||||
self.staging_client = make_feedback_client()
|
||||
self.staging_client._register(
|
||||
'forward_feedback',
|
||||
method='POST',
|
||||
url='deployments/feedback',
|
||||
make_request=(lambda request: {'message': simplejson.dumps(request)}),
|
||||
)
|
||||
)
|
||||
QueueProcessingWorker.start(self)
|
||||
|
||||
def consume(self, event):
|
||||
if settings.FEEDBACK_EMAIL is not None:
|
||||
to_email = settings.FEEDBACK_EMAIL
|
||||
subject = "Zulip feedback from %s" % (event["sender_email"],)
|
||||
content = event["content"]
|
||||
from_email = '"%s" <%s>' % (event["sender_full_name"], event["sender_email"])
|
||||
headers = {'Reply-To' : '"%s" <%s>' % (event["sender_full_name"], event["sender_email"])}
|
||||
msg = EmailMessage(subject, content, from_email, [to_email], headers=headers)
|
||||
msg.send()
|
||||
return
|
||||
|
||||
self.staging_client.forward_feedback(event)
|
||||
|
||||
@assign_queue('error_reports')
|
||||
|
|
|
@ -56,10 +56,15 @@ SESSION_EXPIRE_AT_BROWSER_CLOSE = False
|
|||
# Session cookie expiry in seconds after the last page load
|
||||
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # 2 weeks
|
||||
|
||||
# Controls whether or not there is a feedback button in the UI, which
|
||||
# can be used to send feedback directly to the Zulip developers.
|
||||
# Controls whether or not there is a feedback button in the UI.
|
||||
ENABLE_FEEDBACK = True
|
||||
|
||||
# By default, the feedback button will submit feedback to the Zulip
|
||||
# developers. If you set FEEDBACK_EMAIL to be an email address
|
||||
# (e.g. ZULIP_ADMINISTRATOR), feedback sent by your users will instead
|
||||
# be sent to that email address.
|
||||
# FEEDBACK_EMAIL = ZULIP_ADMINISTRATOR
|
||||
|
||||
# Controls whether or not error reports are sent to Zulip. Error
|
||||
# reports are used to improve the quality of the product and do not
|
||||
# include message contents; please contact Zulip support with any
|
||||
|
|
|
@ -265,6 +265,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
|
|||
'INLINE_IMAGE_PREVIEW': True,
|
||||
'CAMO_URI': None,
|
||||
'ENABLE_FEEDBACK': True,
|
||||
'FEEDBACK_EMAIL': None,
|
||||
'ENABLE_GRAVATAR': True,
|
||||
'DEFAULT_AVATAR_URI': '/static/images/default-avatar.png',
|
||||
'AUTH_LDAP_BIND_DN': "",
|
||||
|
|
Loading…
Reference in New Issue