Making WordPress.org


Ignore:
Timestamp:
11/01/2015 08:39:57 PM (11 years ago)
Author:
nacin
Message:

Trac Notifications: Only one API roundtrip for the notifications box.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications-db.php

    r2023 r2024  
    9494        }
    9595
     96        function get_trac_notifications_info( $ticket_id, $username ) {
     97                $meta = array(
     98                        'get_trac_ticket'                              => $this->get_trac_ticket( $ticket_id ),
     99                        'get_trac_ticket_focuses'                      => $this->get_trac_ticket_focuses( $ticket_id ),
     100                        'get_trac_notifications_for_user'              => $this->get_trac_notifications_for_user( $username ),
     101                        'get_trac_ticket_subscription_status_for_user' => $this->get_trac_ticket_subscription_status_for_user( $ticket_id, $username ),
     102                        'get_trac_ticket_subscriptions'                => $this->get_trac_ticket_subscriptions( $ticket_id ),
     103                        'get_trac_ticket_participants'                 => $this->get_trac_ticket_participants( $ticket_id ),
     104                );
     105
     106                if ( $meta['get_trac_ticket']->reporter !== $username ) {
     107                        $meta['get_reporter_last_activity'] = $this->get_reporter_past_activity( $meta['get_trac_ticket']->reporter, $ticket_id );
     108                }
     109
     110                return $meta;
     111        }
     112
    96113        function get_trac_ticket( $ticket_id ) {
    97114                return $this->db->get_row( $this->db->prepare( "SELECT * FROM ticket WHERE id = %d", $ticket_id ) );
Note: See TracChangeset for help on using the changeset viewer.