community_user_resources.rb 1.2 KB

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