community_user_resources.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. org_community = Organization.create_if_not_exists(
  3. id: 1,
  4. name: __('Zammad Foundation'),
  5. )
  6. user_community = User.create_or_update(
  7. id: 2,
  8. login: 'nicole.braun@zammad.org',
  9. firstname: 'Nicole',
  10. lastname: 'Braun',
  11. email: 'nicole.braun@zammad.org',
  12. password: '',
  13. active: true,
  14. roles: [ Role.find_by(name: 'Customer') ],
  15. organization_id: org_community.id,
  16. )
  17. UserInfo.current_user_id = user_community.id
  18. if Ticket.count.zero?
  19. ticket = Ticket.create!(
  20. group_id: Group.find_by(name: 'Users').id,
  21. customer_id: User.find_by(login: 'nicole.braun@zammad.org').id,
  22. title: __('Welcome to Zammad!'),
  23. )
  24. Ticket::Article.create!(
  25. ticket_id: ticket.id,
  26. type_id: Ticket::Article::Type.find_by(name: 'phone').id,
  27. sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
  28. from: 'Zammad Feedback <feedback@zammad.org>',
  29. body: 'Welcome!
  30. Thank you for choosing Zammad.
  31. You will find updates and patches at https://zammad.org/. Online
  32. documentation is available at https://zammad.org/documentation. Get
  33. involved (discussions, contributing, ...) at https://zammad.org/participate.
  34. Regards,
  35. Your Zammad Team
  36. ',
  37. internal: false,
  38. )
  39. end
  40. UserInfo.current_user_id = 1