Commit 9bcf5758 authored by Holger Just's avatar Holger Just

Merge branch 'release-v2.3.0' into stable

parents 296de668 9af56d07
......@@ -14,8 +14,8 @@ group :test do
gem 'edavis10-object_daddy', :require => 'object_daddy'
gem 'mocha'
platforms :mri_18 do gem 'ruby-debug' end
platforms :mri_19 do gem 'ruby-debug19', :require => 'ruby-debug' end
platforms :mri_18, :mingw_18 do gem 'ruby-debug' end
platforms :mri_19, :mingw_19 do gem 'ruby-debug19', :require => 'ruby-debug' end
end
group :openid do
......@@ -32,7 +32,7 @@ end
# orders of magnitude compared to their native counterparts. You have been
# warned.
platforms :mri do
platforms :mri, :mingw do
group :mysql do
gem "mysql"
# gem "ruby-mysql"
......@@ -48,13 +48,13 @@ platforms :mri do
end
end
platforms :mri_18 do
platforms :mri_18, :mingw_18 do
group :sqlite do
gem "sqlite3-ruby", "< 1.3", :require => "sqlite3"
end
end
platforms :mri_19 do
platforms :mri_19, :mingw_19 do
group :sqlite do
gem "sqlite3"
end
......
......@@ -286,7 +286,7 @@ private
render_error l(:error_no_tracker_in_project)
return false
end
@issue.start_date ||= User.current.today
@issue.start_date ||= User.current.today if Setting.issue_startdate_is_adddate?
if params[:issue].is_a?(Hash)
@issue.safe_attributes = params[:issue]
if User.current.allowed_to?(:add_issue_watchers, @project) && @issue.new_record?
......
......@@ -208,7 +208,10 @@ class Query < ActiveRecord::Base
@available_filters["assigned_to_role"] = { :type => :list_optional, :order => 7, :values => role_values } unless role_values.empty?
if User.current.logged?
@available_filters["watcher_id"] = { :type => :list, :order => 15, :values => [["<< #{l(:label_me)} >>", "me"]] }
# populate the watcher list with the same user list as other user filters if the user has the :view_issue_watchers permission in at least one project
# TODO: this could be differentiated more, e.g. all users could watch issues in public projects, but won't necessarily be shown here
watcher_values = User.current.allowed_to_globally?(:view_issue_watchers, {}) ? user_values : [["<< #{l(:label_me)} >>", "me"]]
@available_filters["watcher_id"] = { :type => :list, :order => 15, :values => watcher_values }
end
if project
......@@ -442,8 +445,21 @@ class Query < ActiveRecord::Base
elsif field == 'watcher_id'
db_table = Watcher.table_name
db_field = 'user_id'
sql << "#{Issue.table_name}.id #{ operator == '=' ? 'IN' : 'NOT IN' } (SELECT #{db_table}.watchable_id FROM #{db_table} WHERE #{db_table}.watchable_type='Issue' AND "
sql << sql_for_field(field, '=', v, db_table, db_field) + ')'
if User.current.admin?
# Admins can always see all watchers
sql << "#{Issue.table_name}.id #{operator == '=' ? 'IN' : 'NOT IN'} (SELECT #{db_table}.watchable_id FROM #{db_table} WHERE #{db_table}.watchable_type='Issue' AND #{sql_for_field field, '=', v, db_table, db_field})"
else
sql_parts = []
if User.current.logged? && user_id = v.delete(User.current.id.to_s)
# a user can always see his own watched issues
sql_parts << "#{Issue.table_name}.id #{operator == '=' ? 'IN' : 'NOT IN'} (SELECT #{db_table}.watchable_id FROM #{db_table} WHERE #{db_table}.watchable_type='Issue' AND #{sql_for_field field, '=', [user_id], db_table, db_field})"
end
# filter watchers only in projects the user has the permission to view watchers in
project_ids = User.current.projects_by_role.collect {|r,p| p if r.permissions.include? :view_issue_watchers}.flatten.compact.collect(&:id).uniq
sql_parts << "#{Issue.table_name}.id #{operator == '=' ? 'IN' : 'NOT IN'} (SELECT #{db_table}.watchable_id FROM #{db_table} WHERE #{db_table}.watchable_type='Issue' AND #{sql_for_field field, '=', v, db_table, db_field})"\
" AND #{Project.table_name}.id IN (#{project_ids.join(',')})" unless project_ids.empty?
sql << "(#{sql_parts.join(' OR ')})"
end
elsif field == "member_of_group" # named field
if operator == '*' # Any group
groups = Group.all
......
......@@ -24,7 +24,7 @@
</div>
<% if @project.new_record? %>
<fieldset class="box"><legend><%= l(:label_module_plural) %></legend>
<fieldset class="box" id="project_modules"><legend><%= l(:label_module_plural) %> <span style="font-size:0.9em">(<%= check_all_links 'project_modules' %>)</span></legend>
<% Redmine::AccessControl.available_project_modules.each do |m| %>
<label class="floating">
<%= check_box_tag 'project[enabled_module_names][]', m, @project.module_enabled?(m), :id => "project_enabled_module_names_#{m}" %>
......@@ -38,7 +38,7 @@
<% if @project.new_record? || @project.module_enabled?('issue_tracking') %>
<% unless @trackers.empty? %>
<fieldset class="box" id="project_trackers"><legend><%=l(:label_tracker_plural)%></legend>
<fieldset class="box" id="project_trackers"><legend><%=l(:label_tracker_plural)%> <span style="font-size:0.9em">(<%= check_all_links 'project_trackers' %>)</span></legend>
<% @trackers.each do |tracker| %>
<label class="floating">
<%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.include?(tracker) %>
......@@ -50,7 +50,7 @@
<% end %>
<% unless @issue_custom_fields.empty? %>
<fieldset class="box" id="project_issue_custom_fields"><legend><%=l(:label_custom_field_plural)%></legend>
<fieldset class="box" id="project_issue_custom_fields"><legend><%=l(:label_custom_field_plural)%> <span style="font-size:0.9em">(<%= check_all_links 'project_issue_custom_fields' %>)</span></legend>
<% @issue_custom_fields.each do |custom_field| %>
<label class="floating">
<%= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %>
......
......@@ -5,6 +5,8 @@
<p><%= setting_check_box :display_subprojects_issues %></p>
<p><%= setting_check_box :issue_startdate_is_adddate %></p>
<p><%= setting_select :issue_done_ratio, Issue::DONE_RATIO_OPTIONS.collect {|i| [l("setting_issue_done_ratio_#{i}"), i]} %></p>
<p><%= setting_text_field :issues_export_limit, :size => 6 %></p>
......
......@@ -6,10 +6,10 @@
<p>
<%= l(:label_version) %> <%= link_to @diff.content_from.version, :action => 'show', :id => @page.title, :project_id => @page.project, :version => @diff.content_from.version %>
<em>(<%= @diff.content_from.author ? link_to_user(@diff.content_from.author) : l(:label_user_anonymous) %>, <%= format_time(@diff.content_from.updated_on) %>)</em>
<em>(<%= @diff.content_from.user ? link_to_user(@diff.content_from.user) : l(:label_user_anonymous) %>, <%= format_time(@diff.content_from.updated_on) %>)</em>
&#8594;
<%= l(:label_version) %> <%= link_to @diff.content_to.version, :action => 'show', :id => @page.title, :project_id => @page.project, :version => @diff.content_to.version %>/<%= @page.content.version %>
<em>(<%= @diff.content_to.author ? link_to_user(@diff.content_to.author) : l(:label_user_anonymous) %>, <%= format_time(@diff.content_to.updated_on) %>)</em>
<em>(<%= @diff.content_to.user ? link_to_user(@diff.content_to.user) : l(:label_user_anonymous) %>, <%= format_time(@diff.content_to.updated_on) %>)</em>
</p>
<div class="text-diff">
......
......@@ -964,3 +964,4 @@ bg:
label_path_encoding: Кодиране на пътищата
text_mercurial_repo_example: локално хранилище (например /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -978,3 +978,4 @@ bs:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -967,3 +967,4 @@ ca:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -1188,3 +1188,4 @@ cs:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -980,3 +980,4 @@ da:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -370,6 +370,7 @@ de:
setting_start_of_week: Wochenanfang
setting_rest_api_enabled: REST-Schnittstelle aktivieren
setting_cache_formatted_text: Formatierten Text im Cache speichern
setting_issue_startdate_is_adddate: Neue Tickets haben "Heute" als Anfangsdatum
permission_add_project: Projekt erstellen
permission_add_subprojects: Unterprojekte erstellen
......
......@@ -964,3 +964,4 @@ el:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -370,6 +370,7 @@ en-GB:
setting_commit_logtime_enabled: Enable time logging
setting_commit_logtime_activity_id: Activity for logged time
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
setting_issue_startdate_is_adddate: Use current date as start date for new issues
permission_add_project: Create project
permission_add_subprojects: Create subprojects
......
......@@ -366,6 +366,7 @@ en:
setting_commit_logtime_enabled: Enable time logging
setting_commit_logtime_activity_id: Activity for logged time
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
setting_issue_startdate_is_adddate: Use current date as start date for new issues
permission_add_project: Create project
permission_add_subprojects: Create subprojects
......
......@@ -1001,3 +1001,4 @@ es:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -968,3 +968,4 @@ eu:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -967,3 +967,4 @@ fa:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -985,3 +985,4 @@ fi:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -367,6 +367,7 @@ fr:
setting_commit_logtime_enabled: Permettre la saisie de temps
setting_commit_logtime_activity_id: Activité pour le temps saisi
setting_gantt_items_limit: Nombre maximum d'éléments affichés sur le gantt
setting_issue_startdate_is_adddate: Utiliser "aujourd'hui" comme début pour les nouvelles demandes
permission_add_project: Créer un projet
permission_add_subprojects: Créer des sous-projets
......
......@@ -976,3 +976,4 @@ gl:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -969,3 +969,4 @@ he:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -971,3 +971,4 @@ hr:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -983,3 +983,4 @@
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -972,3 +972,4 @@ id:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -965,3 +965,4 @@ it:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -986,3 +986,4 @@ ja:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -1016,3 +1016,4 @@ ko:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -1024,3 +1024,4 @@ lt:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -959,3 +959,4 @@ lv:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -964,3 +964,4 @@ mk:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -965,3 +965,4 @@ mn:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -946,3 +946,4 @@ nl:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -951,3 +951,4 @@
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -981,3 +981,4 @@ pl:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -909,6 +909,7 @@ pt-BR:
setting_rest_api_enabled: Habilitar REST web service
label_missing_api_access_key: Chave de acesso a API faltando
label_missing_feeds_access_key: Chave de acesso ao RSS faltando
setting_issue_startdate_is_adddate: Usar data corrente como data inicial para novas tarefas
text_line_separated: Múltiplos valores permitidos (uma linha para cada valor).
setting_mail_handler_body_delimiters: Truncar e-mails após uma destas linhas
permission_add_subprojects: Criar subprojetos
......
......@@ -968,3 +968,4 @@ pt:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -957,3 +957,4 @@ ro:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
This diff is collapsed.
......@@ -959,3 +959,4 @@ sk:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -960,3 +960,4 @@ sl:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -964,3 +964,4 @@ sr-YU:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -965,3 +965,4 @@ sr:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -1006,3 +1006,4 @@ sv:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -961,3 +961,4 @@ th:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -983,3 +983,4 @@ tr:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -960,3 +960,4 @@ uk:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -1015,3 +1015,4 @@ vi:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -1046,3 +1046,4 @@
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -978,3 +978,4 @@ zh:
label_path_encoding: Path encoding
text_mercurial_repo_example: local repository (e.g. /hgrepo, c:\hgrepo)
label_diff: diff
setting_issue_startdate_is_adddate: Use current date as start date for new issues
......@@ -178,3 +178,5 @@ default_notification_option:
default: 'only_my_events'
emails_header:
default: ''
issue_startdate_is_adddate:
default: 1
\ No newline at end of file
......@@ -12,18 +12,24 @@
#++
class MergeWikiVersionsWithJournals < ActiveRecord::Migration
def self.up
# This is provided here for migrating up after the WikiContent::Version class has been removed
unless WikiContent.const_defined?("Version")
WikiContent.const_set("Version", Class.new(ActiveRecord::Base))
# This is provided here for migrating up after the WikiContent::Version class has been removed
class WikiContent < ActiveRecord::Base
class Version < ActiveRecord::Base
end
end
def self.up
# avoid touching WikiContent on journal creation
WikiContentJournal.class_exec {
def touch_journaled_after_creation
end
}
# assign all wiki_contents w/o author to the anonymous user - they used to
# work w/o author but don't any more.
WikiContent.update_all({:author_id => User.anonymous.id}, :author_id => nil)
WikiContent::Version.update_all({:author_id => User.anonymous.id}, :author_id => nil)
WikiContent::Version.find_by_sql("SELECT * FROM wiki_content_versions").each do |wv|
journal = WikiContentJournal.create!(:journaled_id => wv.wiki_content_id, :user_id => wv.author_id,
:notes => wv.comments, :created_at => wv.updated_on, :activity_type => "wiki_edits")
......
= ChiliProject changelog
== 2011-10-04 v2.3.0
* Bug #594: Wiki Diff somehow off
* Bug #617: Gemfile: Missing database related platform block for Windows + RubyInstaller
* Bug #619: Redmine.pm allows anonymous read access to repositories even if Anonymous role prohibits it
* Bug #633: Update from 1.x to 2.x impossible under rare but valid circumstances
* Feature #355: Turn on/off the if the start date will autofill by default
* Feature #566: The "Watcher" filter should show all users.
* Feature #644: Add Check/Uncheck all links to project form
== 2011-08-27 v2.2.0
* Bug #256: requires_redmine_plugin should defer loading plugins if not all dependencies are met
......
......@@ -318,7 +318,7 @@ sub access_handler {
my $project_id = get_project_identifier($r);
$r->set_handlers(PerlAuthenHandler => [\&OK])
if is_public_project($project_id, $r);
if is_public_project($project_id, $r) && anonymous_role_allows_browse_repository($r);
return OK
}
......@@ -390,6 +390,29 @@ sub is_public_project {
$ret;
}
sub anonymous_role_allows_browse_repository {
my $r = shift;
my $dbh = connect_database($r);
my $sth = $dbh->prepare(
"SELECT permissions FROM roles WHERE builtin = 2;"
);
$sth->execute();
my $ret = 0;
if (my @row = $sth->fetchrow_array) {
if ($row[0] =~ /:browse_repository/) {
$ret = 1;
}
}
$sth->finish();
undef $sth;
$dbh->disconnect();
undef $dbh;
$ret;
}
# perhaps we should use repository right (other read right) to check public access.
# it could be faster BUT it doesn't work for the moment.
# sub is_public_project_by_file {
......
......@@ -17,7 +17,7 @@ module ChiliProject
module VERSION #:nodoc:
MAJOR = 2
MINOR = 2
MINOR = 3
PATCH = 0
TINY = PATCH # Redmine compat
......
......@@ -444,6 +444,101 @@ class QueryTest < ActiveSupport::TestCase
end
context "'watcher_id' filter" do
context "globally" do
context "for an anonymous user" do
should "not be present" do
assert ! @query.available_filters.keys.include?("watcher_id")
end
end
context "for a logged in user" do
setup do
User.current = User.find 1
end
teardown do
User.current = nil
end
should "be present" do
assert @query.available_filters.keys.include?("watcher_id")
end
should "be a list" do
assert_equal :list, @query.available_filters["watcher_id"][:type]
end
should "have a list of active users as values" do
assert @query.available_filters["watcher_id"][:values].include?(["<< me >>", "me"])
assert @query.available_filters["watcher_id"][:values].include?(["John Smith", "2"])
assert @query.available_filters["watcher_id"][:values].include?(["Dave Lopper", "3"])
assert @query.available_filters["watcher_id"][:values].include?(["redMine Admin", "1"])
assert @query.available_filters["watcher_id"][:values].include?(["User Misc", "8"])
end
should "not include active users not member of any project" do
assert ! @query.available_filters["watcher_id"][:values].include?(['Robert Hill','4'])
end
should "not include locked users as values" do
assert ! @query.available_filters["watcher_id"][:values].include?(['Dave2 Lopper2','5'])
end
should "not include the anonymous user as values" do
assert ! @query.available_filters["watcher_id"][:values].include?(['Anonymous','6'])
end
end
end
context "in a project" do
setup do
@query.project = Project.find(1)
end
context "for an anonymous user" do
should "not be present" do
assert ! @query.available_filters.keys.include?("watcher_id")
end
end
context "for a logged in user" do
setup do
User.current = User.find 1
end
teardown do
User.current = nil
end
should "be present" do
assert @query.available_filters.keys.include?("watcher_id")
end
should "be a list" do
assert_equal :list, @query.available_filters["watcher_id"][:type]
end
should "have a list of the project members as values" do
assert @query.available_filters["watcher_id"][:values].include?(["<< me >>", "me"])
assert @query.available_filters["watcher_id"][:values].include?(["John Smith", "2"])
assert @query.available_filters["watcher_id"][:values].include?(["Dave Lopper", "3"])
end
should "not include non-project members as values" do
assert ! @query.available_filters["watcher_id"][:values].include?(["redMine Admin", "1"])
end
should "not include locked project members as values" do
assert ! @query.available_filters["watcher_id"][:values].include?(['Dave2 Lopper2','5'])
end
should "not include the anonymous user as values" do
assert ! @query.available_filters["watcher_id"][:values].include?(['Anonymous','6'])
end
end
end
end
end
context "#statement" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment