summaryrefslogtreecommitdiffstats
path: root/lib/redmine/default_data
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-04-28 07:10:59 +0000
committerGo MAEDA <maeda@farend.jp>2020-04-28 07:10:59 +0000
commit3986b6e3b95e3be673735c81ecb996c4c67686fc (patch)
tree613d893e868510394d556b363578868499b95e77 /lib/redmine/default_data
parent0d19732a8151767f85fa4d05ce538ea3f52a2825 (diff)
downloadredmine-3986b6e3b95e3be673735c81ecb996c4c67686fc.tar.gz
redmine-3986b6e3b95e3be673735c81ecb996c4c67686fc.zip
Load default custom queries when running redmine:load_default_data rake task (#33296).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@19731 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/default_data')
-rw-r--r--lib/redmine/default_data/loader.rb82
1 files changed, 81 insertions, 1 deletions
diff --git a/lib/redmine/default_data/loader.rb b/lib/redmine/default_data/loader.rb
index 901c7d9c2..272351fc6 100644
--- a/lib/redmine/default_data/loader.rb
+++ b/lib/redmine/default_data/loader.rb
@@ -31,7 +31,8 @@ module Redmine
!Role.where(:builtin => 0).exists? &&
!Tracker.exists? &&
!IssueStatus.exists? &&
- !Enumeration.exists?
+ !Enumeration.exists? &&
+ !Query.exists?
end
# Loads the default data
@@ -191,6 +192,85 @@ module Redmine
TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1)
TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2)
+
+ # Issue queries
+ IssueQuery.create!(
+ :name => l(:label_assigned_to_me_issues),
+ :filters =>
+ {
+ 'status_id' => {:operator => 'o', :values => ['']},
+ 'assigned_to_id' => {:operator => '=', :values => ['me']},
+ 'project.status' => {:operator => '=', :values => ['1']}
+ },
+ :sort_criteria => [['priority', 'desc'], ['updated_on', 'desc']],
+ :visibility => Query::VISIBILITY_PUBLIC
+ )
+ IssueQuery.create!(
+ :name => l(:label_reported_issues),
+ :filters =>
+ {
+ 'status_id' => {:operator => 'o', :values => ['']},
+ 'author_id' => {:operator => '=', :values => ['me']},
+ 'project.status' => {:operator => '=', :values => ['1']}
+ },
+ :sort_criteria => [['updated_on', 'desc']],
+ :visibility => Query::VISIBILITY_PUBLIC
+ )
+ IssueQuery.create!(
+ :name => l(:label_updated_issues),
+ :filters =>
+ {
+ 'status_id' => {:operator => 'o', :values => ['']},
+ 'updated_by' => {:operator => '=', :values => ['me']},
+ 'project.status' => {:operator => '=', :values => ['1']}
+ },
+ :sort_criteria => [['updated_on', 'desc']],
+ :visibility => Query::VISIBILITY_PUBLIC
+ )
+ IssueQuery.create!(
+ :name => l(:label_watched_issues),
+ :filters =>
+ {
+ 'status_id' => {:operator => 'o', :values => ['']},
+ 'watcher_id' => {:operator => '=', :values => ['me']},
+ 'project.status' => {:operator => '=', :values => ['1']},
+ },
+ :sort_criteria => [['updated_on', 'desc']],
+ :visibility => Query::VISIBILITY_PUBLIC
+ )
+
+ # Project queries
+ ProjectQuery.create!(
+ :name => l(:label_my_projects),
+ :filters =>
+ {
+ 'status' => {:operator => '=', :values => ['1']},
+ 'id' => {:operator => '=', :values => ['mine']}
+ },
+ :visibility => Query::VISIBILITY_PUBLIC
+ )
+ ProjectQuery.create!(
+ :name => l(:label_my_bookmarks),
+ :filters =>
+ {
+ 'status' => {:operator => '=', :values => ['1']},
+ 'id' => {:operator => '=', :values => ['bookmarks']}
+ },
+ :visibility => Query::VISIBILITY_PUBLIC
+ )
+
+ # Time entry queries
+ TimeEntryQuery.create!(
+ :name => l(:label_spent_time),
+ :filters =>
+ {
+ 'spent_on' => {:operator => '*', :values => ['']},
+ 'user_id' => {:operator => '=', :values => ['me']}
+ },
+ :sort_criteria => [['spent_on', 'desc']],
+ :options => {:totalable_names => [:hours]},
+ :visibility => Query::VISIBILITY_PUBLIC
+ )
end
true
end