Defect #28264 » fix_not_initialized_variable_in_query_model_V2.patch
app/models/query.rb (Arbeitskopie) | ||
---|---|---|
222 | 222 |
errors.add(:base, l(:label_role_plural) + ' ' + l('activerecord.errors.messages.blank')) if query.visibility == VISIBILITY_ROLES && roles.blank? |
223 | 223 |
end |
224 | 224 | |
225 |
after_initialize :set_global_attribute |
|
225 | 226 |
after_save do |query| |
226 | 227 |
if query.saved_change_to_visibility? && query.visibility != VISIBILITY_ROLES |
227 | 228 |
query.roles.clear |
... | ... | |
359 | 360 |
@queried_table_name ||= self.class.queried_class.table_name |
360 | 361 |
end |
361 | 362 | |
362 |
def initialize(attributes=nil, *args) |
|
363 |
super attributes |
|
364 |
@is_for_all = project.nil? |
|
363 |
def set_global_attribute |
|
364 |
@global_query = project.nil? |
|
365 | 365 |
end |
366 | 366 | |
367 |
def is_for_all_projects? |
|
368 |
@global_query ||= project.nil? |
|
369 |
end |
|
370 | ||
367 | 371 |
# Builds the query from the given params |
368 | 372 |
def build_from_params(params, defaults={}) |
369 | 373 |
if params[:fields] || params[:f] |
... | ... | |
446 | 450 |
# Admin can edit them all and regular users can edit their private queries |
447 | 451 |
return true if user.admin? || (is_private? && self.user_id == user.id) |
448 | 452 |
# Members can not edit public queries that are for all project (only admin is allowed to) |
449 |
is_public? && !@is_for_all && user.allowed_to?(:manage_public_queries, project)
|
|
453 |
is_public? && !is_for_all_projects? && user.allowed_to?(:manage_public_queries, project)
|
|
450 | 454 |
end |
451 | 455 | |
452 | 456 |
def trackers |
- « Previous
- 1
- 2
- 3
- Next »