mirror of
https://github.com/zulip/zulip.git
synced 2026-07-09 21:21:47 +08:00
Add zephyr_backend RPC call.
(imported from commit e815580e201772e81e94b820174e2410e3069960)
This commit is contained in:
parent
115334c82a
commit
d9f348a348
@ -11,6 +11,7 @@ urlpatterns = patterns('',
|
||||
url(r'^update$', 'zephyr.views.update', name='update'),
|
||||
url(r'^get_updates_longpoll$', 'zephyr.views.get_updates_longpoll', name='get_updates_longpoll'),
|
||||
url(r'^zephyr/', 'zephyr.views.zephyr', name='zephyr'),
|
||||
url(r'^forge_zephyr/', 'zephyr.views.zephyr_backend', name='zephyr_backend'),
|
||||
url(r'^accounts/home/', 'zephyr.views.accounts_home', name='accounts_home'),
|
||||
url(r'^accounts/login/', 'django.contrib.auth.views.login', {'template_name': 'zephyr/login.html'}),
|
||||
url(r'^accounts/logout/', 'django.contrib.auth.views.logout', {'template_name': 'zephyr/index.html'}),
|
||||
|
||||
@ -143,9 +143,12 @@ def get_updates_longpoll(request, handler):
|
||||
# We need to replace this abstraction with the message list
|
||||
user_profile.add_callback(handler.async_callback(on_receive), last_received)
|
||||
|
||||
def zephyr(request):
|
||||
return zephyr_backend(request, request.user)
|
||||
|
||||
@login_required
|
||||
@require_post
|
||||
def zephyr(request):
|
||||
def zephyr_backend(request, sender):
|
||||
user_profile = UserProfile.objects.get(user=request.user)
|
||||
zephyr_type = request.POST["type"]
|
||||
if zephyr_type == 'class':
|
||||
@ -195,7 +198,7 @@ def zephyr(request):
|
||||
raise
|
||||
|
||||
new_zephyr = Zephyr()
|
||||
new_zephyr.sender = UserProfile.objects.get(user=request.user)
|
||||
new_zephyr.sender = UserProfile.objects.get(user=sender)
|
||||
new_zephyr.content = request.POST['new_zephyr']
|
||||
new_zephyr.recipient = recipient
|
||||
if zephyr_type == "class":
|
||||
|
||||
Loading…
Reference in New Issue
Block a user