Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
5d7bc5c9
Commit
5d7bc5c9
authored
May 22, 2011
by
Jean-Philippe Lang
Committed by
Gregor Schmidt
Aug 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#577] Avoid validating users when creating watcher relation
Taken from Redmine r5880 Committed by Jean Philippe Lang
parent
3dc373ee
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
watcher_test.rb
test/unit/watcher_test.rb
+21
-0
acts_as_watchable.rb
vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb
+1
-1
No files found.
test/unit/watcher_test.rb
View file @
5d7bc5c9
...
...
@@ -42,7 +42,28 @@ class WatcherTest < ActiveSupport::TestCase
assert
Issue
.
watched_by
(
@user
).
include?
(
@issue
)
end
def
test_watcher_users
watcher_users
=
Issue
.
find
(
2
).
watcher_users
assert_kind_of
Array
,
watcher_users
assert_kind_of
User
,
watcher_users
.
first
end
def
test_watcher_users_should_not_validate_user
User
.
update_all
(
"firstname = ''"
,
"id=1"
)
@user
.
reload
assert
!
@user
.
valid?
issue
=
Issue
.
new
(
:project
=>
Project
.
find
(
1
),
:tracker_id
=>
1
,
:subject
=>
"test"
,
:author
=>
User
.
find
(
2
))
issue
.
watcher_users
<<
@user
issue
.
save!
assert
issue
.
watched_by?
(
@user
)
end
def
test_watcher_user_ids
assert_equal
[
1
,
3
],
Issue
.
find
(
2
).
watcher_user_ids
.
sort
end
def
test_watcher_user_ids
=
issue
=
Issue
.
new
issue
.
watcher_user_ids
=
[
'1'
,
'3'
]
assert
issue
.
watched_by?
(
User
.
find
(
1
))
...
...
vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb
View file @
5d7bc5c9
...
...
@@ -13,7 +13,7 @@ module Redmine
class_eval
do
has_many
:watchers
,
:as
=>
:watchable
,
:dependent
=>
:delete_all
has_many
:watcher_users
,
:through
=>
:watchers
,
:source
=>
:user
has_many
:watcher_users
,
:through
=>
:watchers
,
:source
=>
:user
,
:validate
=>
false
named_scope
:watched_by
,
lambda
{
|
user_id
|
{
:include
=>
:watchers
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment