Skip to content

Commit

Permalink
Refactor parameters for getting timeline events
Browse files Browse the repository at this point in the history
  • Loading branch information
cproensa authored and vboctor committed Mar 27, 2017
1 parent 911a098 commit 9c209fd
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions core/timeline_api.php
Expand Up @@ -37,19 +37,24 @@
* @param integer $p_start_time Timestamp representing start time of the period.
* @param integer $p_end_time Timestamp representing end time of the period.
* @param integer $p_max_events The maximum number of events to return or 0 for unlimited.
* @param type $p_filter Filter array to use for filtering bugs
* @param array $p_filter Filter array to use for filtering bugs, or null for no limit.
* @param integer $p_user_id A user id, to limit timeline to a user's history, or null for no limit.
* @return array
*/
function timeline_events( $p_start_time, $p_end_time, $p_max_events, $p_filter = null ) {
function timeline_events( $p_start_time, $p_end_time, $p_max_events, $p_filter = null, $p_user_id = null ) {
$t_timeline_events = array();

if( null === $p_filter ) {
# create an empty filter, to match all bugs
$t_filter = filter_ensure_valid_filter( array() );
# Override the default hide status, to show all bugs
$t_filter[FILTER_PROPERTY_HIDE_STATUS] = array( META_FILTER_NONE );
$t_query_options = array();
$t_query_options['start_time'] = $p_start_time;
$t_query_options['end_time'] = $p_end_time;
$t_query_options['order'] = 'DESC';
if( null !== $p_filter ) {
$t_query_options['filter'] = $p_filter;
}
$t_result = history_get_range_result_filter( $t_filter, $p_start_time, $p_end_time, 'DESC' );
if( null !== $p_user_id ) {
$t_query_options['user_id'] = $p_user_id;
}
$t_result = history_query_result( $t_query_options );
$t_count = 0;

while ( $t_history_event = history_get_event_from_row( $t_result, /* $p_user_id */ auth_get_current_user_id(), /* $p_check_access_to_issue */ true ) ) {
Expand Down

0 comments on commit 9c209fd

Please sign in to comment.