Patch #18059 » fixed_bugs_activity.diff
| app/models/journal.rb | ||
|---|---|---|
|
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all
|
||
|
attr_accessor :indice
|
||
|
acts_as_event :title => Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.id}#{status}: #{o.issue.subject}" },
|
||
|
acts_as_event :title => :event_title,
|
||
|
:description => :notes,
|
||
|
:author => :user,
|
||
|
:group => :issue,
|
||
| ... | ... | |
|
acts_as_activity_provider :type => 'issues',
|
||
|
:author_key => :user_id,
|
||
|
:find_options => {:include => [{:issue => :project}, :details, :user],
|
||
|
:conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" +
|
||
|
" (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"}
|
||
|
:conditions => @conditions}
|
||
|
before_create :split_private_notes
|
||
|
after_create :send_notification
|
||
| ... | ... | |
|
where("(#{Journal.table_name}.private_notes = ? OR (#{Project.allowed_to_condition(user, :view_private_notes, *args)}))", false)
|
||
|
}
|
||
|
def event_title
|
||
|
title = title_for_status if !new_status.blank? && new_assigned.blank?
|
||
|
title = title_for_assigned if new_status.blank? && !new_assigned.blank?
|
||
|
title = title_for_assigned_and_status if !new_status.blank? && !new_assigned.blank?
|
||
|
title = "#{l(:text_assigned_to_nobody)}" if title.blank?
|
||
|
event_conditions
|
||
|
title
|
||
|
end
|
||
|
def event_conditions
|
||
|
conditions = conditions_for_status if !new_status.blank? && new_assigned.blank?
|
||
|
conditions = conditions_for_assigned if new_status.blank? && !new_assigned.blank?
|
||
|
conditions = conditions_for_assigned_and_status if !new_status.blank? && !new_assigned.blank?
|
||
|
@conditions = conditions
|
||
|
end
|
||
|
def save(*args)
|
||
|
# Do not save an empty journal
|
||
|
(details.empty? && notes.blank?) ? false : super
|
||
| ... | ... | |
|
s ? IssueStatus.find_by_id(s.to_i) : nil
|
||
|
end
|
||
|
def new_assigned
|
||
|
a = new_value_for('assigned_to_id')
|
||
|
a ? User.find(a.to_i) : nil
|
||
|
end
|
||
|
def new_value_for(prop)
|
||
|
detail_for_attribute(prop).try(:value)
|
||
|
end
|
||
| ... | ... | |
|
Mailer.deliver_issue_edit(self)
|
||
|
end
|
||
|
end
|
||
|
def title_for_status
|
||
|
"#{issue.tracker} ##{issue.id} (#{new_status}): #{issue.subject}"
|
||
|
end
|
||
|
def title_for_assigned
|
||
|
"##{issue.id} - #{l(:text_assigned_to)} (#{new_assigned})"
|
||
|
end
|
||
|
def title_for_assigned_and_status
|
||
|
"#{issue.tracker} ##{issue.id} (#{new_status}): #{issue.subject}. #{l(:text_assigned_to)}(#{new_assigned})"
|
||
|
end
|
||
|
def conditions_for_status
|
||
|
"#{Journal.table_name}.journalized_type = 'Issue' AND" +
|
||
|
" (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"
|
||
|
end
|
||
|
def conditions_for_assigned
|
||
|
"#{Journal.table_name}.journalized_type = 'Issue' AND" +
|
||
|
" (#{JournalDetail.table_name}.prop_key = 'assigned_to_id')"
|
||
|
end
|
||
|
def conditions_for_assigned_and_status
|
||
|
"#{Journal.table_name}.journalized_type = 'Issue' AND" +
|
||
|
" (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')" +
|
||
|
" (#{JournalDetail.table_name}.prop_key = 'assigned_to_id')"
|
||
|
end
|
||
|
end
|
||
| config/locales/en.yml | ||
|---|---|---|
|
field_active: Active
|
||
|
text_assigned_to_nobody: "Now assigned to nobody"
|
||
|
text_assigned_to: "Now assigned to: "
|
||
|
text_select_mail_notifications: Select actions for which email notifications should be sent.
|
||
|
text_regexp_info: eg. ^[A-Z0-9]+$
|
||
|
text_min_max_length_info: 0 means no restriction
|
||
| config/locales/pl.yml | ||
|---|---|---|
|
status_active: aktywny
|
||
|
status_locked: zablokowany
|
||
|
status_registered: zarejestrowany
|
||
|
text_assigned_to_nobody: "Brak przypisanej osoby"
|
||
|
text_assigned_to: "Teraz przypisane do: "
|
||
|
text_are_you_sure: Jesteś pewien ?
|
||
|
text_assign_time_entries_to_project: Przypisz wpisy dziennika do projektu
|
||
|
text_caracters_maximum: "%{count} znaków maksymalnie."
|
||
| test/fixtures/journal_details.yml | ||
|---|---|---|
|
---
|
||
|
journal_details_001:
|
||
|
journal_details_001:
|
||
|
old_value: "1"
|
||
|
property: attr
|
||
|
id: 1
|
||
|
value: "2"
|
||
|
prop_key: status_id
|
||
|
journal_id: 1
|
||
|
journal_details_002:
|
||
|
journal_details_002:
|
||
|
old_value: "40"
|
||
|
property: attr
|
||
|
id: 2
|
||
| ... | ... | |
|
value: 060719210727_picture.jpg
|
||
|
prop_key: 4
|
||
|
journal_id: 3
|
||
|
journal_details_007:
|
||
|
old_value: "1"
|
||
|
property: attr
|
||
|
id: 7
|
||
|
value: "4"
|
||
|
prop_key: "status_id"
|
||
|
journal_id: 6
|
||
|
journal_details_008:
|
||
|
old_value:
|
||
|
property: attr
|
||
|
id: 8
|
||
|
value: "2"
|
||
|
prop_key: "assigned_to_id"
|
||
|
journal_id: 6
|
||
|
journal_details_009:
|
||
|
old_value: "2"
|
||
|
property: attr
|
||
|
id: 9
|
||
|
value:
|
||
|
prop_key: "assigned_to_id"
|
||
|
journal_id: 7
|
||
|
journal_details_010:
|
||
|
old_value:
|
||
|
property: attr
|
||
|
id: 10
|
||
|
value: "2"
|
||
|
prop_key: "assigned_to_id"
|
||
|
journal_id: 8
|
||
| test/fixtures/journals.yml | ||
|---|---|---|
|
user_id: 2
|
||
|
journalized_type: Issue
|
||
|
journalized_id: 14
|
||
|
journals_006:
|
||
|
id: 6
|
||
|
created_on: <%= (Date.today-2).to_date.to_s(:db) %>
|
||
|
notes: "Change Status And Assigned."
|
||
|
user_id: 2
|
||
|
journalized_type: Issue
|
||
|
journalized_id: 1
|
||
|
journals_007:
|
||
|
id: 7
|
||
|
created_on: <%= Date.today.to_date.to_s(:db) %>
|
||
|
notes: "Change Assigned to nobody"
|
||
|
user_id: 2
|
||
|
journalized_type: Issue
|
||
|
journalized_id: 1
|
||
|
journals_008:
|
||
|
id: 8
|
||
|
created_on: <%= Date.today.to_date.to_s(:db) %>
|
||
|
notes: "Change only assigned_to"
|
||
|
user_id: 2
|
||
|
journalized_type: Issue
|
||
|
journalized_id: 1
|
||
| test/functional/activities_controller_test.rb | ||
|---|---|---|
|
:enabled_modules,
|
||
|
:journals, :journal_details
|
||
|
def test_edit_issue_with_new_assigned
|
||
|
get :index, :project_id => 1, :with_subprojects => 0
|
||
|
assert_not_nil assigns(:events_by_day)
|
||
|
# status and assigned_to changed
|
||
|
assert_select 'a[href=/issues/1#change-6]', :text => "Bug #1 (Feedback): #{ESCAPED_UCANT} print recipes. Now assigned to: (John Smith)"
|
||
|
# assigned_to changed on nobody
|
||
|
assert_select 'a[href=/issues/1#change-7]', :text => "Now assigned to nobody"
|
||
|
# assigned_to changed on 2
|
||
|
assert_select 'a[href=/issues/1#change-8]', :text => "#1 - Now assigned to: (John Smith)"
|
||
|
end
|
||
|
def test_project_index
|
||
|
get :index, :id => 1, :with_subprojects => 0
|
||
| test/functional/issues_controller_transaction_test.rb | ||
|---|---|---|
|
:last_journal_id => 1
|
||
|
assert_not_nil assigns(:conflict_journals)
|
||
|
assert_equal 1, assigns(:conflict_journals).size
|
||
|
assert_equal 4, assigns(:conflict_journals).size
|
||
|
assert_equal 2, assigns(:conflict_journals).first.id
|
||
|
assert_tag 'div', :attributes => {:class => 'conflict'},
|
||
|
:descendant => {:content => /Some notes with Redmine links/}
|
||
| ... | ... | |
|
:last_journal_id => ''
|
||
|
assert_not_nil assigns(:conflict_journals)
|
||
|
assert_equal 2, assigns(:conflict_journals).size
|
||
|
assert_equal 5, assigns(:conflict_journals).size
|
||
|
assert_tag 'div', :attributes => {:class => 'conflict'},
|
||
|
:descendant => {:content => /Some notes with Redmine links/}
|
||
|
assert_tag 'div', :attributes => {:class => 'conflict'},
|
||
| test/unit/issue_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_last_journal_id_with_journals_should_return_the_journal_id
|
||
|
assert_equal 2, Issue.find(1).last_journal_id
|
||
|
assert_equal 8, Issue.find(1).last_journal_id
|
||
|
end
|
||
|
def test_last_journal_id_without_journals_should_return_nil
|
||
| ... | ... | |
|
end
|
||
|
def test_journals_after_should_return_journals_with_greater_id
|
||
|
assert_equal [Journal.find(2)], Issue.find(1).journals_after('1')
|
||
|
assert_equal [], Issue.find(1).journals_after('2')
|
||
|
assert_equal Journal.find(2,6,7,8), Issue.find(1).journals_after('1')
|
||
|
assert_equal Journal.find(6,7,8), Issue.find(1).journals_after('2')
|
||
|
end
|
||
|
def test_journals_after_with_blank_arg_should_return_all_journals
|
||
|
assert_equal [Journal.find(1), Journal.find(2)], Issue.find(1).journals_after('')
|
||
|
assert_equal Journal.find(1,2,6,7,8), Issue.find(1).journals_after('')
|
||
|
end
|
||
|
def test_css_classes_should_include_tracker
|
||
- « Previous
- 1
- …
- 4
- 5
- 6
- Next »