##// END OF EJS Templates
Merged r2164 to r2167, r2188 and r2189 from trunk....
Jean-Philippe Lang -
r2214:dea10c54f9f9
parent child
Show More
@@ -123,7 +123,10 class IssuesController < ApplicationController
123 render :nothing => true, :layout => true
123 render :nothing => true, :layout => true
124 return
124 return
125 end
125 end
126 @issue.attributes = params[:issue]
126 if params[:issue].is_a?(Hash)
127 @issue.attributes = params[:issue]
128 @issue.watcher_user_ids = params[:issue]['watcher_user_ids'] if User.current.allowed_to?(:add_issue_watchers, @project)
129 end
127 @issue.author = User.current
130 @issue.author = User.current
128
131
129 default_status = IssueStatus.default
132 default_status = IssueStatus.default
@@ -127,6 +127,9 class RepositoriesController < ApplicationController
127 end
127 end
128
128
129 def annotate
129 def annotate
130 @entry = @repository.entry(@path, @rev)
131 show_error_not_found and return unless @entry
132
130 @annotate = @repository.scm.annotate(@path, @rev)
133 @annotate = @repository.scm.annotate(@path, @rev)
131 render_error l(:error_scm_annotate) and return if @annotate.nil? || @annotate.empty?
134 render_error l(:error_scm_annotate) and return if @annotate.nil? || @annotate.empty?
132 end
135 end
@@ -28,6 +28,7 class Mailer < ActionMailer::Base
28 'Issue-Author' => issue.author.login
28 'Issue-Author' => issue.author.login
29 redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
29 redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
30 recipients issue.recipients
30 recipients issue.recipients
31 cc(issue.watcher_recipients - @recipients)
31 subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
32 subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
32 body :issue => issue,
33 body :issue => issue,
33 :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
34 :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
@@ -48,6 +48,14
48 <p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
48 <p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
49 <% end %>
49 <% end %>
50
50
51 <% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
52 <p><label><%= l(:label_issue_watchers) %></label>
53 <% @issue.project.users.sort.each do |user| -%>
54 <label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watcher_user_ids.include?(user.id) %> <%=h user %></label>
55 <% end -%>
56 </p>
57 <% end %>
58
51 <%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %>
59 <%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %>
52
60
53 <%= wikitoolbar_for 'issue_description' %>
61 <%= wikitoolbar_for 'issue_description' %>
@@ -1,5 +1,7
1 <h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
1 <h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
2
2
3 <p><%= render :partial => 'link_to_functions' %></p>
4
3 <% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
5 <% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
4
6
5 <div class="autoscroll">
7 <div class="autoscroll">
@@ -1,15 +1,6
1 <h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2>
1 <h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2>
2
2
3 <p>
3 <p><%= render :partial => 'link_to_functions' %></p>
4 <% if @repository.supports_cat? %>
5 <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev } %> |
6 <% end %>
7 <% if @repository.supports_annotate? %>
8 <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => to_path_param(@path), :rev => @rev } %> |
9 <% end %>
10 <%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %>
11 <%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
12 </p>
13
4
14 <%= render_properties(@properties) %>
5 <%= render_properties(@properties) %>
15
6
@@ -1,5 +1,7
1 <h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
1 <h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
2
2
3 <p><%= render :partial => 'link_to_functions' %></p>
4
3 <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
5 <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
4
6
5 <% content_for :header_tags do %>
7 <% content_for :header_tags do %>
@@ -5,6 +5,13 Copyright (C) 2006-2008 Jean-Philippe Lang
5 http://www.redmine.org/
5 http://www.redmine.org/
6
6
7
7
8 == v0.8.1
9
10 * Select watchers on new issue form
11 * Show view/annotate/download links on entry and annotate views
12 * Fixed: Deleted files are shown when using Darcs
13
14
8 == 2008-12-30 v0.8.0
15 == 2008-12-30 v0.8.0
9
16
10 * Setting added in order to limit the number of diff lines that should be displayed
17 * 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
580 label_planning: Planning
580 label_planning: Planning
581 label_incoming_emails: Emails entrants
581 label_incoming_emails: Emails entrants
582 label_generate_key: Générer une clé
582 label_generate_key: Générer une clé
583 label_issue_watchers: Utilisateurs surveillant cette demande
583 label_issue_watchers: Observateurs
584 label_example: Exemple
584 label_example: Exemple
585
585
586 button_login: Connexion
586 button_login: Connexion
@@ -84,7 +84,7 module Redmine
84 end
84 end
85 end
85 end
86 return nil if $? && $?.exitstatus != 0
86 return nil if $? && $?.exitstatus != 0
87 entries.sort_by_name
87 entries.compact.sort_by_name
88 end
88 end
89
89
90 def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
90 def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
@@ -148,15 +148,22 module Redmine
148 end
148 end
149
149
150 private
150 private
151
151
152 # Returns an Entry from the given XML element
153 # or nil if the entry was deleted
152 def entry_from_xml(element, path_prefix)
154 def entry_from_xml(element, path_prefix)
155 modified_element = element.elements['modified']
156 if modified_element.elements['modified_how'].text.match(/removed/)
157 return nil
158 end
159
153 Entry.new({:name => element.attributes['name'],
160 Entry.new({:name => element.attributes['name'],
154 :path => path_prefix + element.attributes['name'],
161 :path => path_prefix + element.attributes['name'],
155 :kind => element.name == 'file' ? 'file' : 'dir',
162 :kind => element.name == 'file' ? 'file' : 'dir',
156 :size => nil,
163 :size => nil,
157 :lastrev => Revision.new({
164 :lastrev => Revision.new({
158 :identifier => nil,
165 :identifier => nil,
159 :scmid => element.elements['modified'].elements['patch'].attributes['hash']
166 :scmid => modified_element.elements['patch'].attributes['hash']
160 })
167 })
161 })
168 })
162 end
169 end
@@ -332,6 +332,30 class IssuesControllerTest < Test::Unit::TestCase
332 assert_equal 'activerecord_error_invalid', issue.errors.on(:custom_values)
332 assert_equal 'activerecord_error_invalid', issue.errors.on(:custom_values)
333 end
333 end
334
334
335 def test_post_new_with_watchers
336 @request.session[:user_id] = 2
337 ActionMailer::Base.deliveries.clear
338
339 assert_difference 'Watcher.count', 2 do
340 post :new, :project_id => 1,
341 :issue => {:tracker_id => 1,
342 :subject => 'This is a new issue with watchers',
343 :description => 'This is the description',
344 :priority_id => 5,
345 :watcher_user_ids => ['2', '3']}
346 end
347 assert_redirected_to 'issues/show'
348
349 issue = Issue.find_by_subject('This is a new issue with watchers')
350 # Watchers added
351 assert_equal [2, 3], issue.watcher_user_ids.sort
352 assert issue.watched_by?(User.find(3))
353 # Watchers notified
354 mail = ActionMailer::Base.deliveries.last
355 assert_kind_of TMail::Mail, mail
356 assert [mail.bcc, mail.cc].flatten.include?(User.find(3).mail)
357 end
358
335 def test_post_should_preserve_fields_values_on_validation_failure
359 def test_post_should_preserve_fields_values_on_validation_failure
336 @request.session[:user_id] = 2
360 @request.session[:user_id] = 2
337 post :new, :project_id => 1,
361 post :new, :project_id => 1,
@@ -49,6 +49,12 class RepositoryDarcsTest < Test::Unit::TestCase
49 assert_equal 6, @repository.changesets.count
49 assert_equal 6, @repository.changesets.count
50 end
50 end
51
51
52 def test_deleted_files_should_not_be_listed
53 entries = @repository.entries('sources')
54 assert entries.detect {|e| e.name == 'watchers_controller.rb'}
55 assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'}
56 end
57
52 def test_cat
58 def test_cat
53 @repository.fetch_changesets
59 @repository.fetch_changesets
54 cat = @repository.cat("sources/welcome_controller.rb", 2)
60 cat = @repository.cat("sources/welcome_controller.rb", 2)
@@ -14,6 +14,8 module Redmine
14 class_eval do
14 class_eval do
15 has_many :watchers, :as => :watchable, :dependent => :delete_all
15 has_many :watchers, :as => :watchable, :dependent => :delete_all
16 has_many :watcher_users, :through => :watchers, :source => :user
16 has_many :watcher_users, :through => :watchers, :source => :user
17
18 attr_protected :watcher_ids, :watcher_user_ids
17 end
19 end
18 end
20 end
19 end
21 end
General Comments 0
You need to be logged in to leave comments. Login now