'custom_fields',
:if => lambda {|group, user| user.admin? && !group.builtin?})
+ alias_attribute :name, :lastname
+
def to_s
name.to_s
end
- def name
- lastname
- end
-
- def name=(arg)
- self.lastname = arg
- end
-
def builtin_type
nil
end
)
add_available_filter(
"priority_id",
- :type => :list_with_history, :values => IssuePriority.all.collect{|s| [s.name, s.id.to_s]}
+ :type => :list_with_history,
+ :values => IssuePriority.pluck(:name, :id).map {|name, id| [name, id.to_s]}
)
add_available_filter(
"author_id",
)
add_available_filter(
"member_of_group",
- :type => :list_optional, :values => lambda {Group.givable.visible.collect {|g| [g.name, g.id.to_s]}}
+ :type => :list_optional,
+ :values => lambda {Group.givable.visible.pluck(:name, :id).map {|name, id| [name, id.to_s]}}
)
add_available_filter(
"assigned_to_role",
- :type => :list_optional, :values => lambda {Role.givable.collect {|r| [r.name, r.id.to_s]}}
+ :type => :list_optional,
+ :values => lambda {Role.givable.pluck(:name, :id).map {|name, id| [name, id.to_s]}}
)
add_available_filter(
"fixed_version_id",
add_available_filter(
"category_id",
:type => :list_optional_with_history,
- :values => lambda {project.issue_categories.collect{|s| [s.name, s.id.to_s]}}
+ :values => lambda {project.issue_categories.pluck(:name, :id).map {|name, id| [name, id.to_s]}}
) if project
add_available_filter "subject", :type => :text
add_available_filter "description", :type => :text
end
def subproject_values
- project.descendants.visible.collect{|s| [s.name, s.id.to_s]}
+ project.descendants.visible.pluck(:name, :id).map {|name, id| [name, id.to_s]}
end
def principals
else
statuses = IssueStatus.all.sorted
end
- statuses.collect{|s| [s.name, s.id.to_s]}
+ statuses.pluck(:name, :id).map {|name, id| [name, id.to_s]}
end
def watcher_values
if field == 'project_id' || (self.type == 'ProjectQuery' && %w[id parent_id].include?(field))
if v.delete('mine')
- v += User.current.memberships.map {|m| m.project_id.to_s}
+ v += User.current.memberships.pluck(:project_id).map(&:to_s)
end
if v.delete('bookmarks')
v += User.current.bookmarked_project_ids
"issue.category_id",
:type => :list_optional,
:name => l("label_attribute_of_issue", :name => l(:field_category)),
- :values => lambda {project.issue_categories.collect{|s| [s.name, s.id.to_s]}}
+ :values => lambda {project.issue_categories.pluck(:name, :id).map {|name, id| [name, id.to_s]}}
) if project
add_available_filter(
"issue.subject",
type: :list_optional, values: ->{ auth_sources_values }
add_available_filter "is_member_of_group",
type: :list_optional,
- values: ->{ Group.givable.visible.map {|g| [g.name, g.id.to_s] } }
+ values: ->{ Group.givable.visible.pluck(:name, :id).map {|name, id| [name, id.to_s]} }
if Setting.twofa?
add_available_filter "twofa_scheme",
type: :list_optional,
end
def auth_sources_values
- AuthSource.order(name: :asc).to_a.map do |auth_source|
- [auth_source.name, auth_source.id]
- end
+ AuthSource.order(name: :asc).pluck(:name, :id)
end
def user_statuses_values
def sql_for_is_member_of_group_field(field, operator, value)
if ["*", "!*"].include? operator
- value = Group.givable.map(&:id)
+ value = Group.givable.ids
end
e = operator.start_with?("!") ? "NOT EXISTS" : "EXISTS"