mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 02:17:19 +00:00
enterprise: Add option to forward feedback to an email address.
(imported from commit 0ac9bb0427aeba60a8004953fedfdfdc6bbb587c)
This commit is contained in:
@@ -18,6 +18,7 @@ from zerver.decorator import JsonableError
|
|||||||
from zerver.lib.socket import req_redis_key
|
from zerver.lib.socket import req_redis_key
|
||||||
from confirmation.models import Confirmation
|
from confirmation.models import Confirmation
|
||||||
from django.db import reset_queries
|
from django.db import reset_queries
|
||||||
|
from django.core.mail import EmailMessage
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -217,16 +218,27 @@ def make_feedback_client():
|
|||||||
@assign_queue('feedback_messages')
|
@assign_queue('feedback_messages')
|
||||||
class FeedbackBot(QueueProcessingWorker):
|
class FeedbackBot(QueueProcessingWorker):
|
||||||
def start(self):
|
def start(self):
|
||||||
self.staging_client = make_feedback_client()
|
if settings.FEEDBACK_EMAIL is None:
|
||||||
self.staging_client._register(
|
self.staging_client = make_feedback_client()
|
||||||
|
self.staging_client._register(
|
||||||
'forward_feedback',
|
'forward_feedback',
|
||||||
method='POST',
|
method='POST',
|
||||||
url='deployments/feedback',
|
url='deployments/feedback',
|
||||||
make_request=(lambda request: {'message': simplejson.dumps(request)}),
|
make_request=(lambda request: {'message': simplejson.dumps(request)}),
|
||||||
)
|
)
|
||||||
QueueProcessingWorker.start(self)
|
QueueProcessingWorker.start(self)
|
||||||
|
|
||||||
def consume(self, event):
|
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)
|
self.staging_client.forward_feedback(event)
|
||||||
|
|
||||||
@assign_queue('error_reports')
|
@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 expiry in seconds after the last page load
|
||||||
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # 2 weeks
|
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # 2 weeks
|
||||||
|
|
||||||
# Controls whether or not there is a feedback button in the UI, which
|
# Controls whether or not there is a feedback button in the UI.
|
||||||
# can be used to send feedback directly to the Zulip developers.
|
|
||||||
ENABLE_FEEDBACK = True
|
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
|
# Controls whether or not error reports are sent to Zulip. Error
|
||||||
# reports are used to improve the quality of the product and do not
|
# reports are used to improve the quality of the product and do not
|
||||||
# include message contents; please contact Zulip support with any
|
# include message contents; please contact Zulip support with any
|
||||||
|
|||||||
@@ -265,6 +265,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
|
|||||||
'INLINE_IMAGE_PREVIEW': True,
|
'INLINE_IMAGE_PREVIEW': True,
|
||||||
'CAMO_URI': None,
|
'CAMO_URI': None,
|
||||||
'ENABLE_FEEDBACK': True,
|
'ENABLE_FEEDBACK': True,
|
||||||
|
'FEEDBACK_EMAIL': None,
|
||||||
'ENABLE_GRAVATAR': True,
|
'ENABLE_GRAVATAR': True,
|
||||||
'DEFAULT_AVATAR_URI': '/static/images/default-avatar.png',
|
'DEFAULT_AVATAR_URI': '/static/images/default-avatar.png',
|
||||||
'AUTH_LDAP_BIND_DN': "",
|
'AUTH_LDAP_BIND_DN': "",
|
||||||
|
|||||||
Reference in New Issue
Block a user