~bhavesh-goyal093/postorius/dashboard

« back to all changes in this revision

Viewing changes to src/postorius/views/list.py

  • Committer: Bhavesh Goyal
  • Date: 2015-06-22 05:17:05 UTC
  • Revision ID: bhavesh.goyal093@gmail.com-20150622051705-r8bc0qrv0091dj9c
Widget Functionality:
 *Implement Manual Tasks functionality and appropriate role handlers for different users
 *Replace pop overs with accordian view for tasks and index widgets
 *Implement Missing Search and Create List Functions for Index Widget
 *Simplified and Improve Data Logic for Graphical Stats
 *Add getcount method for EventTracker model
 *Modify Models to support Manual Tasks
UI:
 Improve CSS Code Structure
 Improve UI List Index & Event Streams Widget
 Add animations to Tasks Widget Icons
Fixing:
 Export Scripts to External Files
 Temp fix for Consistent View across all screens
 Fix href page navigation bug
 Fix Role handler for Event Streamer
 Modify regex for reorder tasks url

Show diffs side-by-side

added added

removed removed

Lines of Context:
591
591
 
592
592
def add_mod_event(request, msg_id, list_id, action):
593
593
    """Adds a Moderation Event Log For Event Tracker."""
 
594
    event_count = EventTracker.objects.get_count()
 
595
    if event_count == 30:
 
596
        EventTracker.objects.earliest('made_on').delete()
594
597
    the_list = List.objects.get_or_404(fqdn_listname=list_id)
595
598
    the_msg = next((each for each in the_list.held if each['request_id'] == int(msg_id)), None)
596
599
    event = 'moderation-' + action
608
611
 
609
612
def add_sub_event(request, sub_id, list_id, action):
610
613
    """Adds an Subscription Event Log For Event Tracker."""
 
614
    event_count = EventTracker.objects.get_count()
 
615
    if event_count == 30:
 
616
        EventTracker.objects.earliest('made_on').delete()
611
617
    the_list = List.objects.get_or_404(fqdn_listname=list_id)
612
618
    sub_req = next((each for each in the_list.requests if each['token'] == sub_id), None)
613
619
    event = 'subscription-' + action
665
671
    """
666
672
    try:
667
673
        the_list = List.objects.get_or_404(fqdn_listname=list_id)
 
674
        add_mod_event(request, msg_id, list_id, 'accept')
668
675
        the_list.accept_message(msg_id)
669
676
    except MailmanApiError:
670
677
        return utils.render_api_error(request)
681
688
    """
682
689
    try:
683
690
        the_list = List.objects.get_or_404(fqdn_listname=list_id)
 
691
        add_mod_event(request, msg_id, list_id, 'discard')
684
692
        the_list.discard_message(msg_id)
685
693
    except MailmanApiError:
686
694
        return utils.render_api_error(request)
697
705
    """
698
706
    try:
699
707
        the_list = List.objects.get_or_404(fqdn_listname=list_id)
 
708
        add_mod_event(request, msg_id, list_id, 'defer')
700
709
        the_list.defer_message(msg_id)
701
710
    except MailmanApiError:
702
711
        return utils.render_api_error(request)
713
722
    """
714
723
    try:
715
724
        the_list = List.objects.get_or_404(fqdn_listname=list_id)
 
725
        add_mod_event(request, msg_id, list_id, 'reject')
716
726
        the_list.reject_message(msg_id)
717
727
    except MailmanApiError:
718
728
        return utils.render_api_error(request)
754
764
    try:
755
765
        m_list = utils.get_client().get_list(list_id)
756
766
        # Moderate request and add feedback message to session.
 
767
        add_sub_event(request, request_id, list_id, action)
757
768
        m_list.moderate_request(request_id, action)
758
769
        messages.success(request, confirmation_messages[action])
759
770
    except MailmanApiError: