2016-10-19 03:11:36 +00:00
|
|
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
2014-01-29 23:54:34 +00:00
|
|
|
|
2015-04-27 21:44:41 +00:00
|
|
|
class Organization
|
|
|
|
module SearchIndex
|
2018-04-26 08:55:53 +00:00
|
|
|
extend ActiveSupport::Concern
|
2014-01-29 23:54:34 +00:00
|
|
|
|
2021-01-27 09:58:35 +00:00
|
|
|
def search_index_attribute_lookup(include_references: true)
|
2016-07-06 06:13:44 +00:00
|
|
|
attributes = super
|
2015-04-27 21:44:41 +00:00
|
|
|
|
2021-01-27 09:58:35 +00:00
|
|
|
if include_references
|
|
|
|
|
|
|
|
# add org members for search index data
|
|
|
|
attributes['members'] = []
|
|
|
|
users = User.where(organization_id: id)
|
|
|
|
users.each do |user|
|
|
|
|
attributes['members'].push user.search_index_attribute_lookup(include_references: false)
|
|
|
|
end
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2015-04-27 21:44:41 +00:00
|
|
|
|
2016-07-06 06:13:44 +00:00
|
|
|
attributes
|
2015-04-27 21:44:41 +00:00
|
|
|
end
|
2014-01-29 23:54:34 +00:00
|
|
|
end
|
2014-02-03 19:23:00 +00:00
|
|
|
end
|