Skip to content

Commit

Permalink
added initial version of get_invites() view
Browse files Browse the repository at this point in the history
rref #5357
#GH-64
  • Loading branch information
evrenesat committed Aug 29, 2016
1 parent 8297e12 commit 4a0aacf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions zengine/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
'mark_offline_user': 'zengine.views.system.mark_offline_user',
'ping': 'zengine.views.dev_utils.Ping',
'_zops_sync_wf_cache': 'zengine.views.system.sync_wf_cache',
'_zops_get_invites': 'zengine.views.system.get_invites',
'_zops_create_message': 'zengine.messaging.views.create_message',
'_zops_show_channel': 'zengine.messaging.views.show_channel',
'_zops_list_channels': 'zengine.messaging.views.list_channels',
Expand Down
20 changes: 17 additions & 3 deletions zengine/views/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import six
from pyoko.exceptions import ObjectDoesNotExist
from zengine.models import WFCache
from zengine.models import WFInstance
from zengine.models import WFInstance, TaskInvitation


def sessid_to_userid(current):
Expand All @@ -18,10 +18,26 @@ def sessid_to_userid(current):
current.user.bind_private_channel(current.session.sess_id)
current.output['sessid_to_userid'] = True


def mark_offline_user(current):
current.user.is_online(False)


def get_invites(current):
# TODO: Also return invitations for user's other roles
# TODO: Handle automatic role switching
current.output['task_list'] = [
{
'token': inv.instance.key,
'title': inv.name,
'description': inv.wf.description,
# 'wf_type': string, # Bu nedir ki???
'start_date': inv.task.start_date,
'finish_date': inv.task.finish_date}
for inv in TaskInvitation.objects.filter(role_id=current.role_id)
]


def sync_wf_cache(current):
wf_cache = WFCache(current)
wf_state = wf_cache.get()
Expand All @@ -46,5 +62,3 @@ def sync_wf_cache(current):
# if cache already cleared, we have nothing to sync
# -1 means do not return anything to client
current.output = -1


0 comments on commit 4a0aacf

Please sign in to comment.