assets.rb 554 B

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Mention
  3. module Assets
  4. extend ActiveSupport::Concern
  5. def assets_attributes(data)
  6. app_model = self.class.to_app_model
  7. data[ app_model ] ||= {}
  8. return data if data[ app_model ][ id ]
  9. data[ app_model ][ id ] = attributes_with_association_ids
  10. data
  11. end
  12. def assets(data)
  13. assets_attributes(data)
  14. if mentionable.present?
  15. data = mentionable.assets(data)
  16. end
  17. user.assets(data)
  18. end
  19. end
  20. end