diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2016-06-22 19:15:09 +0200 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2016-07-01 14:52:04 +0200 |
commit | 3942621329b20307c1676d60324c8f47ea1e1b37 (patch) | |
tree | 45ec7ce2810878a7951946754cad10fad28642ab /app/finders | |
parent | fd9cd5ae8cd2d2f5488635b264eb86d89d768d66 (diff) | |
download | gitlab-ce-3942621329b20307c1676d60324c8f47ea1e1b37.tar.gz |
Expose target, filter by state as string
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/todos_finder.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb index 58a00f88af7..7806d9e4cc5 100644 --- a/app/finders/todos_finder.rb +++ b/app/finders/todos_finder.rb @@ -25,6 +25,7 @@ class TodosFinder def execute items = current_user.todos items = by_action_id(items) + items = by_action(items) items = by_author(items) items = by_project(items) items = by_state(items) @@ -43,6 +44,18 @@ class TodosFinder params[:action_id] end + def to_action_id + Todo::ACTION_NAMES.key(action.to_sym) + end + + def action? + action.present? && to_action_id + end + + def action + params[:action] + end + def author? params[:author_id].present? end @@ -96,6 +109,14 @@ class TodosFinder params[:type] end + def by_action(items) + if action? + items = items.where(action: to_action_id) + end + + items + end + def by_action_id(items) if action_id? items = items.where(action: action_id) |