src/cm/client.py
changeset 17 a4be0b8a905d
parent 12 f69ff46d3240
child 24 c8a95e540b79
equal deleted inserted replaced
16:036705244cab 17:a4be0b8a905d
   215     if not email_or_user :
   215     if not email_or_user :
   216         email_or_user = request.POST.get('email', None)
   216         email_or_user = request.POST.get('email', None)
   217         if email_or_user :
   217         if email_or_user :
   218             email_or_user = email_or_user.lower().strip()
   218             email_or_user = email_or_user.lower().strip()
   219 
   219 
       
   220     active = (request.POST.get('active', False) == 'true')
   220     text = Text.objects.get(key=key)
   221     text = Text.objects.get(key=key)
   221     Notification.objects.set_notification(text=None, type='own', active=True, email_or_user=email_or_user)
   222     Notification.objects.set_notification(text=None, type='own', active=active, email_or_user=email_or_user)
   222     ret = HttpResponse()
   223     ret = HttpResponse()
   223     ret.status_code = 200 
   224     ret.status_code = 200 
   224     return ret 
   225     return ret 
   225 
   226 
   226 @has_perm_on_text("can_create_comment")
   227 @has_perm_on_text("can_create_comment")
   264 
   265 
   265         if ask_for_notification :
   266         if ask_for_notification :
   266             ask_for_notification = ( None == Notification.objects.get_notifications(text=None, type='own', email_or_user=(user if user else email)))
   267             ask_for_notification = ( None == Notification.objects.get_notifications(text=None, type='own', email_or_user=(user if user else email)))
   267         ret['ask_for_notification'] = ask_for_notification
   268         ret['ask_for_notification'] = ask_for_notification
   268         ret['email'] = '' if user else email
   269         ret['email'] = '' if user else email
   269     
   270 
   270         if text_version.mod_posteriori or has_perm(request, 'can_view_unapproved_comment', text=text) : 
   271         if text_version.mod_posteriori or has_perm(request, 'can_view_unapproved_comment', text=text) or has_perm(request, 'can_view_comment_own', text=text) : 
   271             ret['comment'] = comment
   272             ret['comment'] = comment
   272             ret['msg'] = _(u"comment saved")
   273             ret['msg'] = _(u"comment saved")
   273         else :
   274         else :
   274             ret['msg'] = _(u"comment saved, it is being held for moderation")
   275             ret['msg'] = _(u"comment saved, it is being held for moderation")
   275         
   276