mirror of https://github.com/zulip/zulip.git
zerver: Fix lines with length greater than 120.
This commit is contained in:
parent
be93b6ea28
commit
a8a4caf2c0
|
@ -640,7 +640,8 @@ def do_send_messages(messages):
|
|||
raise ValueError('Bad recipient type')
|
||||
|
||||
# Only deliver the message to active user recipients
|
||||
message['active_recipients'] = [user_profile for user_profile in message['recipients'] if user_profile.is_active]
|
||||
message['active_recipients'] = [user_profile for user_profile in message['recipients']
|
||||
if user_profile.is_active]
|
||||
message['message'].maybe_render_content(None)
|
||||
message['message'].update_calculated_fields()
|
||||
|
||||
|
@ -1400,7 +1401,8 @@ def do_add_subscription(user_profile, stream, no_log=False):
|
|||
|
||||
if did_subscribe:
|
||||
emails_by_stream = {stream.id: maybe_get_subscriber_emails(stream)}
|
||||
notify_subscriptions_added(user_profile, [(subscription, stream)], lambda stream: emails_by_stream[stream.id], no_log)
|
||||
notify_subscriptions_added(user_profile, [(subscription, stream)],
|
||||
lambda stream: emails_by_stream[stream.id], no_log)
|
||||
|
||||
user_ids = get_other_subscriber_ids(stream, user_profile.id)
|
||||
event = dict(type="subscription", op="peer_add",
|
||||
|
@ -1856,7 +1858,8 @@ def do_create_realm(domain, name, restricted_to_domain=True):
|
|||
product_name = "Zulip"
|
||||
content = """Hello, and welcome to %s!
|
||||
|
||||
This is a message on stream `%s` with the topic `welcome`. We'll use this stream for system-generated notifications.""" % (product_name, notifications_stream.name,)
|
||||
This is a message on stream `%s` with the topic `welcome`. We'll use this stream for
|
||||
system-generated notifications.""" % (product_name, notifications_stream.name,)
|
||||
msg = internal_prep_message(settings.WELCOME_BOT, 'stream',
|
||||
notifications_stream.name, "welcome",
|
||||
content, realm=realm)
|
||||
|
|
|
@ -948,7 +948,8 @@ class Bugdown(markdown.Extension):
|
|||
md.inlinePatterns.add('avatar', Avatar(r'!avatar\((?P<email>[^)]*)\)'), '_begin')
|
||||
md.inlinePatterns.add('gravatar', Avatar(r'!gravatar\((?P<email>[^)]*)\)'), '_begin')
|
||||
|
||||
md.inlinePatterns.add('stream_subscribe_button', StreamSubscribeButton(r'!_stream_subscribe_button\((?P<stream_name>(?:[^)\\]|\\\)|\\)*)\)'), '_begin')
|
||||
md.inlinePatterns.add('stream_subscribe_button',
|
||||
StreamSubscribeButton(r'!_stream_subscribe_button\((?P<stream_name>(?:[^)\\]|\\\)|\\)*)\)'), '_begin')
|
||||
md.inlinePatterns.add(
|
||||
'modal_link',
|
||||
ModalLink(r'!modal_link\((?P<relative_url>[^)]*), (?P<text>[^)]*)\)'),
|
||||
|
|
|
@ -85,7 +85,8 @@ def _do_push_to_apns_service(user, message, apns_connection):
|
|||
def send_apple_push_notification(user, alert, **extra_data):
|
||||
# type: (UserProfile, text_type, **Any) -> None
|
||||
if not connection and not dbx_connection:
|
||||
logging.error("Attempting to send push notification, but no connection was found. This may be because we could not find the APNS Certificate file.")
|
||||
logging.error("Attempting to send push notification, but no connection was found. "
|
||||
"This may be because we could not find the APNS Certificate file.")
|
||||
return
|
||||
|
||||
devices = PushDeviceToken.objects.filter(user=user, kind=PushDeviceToken.APNS)
|
||||
|
@ -112,7 +113,8 @@ def check_apns_feedback():
|
|||
since_date = timestamp_to_datetime(since)
|
||||
logging.info("Found unavailable token %s, unavailable since %s" % (token, since_date))
|
||||
|
||||
PushDeviceToken.objects.filter(token=hex_to_b64(token), last_updates__lt=since_date, type=PushDeviceToken.APNS).delete()
|
||||
PushDeviceToken.objects.filter(token=hex_to_b64(token), last_updates__lt=since_date,
|
||||
type=PushDeviceToken.APNS).delete()
|
||||
logging.info("Finished checking feedback for stale tokens")
|
||||
|
||||
|
||||
|
|
|
@ -219,7 +219,8 @@ def incr_ratelimit(user, domain='all'):
|
|||
break
|
||||
except redis.WatchError:
|
||||
if count > 10:
|
||||
logging.error("Failed to complete incr_ratelimit transaction without interference 10 times in a row! Aborting rate-limit increment")
|
||||
logging.error("Failed to complete incr_ratelimit transaction without interference 10 times "
|
||||
"in a row! Aborting rate-limit increment")
|
||||
break
|
||||
count += 1
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@ Usage: python manage.py deliver_email
|
|||
# be careful not to run this on multiple systems.
|
||||
with lockfile("/tmp/zulip_email_deliver.lockfile"):
|
||||
while True:
|
||||
# make sure to use utcnow, otherwise it gets confused when you set the time with utcnow(), and select with now()
|
||||
# make sure to use utcnow, otherwise it gets confused when you set the time with utcnow(),
|
||||
# and select with now()
|
||||
email_jobs_to_deliver = ScheduledJob.objects.filter(type=ScheduledJob.EMAIL,
|
||||
scheduled_timestamp__lte=datetime.utcnow())
|
||||
if email_jobs_to_deliver:
|
||||
|
|
|
@ -132,7 +132,8 @@ def done(_):
|
|||
def main():
|
||||
# type: () -> None
|
||||
imap_client = protocol.ClientCreator(reactor, imap4.IMAP4Client)
|
||||
d = imap_client.connectSSL(settings.EMAIL_GATEWAY_IMAP_SERVER, settings.EMAIL_GATEWAY_IMAP_PORT, ssl.ClientContextFactory())
|
||||
d = imap_client.connectSSL(settings.EMAIL_GATEWAY_IMAP_SERVER, settings.EMAIL_GATEWAY_IMAP_PORT,
|
||||
ssl.ClientContextFactory())
|
||||
d.addCallbacks(connected, login_failed)
|
||||
d.addBoth(done)
|
||||
|
||||
|
@ -158,7 +159,8 @@ class Command(BaseCommand):
|
|||
try:
|
||||
extract_and_validate(rcpt_to)
|
||||
except ZulipEmailForwardError:
|
||||
print("5.1.1 Bad destination mailbox address: Please use the address specified in your Streams page.")
|
||||
print("5.1.1 Bad destination mailbox address: Please use the address specified "
|
||||
"in your Streams page.")
|
||||
exit(posix.EX_NOUSER) # type: ignore # There are no stubs for posix in python 3
|
||||
|
||||
# Read in the message, at most 25MiB. This is the limit enforced by
|
||||
|
@ -183,7 +185,8 @@ class Command(BaseCommand):
|
|||
if (not settings.EMAIL_GATEWAY_BOT or not settings.EMAIL_GATEWAY_LOGIN or
|
||||
not settings.EMAIL_GATEWAY_PASSWORD or not settings.EMAIL_GATEWAY_IMAP_SERVER or
|
||||
not settings.EMAIL_GATEWAY_IMAP_PORT or not settings.EMAIL_GATEWAY_IMAP_FOLDER):
|
||||
print("Please configure the Email Mirror Gateway in your local_settings.py, or specify $ORIGINAL_RECIPIENT if piping a single mail.")
|
||||
print("Please configure the Email Mirror Gateway in your local_settings.py, "
|
||||
"or specify $ORIGINAL_RECIPIENT if piping a single mail.")
|
||||
exit(1)
|
||||
reactor.callLater(0, main)
|
||||
reactor.run()
|
||||
|
|
|
@ -18,4 +18,5 @@ class Command(BaseCommand):
|
|||
# type: (*Any, **Any) -> None
|
||||
url = generate_realm_creation_url()
|
||||
self.stdout.write("\033[1;92mOne time organization creation link generated\033[0m")
|
||||
self.stdout.write("\033[1;92m=> Please visit \033[4m%s\033[0m \033[1;92mto create the organization\033[0m" % (url))
|
||||
self.stdout.write("\033[1;92m=> Please visit \033[4m%s\033[0m \033[1;92mto "
|
||||
"create the organization\033[0m" % (url))
|
||||
|
|
|
@ -53,7 +53,8 @@ ONLY perform this on customer request from an authorized person.
|
|||
do_change_is_admin(profile, True, permission=options['permission'])
|
||||
print("Done!")
|
||||
else:
|
||||
print("Would have granted %s %s rights for %s" % (email, options['permission'], profile.realm.domain))
|
||||
print("Would have granted %s %s rights for %s" % (
|
||||
email, options['permission'], profile.realm.domain))
|
||||
else:
|
||||
if profile.has_perm(options['permission'], profile.realm):
|
||||
if options['ack']:
|
||||
|
|
|
@ -324,7 +324,8 @@ class RateLimitMiddleware(object):
|
|||
def process_exception(self, request, exception):
|
||||
# type: (HttpRequest, Exception) -> HttpResponse
|
||||
if isinstance(exception, RateLimited):
|
||||
resp = json_error(_("API usage exceeded rate limit, try again in %s secs") % (request._ratelimit_secs_to_freedom,), status=429)
|
||||
resp = json_error(_("API usage exceeded rate limit, try again in %s secs") % (
|
||||
request._ratelimit_secs_to_freedom,), status=429)
|
||||
resp['Retry-After'] = request._ratelimit_secs_to_freedom
|
||||
return resp
|
||||
|
||||
|
|
|
@ -136,7 +136,8 @@ def accounts_register(request):
|
|||
# Other users should not already exist at all.
|
||||
user_email_is_unique(email)
|
||||
except ValidationError:
|
||||
return HttpResponseRedirect(reverse('django.contrib.auth.views.login') + '?email=' + urllib.parse.quote_plus(email))
|
||||
return HttpResponseRedirect(reverse('django.contrib.auth.views.login') + '?email=' +
|
||||
urllib.parse.quote_plus(email))
|
||||
|
||||
name_validated = False
|
||||
full_name = None
|
||||
|
@ -319,7 +320,8 @@ def api_endpoint_docs(request):
|
|||
langs = set()
|
||||
for call in calls:
|
||||
call["endpoint"] = "%s/v1/%s" % (settings.EXTERNAL_API_URI, call["endpoint"])
|
||||
call["example_request"]["curl"] = call["example_request"]["curl"].replace("https://api.zulip.com", settings.EXTERNAL_API_URI)
|
||||
call["example_request"]["curl"] = call["example_request"]["curl"].replace("https://api.zulip.com",
|
||||
settings.EXTERNAL_API_URI)
|
||||
response = call['example_response']
|
||||
if '\n' not in response:
|
||||
# For 1-line responses, pretty-print them
|
||||
|
@ -732,7 +734,8 @@ def create_realm(request, creation_key=None):
|
|||
# type: (HttpRequest, Optional[text_type]) -> HttpResponse
|
||||
if not settings.OPEN_REALM_CREATION:
|
||||
if creation_key is None:
|
||||
return render_to_response("zerver/realm_creation_failed.html", {'message': _('New organization creation disabled.')})
|
||||
return render_to_response("zerver/realm_creation_failed.html",
|
||||
{'message': _('New organization creation disabled.')})
|
||||
elif not check_key_is_valid(creation_key):
|
||||
return render_to_response("zerver/realm_creation_failed.html", {'message': _('The organization creation link has been expired or is not valid.')})
|
||||
|
||||
|
|
Loading…
Reference in New Issue