Merged r2164 to r2167, r2188 and r2189 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2216 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
6abd32be9e
commit
dea10c54f9
@ -123,7 +123,10 @@ class IssuesController < ApplicationController
|
||||
render :nothing => true, :layout => true
|
||||
return
|
||||
end
|
||||
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
|
||||
|
@ -127,6 +127,9 @@ class RepositoriesController < ApplicationController
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ class Mailer < ActionMailer::Base
|
||||
'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)
|
||||
|
@ -48,6 +48,14 @@
|
||||
<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' %>
|
||||
|
10
app/views/repositories/_link_to_functions.rhtml
Normal file
10
app/views/repositories/_link_to_functions.rhtml
Normal file
@ -0,0 +1,10 @@
|
||||
<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>
|
@ -1,5 +1,7 @@
|
||||
<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">
|
||||
|
@ -1,15 +1,6 @@
|
||||
<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) %>
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
<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 %>
|
||||
|
@ -5,6 +5,13 @@ Copyright (C) 2006-2008 Jean-Philippe Lang
|
||||
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
|
||||
|
@ -580,7 +580,7 @@ label_reverse_chronological_order: Dans l'ordre chronologique inverse
|
||||
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
|
||||
|
@ -84,7 +84,7 @@ module Redmine
|
||||
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={})
|
||||
@ -149,14 +149,21 @@ module Redmine
|
||||
|
||||
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
|
||||
|
@ -332,6 +332,30 @@ class IssuesControllerTest < Test::Unit::TestCase
|
||||
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,
|
||||
|
@ -49,6 +49,12 @@ class RepositoryDarcsTest < Test::Unit::TestCase
|
||||
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)
|
||||
|
@ -14,6 +14,8 @@ module Redmine
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user