mirror of https://github.com/zulip/zulip.git
Add backend support for realm admins to rename streams.
(imported from commit eaf419f1f68dfd350b8c99e8a5089ec316f0c409)
This commit is contained in:
parent
b9da1e1976
commit
cfeaa2be9b
|
@ -961,6 +961,10 @@ def do_rename_stream(realm, old_name, new_name, log=True):
|
|||
|
||||
tornado_callbacks.send_notification(notice)
|
||||
|
||||
# Even though the token doesn't change, the web client needs to update the
|
||||
# email forwarding address to display the correctly-escaped new name.
|
||||
return {"email_address": encode_email_address(stream)}
|
||||
|
||||
def do_create_realm(domain, restricted_to_domain=True):
|
||||
realm = get_realm(domain)
|
||||
created = not realm
|
||||
|
|
|
@ -37,7 +37,7 @@ from zerver.lib.actions import do_remove_subscription, bulk_remove_subscriptions
|
|||
do_send_messages, do_add_subscription, get_default_subs, do_deactivate, \
|
||||
user_email_is_unique, do_invite_users, do_refer_friend, compute_mit_user_fullname, \
|
||||
do_add_alert_words, do_remove_alert_words, do_set_alert_words, get_subscribers, \
|
||||
update_user_activity_interval, do_set_muted_topics
|
||||
update_user_activity_interval, do_set_muted_topics, do_rename_stream
|
||||
from zerver.lib.create_user import random_api_key
|
||||
from zerver.forms import RegistrationForm, HomepageForm, ToSForm, CreateBotForm, \
|
||||
is_inactive, isnt_mit, not_mit_mailing_list
|
||||
|
@ -712,7 +712,8 @@ def home(request):
|
|||
furthest_read_time = sent_time_in_epoch_seconds(latest_read),
|
||||
onboarding_steps = ujson.loads(user_profile.onboarding_steps),
|
||||
staging = settings.STAGING_DEPLOYED or not settings.DEPLOYED,
|
||||
alert_words = register_ret['alert_words']
|
||||
alert_words = register_ret['alert_words'],
|
||||
show_admin = user_profile.show_admin
|
||||
))
|
||||
|
||||
statsd.incr('views.home')
|
||||
|
@ -1404,6 +1405,14 @@ def get_public_streams_backend(request, user_profile):
|
|||
return get_streams_backend(request, user_profile, include_public=True,
|
||||
include_subscribed=False, include_all_active=False)
|
||||
|
||||
@authenticated_json_post_view
|
||||
@has_request_variables
|
||||
def json_rename_stream(request, user_profile, old_name=REQ, new_name=REQ):
|
||||
if not user_profile.has_perm('administer', user_profile.realm):
|
||||
return json_error("Insufficient permission to rename stream")
|
||||
|
||||
return json_success(do_rename_stream(user_profile.realm, old_name, new_name))
|
||||
|
||||
@authenticated_api_view
|
||||
def api_list_subscriptions(request, user_profile):
|
||||
return list_subscriptions_backend(request, user_profile)
|
||||
|
|
|
@ -94,6 +94,7 @@ urlpatterns += patterns('zerver.views',
|
|||
url(r'^json/update_pointer$', 'json_update_pointer'),
|
||||
url(r'^json/get_old_messages$', 'json_get_old_messages'),
|
||||
url(r'^json/get_public_streams$', 'json_get_public_streams'),
|
||||
url(r'^json/rename_stream$', 'json_rename_stream'),
|
||||
url(r'^json/send_message$', 'json_send_message'),
|
||||
url(r'^json/invite_users$', 'json_invite_users'),
|
||||
url(r'^json/bulk_invite_users$', 'json_bulk_invite_users'),
|
||||
|
|
Loading…
Reference in New Issue