render :nothing => true, :layout => true
return
end
- @issue.attributes = params[:issue]
+ if params[:issue].is_a?(Hash)
+ @issue.attributes = params[:issue]
+ @issue.watcher_user_ids = params[:issue]['watcher_user_ids'] if User.current.allowed_to?(:add_issue_watchers, @project)
+ end
@issue.author = User.current
default_status = IssueStatus.default
end
def annotate
+ @entry = @repository.entry(@path, @rev)
+ show_error_not_found and return unless @entry
+
@annotate = @repository.scm.annotate(@path, @rev)
render_error l(:error_scm_annotate) and return if @annotate.nil? || @annotate.empty?
end
'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
recipients issue.recipients
+ cc(issue.watcher_recipients - @recipients)
subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
body :issue => issue,
:issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
<% end %>
+<% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
+<p><label><%= l(:label_issue_watchers) %></label>
+<% @issue.project.users.sort.each do |user| -%>
+<label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watcher_user_ids.include?(user.id) %> <%=h user %></label>
+<% end -%>
+</p>
+<% end %>
+
<%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %>
<%= wikitoolbar_for 'issue_description' %>
--- /dev/null
+<p>
+<% if @repository.supports_cat? %>
+ <%= link_to_if action_name != 'entry', l(:button_view), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev } %> |
+<% end %>
+<% if @repository.supports_annotate? %>
+ <%= link_to_if action_name != 'annotate', l(:button_annotate), {:action => 'annotate', :id => @project, :path => to_path_param(@path), :rev => @rev } %> |
+<% end %>
+<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %>
+<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
+</p>
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
+<p><%= render :partial => 'link_to_functions' %></p>
+
<% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
<div class="autoscroll">
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2>
-<p>
-<% if @repository.supports_cat? %>
- <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev } %> |
-<% end %>
-<% if @repository.supports_annotate? %>
- <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => to_path_param(@path), :rev => @rev } %> |
-<% end %>
-<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %>
-<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
-</p>
+<p><%= render :partial => 'link_to_functions' %></p>
<%= render_properties(@properties) %>
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
+<p><%= render :partial => 'link_to_functions' %></p>
+
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
<% content_for :header_tags do %>
http://www.redmine.org/
+== v0.8.1
+
+* Select watchers on new issue form
+* Show view/annotate/download links on entry and annotate views
+* Fixed: Deleted files are shown when using Darcs
+
+
== 2008-12-30 v0.8.0
* Setting added in order to limit the number of diff lines that should be displayed
label_planning: Planning
label_incoming_emails: Emails entrants
label_generate_key: Générer une clé
-label_issue_watchers: Utilisateurs surveillant cette demande
+label_issue_watchers: Observateurs
label_example: Exemple
button_login: Connexion
end
end
return nil if $? && $?.exitstatus != 0
- entries.sort_by_name
+ entries.compact.sort_by_name
end
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
end
private
-
+
+ # Returns an Entry from the given XML element
+ # or nil if the entry was deleted
def entry_from_xml(element, path_prefix)
+ modified_element = element.elements['modified']
+ if modified_element.elements['modified_how'].text.match(/removed/)
+ return nil
+ end
+
Entry.new({:name => element.attributes['name'],
:path => path_prefix + element.attributes['name'],
:kind => element.name == 'file' ? 'file' : 'dir',
:size => nil,
:lastrev => Revision.new({
:identifier => nil,
- :scmid => element.elements['modified'].elements['patch'].attributes['hash']
+ :scmid => modified_element.elements['patch'].attributes['hash']
})
})
end
assert_equal 'activerecord_error_invalid', issue.errors.on(:custom_values)
end
+ def test_post_new_with_watchers
+ @request.session[:user_id] = 2
+ ActionMailer::Base.deliveries.clear
+
+ assert_difference 'Watcher.count', 2 do
+ post :new, :project_id => 1,
+ :issue => {:tracker_id => 1,
+ :subject => 'This is a new issue with watchers',
+ :description => 'This is the description',
+ :priority_id => 5,
+ :watcher_user_ids => ['2', '3']}
+ end
+ assert_redirected_to 'issues/show'
+
+ issue = Issue.find_by_subject('This is a new issue with watchers')
+ # Watchers added
+ assert_equal [2, 3], issue.watcher_user_ids.sort
+ assert issue.watched_by?(User.find(3))
+ # Watchers notified
+ mail = ActionMailer::Base.deliveries.last
+ assert_kind_of TMail::Mail, mail
+ assert [mail.bcc, mail.cc].flatten.include?(User.find(3).mail)
+ end
+
def test_post_should_preserve_fields_values_on_validation_failure
@request.session[:user_id] = 2
post :new, :project_id => 1,
assert_equal 6, @repository.changesets.count
end
+ def test_deleted_files_should_not_be_listed
+ entries = @repository.entries('sources')
+ assert entries.detect {|e| e.name == 'watchers_controller.rb'}
+ assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'}
+ end
+
def test_cat
@repository.fetch_changesets
cat = @repository.cat("sources/welcome_controller.rb", 2)
class_eval do
has_many :watchers, :as => :watchable, :dependent => :delete_all
has_many :watcher_users, :through => :watchers, :source => :user
+
+ attr_protected :watcher_ids, :watcher_user_ids
end
end
end