Defect #34856 » 0001-Allow-adding-time-entry-on-an-issue-that-became-priv.patch
app/models/time_entry.rb | ||
---|---|---|
119 | 119 |
self.project_id = issue.project_id |
120 | 120 |
end |
121 | 121 |
@invalid_issue_id = nil |
122 |
elsif user.allowed_to?(:log_time, issue.project) && issue.assigned_to_id_changed? && issue.previous_assignee == User.current |
|
123 |
current_assignee = issue.assigned_to |
|
124 |
issue.assigned_to = issue.previous_assignee |
|
125 |
unless issue.visible?(user) |
|
126 |
@invalid_issue_id = issue_id |
|
127 |
end |
|
128 |
issue.assigned_to = current_assignee |
|
122 | 129 |
else |
123 | 130 |
@invalid_issue_id = issue_id |
124 | 131 |
end |
test/functional/issues_controller_test.rb | ||
---|---|---|
6501 | 6501 |
assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'this is my comment' |
6502 | 6502 |
end |
6503 | 6503 | |
6504 |
def test_put_with_spent_time_when_assigned_to_of_private_issue_is_update_at_the_same_time |
|
6505 |
@request.session[:user_id] = 3 |
|
6506 |
Role.find(2).update! :issues_visibility => 'own' |
|
6507 |
private_issue = Issue.find(3) |
|
6508 | ||
6509 |
assert_difference('TimeEntry.count', 1) do |
|
6510 |
put( |
|
6511 |
:update, |
|
6512 |
params: { |
|
6513 |
id: private_issue.id, |
|
6514 |
issue: { assigned_to_id: nil }, |
|
6515 |
time_entry: { |
|
6516 |
comments: "add spent time", activity_id: TimeEntryActivity.first.id, hours: 1 |
|
6517 |
} |
|
6518 |
} |
|
6519 |
) |
|
6520 |
end |
|
6521 |
assert_select '#errorExplanation', {text: /Log time is invalid/, count: 0} |
|
6522 |
assert_select '#errorExplanation', {text: /Issue is invalid/, count: 0} |
|
6523 |
assert_redirected_to action: 'show', id: private_issue.id |
|
6524 |
assert_not private_issue.reload.visible? |
|
6525 |
end |
|
6526 | ||
6504 | 6527 |
def test_put_update_should_allow_fixed_version_to_be_set_to_a_subproject |
6505 | 6528 |
issue = Issue.find(2) |
6506 | 6529 |
@request.session[:user_id] = 2 |
- « Previous
- 1
- 2
- 3
- Next »