From 766232f29bc3b80ddea6c18b09cd8b5d56a88b86 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Wed, 30 Mar 2011 00:00:22 +0200 Subject: [PATCH 1/5] Add missing license header. --- test/IDF/DiffTest.php | 21 +++++++++++++++++++++ test/IDF/Scm/Monotone/BasicIOTest.php | 21 +++++++++++++++++++++ test/IDF/Scm/Monotone/ZipRenderTest.php | 21 +++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/test/IDF/DiffTest.php b/test/IDF/DiffTest.php index 68e4ca3..c293768 100644 --- a/test/IDF/DiffTest.php +++ b/test/IDF/DiffTest.php @@ -1,4 +1,25 @@ Date: Wed, 30 Mar 2011 00:12:07 +0200 Subject: [PATCH 2/5] Only display those filter options for items the user actually has access to (fixes issue 655) --- src/IDF/Views/Project.php | 40 ++++++++++++--------- src/IDF/templates/idf/project/timeline.html | 2 +- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/IDF/Views/Project.php b/src/IDF/Views/Project.php index 2befafc..aa746c9 100644 --- a/src/IDF/Views/Project.php +++ b/src/IDF/Views/Project.php @@ -62,20 +62,26 @@ class IDF_Views_Project } /** - * Returns an associative array with available model filters + * Returns an associative array with all accessible model filters * * @return array */ - private static function getAvailableModelFilters() + private function getAccessibleModelFilters($request) { - return array( - 'all' => __('All Updates'), - 'commits' => __('Commits'), - 'issues' => __('Issues and Comments'), - 'downloads' => __('Downloads'), - 'documents' => __('Documents'), - 'reviews' => __('Reviews and Patches'), - ); + $filters = array('all' => __('All Updates')); + + if (true === IDF_Precondition::accessSource($request)) + $filters['commits'] = __('Commits'); + if (true === IDF_Precondition::accessIssues($request)) + $filters['issues'] = __('Issues and Comments'); + if (true === IDF_Precondition::accessDownloads($request)) + $filters['downloads'] = __('Downloads'); + if (true === IDF_Precondition::accessWiki($request)) + $filters['documents'] = __('Documents'); + if (true === IDF_Precondition::accessReview($request)) + $filters['reviews'] = __('Reviews and Patches'); + + return $filters; } /** @@ -141,11 +147,11 @@ class IDF_Views_Project $prj = $request->project; $model_filter = @$match[2]; - $all_model_filters = self::getAvailableModelFilters(); - if (!array_key_exists($model_filter, $all_model_filters)) { + $accessible_model_filters = self::getAccessibleModelFilters($request); + if (!array_key_exists($model_filter, $accessible_model_filters)) { $model_filter = 'all'; } - $title = (string)$prj . ' ' . $all_model_filters[$model_filter]; + $title = (string)$prj . ' ' . $accessible_model_filters[$model_filter]; $pag = new IDF_Timeline_Paginator(new IDF_Timeline()); $pag->class = 'recent-issues'; @@ -183,7 +189,7 @@ class IDF_Views_Project 'feedurl' => $feedurl, 'timeline' => $pag, 'model_filter' => $model_filter, - 'all_model_filters' => $all_model_filters, + 'accessible_model_filters' => $accessible_model_filters, ), $request); @@ -214,11 +220,11 @@ class IDF_Views_Project $prj = $request->project; $model_filter = @$match[2]; - $all_model_filters = self::getAvailableModelFilters(); - if (!array_key_exists($model_filter, $all_model_filters)) { + $accessible_model_filters = self::getAccessibleModelFilters($request); + if (!array_key_exists($model_filter, $accessible_model_filters)) { $model_filter = 'all'; } - $title = $all_model_filters[$model_filter]; + $title = $accessible_model_filters[$model_filter]; $classes = self::determineModelClasses($request, $model_filter); $sqls = sprintf('model_class IN (%s)', implode(', ', $classes)); diff --git a/src/IDF/templates/idf/project/timeline.html b/src/IDF/templates/idf/project/timeline.html index 55186ac..92e66d3 100644 --- a/src/IDF/templates/idf/project/timeline.html +++ b/src/IDF/templates/idf/project/timeline.html @@ -15,7 +15,7 @@ {block context}

{trans 'All Updates'}

{trans 'Filter by type'}
-{foreach $all_model_filters as $filter_key => $filter_name} +{foreach $accessible_model_filters as $filter_key => $filter_name} {if $filter_key != 'all'} {$filter_name}
{/if} From 836986462ac35fd03efed2dffa2e077b9d17bdb7 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Wed, 30 Mar 2011 00:13:50 +0200 Subject: [PATCH 3/5] Add Stewart to AUTHORS. --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 10480b8..1a1790b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -31,6 +31,7 @@ Much appreciated contributors (in alphabetical order): Raphaël Emourgeon Samuel Suther - German translation Sindre R. Myren + Stewart Platt Thomas Keller - Monotone support Vladimir Solomatin William Martin From e408fe873300125efb086b44db3c8460d9f40aff Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Wed, 30 Mar 2011 00:17:35 +0200 Subject: [PATCH 4/5] Make the function static again; this change silently slipped through. --- src/IDF/Views/Project.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IDF/Views/Project.php b/src/IDF/Views/Project.php index aa746c9..528a2dd 100644 --- a/src/IDF/Views/Project.php +++ b/src/IDF/Views/Project.php @@ -66,7 +66,7 @@ class IDF_Views_Project * * @return array */ - private function getAccessibleModelFilters($request) + private static function getAccessibleModelFilters($request) { $filters = array('all' => __('All Updates')); From aa68fe348509ca3a9fde6350a95ee49c414edca9 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Wed, 30 Mar 2011 00:19:18 +0200 Subject: [PATCH 5/5] Note fix for issue 655. --- NEWS.mdtext | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.mdtext b/NEWS.mdtext index e16f211..c3bbfda 100644 --- a/NEWS.mdtext +++ b/NEWS.mdtext @@ -5,6 +5,7 @@ ## Bugfixes - monotone zip archive entries now all carry the revision date as mtime (issue 645) +- Timeline only displays filter options for items a user has actually access to (issue 655) ## Documentation