remove unused method

pull/5385/head
Jens Ulferts 8 years ago
parent 4df369884a
commit 0a882deaf3
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 8
      app/models/query.rb
  2. 30
      spec_legacy/unit/query_spec.rb

@ -231,14 +231,6 @@ class Query < ActiveRecord::Base
end
end
def editable_by?(user)
return false unless user
# Admin can edit them all and regular users can edit their private queries
return true if user.admin? || (!is_public && user_id == user.id)
# Members can not edit public queries that are for all project (only admin is allowed to)
is_public && !for_all? && user.allowed_to?(:manage_public_queries, project)
end
def add_filter(field, operator, values)
filter = filter_for(field)

@ -391,36 +391,6 @@ describe Query, type: :model do
assert_equal %w(Fixnum), count_by_group.values.map { |k| k.class.name }.uniq
end
it 'should editable by' do
admin = User.find(1)
manager = User.find(2)
developer = User.find(3)
# Public query on project 1
q = Query.find(1)
assert q.editable_by?(admin)
assert q.editable_by?(manager)
assert !q.editable_by?(developer)
# Private query on project 1
q = Query.find(2)
assert q.editable_by?(admin)
assert !q.editable_by?(manager)
assert q.editable_by?(developer)
# Private query for all projects
q = Query.find(3)
assert q.editable_by?(admin)
assert !q.editable_by?(manager)
assert q.editable_by?(developer)
# Public query for all projects
q = Query.find(4)
assert q.editable_by?(admin)
assert !q.editable_by?(manager)
assert !q.editable_by?(developer)
end
context '#filter_for' do
before do
@query = Query.new(name: '_')

Loading…
Cancel
Save