mirror of
https://github.com/redmine/redmine.git
synced 2026-05-07 19:45:29 +02:00
Disable auto watch for the anonymous user (#38238).
Patch by Felix Schäfer. git-svn-id: https://svn.redmine.org/redmine/trunk@22116 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -3479,6 +3479,21 @@ class IssueTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_create_should_not_add_anonymous_as_watcher
|
||||
Role.anonymous.add_permission!(:add_issue_watchers)
|
||||
|
||||
user = User.anonymous
|
||||
assert user.pref.auto_watch_on?('issue_contributed_to')
|
||||
|
||||
journal = Journal.new(:journalized => Issue.first, :notes => 'notes', :user => user)
|
||||
|
||||
assert_no_difference 'Watcher.count' do
|
||||
assert journal.save
|
||||
assert journal.valid?
|
||||
assert journal.journalized.valid?
|
||||
end
|
||||
end
|
||||
|
||||
def test_like_should_escape_query
|
||||
issue = Issue.generate!(:subject => "asdf")
|
||||
r = Issue.like('as_f')
|
||||
|
||||
@@ -142,6 +142,21 @@ class JournalTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_create_should_not_add_anonymous_as_watcher
|
||||
Role.anonymous.add_permission!(:add_issue_watchers)
|
||||
|
||||
user = User.anonymous
|
||||
assert user.pref.auto_watch_on?('issue_contributed_to')
|
||||
|
||||
journal = Journal.new(:journalized => Issue.first, :notes => 'notes', :user => user)
|
||||
|
||||
assert_no_difference 'Watcher.count' do
|
||||
assert journal.save
|
||||
assert journal.valid?
|
||||
assert journal.journalized.valid?
|
||||
end
|
||||
end
|
||||
|
||||
def test_visible_scope_for_anonymous
|
||||
# Anonymous user should see issues of public projects only
|
||||
journals = Journal.visible(User.anonymous).to_a
|
||||
|
||||
Reference in New Issue
Block a user