From e8a57517f47b9b6a65a108b39aa0c8428162ec24 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 19 Dec 2018 18:31:51 +0100 Subject: [PATCH] Updated rubocop - applied custom Layout/AlignHash style. --- .rubocop.yml | 9 + Gemfile.lock | 6 +- app/controllers/activity_stream_controller.rb | 2 +- .../application_controller/authenticates.rb | 14 +- .../logs_http_access.rb | 28 +- .../application_controller/renders_models.rb | 2 +- app/controllers/applications_controller.rb | 2 +- .../calendar_subscriptions_controller.rb | 8 +- app/controllers/calendars_controller.rb | 4 +- app/controllers/channels_email_controller.rb | 66 +- .../channels_facebook_controller.rb | 4 +- app/controllers/channels_sms_controller.rb | 8 +- .../channels_telegram_controller.rb | 2 +- .../channels_twitter_controller.rb | 6 +- app/controllers/chats_controller.rb | 2 +- .../clones_ticket_article_attachments.rb | 10 +- .../concerns/creates_ticket_articles.rb | 24 +- app/controllers/concerns/ticket_stats.rb | 16 +- app/controllers/cti_controller.rb | 12 +- app/controllers/first_steps_controller.rb | 104 +- app/controllers/form_controller.rb | 34 +- app/controllers/getting_started_controller.rb | 36 +- app/controllers/import_otrs_controller.rb | 18 +- app/controllers/import_zendesk_controller.rb | 14 +- .../integration/check_mk_controller.rb | 30 +- app/controllers/integration/cti_controller.rb | 8 +- .../integration/idoit_controller.rb | 4 +- .../integration/ldap_controller.rb | 6 +- .../integration/placetel_controller.rb | 8 +- app/controllers/karma_controller.rb | 4 +- app/controllers/links_controller.rb | 10 +- app/controllers/long_polling_controller.rb | 10 +- app/controllers/monitoring_controller.rb | 30 +- .../object_manager_attributes_controller.rb | 36 +- .../online_notifications_controller.rb | 2 +- app/controllers/organizations_controller.rb | 24 +- app/controllers/proxy_controller.rb | 4 +- app/controllers/recent_view_controller.rb | 2 +- app/controllers/reports_controller.rb | 22 +- .../sessions/collection_dashboard.rb | 4 +- app/controllers/sessions_controller.rb | 36 +- app/controllers/settings_controller.rb | 8 +- app/controllers/slas_controller.rb | 2 +- app/controllers/tags_controller.rb | 18 +- app/controllers/text_modules_controller.rb | 10 +- app/controllers/ticket_articles_controller.rb | 32 +- .../ticket_overviews_controller.rb | 8 +- app/controllers/tickets_controller.rb | 110 +- .../time_accountings_controller.rb | 96 +- .../user_access_token_controller.rb | 2 +- app/controllers/users_controller.rb | 90 +- app/models/activity_stream.rb | 20 +- app/models/application_model/can_assets.rb | 2 +- .../application_model/has_attachments.rb | 10 +- app/models/authorization.rb | 30 +- app/models/avatar.rb | 92 +- app/models/calendar.rb | 4 +- app/models/channel.rb | 2 +- app/models/channel/driver/imap.rb | 6 +- app/models/channel/driver/pop3.rb | 6 +- .../channel/driver/sms/massenversand.rb | 14 +- app/models/channel/driver/sms/twilio.rb | 44 +- app/models/channel/driver/smtp.rb | 8 +- app/models/channel/email_build.rb | 4 +- app/models/channel/email_parser.rb | 54 +- app/models/channel/filter/follow_up_merged.rb | 2 +- app/models/channel/filter/identify_sender.rb | 40 +- app/models/chat.rb | 36 +- app/models/chat/agent.rb | 2 +- app/models/chat/session/search.rb | 2 +- app/models/concerns/can_csv_import.rb | 18 +- .../concerns/checks_client_notification.rb | 16 +- .../concerns/checks_condition_validation.rb | 2 +- app/models/concerns/has_groups.rb | 4 +- app/models/concerns/has_history.rb | 10 +- app/models/concerns/has_links.rb | 2 +- app/models/concerns/has_roles.rb | 2 +- app/models/concerns/has_tags.rb | 18 +- app/models/cti/caller_id.rb | 16 +- app/models/cti/log.rb | 28 +- app/models/history.rb | 28 +- app/models/karma/activity_log.rb | 30 +- app/models/karma/user.rb | 4 +- app/models/link.rb | 24 +- app/models/locale.rb | 2 +- app/models/object_manager/attribute.rb | 30 +- .../observer/chat/leave/background_job.rb | 4 +- app/models/observer/tag/ticket_history.rb | 20 +- .../communicate_email/background_job.rb | 48 +- .../communicate_facebook/background_job.rb | 16 +- .../article/communicate_sms/background_job.rb | 34 +- .../communicate_telegram/background_job.rb | 28 +- .../communicate_twitter/background_job.rb | 42 +- .../user_ticket_counter/background_job.rb | 4 +- app/models/observer/transaction.rb | 22 +- app/models/online_notification.rb | 34 +- app/models/organization/search.rb | 8 +- app/models/package.rb | 30 +- app/models/recent_view.rb | 6 +- app/models/report.rb | 286 +- app/models/scheduler.rb | 4 +- app/models/setting.rb | 2 +- app/models/stats_store.rb | 12 +- app/models/store/file.rb | 2 +- app/models/store/provider/db.rb | 2 +- app/models/tag.rb | 22 +- app/models/taskbar.rb | 16 +- app/models/text_module.rb | 8 +- app/models/ticket.rb | 126 +- app/models/ticket/article.rb | 12 +- app/models/ticket/escalation.rb | 16 +- app/models/ticket/overviews.rb | 12 +- app/models/ticket/screen_options.rb | 8 +- app/models/ticket/search.rb | 10 +- app/models/transaction/notification.rb | 38 +- app/models/transaction/slack.rb | 28 +- app/models/translation.rb | 10 +- app/models/user.rb | 32 +- app/models/user/assets.rb | 2 +- app/models/user/search.rb | 10 +- app/models/user_device.rb | 42 +- config/application.rb | 38 +- config/environments/development.rb | 6 +- config/initializers/html_sanitizer.rb | 16 +- config/initializers/omniauth.rb | 12 +- ...160217000001_object_manager_update_user.rb | 714 ++-- ...01_organization_domain_based_assignment.rb | 70 +- ...00002_ticket_number_generator_issue_427.rb | 18 +- ...0003_store_config_name_update_issue_428.rb | 16 +- .../20161122000001_monitoring_issue_453.rb | 22 +- db/migrate/20170116000002_fixed_typos_622.rb | 8 +- ...01_unable_to_enable_time_accounting_633.rb | 34 +- ...001_ui_ticket_zoom_article_new_internal.rb | 24 +- ...170126091128_application_secret_setting.rb | 12 +- ...0130000001_follow_up_possible_check_643.rb | 48 +- ...003_do_not_import_onw_notifications_731.rb | 12 +- db/migrate/20170215000001_telegram_support.rb | 6 +- ...3000001_fixed_admin_user_permission_920.rb | 792 ++-- .../20170418000001_validate_agent_limit.rb | 12 +- db/migrate/20170419000001_ldap_support.rb | 52 +- ...0170421000001_pretty_date_options_added.rb | 22 +- db/migrate/20170504144100_follow_up_merged.rb | 12 +- .../20170525000001_reply_to_sender_feature.rb | 30 +- ...00002_setting_delivery_permanent_failed.rb | 24 +- .../20170628000001_form_group_selection.rb | 74 +- .../20170629000001_exchange_integration.rb | 36 +- ...170713000001_omniauth_office365_setting.rb | 50 +- .../20170713000002_ticket_zoom_setting2.rb | 96 +- ...0001_object_manager_user_email_optional.rb | 38 +- .../20170714000002_user_email_multiple_use.rb | 18 +- db/migrate/20170714000003_cleanup_cti_log.rb | 10 +- db/migrate/20170727000001_setting_proxy.rb | 98 +- db/migrate/20170816000001_idoit_support.rb | 36 +- db/migrate/20170910000002_out_of_office2.rb | 28 +- db/migrate/20170924054554_weibo_oauth2.rb | 50 +- .../20171024000001_monit_integration.rb | 102 +- .../20171024000002_check_mk_integration2.rb | 136 +- .../20171102000001_last_owner_update2.rb | 10 +- ...mer_selection_based_on_sender_recipient.rb | 18 +- .../20171203000001_setting_es_pipeline.rb | 10 +- .../20171206000001_setting_default_locale2.rb | 14 +- ...rmission_user_preferences_out_of_office.rb | 6 +- ..._ticket_number_ignore_system_id_support.rb | 20 +- ...01_sidebar_customer_open_ticket_colored.rb | 22 +- ...180220000001_setting_attachment_preview.rb | 48 +- ...g_user_organization_selector_with_email.rb | 24 +- ...180306084119_custom_html_email_css_font.rb | 12 +- ...00001_setting_table_group_by_show_count.rb | 22 +- ...tting_third_party_link_account_at_login.rb | 20 +- ..._ticket_create_types_setting_issue_1987.rb | 48 +- ...01_issue2029_sipgate_integration_enable.rb | 14 +- ...email_forward_prefix_setting_issue_1730.rb | 18 +- ...0521141004_ticket_last_contact_behavior.rb | 24 +- db/migrate/20180524182518_sms_support.rb | 4 +- ...001_issue_2035_recursive_ticket_trigger.rb | 58 +- ...001_setting_add_ticket_auto_assignment2.rb | 48 +- ...80622140531_sequencer_log_level_setting.rb | 16 +- ...080554_issue_2100_utf8_encode_http_logs.rb | 2 +- ...x_double_domain_links_in_trigger_emails.rb | 2 +- ..._confidential_to_doorkeeper_application.rb | 2 +- db/migrate/20180809000001_cti_generic_api.rb | 56 +- ...00001_setting_delivery_temporary_failed.rb | 12 +- .../20180913000001_setting_add_system_bcc.rb | 12 +- ...13000002_permission_add_time_accounting.rb | 4 +- ...00_setting_add_sipgate_alternative_fqdn.rb | 18 +- .../20181030000001_setting_add_placetel1.rb | 58 +- ...08123847_add_country_attribute_to_users.rb | 40 +- ...000_setting_add_email_full_quote_header.rb | 24 +- db/seeds.rb | 4 +- db/seeds/channels.rb | 20 +- db/seeds/chats.rb | 8 +- db/seeds/community_user_resources.rb | 30 +- db/seeds/groups.rb | 8 +- db/seeds/karma_activities.rb | 66 +- db/seeds/macros.rb | 14 +- db/seeds/object_manager_attributes.rb | 1756 ++++---- db/seeds/overviews.rb | 236 +- db/seeds/permissions.rb | 220 +- db/seeds/report_profiles.rb | 6 +- db/seeds/roles.rb | 36 +- db/seeds/schedulers.rb | 182 +- db/seeds/settings.rb | 3756 ++++++++--------- db/seeds/signatures.rb | 6 +- db/seeds/ticket_states.rb | 46 +- db/seeds/triggers.rb | 66 +- db/seeds/user_nr_1.rb | 12 +- lib/app_version.rb | 4 +- lib/auto_wizard.rb | 2 +- lib/calendar_subscriptions/tickets.rb | 20 +- lib/email_helper.rb | 260 +- lib/email_helper/probe.rb | 30 +- lib/email_helper/verify.rb | 12 +- lib/enrichment/clearbit/user.rb | 14 +- lib/external_credential/facebook.rb | 16 +- lib/external_credential/twitter.rb | 42 +- lib/facebook.rb | 26 +- lib/fill_db.rb | 78 +- lib/html_sanitizer.rb | 10 +- lib/idoit.rb | 8 +- lib/import/otrs/article.rb | 8 +- lib/import/otrs/article/attachment_factory.rb | 10 +- lib/import/otrs/async.rb | 4 +- lib/import/otrs/dynamic_field.rb | 8 +- lib/import/otrs/dynamic_field/checkbox.rb | 4 +- lib/import/otrs/history/article.rb | 14 +- lib/import/otrs/history/move.rb | 20 +- lib/import/otrs/history/new_ticket.rb | 10 +- lib/import/otrs/history/priority_update.rb | 20 +- lib/import/otrs/history/state_update.rb | 20 +- lib/import/otrs/import_stats.rb | 4 +- lib/import/otrs/requester.rb | 2 +- lib/import/otrs/ticket.rb | 18 +- lib/import/zendesk/object_attribute/base.rb | 2 +- lib/ldap/user.rb | 4 +- lib/notification_factory/mailer.rb | 48 +- lib/notification_factory/renderer.rb | 2 +- lib/notification_factory/slack.rb | 10 +- lib/report/base.rb | 8 +- lib/report/ticket_first_solution.rb | 4 +- lib/report/ticket_generic_time.rb | 14 +- lib/report/ticket_moved.rb | 30 +- lib/report/ticket_reopened.rb | 24 +- lib/search_index_backend.rb | 66 +- .../unit/import/common/model/http_log.rb | 16 +- .../import/zendesk/sub_sequence/mapped.rb | 2 +- .../zendesk/ticket/comment/attachment/add.rb | 10 +- lib/service/geo_calendar/zammad.rb | 6 +- lib/service/geo_ip/zammad.rb | 6 +- lib/service/geo_location/gmaps.rb | 10 +- lib/service/image/zammad.rb | 4 +- lib/sessions.rb | 8 +- lib/sessions/backend/activity_stream.rb | 10 +- lib/sessions/backend/base.rb | 2 +- lib/sessions/backend/collections/base.rb | 6 +- lib/sessions/backend/ticket_create.rb | 4 +- lib/sessions/backend/ticket_overview_list.rb | 12 +- lib/sessions/event/base.rb | 12 +- lib/sessions/event/chat_agent_state.rb | 4 +- lib/sessions/event/chat_base.rb | 8 +- lib/sessions/event/chat_session_close.rb | 12 +- lib/sessions/event/chat_session_init.rb | 20 +- lib/sessions/event/chat_session_message.rb | 14 +- lib/sessions/event/chat_session_notice.rb | 4 +- lib/sessions/event/chat_session_start.rb | 16 +- lib/sessions/event/chat_session_typing.rb | 8 +- lib/sessions/event/chat_status_agent.rb | 2 +- lib/sessions/event/chat_status_customer.rb | 10 +- lib/sessions/event/spool.rb | 4 +- lib/sessions/event/who_am_i.rb | 8 +- lib/sessions/node.rb | 14 +- lib/signature_detection.rb | 6 +- lib/static_assets.rb | 20 +- lib/stats.rb | 8 +- lib/stats/ticket_channel_distribution.rb | 8 +- lib/stats/ticket_escalation.rb | 8 +- lib/stats/ticket_in_process.rb | 10 +- lib/stats/ticket_load_measure.rb | 10 +- lib/stats/ticket_reopen.rb | 20 +- lib/stats/ticket_response_time.rb | 6 +- lib/stats/ticket_waiting_time.rb | 6 +- lib/tasks/search_index_es.rake | 26 +- lib/telegram.rb | 164 +- lib/twitter_sync.rb | 104 +- lib/user_agent.rb | 90 +- script/build/database_config.rb | 2 +- script/websocket-server.rb | 10 +- ...1905_exchange_login_from_remote_id_spec.rb | 2 +- .../issue_2140_reset_ldap_config_spec.rb | 16 +- spec/factories/channel.rb | 26 +- spec/factories/job.rb | 52 +- spec/factories/object_manager_attribute.rb | 30 +- spec/factories/overview.rb | 10 +- spec/factories/ticket.rb | 2 +- spec/lib/import/otrs/article_spec.rb | 30 +- .../otrs/dynamic_field/checkbox_spec.rb | 26 +- .../import/otrs/dynamic_field/date_spec.rb | 8 +- .../otrs/dynamic_field/date_time_spec.rb | 14 +- .../otrs/dynamic_field/dropdown_spec.rb | 14 +- .../otrs/dynamic_field/multiselect_spec.rb | 14 +- .../otrs/dynamic_field/text_area_spec.rb | 8 +- .../import/otrs/dynamic_field/text_spec.rb | 18 +- spec/lib/import/otrs/priority_spec.rb | 10 +- spec/lib/import/otrs/queue_spec.rb | 12 +- spec/lib/import/otrs/state_spec.rb | 12 +- spec/lib/import/otrs/ticket_spec.rb | 42 +- spec/lib/import/otrs/user_spec.rb | 96 +- .../zendesk/object_attribute/checkbox_spec.rb | 20 +- .../zendesk/object_attribute/date_spec.rb | 20 +- .../zendesk/object_attribute/decimal_spec.rb | 20 +- .../zendesk/object_attribute/dropdown_spec.rb | 24 +- .../zendesk/object_attribute/integer_spec.rb | 20 +- .../zendesk/object_attribute/regexp_spec.rb | 20 +- .../zendesk/object_attribute/tagger_spec.rb | 24 +- .../zendesk/object_attribute/text_spec.rb | 20 +- .../zendesk/object_attribute/textarea_spec.rb | 20 +- spec/lib/ldap_spec.rb | 4 +- .../lib/notification_factory/renderer_spec.rb | 30 +- .../sequence/import/ldap/users_spec.rb | 12 +- .../zendesk/sub_sequence/base_examples.rb | 10 +- .../channel/driver/sms/massenversand_spec.rb | 16 +- spec/models/channel/driver/sms/twilio_spec.rb | 8 +- spec/models/channel_spec.rb | 2 +- spec/models/recent_view_spec.rb | 4 +- spec/models/tag_spec.rb | 4 +- spec/models/taskbar_spec.rb | 48 +- spec/models/ticket/article_spec.rb | 8 +- spec/models/ticket/overviews_spec.rb | 2 +- spec/models/ticket_spec.rb | 38 +- spec/models/translation_spec.rb | 32 +- spec/models/trigger/sms_spec.rb | 2 +- spec/requests/api_auth_on_behalf_of_spec.rb | 60 +- spec/requests/form_spec.rb | 10 +- spec/requests/integration/check_mk_spec.rb | 66 +- spec/requests/integration/cti_spec.rb | 36 +- spec/requests/integration/idoit_spec.rb | 8 +- spec/requests/integration/monitoring_spec.rb | 52 +- .../object_manager_attributes_spec.rb | 520 +-- spec/requests/integration/placetel_spec.rb | 36 +- spec/requests/integration/sipgate_spec.rb | 36 +- spec/requests/integration/twilio_sms_spec.rb | 38 +- .../integration/twitter_webhook_spec.rb | 18 +- spec/requests/integration/user_device_spec.rb | 2 +- spec/requests/organization_spec.rb | 46 +- spec/requests/overview_spec.rb | 112 +- spec/requests/settings_spec.rb | 24 +- spec/requests/taskbar_spec.rb | 22 +- .../ticket/article_attachments_spec.rb | 10 +- spec/requests/ticket/article_spec.rb | 206 +- spec/requests/ticket/escalation_spec.rb | 42 +- spec/requests/ticket_spec.rb | 700 +-- spec/requests/user_spec.rb | 124 +- test/browser/aaa_getting_started_test.rb | 108 +- test/browser/aab_unit_test.rb | 114 +- test/browser/aac_basic_richtext_test.rb | 24 +- test/browser/abb_one_group_test.rb | 64 +- test/browser/admin_calendar_sla_test.rb | 26 +- test/browser/admin_channel_email_test.rb | 36 +- .../admin_drag_drop_to_new_group_test.rb | 4 +- test/browser/admin_object_manager_test.rb | 266 +- .../admin_object_manager_tree_select_test.rb | 68 +- test/browser/admin_overview_test.rb | 36 +- ...admin_permissions_granular_vs_full_test.rb | 2 +- test/browser/admin_role_test.rb | 86 +- .../agent_navigation_and_title_test.rb | 4 +- .../agent_organization_profile_test.rb | 50 +- test/browser/agent_ticket_attachment_test.rb | 88 +- .../agent_ticket_auto_assignment_test.rb | 44 +- ...te_attachment_missing_after_reload_test.rb | 14 +- ...gent_ticket_create_available_types_test.rb | 4 +- .../agent_ticket_create_cc_tokenizer_test.rb | 2 +- .../agent_ticket_create_default_type_test.rb | 6 +- ...et_create_reset_customer_selection_test.rb | 58 +- .../agent_ticket_create_template_test.rb | 24 +- ...agent_ticket_email_reply_keep_body_test.rb | 44 +- .../agent_ticket_email_signature_test.rb | 126 +- test/browser/agent_ticket_link_test.rb | 42 +- test/browser/agent_ticket_merge_test.rb | 48 +- .../agent_ticket_online_notification_test.rb | 202 +- ...ket_overview_group_by_organization_test.rb | 16 +- .../agent_ticket_overview_level0_test.rb | 140 +- .../agent_ticket_overview_level1_test.rb | 106 +- .../agent_ticket_overview_pending_til_test.rb | 22 +- .../browser/agent_ticket_overview_tab_test.rb | 32 +- test/browser/agent_ticket_tag_test.rb | 216 +- .../browser/agent_ticket_task_changed_test.rb | 12 +- test/browser/agent_ticket_text_module_test.rb | 132 +- .../agent_ticket_time_accounting_test.rb | 54 +- test/browser/agent_ticket_update1_test.rb | 22 +- test/browser/agent_ticket_update2_test.rb | 232 +- test/browser/agent_ticket_update3_test.rb | 112 +- test/browser/agent_ticket_update4_test.rb | 20 +- test/browser/agent_ticket_update5_test.rb | 16 +- .../agent_ticket_update_and_reload_test.rb | 16 +- ...ket_update_with_attachment_refresh_test.rb | 14 +- test/browser/agent_ticket_zoom_hide_test.rb | 14 +- test/browser/agent_user_manage_test.rb | 78 +- test/browser/agent_user_profile_test.rb | 42 +- test/browser/auth_test.rb | 26 +- test/browser/chat_test.rb | 396 +- test/browser/customer_ticket_create_test.rb | 84 +- test/browser/first_steps_test.rb | 26 +- test/browser/form_test.rb | 174 +- test/browser/integration_cti_test.rb | 90 +- test/browser/integration_sipgate_test.rb | 22 +- test/browser/integration_test.rb | 92 +- test/browser/keyboard_shortcuts_test.rb | 20 +- test/browser/maintenance_app_version_test.rb | 6 +- .../browser/maintenance_login_message_test.rb | 30 +- test/browser/maintenance_mode_test.rb | 60 +- .../maintenance_session_message_test.rb | 96 +- test/browser/manage_test.rb | 30 +- test/browser/monitoring_test.rb | 10 +- test/browser/preferences_language_test.rb | 88 +- .../preferences_permission_check_test.rb | 24 +- test/browser/preferences_token_access_test.rb | 16 +- test/browser/reporting_test.rb | 6 +- test/browser/setting_test.rb | 62 +- .../signup_password_change_and_reset_test.rb | 100 +- test/browser/switch_to_user_test.rb | 4 +- test/browser/taskbar_session_test.rb | 32 +- test/browser/taskbar_task_test.rb | 34 +- test/browser/translation_test.rb | 84 +- test/browser/user_access_permissions_test.rb | 62 +- test/browser/user_switch_cache_test.rb | 32 +- test/browser_test_helper.rb | 308 +- test/fixtures/seeds.rb | 20 +- .../aaa_auto_wizard_base_setup_test.rb | 6 +- test/integration/auto_wizard_browser_test.rb | 24 +- test/integration/clearbit_test.rb | 120 +- test/integration/elasticsearch_active_test.rb | 54 +- test/integration/elasticsearch_test.rb | 322 +- test/integration/email_deliver_test.rb | 116 +- test/integration/email_helper_test.rb | 174 +- test/integration/email_keep_on_server_test.rb | 28 +- test/integration/facebook_browser_test.rb | 46 +- test/integration/facebook_test.rb | 18 +- test/integration/geo_location_test.rb | 64 +- test/integration/idoit_browser_test.rb | 34 +- test/integration/object_manager_test.rb | 948 ++--- test/integration/otrs_import_browser_test.rb | 10 +- test/integration/package_test.rb | 80 +- test/integration/report_test.rb | 504 +-- test/integration/slack_test.rb | 22 +- test/integration/twitter_browser_test.rb | 20 +- test/integration/user_agent_test.rb | 20 +- .../zendesk_import_browser_test.rb | 22 +- test/integration/zendesk_import_test.rb | 58 +- test/unit/activity_stream_test.rb | 66 +- test/unit/auth_test.rb | 38 +- test/unit/auto_wizard_test.rb | 110 +- test/unit/calendar_subscription_test.rb | 312 +- test/unit/calendar_test.rb | 60 +- test/unit/chat_test.rb | 126 +- test/unit/cti_caller_id_test.rb | 494 +-- test/unit/email_address_test.rb | 48 +- test/unit/email_build_test.rb | 70 +- test/unit/email_process_auto_response_test.rb | 194 +- ...s_bounce_delivery_permanent_failed_test.rb | 192 +- ...s_bounce_delivery_temporary_failed_test.rb | 28 +- test/unit/email_process_bounce_follow_test.rb | 220 +- ...election_based_on_sender_recipient_test.rb | 30 +- .../email_process_follow_up_possible_test.rb | 28 +- test/unit/email_process_follow_up_test.rb | 112 +- test/unit/email_process_out_of_office_test.rb | 112 +- test/unit/email_process_reply_to_test.rb | 6 +- ..._sender_is_system_address_or_agent_test.rb | 38 +- test/unit/email_process_state_open_set.rb | 70 +- test/unit/email_signature_detection_test.rb | 12 +- test/unit/history_test.rb | 208 +- test/unit/job_assets_test.rb | 58 +- test/unit/job_test.rb | 610 +-- test/unit/karma_test.rb | 316 +- test/unit/model_test.rb | 210 +- ...tification_factory_mailer_template_test.rb | 146 +- test/unit/notification_factory_mailer_test.rb | 126 +- .../notification_factory_renderer_test.rb | 14 +- ...otification_factory_slack_template_test.rb | 96 +- test/unit/object_cache_test.rb | 56 +- ...object_create_update_with_ref_name_test.rb | 134 +- test/unit/online_notifiaction_test.rb | 310 +- test/unit/organization_assets_test.rb | 66 +- test/unit/organization_csv_import_test.rb | 70 +- ...ganization_domain_based_assignment_test.rb | 76 +- .../organization_ref_object_touch_test.rb | 178 +- test/unit/overview_assets_test.rb | 118 +- test/unit/permission_test.rb | 104 +- test/unit/role_test.rb | 124 +- test/unit/role_validate_agent_limit_test.rb | 36 +- test/unit/session_basic_test.rb | 84 +- test/unit/session_basic_ticket_test.rb | 28 +- test/unit/session_collections_test.rb | 60 +- test/unit/session_enhanced_test.rb | 90 +- test/unit/setting_test.rb | 38 +- test/unit/sla_assets_test.rb | 48 +- test/unit/stats_ticket_waiting_time_test.rb | 68 +- test/unit/store_test.rb | 36 +- test/unit/tag_test.rb | 126 +- test/unit/text_module_csv_import_test.rb | 50 +- test/unit/ticket_article_communicate_test.rb | 92 +- test/unit/ticket_article_dos_test.rb | 72 +- .../ticket_article_time_accouting_test.rb | 86 +- test/unit/ticket_csv_import_test.rb | 40 +- ...icket_customer_organization_update_test.rb | 54 +- test/unit/ticket_escalation_test.rb | 134 +- test/unit/ticket_last_owner_update_test.rb | 208 +- test/unit/ticket_notification_test.rb | 688 +-- test/unit/ticket_null_byte_test.rb | 24 +- test/unit/ticket_number_test.rb | 20 +- .../ticket_overview_out_of_office_test.rb | 176 +- test/unit/ticket_overview_test.rb | 500 +-- .../ticket_owner_reset_on_follow_up_test.rb | 136 +- test/unit/ticket_priority_test.rb | 8 +- test/unit/ticket_ref_object_touch_test.rb | 86 +- test/unit/ticket_screen_options_test.rb | 166 +- test/unit/ticket_selector_test.rb | 402 +- test/unit/ticket_sla_test.rb | 1608 +++---- test/unit/ticket_state_change_test.rb | 92 +- test/unit/ticket_state_test.rb | 20 +- test/unit/ticket_test.rb | 330 +- ...rigger_extended_recursive_disabled_test.rb | 444 +- test/unit/ticket_trigger_extended_test.rb | 556 +-- .../ticket_trigger_recursive_disabled_test.rb | 2918 ++++++------- test/unit/ticket_trigger_test.rb | 2986 ++++++------- test/unit/ticket_xss_test.rb | 170 +- test/unit/token_test.rb | 64 +- test/unit/trigger_assets_test.rb | 52 +- test/unit/user_assets_test.rb | 54 +- test/unit/user_csv_import_test.rb | 110 +- test/unit/user_device_test.rb | 26 +- test/unit/user_mail_delivery_failed_test.rb | 12 +- test/unit/user_out_of_office_test.rb | 48 +- test/unit/user_ref_object_touch_test.rb | 168 +- test/unit/user_test.rb | 912 ++-- 533 files changed, 22170 insertions(+), 22161 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 861bbed46..7c546f08a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -93,6 +93,15 @@ Style/MethodDefParentheses: StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens' Enabled: false +Layout/AlignHash: + Description: >- + Align the elements of a hash literal if they span more than + one line. + Enabled: true + EnforcedHashRocketStyle: table + EnforcedColonStyle: table + EnforcedLastArgumentHashStyle: always_inspect + Layout/EmptyLinesAroundClassBody: Description: "Keeps track of empty lines around class bodies." Enabled: false diff --git a/Gemfile.lock b/Gemfile.lock index b850f3494..d1b30015a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -317,7 +317,7 @@ GEM omniauth (~> 1.5) omniauth-oauth2 (>= 1.4.0) parallel (1.12.1) - parser (2.5.1.2) + parser (2.5.3.0) ast (~> 2.4.0) pg (0.21.0) pluginator (1.5.0) @@ -401,14 +401,14 @@ GEM rspec-mocks (~> 3.8.0) rspec-support (~> 3.8.0) rspec-support (3.8.0) - rubocop (0.59.2) + rubocop (0.61.1) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) powerpack (~> 0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) + unicode-display_width (~> 1.4.0) ruby-progressbar (1.10.0) ruby_dep (1.5.0) rubyzip (1.2.2) diff --git a/app/controllers/activity_stream_controller.rb b/app/controllers/activity_stream_controller.rb index 8ab25f151..6def7a647 100644 --- a/app/controllers/activity_stream_controller.rb +++ b/app/controllers/activity_stream_controller.rb @@ -25,7 +25,7 @@ class ActivityStreamController < ApplicationController end render json: { record_ids: item_ids, - assets: assets, + assets: assets, }, status: :ok return end diff --git a/app/controllers/application_controller/authenticates.rb b/app/controllers/application_controller/authenticates.rb index 81fe62db6..1d1936613 100644 --- a/app/controllers/application_controller/authenticates.rb +++ b/app/controllers/application_controller/authenticates.rb @@ -10,8 +10,8 @@ module ApplicationController::Authenticates def permission_check(key) if @_token_auth user = Token.check( - action: 'api', - name: @_token_auth, + action: 'api', + name: @_token_auth, permission: key, ) return false if user @@ -84,15 +84,15 @@ module ApplicationController::Authenticates end user = Token.check( - action: 'api', - name: token_string, + action: 'api', + name: token_string, inactive_user: true, ) if user && auth_param[:permission] user = Token.check( - action: 'api', - name: token_string, - permission: auth_param[:permission], + action: 'api', + name: token_string, + permission: auth_param[:permission], inactive_user: true, ) raise Exceptions::NotAuthorized, 'Not authorized (token)!' if !user diff --git a/app/controllers/application_controller/logs_http_access.rb b/app/controllers/application_controller/logs_http_access.rb index 3aed2fc65..855aad73b 100644 --- a/app/controllers/application_controller/logs_http_access.rb +++ b/app/controllers/application_controller/logs_http_access.rb @@ -17,10 +17,10 @@ module ApplicationController::LogsHttpAccess # request request_data = { - content: '', - content_type: request.headers['Content-Type'], + content: '', + content_type: request.headers['Content-Type'], content_encoding: request.headers['Content-Encoding'], - source: request.headers['User-Agent'] || request.headers['Server'], + source: request.headers['User-Agent'] || request.headers['Server'], } request.headers.each do |key, value| next if key[0, 5] != 'HTTP_' @@ -39,11 +39,11 @@ module ApplicationController::LogsHttpAccess # response response_data = { - code: response.status = response.code, - content: '', - content_type: nil, + code: response.status = response.code, + content: '', + content_type: nil, content_encoding: nil, - source: nil, + source: nil, } response.headers.each do |key, value| response_data[:content] += "#{key}: #{value}\n" @@ -55,13 +55,13 @@ module ApplicationController::LogsHttpAccess response_data[:content] = response_data[:content].slice(0, 8000) record = { direction: 'in', - facility: @http_log_support[:facility], - url: url_for(only_path: false, overwrite_params: {}), - status: response.status, - ip: request.remote_ip, - request: request_data, - response: response_data, - method: request.method, + facility: @http_log_support[:facility], + url: url_for(only_path: false, overwrite_params: {}), + status: response.status, + ip: request.remote_ip, + request: request_data, + response: response_data, + method: request.method, } HttpLog.create(record) end diff --git a/app/controllers/application_controller/renders_models.rb b/app/controllers/application_controller/renders_models.rb index 1643ddb56..adc305224 100644 --- a/app/controllers/application_controller/renders_models.rb +++ b/app/controllers/application_controller/renders_models.rb @@ -136,7 +136,7 @@ module ApplicationController::RendersModels end render json: { record_ids: item_ids, - assets: assets, + assets: assets, }, status: :ok return end diff --git a/app/controllers/applications_controller.rb b/app/controllers/applications_controller.rb index e9f52145c..c1ed90481 100644 --- a/app/controllers/applications_controller.rb +++ b/app/controllers/applications_controller.rb @@ -19,7 +19,7 @@ class ApplicationsController < ApplicationController end render json: { record_ids: item_ids, - assets: assets, + assets: assets, }, status: :ok return end diff --git a/app/controllers/calendar_subscriptions_controller.rb b/app/controllers/calendar_subscriptions_controller.rb index d922d7949..189e79c30 100644 --- a/app/controllers/calendar_subscriptions_controller.rb +++ b/app/controllers/calendar_subscriptions_controller.rb @@ -14,8 +14,8 @@ class CalendarSubscriptionsController < ApplicationController send_data( ical, - filename: 'zammad.ical', - type: 'text/plain', + filename: 'zammad.ical', + type: 'text/plain', disposition: 'inline' ) rescue => e @@ -36,8 +36,8 @@ class CalendarSubscriptionsController < ApplicationController send_data( ical, - filename: 'zammad.ical', - type: 'text/plain', + filename: 'zammad.ical', + type: 'text/plain', disposition: 'inline' ) rescue => e diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 9cff88a63..c08ed2e71 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -16,8 +16,8 @@ class CalendarsController < ApplicationController render json: { record_ids: record_ids, ical_feeds: ical_feeds, - timezones: timezones, - assets: assets, + timezones: timezones, + assets: assets, }, status: :ok end diff --git a/app/controllers/channels_email_controller.rb b/app/controllers/channels_email_controller.rb index b7743b38e..30454091f 100644 --- a/app/controllers/channels_email_controller.rb +++ b/app/controllers/channels_email_controller.rb @@ -37,16 +37,16 @@ class ChannelsEmailController < ApplicationController end end render json: { - accounts_fixed: accounts_fixed, - assets: assets, - account_channel_ids: account_channel_ids, - notification_channel_ids: notification_channel_ids, - email_address_ids: email_address_ids, + accounts_fixed: accounts_fixed, + assets: assets, + account_channel_ids: account_channel_ids, + notification_channel_ids: notification_channel_ids, + email_address_ids: email_address_ids, not_used_email_address_ids: not_used_email_address_ids, - channel_driver: { + channel_driver: { email: EmailHelper.available_driver, }, - config: { + config: { notification_sender: Setting.get('notification_sender'), } } @@ -56,9 +56,9 @@ class ChannelsEmailController < ApplicationController # probe settings based on email and password result = EmailHelper::Probe.full( - email: params[:email], + email: params[:email], password: params[:password], - folder: params[:folder], + folder: params[:folder], ) # verify if user+host already exists @@ -107,9 +107,9 @@ class ChannelsEmailController < ApplicationController # check delivery for 30 sek. result = EmailHelper::Verify.email( outbound: params[:outbound].to_h, - inbound: params[:inbound].to_h, - sender: email, - subject: params[:subject], + inbound: params[:inbound].to_h, + sender: email, + subject: params[:subject], ) if result[:result] != 'ok' @@ -126,15 +126,15 @@ class ChannelsEmailController < ApplicationController if channel_id channel = Channel.find(channel_id) channel.update!( - options: { - inbound: params[:inbound].to_h, + options: { + inbound: params[:inbound].to_h, outbound: params[:outbound].to_h, }, - group_id: params[:group_id], - last_log_in: nil, + group_id: params[:group_id], + last_log_in: nil, last_log_out: nil, - status_in: 'ok', - status_out: 'ok', + status_in: 'ok', + status_out: 'ok', ) render json: result return @@ -142,17 +142,17 @@ class ChannelsEmailController < ApplicationController # create new account channel = Channel.create( - area: 'Email::Account', - options: { - inbound: params[:inbound].to_h, + area: 'Email::Account', + options: { + inbound: params[:inbound].to_h, outbound: params[:outbound].to_h, }, - group_id: params[:group_id], - last_log_in: nil, + group_id: params[:group_id], + last_log_in: nil, last_log_out: nil, - status_in: 'ok', - status_out: 'ok', - active: true, + status_in: 'ok', + status_out: 'ok', + active: true, ) # remember address && set channel for email address @@ -165,16 +165,16 @@ class ChannelsEmailController < ApplicationController if address address.update!( - realname: params[:meta][:realname], - email: email, - active: true, + realname: params[:meta][:realname], + email: email, + active: true, channel_id: channel.id, ) else address = EmailAddress.create( - realname: params[:meta][:realname], - email: email, - active: true, + realname: params[:meta][:realname], + email: email, + active: true, channel_id: channel.id, ) end @@ -259,7 +259,7 @@ class ChannelsEmailController < ApplicationController next if channel.id.to_s == channel_id.to_s render json: { - result: 'duplicate', + result: 'duplicate', message: 'Account already exists!', } return true diff --git a/app/controllers/channels_facebook_controller.rb b/app/controllers/channels_facebook_controller.rb index 0b92602fb..8549fee85 100644 --- a/app/controllers/channels_facebook_controller.rb +++ b/app/controllers/channels_facebook_controller.rb @@ -14,8 +14,8 @@ class ChannelsFacebookController < ApplicationController channel_ids.push channel.id end render json: { - assets: assets, - channel_ids: channel_ids, + assets: assets, + channel_ids: channel_ids, callback_url: ExternalCredential.callback_url('facebook'), } end diff --git a/app/controllers/channels_sms_controller.rb b/app/controllers/channels_sms_controller.rb index 15fc3e747..e6d99d05a 100644 --- a/app/controllers/channels_sms_controller.rb +++ b/app/controllers/channels_sms_controller.rb @@ -8,10 +8,10 @@ class ChannelsSmsController < ApplicationChannelController def index assets = {} render json: { - account_channel_ids: channels_data('Sms::Account', assets), + account_channel_ids: channels_data('Sms::Account', assets), notification_channel_ids: channels_data('Sms::Notification', assets), - config: channels_config, - assets: assets + config: channels_config, + assets: assets } end @@ -37,7 +37,7 @@ class ChannelsSmsController < ApplicationChannelController end if !channel render( - json: { message: 'channel not found' }, + json: { message: 'channel not found' }, status: :not_found ) return diff --git a/app/controllers/channels_telegram_controller.rb b/app/controllers/channels_telegram_controller.rb index dbc6834f5..a161b18bf 100644 --- a/app/controllers/channels_telegram_controller.rb +++ b/app/controllers/channels_telegram_controller.rb @@ -12,7 +12,7 @@ class ChannelsTelegramController < ApplicationController channel_ids.push channel.id end render json: { - assets: assets, + assets: assets, channel_ids: channel_ids } end diff --git a/app/controllers/channels_twitter_controller.rb b/app/controllers/channels_twitter_controller.rb index a560745d3..fdd4d852a 100644 --- a/app/controllers/channels_twitter_controller.rb +++ b/app/controllers/channels_twitter_controller.rb @@ -74,10 +74,10 @@ class ChannelsTwitterController < ApplicationController channel_ids.push channel.id end render json: { - assets: assets, - channel_ids: channel_ids, + assets: assets, + channel_ids: channel_ids, external_credential_ids: external_credential_ids, - callback_url: ExternalCredential.callback_url('twitter'), + callback_url: ExternalCredential.callback_url('twitter'), } end diff --git a/app/controllers/chats_controller.rb b/app/controllers/chats_controller.rb index 6eb0bf2c7..8954eb187 100644 --- a/app/controllers/chats_controller.rb +++ b/app/controllers/chats_controller.rb @@ -14,7 +14,7 @@ class ChatsController < ApplicationController assets = setting.assets(assets) render json: { chat_ids: chat_ids, - assets: assets, + assets: assets, } end diff --git a/app/controllers/concerns/clones_ticket_article_attachments.rb b/app/controllers/concerns/clones_ticket_article_attachments.rb index d521f85b2..5a47d57ae 100644 --- a/app/controllers/concerns/clones_ticket_article_attachments.rb +++ b/app/controllers/concerns/clones_ticket_article_attachments.rb @@ -8,7 +8,7 @@ module ClonesTicketArticleAttachments existing_attachments = Store.list( object: 'UploadCache', - o_id: params[:form_id], + o_id: params[:form_id], ) attachments = [] article.attachments.each do |new_attachment| @@ -31,10 +31,10 @@ module ClonesTicketArticleAttachments next if already_added == true file = Store.add( - object: 'UploadCache', - o_id: params[:form_id], - data: new_attachment.content, - filename: new_attachment.filename, + object: 'UploadCache', + o_id: params[:form_id], + data: new_attachment.content, + filename: new_attachment.filename, preferences: new_attachment.preferences, ) attachments.push file diff --git a/app/controllers/concerns/creates_ticket_articles.rb b/app/controllers/concerns/creates_ticket_articles.rb index 1502ad75c..58fcfd304 100644 --- a/app/controllers/concerns/creates_ticket_articles.rb +++ b/app/controllers/concerns/creates_ticket_articles.rb @@ -57,7 +57,7 @@ module CreatesTicketArticles if form_id article.attachments = Store.list( object: 'UploadCache', - o_id: form_id, + o_id: form_id, ) end @@ -69,10 +69,10 @@ module CreatesTicketArticles # store inline attachments attachments_inline.each do |attachment| Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: attachment[:data], - filename: attachment[:filename], + object: 'Ticket::Article', + o_id: article.id, + data: attachment[:data], + filename: attachment[:filename], preferences: attachment[:preferences], ) end @@ -104,10 +104,10 @@ module CreatesTicketArticles end Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: attachment_data, - filename: attachment[:filename], + object: 'Ticket::Article', + o_id: article.id, + data: attachment_data, + filename: attachment[:filename], preferences: preferences, ) end @@ -116,9 +116,9 @@ module CreatesTicketArticles # account time if time_unit.present? Ticket::TimeAccounting.create!( - ticket_id: article.ticket_id, + ticket_id: article.ticket_id, ticket_article_id: article.id, - time_unit: time_unit + time_unit: time_unit ) end @@ -133,7 +133,7 @@ module CreatesTicketArticles # remove attachments from upload cache Store.remove( object: 'UploadCache', - o_id: form_id, + o_id: form_id, ) article diff --git a/app/controllers/concerns/ticket_stats.rb b/app/controllers/concerns/ticket_stats.rb index 8fc05d29f..c7ef43f03 100644 --- a/app/controllers/concerns/ticket_stats.rb +++ b/app/controllers/concerns/ticket_stats.rb @@ -5,11 +5,11 @@ module TicketStats def ticket_ids_and_assets(condition, current_user, limit, assets) tickets = Ticket.search( - limit: limit, - condition: condition, + limit: limit, + condition: condition, current_user: current_user, - sort_by: 'created_at', - order_by: 'desc', + sort_by: 'created_at', + order_by: 'desc', ) assets_of_tickets(tickets, assets) end @@ -36,11 +36,11 @@ module TicketStats .count data = { - month: date_to_check.month, - year: date_to_check.year, - text: Date::MONTHNAMES[date_to_check.month], + month: date_to_check.month, + year: date_to_check.year, + text: Date::MONTHNAMES[date_to_check.month], created: created, - closed: closed, + closed: closed, } volume_by_year.push data end diff --git a/app/controllers/cti_controller.rb b/app/controllers/cti_controller.rb index cbfa90e24..64f06e794 100644 --- a/app/controllers/cti_controller.rb +++ b/app/controllers/cti_controller.rb @@ -7,19 +7,19 @@ class CtiController < ApplicationController def index backends = [ { - name: 'CTI (generic)', + name: 'CTI (generic)', enabled: Setting.get('cti_integration'), - url: '#system/integration/cti', + url: '#system/integration/cti', }, { - name: 'sipgate.io', + name: 'sipgate.io', enabled: Setting.get('sipgate_integration'), - url: '#system/integration/sipgate', + url: '#system/integration/sipgate', }, { - name: 'Placetel', + name: 'Placetel', enabled: Setting.get('placetel_integration'), - url: '#system/integration/placetel', + url: '#system/integration/placetel', } ] diff --git a/app/controllers/first_steps_controller.rb b/app/controllers/first_steps_controller.rb index b41746f88..47eebc78f 100644 --- a/app/controllers/first_steps_controller.rb +++ b/app/controllers/first_steps_controller.rb @@ -48,54 +48,54 @@ class FirstStepsController < ApplicationController result = [ { - name: 'Configuration', + name: 'Configuration', items: [ { - name: 'Branding', - checked: true, + name: 'Branding', + checked: true, location: '#settings/branding', }, { - name: 'Your Email Configuration', - checked: email_active, + name: 'Your Email Configuration', + checked: email_active, location: '#channels/email', }, { - name: 'Invite agents/colleagues to help working on tickets', - checked: invite_agents, + name: 'Invite agents/colleagues to help working on tickets', + checked: invite_agents, location: '#', - class: 'js-inviteAgent', + class: 'js-inviteAgent', }, { - name: 'Invite customers to create issues in Zammad', - checked: invite_customers, + name: 'Invite customers to create issues in Zammad', + checked: invite_customers, location: '#', - class: 'js-inviteCustomer', + class: 'js-inviteCustomer', }, ], }, { - name: 'How to use it', + name: 'How to use it', items: [ { - name: 'Intro', - checked: true, + name: 'Intro', + checked: true, location: '#clues', }, { - name: 'Create a Test Ticket', - checked: false, + name: 'Create a Test Ticket', + checked: false, location: '#', - class: 'js-testTicket', + class: 'js-testTicket', }, { - name: 'Create Text Modules', - checked: text_module_active, + name: 'Create Text Modules', + checked: text_module_active, location: '#manage/text_modules', }, { - name: 'Create Macros', - checked: macro_active, + name: 'Create Macros', + checked: macro_active, location: '#manage/macros', }, #{ @@ -106,26 +106,26 @@ class FirstStepsController < ApplicationController ], }, { - name: 'Additional Channels', + name: 'Additional Channels', items: [ { - name: 'Twitter', - checked: twitter_active, + name: 'Twitter', + checked: twitter_active, location: '#channels/twitter', }, { - name: 'Facebook', - checked: facebook_active, + name: 'Facebook', + checked: facebook_active, location: '#channels/facebook', }, { - name: 'Chat', - checked: chat_active, + name: 'Chat', + checked: chat_active, location: '#channels/chat', }, { - name: 'Online Forms', - checked: from_active, + name: 'Online Forms', + checked: from_active, location: '#channels/form', }, ], @@ -140,24 +140,24 @@ class FirstStepsController < ApplicationController result = [ { - name: 'How to use it', + name: 'How to use it', items: [ { - name: 'Intro', - checked: true, + name: 'Intro', + checked: true, location: '#clues', }, { - name: 'Create a Test Ticket', - checked: false, + name: 'Create a Test Ticket', + checked: false, location: '#', - class: 'js-testTicket', + class: 'js-testTicket', }, { - name: 'Invite customers to create issues in Zammad', - checked: invite_customers, + name: 'Invite customers to create issues in Zammad', + checked: invite_customers, location: '#', - class: 'js-inviteCustomer', + class: 'js-inviteCustomer', }, ], }, @@ -177,27 +177,27 @@ class FirstStepsController < ApplicationController original_user_id = UserInfo.current_user_id result = NotificationFactory::Mailer.template( template: 'test_ticket', - locale: agent.preferences[:locale] || Setting.get('locale_default') || 'en-us', + locale: agent.preferences[:locale] || Setting.get('locale_default') || 'en-us', objects: { - agent: agent, + agent: agent, customer: customer, }, - raw: true, + raw: true, ) UserInfo.current_user_id = customer.id ticket = Ticket.create!( - group_id: Group.find_by(active: true, name: 'Users').id, + group_id: Group.find_by(active: true, name: 'Users').id, customer_id: customer.id, - title: result[:subject], + title: result[:subject], ) article = Ticket::Article.create!( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'phone').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - from: from, - body: result[:body], + ticket_id: ticket.id, + type_id: Ticket::Article::Type.find_by(name: 'phone').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, + from: from, + body: result[:body], content_type: 'text/html', - internal: false, + internal: false, ) UserInfo.current_user_id = original_user_id overview = test_overview @@ -206,8 +206,8 @@ class FirstStepsController < ApplicationController assets = overview.assets(assets) render json: { overview_id: overview.id, - ticket_id: ticket.id, - assets: assets, + ticket_id: ticket.id, + assets: assets, } end diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 681d28bd0..41d7b58b3 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -85,11 +85,11 @@ class FormController < ApplicationController if !customer role_ids = Role.signup_role_ids customer = User.create( - firstname: name, - lastname: '', - email: email, - active: true, - role_ids: role_ids, + firstname: name, + lastname: '', + email: email, + active: true, + role_ids: role_ids, updated_by_id: 1, created_by_id: 1, ) @@ -106,31 +106,31 @@ class FormController < ApplicationController end end ticket = Ticket.create!( - group_id: group.id, + group_id: group.id, customer_id: customer.id, - title: params[:title], + title: params[:title], preferences: { form: { - remote_ip: request.remote_ip, + remote_ip: request.remote_ip, fingerprint_md5: Digest::MD5.hexdigest(params[:fingerprint]), } } ) article = Ticket::Article.create!( ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'web').id, + type_id: Ticket::Article::Type.find_by(name: 'web').id, sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - body: params[:body], - subject: params[:title], - internal: false, + body: params[:body], + subject: params[:title], + internal: false, ) params[:file]&.each do |file| Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: file.read, - filename: file.original_filename, + object: 'Ticket::Article', + o_id: article.id, + data: file.read, + filename: file.original_filename, preferences: { 'Mime-Type' => file.content_type, } @@ -141,7 +141,7 @@ class FormController < ApplicationController result = { ticket: { - id: ticket.id, + id: ticket.id, number: ticket.number } } diff --git a/app/controllers/getting_started_controller.rb b/app/controllers/getting_started_controller.rb index 2d1cf73ba..367e231bf 100644 --- a/app/controllers/getting_started_controller.rb +++ b/app/controllers/getting_started_controller.rb @@ -41,9 +41,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # return result render json: { - setup_done: setup_done, - import_mode: Setting.get('import_mode'), - import_backend: Setting.get('import_backend'), + setup_done: setup_done, + import_mode: Setting.get('import_mode'), + import_backend: Setting.get('import_backend'), system_online_service: Setting.get('system_online_service'), } end @@ -65,9 +65,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} auto_wizard_data = AutoWizard.data if auto_wizard_data.blank? render json: { - auto_wizard: true, + auto_wizard: true, auto_wizard_success: false, - message: 'Invalid auto wizard file.', + message: 'Invalid auto wizard file.', } return end @@ -75,7 +75,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # verify auto wizard token if auto_wizard_data['Token'] && auto_wizard_data['Token'] != params[:token] render json: { - auto_wizard: true, + auto_wizard: true, auto_wizard_success: false, } return @@ -85,9 +85,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} auto_wizard_admin = AutoWizard.setup if !auto_wizard_admin render json: { - auto_wizard: true, + auto_wizard: true, auto_wizard_success: false, - message: 'Error during execution of auto wizard.', + message: 'Error during execution of auto wizard.', } return end @@ -99,7 +99,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} Setting.set('system_init_done', true) render json: { - auto_wizard: true, + auto_wizard: true, auto_wizard_success: true, } end @@ -150,7 +150,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} if messages.present? render json: { - result: 'invalid', + result: 'invalid', messages: messages, } return @@ -181,7 +181,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} end render json: { - result: 'ok', + result: 'ok', settings: settings, } end @@ -214,14 +214,14 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} addresses = EmailAddress.where(active: true) render json: { - setup_done: true, - import_mode: Setting.get('import_mode'), - import_backend: Setting.get('import_backend'), + setup_done: true, + import_mode: Setting.get('import_mode'), + import_backend: Setting.get('import_backend'), system_online_service: Setting.get('system_online_service'), - addresses: addresses, - groups: groups, - config: config_to_update, - channel_driver: { + addresses: addresses, + groups: groups, + config: config_to_update, + channel_driver: { email: EmailHelper.available_driver, }, } diff --git a/app/controllers/import_otrs_controller.rb b/app/controllers/import_otrs_controller.rb index 60cdcb371..d3865305c 100644 --- a/app/controllers/import_otrs_controller.rb +++ b/app/controllers/import_otrs_controller.rb @@ -8,7 +8,7 @@ class ImportOtrsController < ApplicationController # validate if !params[:url] || params[:url] !~ %r{^(http|https)://.+?$} render json: { - result: 'invalid', + result: 'invalid', message: 'Invalid URL!', } return @@ -31,9 +31,9 @@ class ImportOtrsController < ApplicationController end end render json: { - result: 'invalid', + result: 'invalid', message_human: message_human, - message: response.error.to_s, + message: response.error.to_s, } return end @@ -59,7 +59,7 @@ class ImportOtrsController < ApplicationController if !key_parts[1] render json: { - result: 'invalid', + result: 'invalid', message_human: 'Unable to get key from URL!' } return @@ -78,22 +78,22 @@ class ImportOtrsController < ApplicationController result = { result: 'ok', - url: params[:url], + url: params[:url], } else result = { - result: 'invalid', + result: 'invalid', message_human: migrator_response['Error'] } end elsif response.body.match?(/(otrs\sag|otrs\.com|otrs\.org)/i) result = { - result: 'invalid', + result: 'invalid', message_human: 'Host found, but no OTRS migrator is installed!' } else result = { - result: 'invalid', + result: 'invalid', message_human: 'Host found, but it seems to be no OTRS installation!', } end @@ -109,7 +109,7 @@ class ImportOtrsController < ApplicationController if !welcome render json: { message: 'Migrator can\'t read OTRS output!', - result: 'invalid', + result: 'invalid', } return end diff --git a/app/controllers/import_zendesk_controller.rb b/app/controllers/import_zendesk_controller.rb index 8537fdd93..3d0a97920 100644 --- a/app/controllers/import_zendesk_controller.rb +++ b/app/controllers/import_zendesk_controller.rb @@ -7,7 +7,7 @@ class ImportZendeskController < ApplicationController # validate if params[:url].blank? || params[:url] !~ %r{^(http|https)://.+?$} render json: { - result: 'invalid', + result: 'invalid', message: 'Invalid URL!', } return @@ -31,9 +31,9 @@ class ImportZendeskController < ApplicationController end end render json: { - result: 'invalid', + result: 'invalid', message_human: message_human, - message: response.error.to_s, + message: response.error.to_s, } return end @@ -41,7 +41,7 @@ class ImportZendeskController < ApplicationController # since 2016-10-15 a redirect to a marketing page has been implemented if !response.body.match?(/#{params[:url]}/) render json: { - result: 'invalid', + result: 'invalid', message_human: 'Hostname not found!', } return @@ -53,7 +53,7 @@ class ImportZendeskController < ApplicationController render json: { result: 'ok', - url: params[:url], + url: params[:url], } end @@ -63,7 +63,7 @@ class ImportZendeskController < ApplicationController if !params[:username] || !params[:token] render json: { - result: 'invalid', + result: 'invalid', message_human: 'Incomplete credentials', } return @@ -80,7 +80,7 @@ class ImportZendeskController < ApplicationController Setting.set('import_zendesk_endpoint_key', nil) render json: { - result: 'invalid', + result: 'invalid', message_human: 'Invalid credentials!', } return diff --git a/app/controllers/integration/check_mk_controller.rb b/app/controllers/integration/check_mk_controller.rb index db8a562f7..7afddcba9 100644 --- a/app/controllers/integration/check_mk_controller.rb +++ b/app/controllers/integration/check_mk_controller.rb @@ -57,16 +57,16 @@ UserAgent: #{request.env['HTTP_USER_AGENT']} article = Ticket::Article.create!( ticket_id: ticket_id, - type_id: Ticket::Article::Type.find_by(name: 'web').id, + type_id: Ticket::Article::Type.find_by(name: 'web').id, sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - body: body, - subject: title, - internal: false, + body: body, + subject: title, + internal: false, ) end if (!auto_close && params[:state].match(/#{state_recovery_match}/i)) || !params[:state].match(/#{state_recovery_match}/i) render json: { - result: 'ticket already open, added note', + result: 'ticket already open, added note', ticket_ids: ticket_ids_found, } return @@ -90,35 +90,35 @@ UserAgent: #{request.env['HTTP_USER_AGENT']} ticket.save! end render json: { - result: "closed tickets with ids #{ticket_ids_found.join(',')}", + result: "closed tickets with ids #{ticket_ids_found.join(',')}", ticket_ids: ticket_ids_found, } return end ticket = Ticket.create!( - group_id: group_id, + group_id: group_id, customer_id: customer.id, - title: title, + title: title, preferences: { check_mk: { - host: params[:host], + host: params[:host], service: params[:service], }, } ) article = Ticket::Article.create!( ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'web').id, + type_id: Ticket::Article::Type.find_by(name: 'web').id, sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - body: body, - subject: title, - internal: false, + body: body, + subject: title, + internal: false, ) render json: { - result: "new ticket created (ticket id: #{ticket.id})", - ticket_id: ticket.id, + result: "new ticket created (ticket id: #{ticket.id})", + ticket_id: ticket.id, ticket_number: ticket.number, } end diff --git a/app/controllers/integration/cti_controller.rb b/app/controllers/integration/cti_controller.rb index 2091475fe..ecb0bc120 100644 --- a/app/controllers/integration/cti_controller.rb +++ b/app/controllers/integration/cti_controller.rb @@ -51,18 +51,18 @@ class Integration::CtiController < ApplicationController from = row[:caller_id] data = { - action: 'dial', + action: 'dial', caller_id: from, - number: params[:to] + number: params[:to] } break end if data.blank? && default_caller_id.present? from = default_caller_id data = { - action: 'dial', + action: 'dial', caller_id: default_caller_id, - number: params[:to] + number: params[:to] } end end diff --git a/app/controllers/integration/idoit_controller.rb b/app/controllers/integration/idoit_controller.rb index 6ca159113..3eae7d3aa 100644 --- a/app/controllers/integration/idoit_controller.rb +++ b/app/controllers/integration/idoit_controller.rb @@ -8,7 +8,7 @@ class Integration::IdoitController < ApplicationController def verify response = ::Idoit.verify(params[:api_token], params[:endpoint], params[:client_id]) render json: { - result: 'ok', + result: 'ok', response: response, } rescue => e @@ -23,7 +23,7 @@ class Integration::IdoitController < ApplicationController def query response = ::Idoit.query(params[:method], params[:filter]) render json: { - result: 'ok', + result: 'ok', response: response, } rescue => e diff --git a/app/controllers/integration/ldap_controller.rb b/app/controllers/integration/ldap_controller.rb index 92ce57f22..1a80441cb 100644 --- a/app/controllers/integration/ldap_controller.rb +++ b/app/controllers/integration/ldap_controller.rb @@ -42,9 +42,9 @@ class Integration::LdapController < ApplicationController user_uid: user.uid_attribute, # the order of these calls is relevant! - group_filter: group.filter, - groups: group.list, - group_uid: group.uid_attribute, + group_filter: group.filter, + groups: group.list, + group_uid: group.uid_attribute, } end end diff --git a/app/controllers/integration/placetel_controller.rb b/app/controllers/integration/placetel_controller.rb index 7e378809e..8f261b8ec 100644 --- a/app/controllers/integration/placetel_controller.rb +++ b/app/controllers/integration/placetel_controller.rb @@ -184,12 +184,12 @@ class Integration::PlacetelController < ApplicationController api_key: config_integration[:api_token], }, { - log: { + log: { facility: 'placetel', }, - json: true, - open_timeout: 4, - read_timeout: 6, + json: true, + open_timeout: 4, + read_timeout: 6, total_timeout: 6, }, ) diff --git a/app/controllers/karma_controller.rb b/app/controllers/karma_controller.rb index 0772ea030..b806e2d1f 100644 --- a/app/controllers/karma_controller.rb +++ b/app/controllers/karma_controller.rb @@ -6,8 +6,8 @@ class KarmaController < ApplicationController def index render json: { levels: Setting.get('karma_levels'), - user: Karma::User.by_user(current_user), - logs: Karma::ActivityLog.latest(current_user, 20), + user: Karma::User.by_user(current_user), + logs: Karma::ActivityLog.latest(current_user, 20), } end diff --git a/app/controllers/links_controller.rb b/app/controllers/links_controller.rb index 2ae8c7e96..1cb90f8d1 100644 --- a/app/controllers/links_controller.rb +++ b/app/controllers/links_controller.rb @@ -6,7 +6,7 @@ class LinksController < ApplicationController # GET /api/v1/links def index links = Link.list( - link_object: params[:link_object], + link_object: params[:link_object], link_object_value: params[:link_object_value], ) @@ -22,7 +22,7 @@ class LinksController < ApplicationController # return result render json: { - links: link_list, + links: link_list, assets: assets, } end @@ -37,10 +37,10 @@ class LinksController < ApplicationController end link = Link.add( - link_type: params[:link_type], - link_object_target: params[:link_object_target], + link_type: params[:link_type], + link_object_target: params[:link_object_target], link_object_target_value: params[:link_object_target_value], - link_object_source: params[:link_object_source], + link_object_source: params[:link_object_source], link_object_source_value: object.id, ) diff --git a/app/controllers/long_polling_controller.rb b/app/controllers/long_polling_controller.rb index 3c3d7c652..30b01135f 100644 --- a/app/controllers/long_polling_controller.rb +++ b/app/controllers/long_polling_controller.rb @@ -29,12 +29,12 @@ class LongPollingController < ApplicationController Sessions.create(client_id, session_data, { type: 'ajax' }) elsif data['event'] message = Sessions::Event.run( - event: data['event'], - payload: data, - session: session_data, + event: data['event'], + payload: data, + session: session_data, client_id: client_id, - clients: {}, - options: {}, + clients: {}, + options: {}, ) if message Sessions.send(client_id, message) diff --git a/app/controllers/monitoring_controller.rb b/app/controllers/monitoring_controller.rb index ebfa61ef4..7d4aa3172 100644 --- a/app/controllers/monitoring_controller.rb +++ b/app/controllers/monitoring_controller.rb @@ -152,7 +152,7 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX result = { healthy: true, message: 'success', - token: token, + token: token, } render json: result return @@ -204,19 +204,19 @@ curl http://localhost/api/v1/monitoring/status?token=XXX end status = { - counts: {}, + counts: {}, last_created_at: {}, - last_login: last_login, - agents: User.with_permissions('ticket.agent').count, + last_login: last_login, + agents: User.with_permissions('ticket.agent').count, } map = { - users: User, - groups: Group, - overviews: Overview, - tickets: Ticket, + users: User, + groups: Group, + overviews: Overview, + tickets: Ticket, ticket_articles: Ticket::Article, - text_modules: TextModule, + text_modules: TextModule, } map.each do |key, class_name| status[:counts][key] = class_name.count @@ -316,9 +316,9 @@ curl http://localhost/api/v1/monitoring/amount_check?token=XXX&periode=1h if row[:type] == 'gt' if count > params[row[:param]].to_i result = { - state: row[:notice], + state: row[:notice], message: "The limit of #{params[row[:param]]} was exceeded with #{count} in the last #{params[:periode]}", - count: count, + count: count, } break end @@ -327,18 +327,18 @@ curl http://localhost/api/v1/monitoring/amount_check?token=XXX&periode=1h next if count > params[row[:param]].to_i result = { - state: row[:notice], + state: row[:notice], message: "The minimum of #{params[row[:param]]} was undercut by #{count} in the last #{params[:periode]}", - count: count, + count: count, } break end if result.blank? result = { - state: 'ok', + state: 'ok', message: '', - count: Ticket.where('created_at >= ?', created_at).count, + count: Ticket.where('created_at >= ?', created_at).count, } end diff --git a/app/controllers/object_manager_attributes_controller.rb b/app/controllers/object_manager_attributes_controller.rb index 62c8346ab..3a4904dec 100644 --- a/app/controllers/object_manager_attributes_controller.rb +++ b/app/controllers/object_manager_attributes_controller.rb @@ -25,21 +25,21 @@ class ObjectManagerAttributesController < ApplicationController # check if attribute already exists exists = ObjectManager::Attribute.get( object: permitted_params[:object], - name: permitted_params[:name], + name: permitted_params[:name], ) raise Exceptions::UnprocessableEntity, 'already exists' if exists begin object_manager_attribute = ObjectManager::Attribute.add( - object: permitted_params[:object], - name: permitted_params[:name], - display: permitted_params[:display], - data_type: permitted_params[:data_type], + object: permitted_params[:object], + name: permitted_params[:name], + display: permitted_params[:display], + data_type: permitted_params[:data_type], data_option: permitted_params[:data_option], - active: permitted_params[:active], - screens: permitted_params[:screens], - position: 1550, - editable: true, + active: permitted_params[:active], + screens: permitted_params[:screens], + position: 1550, + editable: true, ) render json: object_manager_attribute.attributes_with_association_ids, status: :created rescue => e @@ -52,15 +52,15 @@ class ObjectManagerAttributesController < ApplicationController def update object_manager_attribute = ObjectManager::Attribute.add( - object: permitted_params[:object], - name: permitted_params[:name], - display: permitted_params[:display], - data_type: permitted_params[:data_type], + object: permitted_params[:object], + name: permitted_params[:name], + display: permitted_params[:display], + data_type: permitted_params[:data_type], data_option: permitted_params[:data_option], - active: permitted_params[:active], - screens: permitted_params[:screens], - position: 1550, - editable: true, + active: permitted_params[:active], + screens: permitted_params[:screens], + position: 1550, + editable: true, ) render json: object_manager_attribute.attributes_with_association_ids, status: :ok rescue => e @@ -74,7 +74,7 @@ class ObjectManagerAttributesController < ApplicationController object_manager_attribute = ObjectManager::Attribute.find(params[:id]) ObjectManager::Attribute.remove( object_lookup_id: object_manager_attribute.object_lookup_id, - name: object_manager_attribute.name, + name: object_manager_attribute.name, ) model_destroy_render_item rescue => e diff --git a/app/controllers/online_notifications_controller.rb b/app/controllers/online_notifications_controller.rb index 632127b9e..17bdcbdb2 100644 --- a/app/controllers/online_notifications_controller.rb +++ b/app/controllers/online_notifications_controller.rb @@ -67,7 +67,7 @@ curl http://localhost/api/v1/online_notifications.json -v -u #{login}:#{password end render json: { record_ids: item_ids, - assets: assets, + assets: assets, }, status: :ok return end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index e951bc2d5..885220aa1 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -87,7 +87,7 @@ curl http://localhost/api/v1/organizations -v -u #{login}:#{password} end render json: { record_ids: item_ids, - assets: assets, + assets: assets, }, status: :ok return end @@ -243,11 +243,11 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co query = query.permit!.to_h end query_params = { - query: query, - limit: per_page, - offset: offset, - sort_by: params[:sort_by], - order_by: params[:order_by], + query: query, + limit: per_page, + offset: offset, + sort_by: params[:sort_by], + order_by: params[:order_by], current_user: current_user, } if params[:role_ids].present? @@ -289,7 +289,7 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co # return result render json: { - assets: assets, + assets: assets, organization_ids: organization_ids.uniq, } return @@ -332,8 +332,8 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co permission_check('admin.organization') send_data( Organization.csv_example, - filename: 'organization-example.csv', - type: 'text/csv', + filename: 'organization-example.csv', + type: 'text/csv', disposition: 'attachment' ) end @@ -356,12 +356,12 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank? result = Organization.csv_import( - string: string, + string: string, parse_params: { col_sep: params[:col_sep] || ',', }, - try: params[:try], - delete: params[:delete], + try: params[:try], + delete: params[:delete], ) render json: result, status: :ok end diff --git a/app/controllers/proxy_controller.rb b/app/controllers/proxy_controller.rb index 1f43c7846..934f70f3a 100644 --- a/app/controllers/proxy_controller.rb +++ b/app/controllers/proxy_controller.rb @@ -17,7 +17,7 @@ class ProxyController < ApplicationController ) rescue => e render json: { - result: 'failed', + result: 'failed', message: e.inspect } return @@ -29,7 +29,7 @@ class ProxyController < ApplicationController return end render json: { - result: 'failed', + result: 'failed', message: result.body || result.error || result.code } end diff --git a/app/controllers/recent_view_controller.rb b/app/controllers/recent_view_controller.rb index 032404efd..bf45907df 100644 --- a/app/controllers/recent_view_controller.rb +++ b/app/controllers/recent_view_controller.rb @@ -39,7 +39,7 @@ curl http://localhost/api/v1/recent_view -v -u #{login}:#{password} -H "Content- end render json: { record_ids: item_ids, - assets: assets, + assets: assets, }, status: :ok return end diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 350e65b6d..97f1b233e 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -11,7 +11,7 @@ class ReportsController < ApplicationController return end render json: { - config: Report.config, + config: Report.config, profiles: Report::Profile.list, } end @@ -102,8 +102,8 @@ class ReportsController < ApplicationController content = sheet(get_params[:profile], backend[:display], result) send_data( content, - filename: "tickets-#{get_params[:profile].name}-#{backend[:display]}.xls", - type: 'application/vnd.ms-excel', + filename: "tickets-#{get_params[:profile].name}-#{backend[:display]}.xls", + type: 'application/vnd.ms-excel', disposition: 'attachment' ) end @@ -163,11 +163,11 @@ class ReportsController < ApplicationController end { profile: profile, - metric: metric, - config: local_config, - start: start, - stop: stop, - range: range, + metric: metric, + config: local_config, + start: start, + stop: stop, + range: range, } end @@ -217,9 +217,9 @@ class ReportsController < ApplicationController # ObjectManager attributes header_column = 14 # needs to be skipped - objects = ObjectManager::Attribute.where(editable: true, - active: true, - to_create: false, + objects = ObjectManager::Attribute.where(editable: true, + active: true, + to_create: false, object_lookup_id: ObjectLookup.lookup(name: 'Ticket').id) .pluck(:name, :display, :data_type, :data_option) .map { |name, display, data_type, data_option| { name: name, display: display, data_type: data_type, data_option: data_option } } diff --git a/app/controllers/sessions/collection_dashboard.rb b/app/controllers/sessions/collection_dashboard.rb index 7ed34c4a6..af9743295 100644 --- a/app/controllers/sessions/collection_dashboard.rb +++ b/app/controllers/sessions/collection_dashboard.rb @@ -6,8 +6,8 @@ module ExtraCollection item = StatsStore.search( object: 'User', - o_id: user.id, - key: 'dashboard', + o_id: user.id, + key: 'dashboard', ) return [collections, assets] if !item diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index e207b717b..4e4be2efb 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -51,12 +51,12 @@ class SessionsController < ApplicationController # return new session data render status: :created, - json: { - session: user, - config: config_frontend, - models: models, + json: { + session: user, + config: config_frontend, + models: models, collections: collections, - assets: assets, + assets: assets, } end @@ -74,9 +74,9 @@ class SessionsController < ApplicationController models = SessionHelper.models() render json: { - error: 'no valid session', - config: config_frontend, - models: models, + error: 'no valid session', + config: config_frontend, + models: models, collections: { Locale.to_app_model => Locale.where(active: true) }, @@ -103,11 +103,11 @@ class SessionsController < ApplicationController # return current session render json: { - session: user, - config: config_frontend, - models: models, + session: user, + config: config_frontend, + models: models, collections: collections, - assets: assets, + assets: assets, } end @@ -206,7 +206,7 @@ class SessionsController < ApplicationController # check user if !params[:id] render( - json: { message: 'no user given' }, + json: { message: 'no user given' }, status: :not_found ) return false @@ -215,7 +215,7 @@ class SessionsController < ApplicationController user = User.find(params[:id]) if !user render( - json: {}, + json: {}, status: :not_found ) return false @@ -232,7 +232,7 @@ class SessionsController < ApplicationController render( json: { - success: true, + success: true, location: '', }, ) @@ -250,7 +250,7 @@ class SessionsController < ApplicationController user = User.lookup(id: session[:switched_from_user_id]) if !user render( - json: {}, + json: {}, status: :not_found ) return false @@ -270,7 +270,7 @@ class SessionsController < ApplicationController render( json: { - success: true, + success: true, location: '', }, ) @@ -299,7 +299,7 @@ class SessionsController < ApplicationController end render json: { sessions: sessions_clean, - assets: assets, + assets: assets, } end diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 07c87f57a..676e216c5 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -39,7 +39,7 @@ class SettingsController < ApplicationController if !clean_params[:logo] render json: { - result: 'invalid', + result: 'invalid', message: 'Need logo param', } return @@ -48,7 +48,7 @@ class SettingsController < ApplicationController # validate image if !clean_params[:logo].match?(/^data:image/i) render json: { - result: 'invalid', + result: 'invalid', message: 'Invalid payload, need data:image in logo param', } return @@ -58,7 +58,7 @@ class SettingsController < ApplicationController file = StaticAssets.data_url_attributes(clean_params[:logo]) if !file[:content] || !file[:mime_type] render json: { - result: 'invalid', + result: 'invalid', message: 'Unable to process image upload.', } return @@ -80,7 +80,7 @@ class SettingsController < ApplicationController end render json: { - result: 'ok', + result: 'ok', settings: [setting], } end diff --git a/app/controllers/slas_controller.rb b/app/controllers/slas_controller.rb index 09df65ff6..c6c5b4006 100644 --- a/app/controllers/slas_controller.rb +++ b/app/controllers/slas_controller.rb @@ -65,7 +65,7 @@ curl http://localhost/api/v1/slas.json -v -u #{login}:#{password} end render json: { record_ids: sla_ids, - assets: assets, + assets: assets, }, status: :ok return end diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 5c910f039..dbb1d6b53 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -9,7 +9,7 @@ class TagsController < ApplicationController results = [] list.each do |item| result = { - id: item.id, + id: item.id, value: item.name, } results.push result @@ -21,7 +21,7 @@ class TagsController < ApplicationController def list list = Tag.tag_list( object: params[:object], - o_id: params[:o_id], + o_id: params[:o_id], ) # return result @@ -34,8 +34,8 @@ class TagsController < ApplicationController def add success = Tag.tag_add( object: params[:object], - o_id: params[:o_id], - item: params[:item], + o_id: params[:o_id], + item: params[:item], ) if success render json: success, status: :created @@ -48,8 +48,8 @@ class TagsController < ApplicationController def remove success = Tag.tag_remove( object: params[:object], - o_id: params[:o_id], - item: params[:item], + o_id: params[:o_id], + item: params[:item], ) if success render json: success, status: :created @@ -65,8 +65,8 @@ class TagsController < ApplicationController results = [] list.each do |item| result = { - id: item.id, - name: item.name, + id: item.id, + name: item.name, count: Tag.where(tag_item_id: item.id).count } results.push result @@ -85,7 +85,7 @@ class TagsController < ApplicationController def admin_rename permission_check('admin.tag') Tag::Item.rename( - id: params[:id], + id: params[:id], name: params[:name], ) render json: {} diff --git a/app/controllers/text_modules_controller.rb b/app/controllers/text_modules_controller.rb index a6d3de4d6..0fd3f6f4a 100644 --- a/app/controllers/text_modules_controller.rb +++ b/app/controllers/text_modules_controller.rb @@ -168,8 +168,8 @@ curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} -H "Co ) send_data( csv_string, - filename: 'text_module-example.csv', - type: 'text/csv', + filename: 'text_module-example.csv', + type: 'text/csv', disposition: 'attachment' ) @@ -193,12 +193,12 @@ curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} -H "Co raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank? result = TextModule.csv_import( - string: string, + string: string, parse_params: { col_sep: params[:col_sep] || ',', }, - try: params[:try], - delete: params[:delete], + try: params[:try], + delete: params[:delete], ) render json: result, status: :ok end diff --git a/app/controllers/ticket_articles_controller.rb b/app/controllers/ticket_articles_controller.rb index da58e0a21..681ffb17b 100644 --- a/app/controllers/ticket_articles_controller.rb +++ b/app/controllers/ticket_articles_controller.rb @@ -66,7 +66,7 @@ class TicketArticlesController < ApplicationController end render json: { record_ids: record_ids, - assets: assets, + assets: assets, }, status: :ok return end @@ -196,20 +196,20 @@ class TicketArticlesController < ApplicationController 'Content-Type' => content_type } store = Store.add( - object: 'UploadCache', - o_id: params[:form_id], - data: file.read, - filename: file.original_filename, + object: 'UploadCache', + o_id: params[:form_id], + data: file.read, + filename: file.original_filename, preferences: headers_store ) # return result render json: { success: true, - data: { - id: store.id, + data: { + id: store.id, filename: file.original_filename, - size: store.size, + size: store.size, } } end @@ -257,8 +257,8 @@ class TicketArticlesController < ApplicationController send_data( file.content, - filename: file.filename, - type: file.preferences['Content-Type'] || file.preferences['Mime-Type'] || 'application/octet-stream', + filename: file.filename, + type: file.preferences['Content-Type'] || file.preferences['Mime-Type'] || 'application/octet-stream', disposition: disposition ) end @@ -275,8 +275,8 @@ class TicketArticlesController < ApplicationController send_data( file.content, - filename: file.filename, - type: 'message/rfc822', + filename: file.filename, + type: 'message/rfc822', disposition: 'inline' ) end @@ -296,8 +296,8 @@ class TicketArticlesController < ApplicationController ) send_data( csv_string, - filename: 'example.csv', - type: 'text/csv', + filename: 'example.csv', + type: 'text/csv', disposition: 'attachment' ) @@ -325,11 +325,11 @@ class TicketArticlesController < ApplicationController raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank? result = Ticket::Article.csv_import( - string: string, + string: string, parse_params: { col_sep: ';', }, - try: params[:try], + try: params[:try], ) render json: result, status: :ok end diff --git a/app/controllers/ticket_overviews_controller.rb b/app/controllers/ticket_overviews_controller.rb index eede33cd2..cbf0a4d50 100644 --- a/app/controllers/ticket_overviews_controller.rb +++ b/app/controllers/ticket_overviews_controller.rb @@ -13,9 +13,9 @@ class TicketOverviewsController < ApplicationController assets = {} overview = Overview.lookup(id: index[:overview][:id]) meta = { - name: overview.name, - prio: overview.prio, - link: overview.link, + name: overview.name, + prio: overview.prio, + link: overview.link, count: index[:count], } indexes.push meta @@ -42,7 +42,7 @@ class TicketOverviewsController < ApplicationController render json: { assets: assets, - index: result, + index: result, } end diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index b21d44443..e5972d077 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -44,7 +44,7 @@ class TicketsController < ApplicationController end render json: { record_ids: item_ids, - assets: assets, + assets: assets, }, status: :ok return end @@ -107,11 +107,11 @@ class TicketsController < ApplicationController role_ids = Role.signup_role_ids local_customer = User.create( firstname: '', - lastname: '', - email: email, - password: '', - active: true, - role_ids: role_ids, + lastname: '', + email: email, + password: '', + active: true, + role_ids: role_ids, ) end clean_params[:customer_id] = local_customer.id @@ -186,10 +186,10 @@ class TicketsController < ApplicationController object_ids.each do |local_object_id| link = Link.add( - link_type: link_type, - link_object_target: target_object, + link_type: link_type, + link_object_target: target_object, link_object_target_value: local_object_id, - link_object_source: 'Ticket', + link_object_source: 'Ticket', link_object_source_value: ticket.id, ) end @@ -281,7 +281,7 @@ class TicketsController < ApplicationController # return result result = Ticket::ScreenOptions.list_by_customer( customer_id: params[:customer_id], - limit: 15, + limit: 15, ) render json: result end @@ -312,7 +312,7 @@ class TicketsController < ApplicationController ticket_lists = Ticket .where( customer_id: ticket.customer_id, - state_id: Ticket::State.by_category(:open) + state_id: Ticket::State.by_category(:open) ) .where(access_condition) .where('id != ?', [ ticket.id ]) @@ -353,8 +353,8 @@ class TicketsController < ApplicationController # return result render json: { - assets: assets, - ticket_ids_by_customer: ticket_ids_by_customer, + assets: assets, + ticket_ids_by_customer: ticket_ids_by_customer, ticket_ids_recent_viewed: ticket_ids_recent_viewed, } end @@ -366,7 +366,7 @@ class TicketsController < ApplicationController ticket_master = Ticket.find_by(number: params[:master_ticket_number]) if !ticket_master render json: { - result: 'failed', + result: 'failed', message: 'No such master ticket number!', } return @@ -377,7 +377,7 @@ class TicketsController < ApplicationController ticket_slave = Ticket.find_by(id: params[:slave_ticket_id]) if !ticket_slave render json: { - result: 'failed', + result: 'failed', message: 'No such slave ticket!', } return @@ -386,15 +386,15 @@ class TicketsController < ApplicationController # merge ticket ticket_slave.merge_to( - ticket_id: ticket_master.id, + ticket_id: ticket_master.id, created_by_id: current_user.id, ) # return result render json: { - result: 'success', + result: 'success', master_ticket: ticket_master.attributes, - slave_ticket: ticket_slave.attributes, + slave_ticket: ticket_slave.attributes, } end @@ -409,7 +409,7 @@ class TicketsController < ApplicationController assets = article.assets(assets) render json: { - assets: assets, + assets: assets, attachments: article_attachments_clone(article), } end @@ -448,12 +448,12 @@ class TicketsController < ApplicationController # build result list tickets = Ticket.search( - query: query, - condition: params[:condition].to_h, - limit: per_page, - offset: offset, - order_by: params[:order_by], - sort_by: params[:sort_by], + query: query, + condition: params[:condition].to_h, + limit: per_page, + offset: offset, + order_by: params[:order_by], + sort_by: params[:sort_by], current_user: current_user, ) @@ -475,9 +475,9 @@ class TicketsController < ApplicationController # return result render json: { - tickets: ticket_result, + tickets: ticket_result, tickets_count: tickets.count, - assets: assets, + assets: assets, } end @@ -496,9 +496,9 @@ class TicketsController < ApplicationController # return result render json: { - ticket_ids: ticket_ids, + ticket_ids: ticket_ids, ticket_count: ticket_count || 0, - assets: assets, + assets: assets, } end @@ -523,23 +523,23 @@ class TicketsController < ApplicationController conditions = { closed_ids: { - 'ticket.state_id' => { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:closed).pluck(:id), + value: Ticket::State.by_category(:closed).pluck(:id), }, 'ticket.customer_id' => { operator: 'is', - value: user.id, + value: user.id, }, }, - open_ids: { - 'ticket.state_id' => { + open_ids: { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:open).pluck(:id), + value: Ticket::State.by_category(:open).pluck(:id), }, 'ticket.customer_id' => { operator: 'is', - value: user.id, + value: user.id, }, }, } @@ -565,23 +565,23 @@ class TicketsController < ApplicationController conditions = { closed_ids: { - 'ticket.state_id' => { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:closed).pluck(:id), + value: Ticket::State.by_category(:closed).pluck(:id), }, 'ticket.organization_id' => { operator: 'is', - value: organization.id, + value: organization.id, }, }, - open_ids: { - 'ticket.state_id' => { + open_ids: { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:open).pluck(:id), + value: Ticket::State.by_category(:open).pluck(:id), }, 'ticket.organization_id' => { operator: 'is', - value: organization.id, + value: organization.id, }, }, } @@ -598,9 +598,9 @@ class TicketsController < ApplicationController # return result render json: { - user: user_tickets, + user: user_tickets, organization: org_tickets, - assets: assets, + assets: assets, } end @@ -619,8 +619,8 @@ class TicketsController < ApplicationController ) send_data( csv_string, - filename: 'example.csv', - type: 'text/csv', + filename: 'example.csv', + type: 'text/csv', disposition: 'attachment' ) @@ -648,11 +648,11 @@ class TicketsController < ApplicationController raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank? result = Ticket.csv_import( - string: string, + string: string, parse_params: { col_sep: params[:col_sep] || ',', }, - try: params[:try], + try: params[:try], ) render json: result, status: :ok end @@ -693,7 +693,7 @@ class TicketsController < ApplicationController # get links links = Link.list( - link_object: 'Ticket', + link_object: 'Ticket', link_object_value: ticket.id, ) link_list = [] @@ -710,12 +710,12 @@ class TicketsController < ApplicationController # return result { - ticket_id: ticket.id, + ticket_id: ticket.id, ticket_article_ids: article_ids, - assets: assets, - links: link_list, - tags: tags, - form_meta: attributes_to_change[:form_meta], + assets: assets, + links: link_list, + tags: tags, + form_meta: attributes_to_change[:form_meta], } end diff --git a/app/controllers/time_accountings_controller.rb b/app/controllers/time_accountings_controller.rb index 002abbe88..45ee8d163 100644 --- a/app/controllers/time_accountings_controller.rb +++ b/app/controllers/time_accountings_controller.rb @@ -16,7 +16,7 @@ class TimeAccountingsController < ApplicationController if !time_unit[record[0]] time_unit[record[0]] = { time_unit: 0, - agent_id: record[2], + agent_id: record[2], } end time_unit[record[0]][:time_unit] += record[1] @@ -55,11 +55,11 @@ class TimeAccountingsController < ApplicationController end end result = { - ticket: ticket.attributes, - time_unit: local_time_unit[:time_unit], - customer: customers[ticket.customer_id], + ticket: ticket.attributes, + time_unit: local_time_unit[:time_unit], + customer: customers[ticket.customer_id], organization: organizations[ticket.organization_id], - agent: agents[local_time_unit[:agent_id]], + agent: agents[local_time_unit[:agent_id]], } results.push result end @@ -67,105 +67,105 @@ class TimeAccountingsController < ApplicationController if params[:download] header = [ { - name: 'Ticket#', + name: 'Ticket#', width: 15, }, { - name: 'Title', + name: 'Title', width: 30, }, { - name: 'Customer', + name: 'Customer', width: 20, }, { - name: 'Organization', + name: 'Organization', width: 20, }, { - name: 'Agent', + name: 'Agent', width: 20, }, { - name: 'Time Units', + name: 'Time Units', width: 10, }, { - name: 'Time Units Total', + name: 'Time Units Total', width: 10, }, { - name: 'Created at', + name: 'Created at', width: 10, }, { - name: 'Closed at', + name: 'Closed at', width: 10, }, { - name: 'Close Escalation At', + name: 'Close Escalation At', width: 10, }, { - name: 'Close In Min', + name: 'Close In Min', width: 10, }, { - name: 'Close Diff In Min', + name: 'Close Diff In Min', width: 10, }, { - name: 'First Response At', + name: 'First Response At', width: 10, }, { - name: 'First Response Escalation At', + name: 'First Response Escalation At', width: 10, }, { - name: 'First Response In Min', + name: 'First Response In Min', width: 10, }, { - name: 'First Response Diff In Min', + name: 'First Response Diff In Min', width: 10, }, { - name: 'Update Escalation At', + name: 'Update Escalation At', width: 10, }, { - name: 'Update In Min', + name: 'Update In Min', width: 10, }, { - name: 'Update Diff In Min', + name: 'Update Diff In Min', width: 10, }, { - name: 'Last Contact At', + name: 'Last Contact At', width: 10, }, { - name: 'Last Contact Agent At', + name: 'Last Contact Agent At', width: 10, }, { - name: 'Last Contact Customer At', + name: 'Last Contact Customer At', width: 10, }, { - name: 'Article Count', + name: 'Article Count', width: 10, }, { - name: 'Escalation At', + name: 'Escalation At', width: 10, }, ] - objects = ObjectManager::Attribute.where(editable: true, - active: true, - to_create: false, + objects = ObjectManager::Attribute.where(editable: true, + active: true, + to_create: false, object_lookup_id: ObjectLookup.lookup(name: 'Ticket').id) .pluck(:name, :display, :data_type, :data_option) .map { |name, display, data_type, data_option| { name: name, display: display, data_type: data_type, data_option: data_option } } @@ -233,8 +233,8 @@ class TimeAccountingsController < ApplicationController content = sheet("By Ticket #{year}-#{month}", header, result) send_data( content, - filename: "by_ticket-#{year}-#{month}.xls", - type: 'application/vnd.ms-excel', + filename: "by_ticket-#{year}-#{month}.xls", + type: 'application/vnd.ms-excel', disposition: 'attachment' ) return @@ -256,7 +256,7 @@ class TimeAccountingsController < ApplicationController if !time_unit[record[0]] time_unit[record[0]] = { time_unit: 0, - agent_id: record[2], + agent_id: record[2], } end time_unit[record[0]][:time_unit] += record[1] @@ -273,9 +273,9 @@ class TimeAccountingsController < ApplicationController organization = Organization.lookup(id: ticket.organization_id).attributes end customers[ticket.customer_id] = { - customer: User.lookup(id: ticket.customer_id).attributes, + customer: User.lookup(id: ticket.customer_id).attributes, organization: organization, - time_unit: local_time_unit[:time_unit], + time_unit: local_time_unit[:time_unit], } next end @@ -289,15 +289,15 @@ class TimeAccountingsController < ApplicationController if params[:download] header = [ { - name: 'Customer', + name: 'Customer', width: 30, }, { - name: 'Organization', + name: 'Organization', width: 30, }, { - name: 'Time Units', + name: 'Time Units', width: 10, } ] @@ -314,8 +314,8 @@ class TimeAccountingsController < ApplicationController content = sheet("By Customer #{year}-#{month}", header, result) send_data( content, - filename: "by_customer-#{year}-#{month}.xls", - type: 'application/vnd.ms-excel', + filename: "by_customer-#{year}-#{month}.xls", + type: 'application/vnd.ms-excel', disposition: 'attachment' ) return @@ -337,7 +337,7 @@ class TimeAccountingsController < ApplicationController if !time_unit[record[0]] time_unit[record[0]] = { time_unit: 0, - agent_id: record[2], + agent_id: record[2], } end time_unit[record[0]][:time_unit] += record[1] @@ -352,7 +352,7 @@ class TimeAccountingsController < ApplicationController if !organizations[ticket.organization_id] organizations[ticket.organization_id] = { organization: Organization.lookup(id: ticket.organization_id).attributes, - time_unit: local_time_unit[:time_unit], + time_unit: local_time_unit[:time_unit], } next end @@ -366,11 +366,11 @@ class TimeAccountingsController < ApplicationController if params[:download] header = [ { - name: 'Organization', + name: 'Organization', width: 40, }, { - name: 'Time Units', + name: 'Time Units', width: 20, } ] @@ -386,8 +386,8 @@ class TimeAccountingsController < ApplicationController content = sheet("By Organization #{year}-#{month}", header, result) send_data( content, - filename: "by_organization-#{year}-#{month}.xls", - type: 'application/vnd.ms-excel', + filename: "by_organization-#{year}-#{month}.xls", + type: 'application/vnd.ms-excel', disposition: 'attachment' ) return diff --git a/app/controllers/user_access_token_controller.rb b/app/controllers/user_access_token_controller.rb index 2efce83c3..123ba2785 100644 --- a/app/controllers/user_access_token_controller.rb +++ b/app/controllers/user_access_token_controller.rb @@ -61,7 +61,7 @@ curl http://localhost/api/v1/user_access_token -v -u #{login}:#{password} end render json: { - tokens: token_list, + tokens: token_list, permissions: permissions, }, status: :ok end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7cdeb0209..1e6b9a86c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -52,7 +52,7 @@ class UsersController < ApplicationController end render json: { record_ids: item_ids, - assets: assets, + assets: assets, }, status: :ok return end @@ -211,10 +211,10 @@ class UsersController < ApplicationController token = Token.create(action: 'PasswordReset', user_id: user.id) NotificationFactory::Mailer.notification( template: 'user_invite', - user: user, - objects: { - token: token, - user: user, + user: user, + objects: { + token: token, + user: user, current_user: current_user, } ) @@ -225,8 +225,8 @@ class UsersController < ApplicationController result = User.signup_new_token(user) NotificationFactory::Mailer.notification( template: 'signup', - user: user, - objects: result, + user: user, + objects: result, ) end @@ -389,10 +389,10 @@ class UsersController < ApplicationController # build result list tickets = Ticket.search( - query: query, - condition: params[:condition].to_h, - limit: per_page, - offset: offset, + query: query, + condition: params[:condition].to_h, + limit: per_page, + offset: offset, current_user: current_user, ) @@ -402,11 +402,11 @@ class UsersController < ApplicationController end query_params = { - query: query, - limit: per_page, - offset: offset, - sort_by: params[:sort_by], - order_by: params[:order_by], + query: query, + limit: per_page, + offset: offset, + sort_by: params[:sort_by], + order_by: params[:order_by], current_user: current_user, } %i[role_ids permissions].each do |key| @@ -464,7 +464,7 @@ class UsersController < ApplicationController # return result render json: { - assets: assets, + assets: assets, user_ids: user_ids.uniq, } return @@ -577,8 +577,8 @@ curl http://localhost/api/v1/users/email_verify_send -v -u #{login}:#{password} user = result[:user] NotificationFactory::Mailer.notification( template: 'signup', - user: user, - objects: result + user: user, + objects: result ) # only if system is in develop mode, send token back to browser for browser tests @@ -628,8 +628,8 @@ curl http://localhost/api/v1/users/password_reset -v -u #{login}:#{password} -H user = result[:user] NotificationFactory::Mailer.notification( template: 'password_reset', - user: user, - objects: result + user: user, + objects: result ) # only if system is in develop mode, send token back to browser for browser tests @@ -685,9 +685,9 @@ curl http://localhost/api/v1/users/password_reset_verify -v -u #{login}:#{passwo if user NotificationFactory::Mailer.notification( template: 'password_change', - user: user, - objects: { - user: user, + user: user, + objects: { + user: user, current_user: current_user, } ) @@ -754,9 +754,9 @@ curl http://localhost/api/v1/users/password_change -v -u #{login}:#{password} -H NotificationFactory::Mailer.notification( template: 'password_change', - user: user, - objects: { - user: user, + user: user, + objects: { + user: user, current_user: current_user, } ) @@ -873,9 +873,9 @@ curl http://localhost/api/v1/users/account -v -u #{login}:#{password} -H "Conten # remove from database record = Authorization.where( - user_id: current_user.id, + user_id: current_user.id, provider: params[:provider], - uid: params[:uid], + uid: params[:uid], ) raise Exceptions::UnprocessableEntity, 'No record found!' if !record.first @@ -907,8 +907,8 @@ curl http://localhost/api/v1/users/image/8d6cca1c6bdc226cf2ba131e264ca2c7 -v -u if file send_data( file.content, - filename: file.filename, - type: file.preferences['Content-Type'] || file.preferences['Mime-Type'], + filename: file.filename, + type: file.preferences['Content-Type'] || file.preferences['Mime-Type'], disposition: 'inline' ) return @@ -918,8 +918,8 @@ curl http://localhost/api/v1/users/image/8d6cca1c6bdc226cf2ba131e264ca2c7 -v -u image = 'R0lGODdhMAAwAOMAAMzMzJaWlr6+vqqqqqOjo8XFxbe3t7GxsZycnAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAMAAwAAAEcxDISau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru98TwuAA+KQAQqJK8EAgBAgMEqmkzUgBIeSwWGZtR5XhSqAULACCoGCJGwlm1MGQrq9RqgB8fm4ZTUgDBIEcRR9fz6HiImKi4yNjo+QkZKTlJWWkBEAOw==' send_data( Base64.decode64(image), - filename: 'image.gif', - type: 'image/gif', + filename: 'image.gif', + type: 'image/gif', disposition: 'inline' ) end @@ -952,17 +952,17 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content file_resize = StaticAssets.data_url_attributes(params[:avatar_resize]) avatar = Avatar.add( - object: 'User', - o_id: current_user.id, - full: { - content: file_full[:content], + object: 'User', + o_id: current_user.id, + full: { + content: file_full[:content], mime_type: file_full[:mime_type], }, - resize: { - content: file_resize[:content], + resize: { + content: file_resize[:content], mime_type: file_resize[:mime_type], }, - source: 'upload ' + Time.zone.now.to_s, + source: 'upload ' + Time.zone.now.to_s, deletable: true, ) @@ -1026,8 +1026,8 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content permission_check('admin.user') send_data( User.csv_example, - filename: 'user-example.csv', - type: 'text/csv', + filename: 'user-example.csv', + type: 'text/csv', disposition: 'attachment' ) end @@ -1050,12 +1050,12 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank? result = User.csv_import( - string: string, + string: string, parse_params: { col_sep: params[:col_sep] || ',', }, - try: params[:try], - delete: params[:delete], + try: params[:try], + delete: params[:delete], ) render json: result, status: :ok end diff --git a/app/models/activity_stream.rb b/app/models/activity_stream.rb index 9a2ed922a..f19120c96 100644 --- a/app/models/activity_stream.rb +++ b/app/models/activity_stream.rb @@ -54,11 +54,11 @@ add a new activity entry for an object # check newest entry - is needed result = ActivityStream.where( - o_id: data[:o_id], + o_id: data[:o_id], #:activity_stream_type_id => type_id, - permission_id: permission_id, + permission_id: permission_id, activity_stream_object_id: object_id, - created_by_id: data[:created_by_id] + created_by_id: data[:created_by_id] ).order('created_at DESC, id DESC').first # resturn if old entry is really fresh @@ -69,13 +69,13 @@ add a new activity entry for an object # create history record = { - o_id: data[:o_id], - activity_stream_type_id: type_id, + o_id: data[:o_id], + activity_stream_type_id: type_id, activity_stream_object_id: object_id, - permission_id: permission_id, - group_id: data[:group_id], - created_at: data[:created_at], - created_by_id: data[:created_by_id] + permission_id: permission_id, + group_id: data[:group_id], + created_at: data[:created_at], + created_by_id: data[:created_by_id] } ActivityStream.create(record) @@ -93,7 +93,7 @@ remove whole activity entries of an object object_id = ObjectLookup.by_name(object_name) ActivityStream.where( activity_stream_object_id: object_id, - o_id: o_id, + o_id: o_id, ).destroy_all end diff --git a/app/models/application_model/can_assets.rb b/app/models/application_model/can_assets.rb index 7036377b6..c1f084390 100644 --- a/app/models/application_model/can_assets.rb +++ b/app/models/application_model/can_assets.rb @@ -118,7 +118,7 @@ return object and assets object = find(id) assets = object.assets({}) { - id: object.id, + id: object.id, assets: assets, } end diff --git a/app/models/application_model/has_attachments.rb b/app/models/application_model/has_attachments.rb index eea4f1540..46574e27f 100644 --- a/app/models/application_model/has_attachments.rb +++ b/app/models/application_model/has_attachments.rb @@ -61,11 +61,11 @@ store attachments for this object article_store = [] attachments_buffer.each do |attachment| article_store.push Store.add( - object: self.class.to_s, - o_id: id, - data: attachment.content, - filename: attachment.filename, - preferences: attachment.preferences, + object: self.class.to_s, + o_id: id, + data: attachment.content, + filename: attachment.filename, + preferences: attachment.preferences, created_by_id: created_by_id, ) end diff --git a/app/models/authorization.rb b/app/models/authorization.rb index 6591013cb..c84deb4a9 100644 --- a/app/models/authorization.rb +++ b/app/models/authorization.rb @@ -15,7 +15,7 @@ class Authorization < ApplicationModel # update auth tokens auth.update!( - token: hash['credentials']['token'], + token: hash['credentials']['token'], secret: hash['credentials']['secret'] ) @@ -40,11 +40,11 @@ class Authorization < ApplicationModel # update image if needed if hash['info']['image'].present? avatar = Avatar.add( - object: 'User', - o_id: user.id, - url: hash['info']['image'], - source: hash['provider'], - deletable: true, + object: 'User', + o_id: user.id, + url: hash['info']['image'], + source: hash['provider'], + deletable: true, updated_by_id: user.id, created_by_id: user.id, ) @@ -75,11 +75,11 @@ class Authorization < ApplicationModel # save/update avatar if hash['info'].present? && hash['info']['image'].present? avatar = Avatar.add( - object: 'User', - o_id: user.id, - url: hash['info']['image'], - source: hash['provider'], - deletable: true, + object: 'User', + o_id: user.id, + url: hash['info']['image'], + source: hash['provider'], + deletable: true, updated_by_id: user.id, created_by_id: user.id, ) @@ -92,12 +92,12 @@ class Authorization < ApplicationModel end Authorization.create!( - user: user, - uid: hash['uid'], + user: user, + uid: hash['uid'], username: hash['info']['nickname'] || hash['info']['username'] || hash['info']['name'] || hash['info']['email'] || hash['username'], provider: hash['provider'], - token: hash['credentials']['token'], - secret: hash['credentials']['secret'] + token: hash['credentials']['token'], + secret: hash['credentials']['secret'] ) end diff --git a/app/models/avatar.rb b/app/models/avatar.rb index 7f6ccb62c..0d6684910 100644 --- a/app/models/avatar.rb +++ b/app/models/avatar.rb @@ -24,11 +24,11 @@ add an avatar based on auto detection (email address) return if data[:url].blank? Avatar.add( - object: data[:object], - o_id: data[:o_id], - url: data[:url], - source: 'zammad.com', - deletable: false, + object: data[:object], + o_id: data[:o_id], + url: data[:url], + source: 'zammad.com', + deletable: false, updated_by_id: 1, created_by_id: 1, ) @@ -82,15 +82,15 @@ add avatar by url _add_init_avatar(object_id, data[:o_id]) record = { - o_id: data[:o_id], + o_id: data[:o_id], object_lookup_id: object_id, - default: true, - deletable: data[:deletable], - initial: false, - source: data[:source], - source_url: data[:url], - updated_by_id: data[:updated_by_id], - created_by_id: data[:created_by_id], + default: true, + deletable: data[:deletable], + initial: false, + source: data[:source], + source_url: data[:url], + updated_by_id: data[:updated_by_id], + created_by_id: data[:created_by_id], } # check if avatar with url already exists @@ -98,8 +98,8 @@ add avatar by url if data[:source].present? avatar_already_exists = Avatar.find_by( object_lookup_id: object_id, - o_id: data[:o_id], - source: data[:source], + o_id: data[:o_id], + source: data[:source], ) end @@ -142,8 +142,8 @@ add avatar by url url, {}, { - open_timeout: 4, - read_timeout: 6, + open_timeout: 4, + read_timeout: 6, total_timeout: 6, }, ) @@ -198,11 +198,11 @@ add avatar by url object_name = "Avatar::#{data[:object]}" if data[:full].present? store_full = Store.add( - object: "#{object_name}::Full", - o_id: data[:o_id], - data: data[:full][:content], - filename: 'avatar_full', - preferences: { + object: "#{object_name}::Full", + o_id: data[:o_id], + data: data[:full][:content], + filename: 'avatar_full', + preferences: { 'Mime-Type' => data[:full][:mime_type] }, created_by_id: data[:created_by_id], @@ -212,11 +212,11 @@ add avatar by url end if data[:resize].present? store_resize = Store.add( - object: "#{object_name}::Resize", - o_id: data[:o_id], - data: data[:resize][:content], - filename: 'avatar', - preferences: { + object: "#{object_name}::Resize", + o_id: data[:o_id], + data: data[:resize][:content], + filename: 'avatar', + preferences: { 'Mime-Type' => data[:resize][:mime_type] }, created_by_id: data[:created_by_id], @@ -253,8 +253,8 @@ set avatars as default object_id = ObjectLookup.by_name(object_name) avatar = Avatar.find_by( object_lookup_id: object_id, - o_id: o_id, - id: avatar_id, + o_id: o_id, + id: avatar_id, ) avatar.default = true avatar.save! @@ -277,17 +277,17 @@ remove all avatars of an object object_id = ObjectLookup.by_name(object_name) Avatar.where( object_lookup_id: object_id, - o_id: o_id, + o_id: o_id, ).destroy_all object_name_store = "Avatar::#{object_name}" Store.remove( object: "#{object_name_store}::Full", - o_id: o_id, + o_id: o_id, ) Store.remove( object: "#{object_name_store}::Resize", - o_id: o_id, + o_id: o_id, ) end @@ -303,8 +303,8 @@ remove one avatars of an object object_id = ObjectLookup.by_name(object_name) Avatar.where( object_lookup_id: object_id, - o_id: o_id, - id: avatar_id, + o_id: o_id, + id: avatar_id, ).destroy_all end @@ -322,7 +322,7 @@ return all avatars of an user object_id = ObjectLookup.by_name(object_name) avatars = Avatar.where( object_lookup_id: object_id, - o_id: o_id, + o_id: o_id, ).order('initial DESC, deletable ASC, created_at ASC, id DESC') # add initial avatar @@ -379,15 +379,15 @@ returns: object_id = ObjectLookup.by_name(object_name) Avatar.find_by( object_lookup_id: object_id, - o_id: o_id, - default: true, + o_id: o_id, + default: true, ) end def self.set_default_items(object_id, o_id, avatar_id) avatars = Avatar.where( object_lookup_id: object_id, - o_id: o_id, + o_id: o_id, ).order('created_at ASC, id DESC') avatars.each do |avatar| next if avatar.id == avatar_id @@ -401,7 +401,7 @@ returns: count = Avatar.where( object_lookup_id: object_id, - o_id: o_id, + o_id: o_id, ).count return if count.positive? @@ -409,14 +409,14 @@ returns: return if !object_name.constantize.exists?(id: o_id) Avatar.create!( - o_id: o_id, + o_id: o_id, object_lookup_id: object_id, - default: true, - source: 'init', - initial: true, - deletable: false, - updated_by_id: 1, - created_by_id: 1, + default: true, + source: 'init', + initial: true, + deletable: false, + updated_by_id: 1, + created_by_id: 1, ) end end diff --git a/app/models/calendar.rb b/app/models/calendar.rb index 9a660e22d..366fe4cdf 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -187,9 +187,9 @@ returns # create new entry public_holidays[day] = { - active: true, + active: true, summary: summary, - feed: Digest::MD5.hexdigest(ical_url) + feed: Digest::MD5.hexdigest(ical_url) } end self.last_log = nil diff --git a/app/models/channel.rb b/app/models/channel.rb index bb8e6abe9..cd39c781e 100644 --- a/app/models/channel.rb +++ b/app/models/channel.rb @@ -179,7 +179,7 @@ stream all accounts next if @@channel_stream[channel_id].present? @@channel_stream[channel_id] = { - options: channel.options, + options: channel.options, started_at: Time.zone.now, } diff --git a/app/models/channel/driver/imap.rb b/app/models/channel/driver/imap.rb index 065693901..42c7c8e46 100644 --- a/app/models/channel/driver/imap.rb +++ b/app/models/channel/driver/imap.rb @@ -156,7 +156,7 @@ example end disconnect return { - result: 'ok', + result: 'ok', content_messages: content_messages, } end @@ -253,9 +253,9 @@ example end Rails.logger.info 'done' { - result: 'ok', + result: 'ok', fetched: count_fetched, - notice: notice, + notice: notice, } end diff --git a/app/models/channel/driver/pop3.rb b/app/models/channel/driver/pop3.rb index 474cd3a10..346f9d444 100644 --- a/app/models/channel/driver/pop3.rb +++ b/app/models/channel/driver/pop3.rb @@ -101,7 +101,7 @@ returns end disconnect return { - result: 'ok', + result: 'ok', content_messages: content_messages, } end @@ -164,9 +164,9 @@ returns end Rails.logger.info 'done' { - result: 'ok', + result: 'ok', fetched: count_fetched, - notice: notice, + notice: notice, } end diff --git a/app/models/channel/driver/sms/massenversand.rb b/app/models/channel/driver/sms/massenversand.rb index ae954bcb1..3fc7aca3e 100644 --- a/app/models/channel/driver/sms/massenversand.rb +++ b/app/models/channel/driver/sms/massenversand.rb @@ -24,8 +24,8 @@ class Channel::Driver::Sms::Massenversand def self.definition { - name: 'Massenversand', - adapter: 'sms/massenversand', + name: 'Massenversand', + adapter: 'sms/massenversand', notification: [ { name: 'options::gateway', display: 'Gateway', tag: 'input', type: 'text', limit: 200, null: false, placeholder: 'https://gate1.goyyamobile.com/sms/sendsms.asp', default: 'https://gate1.goyyamobile.com/sms/sendsms.asp' }, { name: 'options::token', display: 'Token', tag: 'input', type: 'text', limit: 200, null: false, placeholder: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' }, @@ -39,11 +39,11 @@ class Channel::Driver::Sms::Massenversand def build_url(options, attr) params = { authToken: options[:token], - getID: 1, - msg: attr[:message], - msgtype: 'c', - receiver: attr[:recipient], - sender: options[:sender] + getID: 1, + msg: attr[:message], + msgtype: 'c', + receiver: attr[:recipient], + sender: options[:sender] } options[:gateway] + '?' + URI.encode_www_form(params) diff --git a/app/models/channel/driver/sms/twilio.rb b/app/models/channel/driver/sms/twilio.rb index b302d8875..1288e868c 100644 --- a/app/models/channel/driver/sms/twilio.rb +++ b/app/models/channel/driver/sms/twilio.rb @@ -15,7 +15,7 @@ class Channel::Driver::Sms::Twilio if Setting.get('developer_mode') != true result = api(options).messages.create( from: options[:sender], - to: attr[:recipient], + to: attr[:recipient], body: attr[:message], ) @@ -50,7 +50,7 @@ class Channel::Driver::Sms::Twilio if !user user = User.create!( firstname: attr[:From], - mobile: attr[:From], + mobile: attr[:From], ) end @@ -81,17 +81,17 @@ class Channel::Driver::Sms::Twilio title = "#{title[0, 40]}..." end ticket = Ticket.new( - group_id: channel.group_id, - title: title, - state_id: Ticket::State.find_by(default_create: true).id, + group_id: channel.group_id, + title: title, + state_id: Ticket::State.find_by(default_create: true).id, priority_id: Ticket::Priority.find_by(default_create: true).id, customer_id: user.id, preferences: { channel_id: channel.id, - sms: { + sms: { AccountSid: attr['AccountSid'], - From: attr['From'], - To: attr['To'], + From: attr['From'], + To: attr['To'], } } ) @@ -99,20 +99,20 @@ class Channel::Driver::Sms::Twilio end Ticket::Article.create!( - ticket_id: ticket.id, - type: article_type_sms, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - body: attr[:Body], - from: attr[:From], - to: attr[:To], - message_id: attr[:SmsMessageSid], + ticket_id: ticket.id, + type: article_type_sms, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + body: attr[:Body], + from: attr[:From], + to: attr[:To], + message_id: attr[:SmsMessageSid], content_type: 'text/plain', - preferences: { + preferences: { channel_id: channel.id, - sms: { + sms: { AccountSid: attr['AccountSid'], - From: attr['From'], - To: attr['To'], + From: attr['From'], + To: attr['To'], } } ) @@ -122,9 +122,9 @@ class Channel::Driver::Sms::Twilio def self.definition { - name: 'twilio', - adapter: 'sms/twilio', - account: [ + name: 'twilio', + adapter: 'sms/twilio', + account: [ { name: 'options::webhook_token', display: 'Webhook Token', tag: 'input', type: 'text', limit: 200, null: false, default: Digest::MD5.hexdigest(rand(999_999_999_999).to_s), disabled: true, readonly: true }, { name: 'options::account_id', display: 'Account SID', tag: 'input', type: 'text', limit: 200, null: false, placeholder: 'XXXXXX' }, { name: 'options::token', display: 'Token', tag: 'input', type: 'text', limit: 200, null: false }, diff --git a/app/models/channel/driver/smtp.rb b/app/models/channel/driver/smtp.rb index ffc872c17..0e343c26a 100644 --- a/app/models/channel/driver/smtp.rb +++ b/app/models/channel/driver/smtp.rb @@ -63,10 +63,10 @@ class Channel::Driver::Smtp mail = Channel::EmailBuild.build(attr, notification) smtp_params = { - openssl_verify_mode: options[:openssl_verify_mode], - address: options[:host], - port: options[:port], - domain: options[:domain], + openssl_verify_mode: options[:openssl_verify_mode], + address: options[:host], + port: options[:port], + domain: options[:domain], enable_starttls_auto: options[:enable_starttls_auto], } diff --git a/app/models/channel/email_build.rb b/app/models/channel/email_build.rb index d9d8082fd..ee2083b0f 100644 --- a/app/models/channel/email_build.rb +++ b/app/models/channel/email_build.rb @@ -114,8 +114,8 @@ module Channel::EmailBuild content_type = attachment.preferences['Content-Type'] || attachment.preferences['Mime-Type'] || 'application/octet-stream' mail.attachments[attachment.filename] = { content_disposition: "#{disposition}; filename=\"#{encoded_filename}\"", - content_type: "#{content_type}; filename=\"#{encoded_filename}\"", - content: attachment.content + content_type: "#{content_type}; filename=\"#{encoded_filename}\"", + content: attachment.content } end end diff --git a/app/models/channel/email_parser.rb b/app/models/channel/email_parser.rb index 96951c6d2..ea1f09677 100644 --- a/app/models/channel/email_parser.rb +++ b/app/models/channel/email_parser.rb @@ -3,7 +3,7 @@ # encoding: utf-8 class Channel::EmailParser - EMAIL_REGEX = /.+@.+/ + EMAIL_REGEX = /.+@.+/.freeze RECIPIENT_FIELDS = %w[to cc delivered-to x-original-to envelope-to].freeze SENDER_FIELDS = %w[from reply-to return-path sender].freeze EXCESSIVE_LINKS_MSG = 'This message cannot be displayed because it contains over 5,000 links. Download the raw message below and open it via an Email client if you still wish to view it.'.freeze @@ -234,8 +234,8 @@ returns title = '-' end ticket = Ticket.new( - group_id: group.id, - title: title, + group_id: group.id, + title: title, preferences: preferences, ) set_attributes_by_x_headers(ticket, 'ticket', mail) @@ -255,18 +255,18 @@ returns # set attributes ticket.with_lock do article = Ticket::Article.new( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'email').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.find_by(name: 'email').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, content_type: mail[:content_type], - body: mail[:body], - from: mail[:from], - reply_to: mail[:"reply-to"], - to: mail[:to], - cc: mail[:cc], - subject: mail[:subject], - message_id: mail[:message_id], - internal: false, + body: mail[:body], + from: mail[:from], + reply_to: mail[:"reply-to"], + to: mail[:to], + cc: mail[:cc], + subject: mail[:subject], + message_id: mail[:message_id], + internal: false, ) # x-headers lookup @@ -285,10 +285,10 @@ returns filename = filename.utf8_encode(fallback: :read_as_sanitized_binary) end Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: attachment[:data], - filename: filename, + object: 'Ticket::Article', + o_id: article.id, + data: attachment[:data], + filename: filename, preferences: attachment[:preferences] ) end @@ -699,13 +699,13 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again if filename.blank? map = { 'message/delivery-status': ['txt', 'delivery-status'], - 'text/plain': %w[txt document], - 'text/html': %w[html document], - 'video/quicktime': %w[mov video], - 'image/jpeg': %w[jpg image], - 'image/jpg': %w[jpg image], - 'image/png': %w[png image], - 'image/gif': %w[gif image], + 'text/plain': %w[txt document], + 'text/html': %w[html document], + 'video/quicktime': %w[mov video], + 'image/jpeg': %w[jpg image], + 'image/jpg': %w[jpg image], + 'image/png': %w[png image], + 'image/gif': %w[gif image], } map.each do |type, ext| next if headers_store['Content-Type'] !~ /^#{Regexp.quote(type)}/i @@ -766,8 +766,8 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again filename = Mail::Encodings.value_decode(filename) attach = { - data: file.body.to_s, - filename: filename, + data: file.body.to_s, + filename: filename, preferences: headers_store, } diff --git a/app/models/channel/filter/follow_up_merged.rb b/app/models/channel/filter/follow_up_merged.rb index d12f7f979..105db0529 100644 --- a/app/models/channel/filter/follow_up_merged.rb +++ b/app/models/channel/filter/follow_up_merged.rb @@ -18,7 +18,7 @@ module Channel::Filter::FollowUpMerged return if ticket.state.name != 'merged' links = Link.list( - link_object: 'Ticket', + link_object: 'Ticket', link_object_value: ticket.id ) return if links.blank? diff --git a/app/models/channel/filter/identify_sender.rb b/app/models/channel/filter/identify_sender.rb index 315acaedc..14990f0b4 100644 --- a/app/models/channel/filter/identify_sender.rb +++ b/app/models/channel/filter/identify_sender.rb @@ -38,9 +38,9 @@ module Channel::Filter::IdentifySender next if EmailAddress.find_by(email: item.address.downcase) customer_user = user_create( - login: item.address, + login: item.address, firstname: item.display_name, - email: item.address, + email: item.address, ) break end @@ -54,10 +54,10 @@ module Channel::Filter::IdentifySender # take regular from as customer if !customer_user customer_user = user_create( - login: mail[ 'x-zammad-customer-login'.to_sym ] || mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email], + login: mail[ 'x-zammad-customer-login'.to_sym ] || mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email], firstname: mail[ 'x-zammad-customer-firstname'.to_sym ] || mail[:from_display_name], - lastname: mail[ 'x-zammad-customer-lastname'.to_sym ], - email: mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email], + lastname: mail[ 'x-zammad-customer-lastname'.to_sym ], + email: mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email], ) end @@ -77,10 +77,10 @@ module Channel::Filter::IdentifySender end if !session_user session_user = user_create( - login: mail[:from_email], + login: mail[:from_email], firstname: mail[:from_display_name], - lastname: '', - email: mail[:from_email], + lastname: '', + email: mail[:from_email], ) end if session_user @@ -109,8 +109,8 @@ module Channel::Filter::IdentifySender user_create( firstname: address_data.display_name, - lastname: '', - email: email_address, + lastname: '', + email: email_address, ) current_count += 1 return false if current_count == max_count @@ -137,8 +137,8 @@ module Channel::Filter::IdentifySender user_create( firstname: display_name, - lastname: '', - email: address, + lastname: '', + email: address, ) current_count += 1 return false if current_count == max_count @@ -161,18 +161,18 @@ module Channel::Filter::IdentifySender def self.populate_attributes!(attrs, **extras) if attrs[:email].match?(/\S\s+\S/) || attrs[:email].match?(/^<|>$/) - attrs[:preferences] = { mail_delivery_failed: true, + attrs[:preferences] = { mail_delivery_failed: true, mail_delivery_failed_reason: 'invalid email', - mail_delivery_failed_data: Time.zone.now } + mail_delivery_failed_data: Time.zone.now } end attrs.merge!( - email: sanitize_email(attrs[:email]), - firstname: sanitize_name(attrs[:firstname]), - lastname: sanitize_name(attrs[:lastname]), - password: '', - active: true, - role_ids: extras[:role_ids] || Role.signup_role_ids, + email: sanitize_email(attrs[:email]), + firstname: sanitize_name(attrs[:firstname]), + lastname: sanitize_name(attrs[:lastname]), + password: '', + active: true, + role_ids: extras[:role_ids] || Role.signup_role_ids, updated_by_id: 1, created_by_id: 1 ) diff --git a/app/models/chat.rb b/app/models/chat.rb index 612050856..d407ca804 100644 --- a/app/models/chat.rb +++ b/app/models/chat.rb @@ -21,7 +21,7 @@ class Chat < ApplicationModel url = "#{Setting.get('http_type')}://#{Setting.get('fqdn')}/api/v1/users/image/#{chat_user.image}" end user = { - name: chat_user.fullname, + name: chat_user.fullname, avatar: url, } @@ -29,15 +29,15 @@ class Chat < ApplicationModel session = Chat::Session.messages_by_session_id(session_id) if session return { - state: 'reconnect', + state: 'reconnect', session: session, - agent: user, + agent: user, } end end elsif chat_session.state == 'waiting' return { - state: 'reconnect', + state: 'reconnect', position: chat_session.position, } end @@ -84,16 +84,16 @@ class Chat < ApplicationModel assets = user.assets(assets) end { - waiting_chat_count: waiting_chat_count, + waiting_chat_count: waiting_chat_count, waiting_chat_session_list: waiting_chat_session_list, - running_chat_count: running_chat_count, + running_chat_count: running_chat_count, running_chat_session_list: runningchat_session_list_local, - active_agent_count: active_agent_count, - active_agent_ids: active_agent_ids, - seads_available: seads_available, - seads_total: seads_total, - active: Chat::Agent.state(user_id), - assets: assets, + active_agent_count: active_agent_count, + active_agent_ids: active_agent_ids, + seads_available: seads_available, + seads_total: seads_total, + active: Chat::Agent.state(user_id), + assets: assets, } end @@ -188,7 +188,7 @@ optional you can ignore it for dedecated user data = { event: 'chat_status_agent', - data: Chat.agent_state(item.updated_by_id), + data: Chat.agent_state(item.updated_by_id), } Sessions.send_to(item.updated_by_id, data) end @@ -210,9 +210,9 @@ broadcast new customer queue position to all waiting customers position += 1 data = { event: 'chat_session_queue', - data: { - state: 'queue', - position: position, + data: { + state: 'queue', + position: position, session_id: local_chat_session.session_id, }, } @@ -261,9 +261,9 @@ optional you can put the max oldest chat sessions as argument chat_session.save message = { event: 'chat_session_closed', - data: { + data: { session_id: chat_session.session_id, - realname: 'System', + realname: 'System', }, } chat_session.send_to_recipients(message) diff --git a/app/models/chat/agent.rb b/app/models/chat/agent.rb index 42ef218bf..b543482e3 100644 --- a/app/models/chat/agent.rb +++ b/app/models/chat/agent.rb @@ -23,7 +23,7 @@ class Chat::Agent < ApplicationModel chat_agent.save else Chat::Agent.create( - active: state, + active: state, updated_by_id: user_id, created_by_id: user_id, ) diff --git a/app/models/chat/session/search.rb b/app/models/chat/session/search.rb index 47c7df9d2..545a0c69e 100644 --- a/app/models/chat/session/search.rb +++ b/app/models/chat/session/search.rb @@ -29,7 +29,7 @@ returns if user has no permissions to search return false if Setting.get('chat') != true || !current_user.permissions?('chat.agent') { - prio: 900, + prio: 900, direct_search_index: true, } end diff --git a/app/models/concerns/can_csv_import.rb b/app/models/concerns/can_csv_import.rb index c514506e1..ce924551c 100644 --- a/app/models/concerns/can_csv_import.rb +++ b/app/models/concerns/can_csv_import.rb @@ -62,7 +62,7 @@ returns errors.push "Delete is not possible for #{new.class}." result = { errors: errors, - try: try, + try: try, result: 'failed', } return result @@ -82,7 +82,7 @@ returns errors.push "Unable to parse empty file/string for #{new.class}." result = { errors: errors, - try: try, + try: try, result: 'failed', } return result @@ -94,7 +94,7 @@ returns errors.push "Unable to parse file/string without header for #{new.class}." result = { errors: errors, - try: try, + try: try, result: 'failed', } return result @@ -112,7 +112,7 @@ returns errors.push "No records found in file/string for #{new.class}." result = { errors: errors, - try: try, + try: try, result: 'failed', } return result @@ -123,7 +123,7 @@ returns errors.push "No lookup column like #{lookup_keys.map(&:to_s).join(',')} for #{new.class} found." result = { errors: errors, - try: try, + try: try, result: 'failed', } return result @@ -274,11 +274,11 @@ returns end { - stats: stats, + stats: stats, records: records, - errors: errors, - try: try, - result: result, + errors: errors, + try: try, + result: result, } end diff --git a/app/models/concerns/checks_client_notification.rb b/app/models/concerns/checks_client_notification.rb index 0d44dcb43..dea1cae57 100644 --- a/app/models/concerns/checks_client_notification.rb +++ b/app/models/concerns/checks_client_notification.rb @@ -36,9 +36,9 @@ class OwnModel < ApplicationModel PushMessages.send( message: { event: class_name + ':create', - data: { id: id, updated_at: updated_at } + data: { id: id, updated_at: updated_at } }, - type: 'authenticated', + type: 'authenticated', ) end @@ -69,9 +69,9 @@ class OwnModel < ApplicationModel PushMessages.send( message: { event: class_name + ':update', - data: { id: id, updated_at: updated_at } + data: { id: id, updated_at: updated_at } }, - type: 'authenticated', + type: 'authenticated', ) end @@ -102,9 +102,9 @@ class OwnModel < ApplicationModel PushMessages.send( message: { event: class_name + ':touch', - data: { id: id, updated_at: updated_at } + data: { id: id, updated_at: updated_at } }, - type: 'authenticated', + type: 'authenticated', ) end @@ -134,9 +134,9 @@ class OwnModel < ApplicationModel PushMessages.send( message: { event: class_name + ':destroy', - data: { id: id, updated_at: updated_at } + data: { id: id, updated_at: updated_at } }, - type: 'authenticated', + type: 'authenticated', ) end end diff --git a/app/models/concerns/checks_condition_validation.rb b/app/models/concerns/checks_condition_validation.rb index 4f24d8ee2..2c6570994 100644 --- a/app/models/concerns/checks_condition_validation.rb +++ b/app/models/concerns/checks_condition_validation.rb @@ -23,7 +23,7 @@ module ChecksConditionValidation validate_condition['ticket.id'] = { operator: 'is', - value: 1, + value: 1, } ticket_count, tickets = Ticket.selectors(validate_condition, 1, User.find(1)) diff --git a/app/models/concerns/has_groups.rb b/app/models/concerns/has_groups.rb index 0d8074de3..87b36fc24 100644 --- a/app/models/concerns/has_groups.rb +++ b/app/models/concerns/has_groups.rb @@ -75,8 +75,8 @@ module HasGroups return true if group_through.klass.includes(:group).exists?( group_through.foreign_key => id, group_id: group_id, - access: access, - groups: { + access: access, + groups: { active: true } ) diff --git a/app/models/concerns/has_history.rb b/app/models/concerns/has_history.rb index 543550aab..d96e80740 100644 --- a/app/models/concerns/has_history.rb +++ b/app/models/concerns/has_history.rb @@ -95,10 +95,10 @@ log object update history with all updated attributes, if configured - will be e end data = { history_attribute: attribute_name, - value_from: value_str[0].to_s, - value_to: value_str[1].to_s, - id_from: value_id[0], - id_to: value_id[1], + value_from: value_str[0].to_s, + value_to: value_str[1].to_s, + id_from: value_id[0], + id_to: value_id[1], } #logger.info "HIST NEW #{self.class.to_s}.find(#{self.id}) #{data.inspect}" history_log('updated', updated_by_id, data) @@ -222,7 +222,7 @@ returns end { history: history[:list], - assets: history[:assets], + assets: history[:assets], } end diff --git a/app/models/concerns/has_links.rb b/app/models/concerns/has_links.rb index 088fa104f..6dc158c1f 100644 --- a/app/models/concerns/has_links.rb +++ b/app/models/concerns/has_links.rb @@ -17,7 +17,7 @@ delete object link list, will be executed automatically def links_destroy Link.remove_all( - link_object: self.class.to_s, + link_object: self.class.to_s, link_object_value: id, ) true diff --git a/app/models/concerns/has_roles.rb b/app/models/concerns/has_roles.rb index 652431ac3..e8c114dba 100644 --- a/app/models/concerns/has_roles.rb +++ b/app/models/concerns/has_roles.rb @@ -30,7 +30,7 @@ module HasRoles groups: { active: true }, - roles: { + roles: { active: true } ) diff --git a/app/models/concerns/has_tags.rb b/app/models/concerns/has_tags.rb index 3575d832b..834f9b518 100644 --- a/app/models/concerns/has_tags.rb +++ b/app/models/concerns/has_tags.rb @@ -17,9 +17,9 @@ add an tag to model def tag_add(name, current_user_id = nil) Tag.tag_add( - object: self.class.to_s, - o_id: id, - item: name, + object: self.class.to_s, + o_id: id, + item: name, created_by_id: current_user_id, ) end @@ -35,9 +35,9 @@ remove an tag of model def tag_remove(name, current_user_id = nil) Tag.tag_remove( - object: self.class.to_s, - o_id: id, - item: name, + object: self.class.to_s, + o_id: id, + item: name, created_by_id: current_user_id, ) end @@ -54,7 +54,7 @@ tag list of model def tag_list Tag.tag_list( object: self.class.to_s, - o_id: id, + o_id: id, ) end @@ -69,8 +69,8 @@ destroy all tags of an object def tag_destroy(current_user_id = nil) Tag.tag_destroy( - object: self.class.to_s, - o_id: id, + object: self.class.to_s, + o_id: id, created_by_id: current_user_id, ) true diff --git a/app/models/cti/caller_id.rb b/app/models/cti/caller_id.rb index c4a7f49e2..5dd7cba3b 100644 --- a/app/models/cti/caller_id.rb +++ b/app/models/cti/caller_id.rb @@ -131,11 +131,11 @@ returns existing_record_ids = Cti::CallerId.where(object: model.to_s, o_id: record.id).pluck(:id) caller_ids.uniq.each do |caller_id| existing_record_id = Cti::CallerId.where( - object: model.to_s, - o_id: record.id, + object: model.to_s, + o_id: record.id, caller_id: caller_id, - level: level, - user_id: user_id, + level: level, + user_id: user_id, ).pluck(:id) if existing_record_id[0] existing_record_ids.delete(existing_record_id[0]) @@ -153,10 +153,10 @@ returns caller_ids_to_add.each do |caller_id| Cti::CallerId.maybe_add( caller_id: caller_id, - level: level, - object: model.to_s, - o_id: record.id, - user_id: user_id, + level: level, + object: model.to_s, + o_id: record.id, + user_id: user_id, ) end true diff --git a/app/models/cti/log.rb b/app/models/cti/log.rb index 41e6e7174..a559fcbd8 100644 --- a/app/models/cti/log.rb +++ b/app/models/cti/log.rb @@ -292,7 +292,7 @@ returns .each.with_object({}) { |user, a| user.assets(a) } { - list: list, + list: list, assets: assets, } end @@ -364,18 +364,18 @@ Cti::Log.process( raise "call_id #{call_id} already exists!" if log create( - direction: params['direction'], - from: params['from'], - from_comment: from_comment, - to: params['to'], - to_comment: to_comment, - call_id: call_id, - comment: cause, - queue: queue, - state: event, + direction: params['direction'], + from: params['from'], + from_comment: from_comment, + to: params['to'], + to_comment: to_comment, + call_id: call_id, + comment: cause, + queue: queue, + state: event, initialized_at: Time.zone.now, - preferences: preferences, - done: done, + preferences: preferences, + done: done, ) when 'answer' raise "No such call_id #{call_id}" if !log @@ -431,7 +431,7 @@ Cti::Log.process( user.id, { event: 'cti_event', - data: self, + data: self, }, ) end @@ -483,7 +483,7 @@ optional you can put the max oldest chat entries as argument def attributes virtual_attributes = { 'from_pretty' => from_pretty, - 'to_pretty' => to_pretty, + 'to_pretty' => to_pretty, } super.merge(virtual_attributes) diff --git a/app/models/history.rb b/app/models/history.rb index 9b82e54e4..5232aa683 100644 --- a/app/models/history.rb +++ b/app/models/history.rb @@ -59,19 +59,19 @@ add a new history entry for an object # create history record = { - id: data[:id], - o_id: data[:o_id], - history_type_id: history_type.id, - history_object_id: history_object.id, - history_attribute_id: history_attribute_id, + id: data[:id], + o_id: data[:o_id], + history_type_id: history_type.id, + history_object_id: history_object.id, + history_attribute_id: history_attribute_id, related_history_object_id: related_history_object_id, - related_o_id: data[:related_o_id], - value_from: data[:value_from], - value_to: data[:value_to], - id_from: data[:id_from], - id_to: data[:id_to], - created_at: data[:created_at], - created_by_id: data[:created_by_id] + related_o_id: data[:related_o_id], + value_from: data[:value_from], + value_to: data[:value_to], + id_from: data[:id_from], + id_to: data[:id_to], + created_at: data[:created_at], + created_by_id: data[:created_by_id] } history_record = nil if data[:id] @@ -102,7 +102,7 @@ remove whole history entries of an object History.where( history_object_id: history_object.id, - o_id: requested_object_id, + o_id: requested_object_id, ).destroy_all end @@ -206,7 +206,7 @@ returns end if assets return { - list: list, + list: list, assets: asset_list, } end diff --git a/app/models/karma/activity_log.rb b/app/models/karma/activity_log.rb index ac3b5b9c9..30e016b9b 100644 --- a/app/models/karma/activity_log.rb +++ b/app/models/karma/activity_log.rb @@ -23,10 +23,10 @@ add karma activity log of an object Karma::ActivityLog.transaction do last_activity = Karma::ActivityLog.where(user_id: user.id).order(created_at: :desc, id: :desc).lock(true).first latest_activity = Karma::ActivityLog.where( - user_id: user.id, + user_id: user.id, object_lookup_id: object_id, - o_id: o_id, - activity_id: activity.id, + o_id: o_id, + activity_id: activity.id, ).find_by('created_at >= ?', Time.zone.now - activity.once_ttl.seconds) return false if !force && latest_activity @@ -42,11 +42,11 @@ add karma activity log of an object Karma::ActivityLog.create( object_lookup_id: object_id, - o_id: o_id, - user_id: user.id, - activity_id: activity.id, - score: activity.score, - score_total: local_score_total, + o_id: o_id, + user_id: user.id, + activity_id: activity.id, + score: activity.score, + score_total: local_score_total, ) end @@ -68,7 +68,7 @@ remove whole karma activity log of an object object_id = ObjectLookup.by_name(object_name) Karma::ActivityLog.where( object_lookup_id: object_id, - o_id: o_id, + o_id: o_id, ).destroy_all end @@ -80,22 +80,22 @@ remove whole karma activity log of an object if last && last[:object_id] == log.object_id && last[:o_id] == log.o_id && last[:created_at] == log.created_at comment = { description: Karma::Activity.lookup(id: log.activity_id).description, - score: log.score, + score: log.score, } last[:comments].push comment last[:score_total] = score_total next end comment = { - object_id: log.object_id, - o_id: log.o_id, + object_id: log.object_id, + o_id: log.o_id, description: Karma::Activity.lookup(id: log.activity_id).description, - score: log.score, + score: log.score, } data = { - comments: [comment], + comments: [comment], score_total: log.score_total, - created_at: log.created_at, + created_at: log.created_at, } result.push data end diff --git a/app/models/karma/user.rb b/app/models/karma/user.rb index ca5e1dd9b..68300cc2d 100644 --- a/app/models/karma/user.rb +++ b/app/models/karma/user.rb @@ -17,8 +17,8 @@ class Karma::User < ApplicationModel end Karma::User.create!( user_id: user.id, - level: level, - score: score, + level: level, + score: score, ) end diff --git a/app/models/link.rb b/app/models/link.rb index e96730d60..ef4f55544 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -89,7 +89,7 @@ class Link < ApplicationModel data[:link_object_source_id] = linkobject.id touch_reference_by_params( object: data[:link_object_source], - o_id: data[:link_object_source_value], + o_id: data[:link_object_source_value], ) data.delete(:link_object_source) end @@ -99,7 +99,7 @@ class Link < ApplicationModel data[:link_object_target_id] = linkobject.id touch_reference_by_params( object: data[:link_object_target], - o_id: data[:link_object_target_value], + o_id: data[:link_object_target_value], ) data.delete(:link_object_target) end @@ -136,10 +136,10 @@ class Link < ApplicationModel data[:link_type_id] = linktype.id end Link.where( - link_type_id: data[:link_type_id], - link_object_source_id: data[:link_object_source_id], + link_type_id: data[:link_type_id], + link_object_source_id: data[:link_object_source_id], link_object_source_value: data[:link_object_source_value], - link_object_target_id: data[:link_object_target_id], + link_object_target_id: data[:link_object_target_id], link_object_target_value: data[:link_object_target_value] ).destroy_all @@ -150,10 +150,10 @@ class Link < ApplicationModel end Link.where( - link_type_id: data[:link_type_id], - link_object_target_id: data[:link_object_source_id], + link_type_id: data[:link_type_id], + link_object_target_id: data[:link_object_source_id], link_object_target_value: data[:link_object_source_value], - link_object_source_id: data[:link_object_target_id], + link_object_source_id: data[:link_object_target_id], link_object_source_value: data[:link_object_target_value] ).destroy_all end @@ -174,11 +174,11 @@ class Link < ApplicationModel end Link.where( - link_object_target_id: data[:link_object_id], + link_object_target_id: data[:link_object_id], link_object_target_value: data[:link_object_value], ).destroy_all Link.where( - link_object_source_id: data[:link_object_id], + link_object_source_id: data[:link_object_id], link_object_source_value: data[:link_object_value], ).destroy_all @@ -188,11 +188,11 @@ class Link < ApplicationModel def touch_link_references Link.touch_reference_by_params( object: Link::Object.lookup(id: link_object_source_id).name, - o_id: link_object_source_value, + o_id: link_object_source_value, ) Link.touch_reference_by_params( object: Link::Object.lookup(id: link_object_target_id).name, - o_id: link_object_target_value, + o_id: link_object_target_value, ) end diff --git a/app/models/locale.rb b/app/models/locale.rb index 8ae95f0d9..68dec71be 100644 --- a/app/models/locale.rb +++ b/app/models/locale.rb @@ -100,7 +100,7 @@ all: version: version, }, { - json: true, + json: true, open_timeout: 8, read_timeout: 24, } diff --git a/app/models/object_manager/attribute.rb b/app/models/object_manager/attribute.rb index 6b86dae8d..e44eaba2b 100644 --- a/app/models/object_manager/attribute.rb +++ b/app/models/object_manager/attribute.rb @@ -302,7 +302,7 @@ possible types # check new entry - is needed record = ObjectManager::Attribute.find_by( object_lookup_id: data[:object_lookup_id], - name: data[:name], + name: data[:name], ) if record @@ -400,7 +400,7 @@ use "force: true" to delete also not editable fields # check newest entry - is needed record = ObjectManager::Attribute.find_by( object_lookup_id: data[:object_lookup_id], - name: data[:name], + name: data[:name], ) if !record raise "ERROR: No such field #{data[:object]}.#{data[:name]}" @@ -448,7 +448,7 @@ get the attribute model based on object and name ObjectManager::Attribute.find_by( object_lookup_id: data[:object_lookup_id], - name: data[:name], + name: data[:name], ) end @@ -478,16 +478,16 @@ returns: # get attributes in right order result = ObjectManager::Attribute.where( object_lookup_id: object_lookup_id, - active: true, - to_create: false, - to_delete: false, + active: true, + to_create: false, + to_delete: false, ).order('position ASC, name ASC') attributes = [] result.each do |item| data = { - name: item.name, + name: item.name, display: item.display, - tag: item.data_type, + tag: item.data_type, #:null => item.null, } if item.data_option[:permission]&.any? @@ -683,7 +683,7 @@ to send no browser reload event, pass false attribute.name, data_type, limit: attribute.data_option[:maxlength], - null: true + null: true ) elsif attribute.data_type.match?(/^integer|user_autocompletion|datetime|date$/) ActiveRecord::Migration.change_column( @@ -691,7 +691,7 @@ to send no browser reload event, pass false attribute.name, data_type, default: attribute.data_option[:default], - null: true + null: true ) elsif attribute.data_type.match?(/^boolean|active$/) ActiveRecord::Migration.change_column( @@ -699,7 +699,7 @@ to send no browser reload event, pass false attribute.name, data_type, default: attribute.data_option[:default], - null: true + null: true ) else raise "Unknown attribute.data_type '#{attribute.data_type}', can't update attribute" @@ -722,7 +722,7 @@ to send no browser reload event, pass false attribute.name, data_type, limit: attribute.data_option[:maxlength], - null: true + null: true ) elsif attribute.data_type.match?(/^integer|user_autocompletion$/) ActiveRecord::Migration.add_column( @@ -730,7 +730,7 @@ to send no browser reload event, pass false attribute.name, data_type, default: attribute.data_option[:default], - null: true + null: true ) elsif attribute.data_type.match?(/^boolean|active$/) ActiveRecord::Migration.add_column( @@ -738,7 +738,7 @@ to send no browser reload event, pass false attribute.name, data_type, default: attribute.data_option[:default], - null: true + null: true ) elsif attribute.data_type.match?(/^datetime|date$/) ActiveRecord::Migration.add_column( @@ -746,7 +746,7 @@ to send no browser reload event, pass false attribute.name, data_type, default: attribute.data_option[:default], - null: true + null: true ) else raise "Unknown attribute.data_type '#{attribute.data_type}', can't create attribute" diff --git a/app/models/observer/chat/leave/background_job.rb b/app/models/observer/chat/leave/background_job.rb index 666bb8ddd..1128f201b 100644 --- a/app/models/observer/chat/leave/background_job.rb +++ b/app/models/observer/chat/leave/background_job.rb @@ -23,8 +23,8 @@ class Observer::Chat::Leave::BackgroundJob # notify participants message = { event: 'chat_session_left', - data: { - realname: realname, + data: { + realname: realname, session_id: chat_session.session_id, }, } diff --git a/app/models/observer/tag/ticket_history.rb b/app/models/observer/tag/ticket_history.rb index 0336a5d3f..e9d28335a 100644 --- a/app/models/observer/tag/ticket_history.rb +++ b/app/models/observer/tag/ticket_history.rb @@ -9,12 +9,12 @@ class Observer::Tag::TicketHistory < ActiveRecord::Observer # add ticket history History.add( - o_id: record.o_id, - history_type: 'added', - history_object: 'Ticket', + o_id: record.o_id, + history_type: 'added', + history_object: 'Ticket', history_attribute: 'tag', - value_to: record.tag_item.name, - created_by_id: record.created_by_id, + value_to: record.tag_item.name, + created_by_id: record.created_by_id, ) end @@ -25,12 +25,12 @@ class Observer::Tag::TicketHistory < ActiveRecord::Observer # add ticket history History.add( - o_id: record.o_id, - history_type: 'removed', - history_object: 'Ticket', + o_id: record.o_id, + history_type: 'removed', + history_object: 'Ticket', history_attribute: 'tag', - value_to: record.tag_item.name, - created_by_id: record.created_by_id, + value_to: record.tag_item.name, + created_by_id: record.created_by_id, ) end end diff --git a/app/models/observer/ticket/article/communicate_email/background_job.rb b/app/models/observer/ticket/article/communicate_email/background_job.rb index 5835838cb..9bb5cd94d 100644 --- a/app/models/observer/ticket/article/communicate_email/background_job.rb +++ b/app/models/observer/ticket/article/communicate_email/background_job.rb @@ -53,16 +53,16 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob begin message = channel.deliver( { - message_id: record.message_id, - in_reply_to: record.in_reply_to, - references: ticket.get_references([record.message_id]), - from: record.from, - to: record.to, - cc: record.cc, - subject: subject, + message_id: record.message_id, + in_reply_to: record.in_reply_to, + references: ticket.get_references([record.message_id]), + from: record.from, + to: record.to, + cc: record.cc, + subject: subject, content_type: record.content_type, - body: record.body, - attachments: record.attachments + body: record.body, + attachments: record.attachments }, notification ) @@ -103,14 +103,14 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob return if recipient_list == '' History.add( - o_id: record.id, - history_type: 'email', - history_object: 'Ticket::Article', - related_o_id: ticket.id, + o_id: record.id, + history_type: 'email', + history_object: 'Ticket::Article', + related_o_id: ticket.id, related_history_object: 'Ticket', - value_from: record.subject, - value_to: recipient_list, - created_by_id: record.created_by_id, + value_from: record.subject, + value_to: recipient_list, + created_by_id: record.created_by_id, ) end @@ -142,16 +142,16 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob Observer::Transaction.reset UserInfo.current_user_id = 1 Ticket::Article.create!( - ticket_id: local_record.ticket_id, + ticket_id: local_record.ticket_id, content_type: 'text/plain', - body: "Unable to send email to '#{recipient_list}': #{message}", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'System'), - type: Ticket::Article::Type.find_by(name: 'note'), - preferences: { + body: "Unable to send email to '#{recipient_list}': #{message}", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'System'), + type: Ticket::Article::Type.find_by(name: 'note'), + preferences: { delivery_article_id_related: local_record.id, - delivery_message: true, - notification: true, + delivery_message: true, + notification: true, }, ) ticket = Ticket.find(local_record.ticket_id) diff --git a/app/models/observer/ticket/article/communicate_facebook/background_job.rb b/app/models/observer/ticket/article/communicate_facebook/background_job.rb index 598ca7348..7517cfe4e 100644 --- a/app/models/observer/ticket/article/communicate_facebook/background_job.rb +++ b/app/models/observer/ticket/article/communicate_facebook/background_job.rb @@ -73,15 +73,15 @@ class Observer::Ticket::Article::CommunicateFacebook::BackgroundJob if local_record.preferences['delivery_retry'] > 3 Ticket::Article.create( - ticket_id: local_record.ticket_id, - content_type: 'text/plain', - body: "Unable to send post: #{message}", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'System'), - type: Ticket::Article::Type.find_by(name: 'note'), - preferences: { + ticket_id: local_record.ticket_id, + content_type: 'text/plain', + body: "Unable to send post: #{message}", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'System'), + type: Ticket::Article::Type.find_by(name: 'note'), + preferences: { delivery_article_id_related: local_record.id, - delivery_message: true, + delivery_message: true, }, updated_by_id: 1, created_by_id: 1, diff --git a/app/models/observer/ticket/article/communicate_sms/background_job.rb b/app/models/observer/ticket/article/communicate_sms/background_job.rb index c6ca40471..2ace7cebb 100644 --- a/app/models/observer/ticket/article/communicate_sms/background_job.rb +++ b/app/models/observer/ticket/article/communicate_sms/background_job.rb @@ -32,13 +32,13 @@ class Observer::Ticket::Article::CommunicateSms::BackgroundJob article.preferences['sms_recipients'].each do |recipient| channel.deliver( recipient: recipient, - message: article.body.first(160), + message: article.body.first(160), ) end else channel.deliver( recipient: article.to, - message: article.body.first(160), + message: article.body.first(160), ) end rescue => e @@ -70,15 +70,15 @@ class Observer::Ticket::Article::CommunicateSms::BackgroundJob if local_record.preferences['delivery_retry'] >= max_attempts Ticket::Article.create( - ticket_id: local_record.ticket_id, - content_type: 'text/plain', - body: "#{log_error_prefix}: #{message}", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'System'), - type: Ticket::Article::Type.find_by(name: 'note'), - preferences: { + ticket_id: local_record.ticket_id, + content_type: 'text/plain', + body: "#{log_error_prefix}: #{message}", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'System'), + type: Ticket::Article::Type.find_by(name: 'note'), + preferences: { delivery_article_id_related: local_record.id, - delivery_message: true, + delivery_message: true, }, updated_by_id: 1, created_by_id: 1, @@ -92,14 +92,14 @@ class Observer::Ticket::Article::CommunicateSms::BackgroundJob return if recipient_list.blank? History.add( - o_id: article.id, - history_type: history_type, - history_object: 'Ticket::Article', - related_o_id: ticket.id, + o_id: article.id, + history_type: history_type, + history_object: 'Ticket::Article', + related_o_id: ticket.id, related_history_object: 'Ticket', - value_from: article.subject, - value_to: recipient_list, - created_by_id: article.created_by_id, + value_from: article.subject, + value_to: recipient_list, + created_by_id: article.created_by_id, ) end diff --git a/app/models/observer/ticket/article/communicate_telegram/background_job.rb b/app/models/observer/ticket/article/communicate_telegram/background_job.rb index 4d0d9e5a4..7d0657e46 100644 --- a/app/models/observer/ticket/article/communicate_telegram/background_job.rb +++ b/app/models/observer/ticket/article/communicate_telegram/background_job.rb @@ -51,9 +51,9 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob article.to = "@#{result['chat']['username']}" article.preferences['telegram'] = { - date: result['date'], - from_id: result['from']['id'], - chat_id: result['chat']['id'], + date: result['date'], + from_id: result['from']['id'], + chat_id: result['chat']['id'], message_id: result['message_id'] } else @@ -62,9 +62,9 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob article.to = "#{result['chat']['title']} Channel" article.preferences['telegram'] = { - date: result['date'], - from_id: me['id'], - chat_id: result['chat']['id'], + date: result['date'], + from_id: me['id'], + chat_id: result['chat']['id'], message_id: result['message_id'] } end @@ -92,15 +92,15 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob if local_record.preferences['delivery_retry'] > 3 Ticket::Article.create( - ticket_id: local_record.ticket_id, - content_type: 'text/plain', - body: "Unable to send telegram message: #{message}", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'System'), - type: Ticket::Article::Type.find_by(name: 'note'), - preferences: { + ticket_id: local_record.ticket_id, + content_type: 'text/plain', + body: "Unable to send telegram message: #{message}", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'System'), + type: Ticket::Article::Type.find_by(name: 'note'), + preferences: { delivery_article_id_related: local_record.id, - delivery_message: true, + delivery_message: true, }, updated_by_id: 1, created_by_id: 1, diff --git a/app/models/observer/ticket/article/communicate_twitter/background_job.rb b/app/models/observer/ticket/article/communicate_twitter/background_job.rb index 563e83f96..ec2ba06ee 100644 --- a/app/models/observer/ticket/article/communicate_twitter/background_job.rb +++ b/app/models/observer/ticket/article/communicate_twitter/background_job.rb @@ -61,7 +61,7 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob article.preferences['twitter'] = { recipient_id: tweet[:event][:message_create][:target][:recipient_id], - sender_id: tweet[:event][:message_create][:sender_id], + sender_id: tweet[:event][:message_create][:sender_id], } end @@ -82,17 +82,17 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob end article.to = to article.preferences['twitter'] = TwitterSync.preferences_cleanup( - mention_ids: mention_ids, - geo: tweet.geo, - retweeted: tweet.retweeted?, - possibly_sensitive: tweet.possibly_sensitive?, + mention_ids: mention_ids, + geo: tweet.geo, + retweeted: tweet.retweeted?, + possibly_sensitive: tweet.possibly_sensitive?, in_reply_to_user_id: tweet.in_reply_to_user_id, - place: tweet.place, - retweet_count: tweet.retweet_count, - source: tweet.source, - favorited: tweet.favorited?, - truncated: tweet.truncated?, - created_at: tweet.created_at, + place: tweet.place, + retweet_count: tweet.retweet_count, + source: tweet.source, + favorited: tweet.favorited?, + truncated: tweet.truncated?, + created_at: tweet.created_at, ) end else @@ -107,9 +107,9 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob article.message_id = tweet_id article.preferences['links'] = [ { - url: "https://twitter.com/statuses/#{tweet_id}", + url: "https://twitter.com/statuses/#{tweet_id}", target: '_blank', - name: 'on Twitter', + name: 'on Twitter', }, ] @@ -129,15 +129,15 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob if local_record.preferences['delivery_retry'] > 3 Ticket::Article.create( - ticket_id: local_record.ticket_id, - content_type: 'text/plain', - body: "Unable to send tweet: #{message}", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'System'), - type: Ticket::Article::Type.find_by(name: 'note'), - preferences: { + ticket_id: local_record.ticket_id, + content_type: 'text/plain', + body: "Unable to send tweet: #{message}", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'System'), + type: Ticket::Article::Type.find_by(name: 'note'), + preferences: { delivery_article_id_related: local_record.id, - delivery_message: true, + delivery_message: true, }, updated_by_id: 1, created_by_id: 1, diff --git a/app/models/observer/ticket/user_ticket_counter/background_job.rb b/app/models/observer/ticket/user_ticket_counter/background_job.rb index b24f88398..22a2edcab 100644 --- a/app/models/observer/ticket/user_ticket_counter/background_job.rb +++ b/app/models/observer/ticket/user_ticket_counter/background_job.rb @@ -13,14 +13,14 @@ class Observer::Ticket::UserTicketCounter::BackgroundJob state_open = Ticket::State.by_category(:open) tickets_open = Ticket.where( customer_id: @customer_id, - state_id: state_open, + state_id: state_open, ).count() # closed ticket count state_closed = Ticket::State.by_category(:closed) tickets_closed = Ticket.where( customer_id: @customer_id, - state_id: state_closed, + state_id: state_closed, ).count() end diff --git a/app/models/observer/transaction.rb b/app/models/observer/transaction.rb index 217aab610..da35c64cb 100644 --- a/app/models/observer/transaction.rb +++ b/app/models/observer/transaction.rb @@ -182,11 +182,11 @@ class Observer::Transaction < ActiveRecord::Observer return true if Setting.get('import_mode') e = { - object: record.class.name, - type: 'create', - data: record, - id: record.id, - user_id: record.created_by_id, + object: record.class.name, + type: 'create', + data: record, + id: record.id, + user_id: record.created_by_id, created_at: Time.zone.now, } EventBuffer.add('transaction', e) @@ -225,12 +225,12 @@ class Observer::Transaction < ActiveRecord::Observer end e = { - object: record.class.name, - type: 'update', - data: record, - changes: real_changes, - id: record.id, - user_id: changed_by_id, + object: record.class.name, + type: 'update', + data: record, + changes: real_changes, + id: record.id, + user_id: changed_by_id, created_at: Time.zone.now, } EventBuffer.add('transaction', e) diff --git a/app/models/online_notification.rb b/app/models/online_notification.rb index e0cd562aa..78825fa19 100644 --- a/app/models/online_notification.rb +++ b/app/models/online_notification.rb @@ -45,15 +45,15 @@ add a new online notification for this user exists_by_object_and_id?(data[:object], data[:o_id]) record = { - o_id: data[:o_id], + o_id: data[:o_id], object_lookup_id: object_id, - type_lookup_id: type_id, - seen: data[:seen], - user_id: data[:user_id], - created_by_id: data[:created_by_id], - updated_by_id: data[:updated_by_id] || data[:created_by_id], - created_at: data[:created_at] || Time.zone.now, - updated_at: data[:updated_at] || Time.zone.now, + type_lookup_id: type_id, + seen: data[:seen], + user_id: data[:user_id], + created_by_id: data[:created_by_id], + updated_by_id: data[:updated_by_id] || data[:created_by_id], + created_at: data[:created_at] || Time.zone.now, + updated_at: data[:updated_at] || Time.zone.now, } OnlineNotification.create!(record) @@ -87,7 +87,7 @@ remove whole online notifications of an object object_id = ObjectLookup.by_name(object_name) OnlineNotification.where( object_lookup_id: object_id, - o_id: o_id, + o_id: o_id, ).destroy_all end @@ -104,9 +104,9 @@ remove whole online notifications of an object by type type_id = TypeLookup.by_name(type_name) OnlineNotification.where( object_lookup_id: object_id, - type_lookup_id: type_id, - o_id: o_id, - user_id: user.id, + type_lookup_id: type_id, + o_id: o_id, + user_id: user.id, ).destroy_all end @@ -136,7 +136,7 @@ return all online notifications of an object object_id = ObjectLookup.by_name(object_name) notifications = OnlineNotification.where( object_lookup_id: object_id, - o_id: o_id, + o_id: o_id, ) .order('created_at DESC, id DESC') .limit(10_000) @@ -155,8 +155,8 @@ mark online notification as seen by object object_id = ObjectLookup.by_name(object_name) notifications = OnlineNotification.where( object_lookup_id: object_id, - o_id: o_id, - seen: false, + o_id: o_id, + seen: false, ) notifications.each do |notification| notification.seen = true @@ -170,7 +170,7 @@ mark online notification as seen by object user_id, { event: 'OnlineNotification::changed', - data: {} + data: {} } ) end @@ -260,7 +260,7 @@ with dedicated times user.id, { event: 'OnlineNotification::changed', - data: {} + data: {} } ) sleep 2 # slow down client requests diff --git a/app/models/organization/search.rb b/app/models/organization/search.rb index f236fe12a..b915cb98a 100644 --- a/app/models/organization/search.rb +++ b/app/models/organization/search.rb @@ -34,7 +34,7 @@ returns if user has no permissions to search return false if !current_user.permissions?('ticket.agent') && !current_user.permissions?('admin.organization') { - prio: 1000, + prio: 1000, direct_search_index: true, } end @@ -83,9 +83,9 @@ returns # try search index backend if SearchIndexBackend.enabled? - items = SearchIndexBackend.search(query, 'Organization', limit: limit, - from: offset, - sort_by: sort_by, + items = SearchIndexBackend.search(query, 'Organization', limit: limit, + from: offset, + sort_by: sort_by, order_by: order_by) organizations = [] items.each do |item| diff --git a/app/models/package.rb b/app/models/package.rb index 6735cdab3..04584748b 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -234,10 +234,10 @@ returns # package meta data meta = { - name: package['name'], - version: package['version'], - vendor: package['vendor'], - state: 'uninstalled', + name: package['name'], + version: package['version'], + vendor: package['vendor'], + state: 'uninstalled', created_by_id: 1, updated_by_id: 1, } @@ -256,10 +256,10 @@ returns # uninstall files of old package uninstall( - name: package_db.name, - version: package_db.version, + name: package_db.name, + version: package_db.version, migration_not_down: true, - reinstall: data[:reinstall], + reinstall: data[:reinstall], ) end @@ -267,11 +267,11 @@ returns if !data[:reinstall] package_db = Package.create(meta) Store.add( - object: 'Package', - o_id: package_db.id, - data: package.to_json, - filename: "#{meta[:name]}-#{meta[:version]}.zpm", - preferences: {}, + object: 'Package', + o_id: package_db.id, + data: package.to_json, + filename: "#{meta[:name]}-#{meta[:version]}.zpm", + preferences: {}, created_by_id: UserInfo.current_user_id || 1, ) end @@ -357,7 +357,7 @@ returns # delete package if !data[:reinstall] record = Package.find_by( - name: package['name'], + name: package['name'], version: package['version'], ) record.destroy @@ -384,7 +384,7 @@ execute all pending package migrations at once def self._get_bin(name, version) package = Package.find_by( - name: name, + name: name, version: version, ) if !package @@ -393,7 +393,7 @@ execute all pending package migrations at once list = Store.list( object: 'Package', - o_id: package.id, + o_id: package.id, ) # find file diff --git a/app/models/recent_view.rb b/app/models/recent_view.rb index 019ea85ae..611cac70f 100644 --- a/app/models/recent_view.rb +++ b/app/models/recent_view.rb @@ -17,9 +17,9 @@ class RecentView < ApplicationModel exists_by_object_and_id?(object, o_id) - RecentView.create!(o_id: o_id, + RecentView.create!(o_id: o_id, recent_view_object_id: ObjectLookup.by_name(object), - created_by_id: user.id) + created_by_id: user.id) end def self.log_destroy(requested_object, requested_object_id) @@ -70,7 +70,7 @@ class RecentView < ApplicationModel created_by_id, { event: 'RecentView::changed', - data: {} + data: {} } ) end diff --git a/app/models/report.rb b/app/models/report.rb index 8546a649d..5080b17b1 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -9,210 +9,210 @@ class Report config[:metric] = {} config[:metric][:count] = { - name: 'count', + name: 'count', display: 'Ticket Count', default: true, - prio: 10_000, + prio: 10_000, } backend = [ { - name: 'created', - display: 'Created', - selected: true, + name: 'created', + display: 'Created', + selected: true, dataDownload: true, - adapter: Report::TicketGenericTime, - params: { field: 'created_at' } + adapter: Report::TicketGenericTime, + params: { field: 'created_at' } }, { - name: 'closed', - display: 'Closed', - selected: true, + name: 'closed', + display: 'Closed', + selected: true, dataDownload: true, - adapter: Report::TicketGenericTime, - params: { field: 'close_at' } + adapter: Report::TicketGenericTime, + params: { field: 'close_at' } }, { - name: 'backlog', - display: 'Backlog', - selected: true, + name: 'backlog', + display: 'Backlog', + selected: true, dataDownload: false, - adapter: Report::TicketBacklog + adapter: Report::TicketBacklog }, { - name: 'first_solution', - display: 'First Solution', - selected: false, + name: 'first_solution', + display: 'First Solution', + selected: false, dataDownload: true, - adapter: Report::TicketFirstSolution + adapter: Report::TicketFirstSolution }, { - name: 'reopened', - display: 'Reopened', - selected: false, + name: 'reopened', + display: 'Reopened', + selected: false, dataDownload: true, - adapter: Report::TicketReopened + adapter: Report::TicketReopened }, { - name: 'movedin', - display: 'Moved in', - selected: false, + name: 'movedin', + display: 'Moved in', + selected: false, dataDownload: true, - adapter: Report::TicketMoved, - params: { type: 'in' } + adapter: Report::TicketMoved, + params: { type: 'in' } }, { - name: 'movedout', - display: 'Moved out', - selected: false, + name: 'movedout', + display: 'Moved out', + selected: false, dataDownload: true, - adapter: Report::TicketMoved, - params: { type: 'out' } + adapter: Report::TicketMoved, + params: { type: 'out' } }, ] config[:metric][:count][:backend] = backend config[:metric][:create_channels] = { - name: 'create_channels', + name: 'create_channels', display: 'Create Channels', - prio: 9000, + prio: 9000, } backend = [ { - name: 'phone_in', - display: 'Phone (in)', - selected: true, + name: 'phone_in', + display: 'Phone (in)', + selected: true, dataDownload: true, - adapter: Report::TicketGenericTime, - params: { - field: 'created_at', + adapter: Report::TicketGenericTime, + params: { + field: 'created_at', selector: { - 'create_article_type_id' => { + 'create_article_type_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Type.lookup(name: 'phone').id, + 'value' => Ticket::Article::Type.lookup(name: 'phone').id, }, 'create_article_sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, }, }, }, { - name: 'phone_out', - display: 'Phone (out)', - selected: true, + name: 'phone_out', + display: 'Phone (out)', + selected: true, dataDownload: true, - adapter: Report::TicketGenericTime, - params: { - field: 'created_at', + adapter: Report::TicketGenericTime, + params: { + field: 'created_at', selector: { - 'create_article_type_id' => { + 'create_article_type_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Type.lookup(name: 'phone').id, + 'value' => Ticket::Article::Type.lookup(name: 'phone').id, }, 'create_article_sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, }, } }, }, { - name: 'email_in', - display: 'Email (in)', - selected: true, + name: 'email_in', + display: 'Email (in)', + selected: true, dataDownload: true, - adapter: Report::TicketGenericTime, - params: { - field: 'created_at', + adapter: Report::TicketGenericTime, + params: { + field: 'created_at', selector: { - 'create_article_type_id' => { + 'create_article_type_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Type.lookup(name: 'email').id, + 'value' => Ticket::Article::Type.lookup(name: 'email').id, }, 'create_article_sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, }, }, }, { - name: 'email_out', - display: 'Email (out)', - selected: true, + name: 'email_out', + display: 'Email (out)', + selected: true, dataDownload: true, - adapter: Report::TicketGenericTime, - params: { - field: 'created_at', + adapter: Report::TicketGenericTime, + params: { + field: 'created_at', selector: { - 'create_article_type_id' => { + 'create_article_type_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Type.lookup(name: 'email').id, + 'value' => Ticket::Article::Type.lookup(name: 'email').id, }, 'create_article_sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, }, }, }, }, { - name: 'web_in', - display: 'Web (in)', - selected: true, + name: 'web_in', + display: 'Web (in)', + selected: true, dataDownload: true, - adapter: Report::TicketGenericTime, - params: { - field: 'created_at', + adapter: Report::TicketGenericTime, + params: { + field: 'created_at', selector: { - 'create_article_type_id' => { + 'create_article_type_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Type.lookup(name: 'web').id, + 'value' => Ticket::Article::Type.lookup(name: 'web').id, }, 'create_article_sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, }, }, }, { - name: 'twitter_in', - display: 'Twitter (in)', - selected: true, + name: 'twitter_in', + display: 'Twitter (in)', + selected: true, dataDownload: true, - adapter: Report::TicketGenericTime, - params: { - field: 'created_at', + adapter: Report::TicketGenericTime, + params: { + field: 'created_at', selector: { - 'create_article_type_id' => { + 'create_article_type_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Type.lookup(name: 'twitter status').id, + 'value' => Ticket::Article::Type.lookup(name: 'twitter status').id, }, 'create_article_sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, }, }, }, { - name: 'twitter_out', - display: 'Twitter (out)', - selected: true, + name: 'twitter_out', + display: 'Twitter (out)', + selected: true, dataDownload: true, - adapter: Report::TicketGenericTime, - params: { - field: 'created_at', + adapter: Report::TicketGenericTime, + params: { + field: 'created_at', selector: { - 'create_article_type_id' => { + 'create_article_type_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Type.lookup(name: 'twitter status').id, + 'value' => Ticket::Article::Type.lookup(name: 'twitter status').id, }, 'create_article_sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, }, }, }, @@ -221,85 +221,85 @@ class Report config[:metric][:create_channels][:backend] = backend config[:metric][:communication] = { - name: 'communication', + name: 'communication', display: 'Communication', - prio: 7000, + prio: 7000, } backend = [ { - name: 'phone_in', - display: 'Phone (in)', - selected: true, + name: 'phone_in', + display: 'Phone (in)', + selected: true, dataDownload: false, - adapter: Report::ArticleByTypeSender, - params: { - type: 'phone', + adapter: Report::ArticleByTypeSender, + params: { + type: 'phone', sender: 'Customer', }, }, { - name: 'phone_out', - display: 'Phone (out)', - selected: true, + name: 'phone_out', + display: 'Phone (out)', + selected: true, dataDownload: false, - adapter: Report::ArticleByTypeSender, - params: { - type: 'phone', + adapter: Report::ArticleByTypeSender, + params: { + type: 'phone', sender: 'Agent', }, }, { - name: 'email_in', - display: 'Email (in)', - selected: true, + name: 'email_in', + display: 'Email (in)', + selected: true, dataDownload: false, - adapter: Report::ArticleByTypeSender, - params: { - type: 'email', + adapter: Report::ArticleByTypeSender, + params: { + type: 'email', sender: 'Customer', }, }, { - name: 'email_out', - display: 'Email (out)', - selected: true, + name: 'email_out', + display: 'Email (out)', + selected: true, dataDownload: false, - adapter: Report::ArticleByTypeSender, - params: { - type: 'email', + adapter: Report::ArticleByTypeSender, + params: { + type: 'email', sender: 'Agent', }, }, { - name: 'web_in', - display: 'Web (in)', - selected: true, + name: 'web_in', + display: 'Web (in)', + selected: true, dataDownload: false, - adapter: Report::ArticleByTypeSender, - params: { - type: 'web', + adapter: Report::ArticleByTypeSender, + params: { + type: 'web', sender: 'Customer', }, }, { - name: 'twitter_in', - display: 'Twitter (in)', - selected: true, + name: 'twitter_in', + display: 'Twitter (in)', + selected: true, dataDownload: false, - adapter: Report::ArticleByTypeSender, - params: { - type: 'twitter status', + adapter: Report::ArticleByTypeSender, + params: { + type: 'twitter status', sender: 'Customer', }, }, { - name: 'twitter_out', - display: 'Twitter (out)', - selected: true, + name: 'twitter_out', + display: 'Twitter (out)', + selected: true, dataDownload: false, - adapter: Report::ArticleByTypeSender, - params: { - type: 'twitter status', + adapter: Report::ArticleByTypeSender, + params: { + type: 'twitter status', sender: 'Agent', }, }, diff --git a/app/models/scheduler.rb b/app/models/scheduler.rb index 5710d400d..321fd0098 100644 --- a/app/models/scheduler.rb +++ b/app/models/scheduler.rb @@ -309,8 +309,8 @@ class Scheduler < ApplicationModel job.update!( error_message: error, - status: 'error', - active: false, + status: 'error', + active: false, ) end diff --git a/app/models/setting.rb b/app/models/setting.rb index fa3267a84..9bbc6912c 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -194,7 +194,7 @@ reload config settings Sessions.broadcast( { event: 'config_update', - data: { name: name, value: value } + data: { name: name, value: value } }, 'public' ) diff --git a/app/models/stats_store.rb b/app/models/stats_store.rb index b218012d7..657546d39 100644 --- a/app/models/stats_store.rb +++ b/app/models/stats_store.rb @@ -112,11 +112,11 @@ class StatsStore < ApplicationModel # create history record = { stats_store_object_id: object_id, - o_id: data[:o_id], - key: data[:key], - data: data[:data], - created_at: data[:created_at], - created_by_id: data[:created_by_id], + o_id: data[:o_id], + key: data[:key], + data: data[:data], + created_at: data[:created_at], + created_by_id: data[:created_by_id], } StatsStore.create(record) @@ -141,7 +141,7 @@ class StatsStore < ApplicationModel # create history record = { stats_store_object_id: object_id, - o_id: data[:o_id], + o_id: data[:o_id], } StatsStore.where(record).destroy_all diff --git a/app/models/store/file.rb b/app/models/store/file.rb index db8bbfaf6..7817b03df 100644 --- a/app/models/store/file.rb +++ b/app/models/store/file.rb @@ -33,7 +33,7 @@ do also verify of written data adapter.add(data, sha) file = Store::File.create( provider: adapter_name, - sha: sha, + sha: sha, ) # verify diff --git a/app/models/store/provider/db.rb b/app/models/store/provider/db.rb index a47db5b52..77b714f15 100644 --- a/app/models/store/provider/db.rb +++ b/app/models/store/provider/db.rb @@ -8,7 +8,7 @@ class Store def self.add(data, sha) Store::Provider::DB.create( data: data, - sha: sha, + sha: sha, ) true end diff --git a/app/models/tag.rb b/app/models/tag.rb index 7805c747a..9eae95c3f 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -41,8 +41,8 @@ add tags for certain object # create history Tag.create( tag_object_id: tag_object_id, - tag_item_id: tag_item_id, - o_id: data[:o_id], + tag_item_id: tag_item_id, + o_id: data[:o_id], created_by_id: data[:created_by_id], ) @@ -89,8 +89,8 @@ or by ids # create history result = Tag.where( tag_object_id: data[:tag_object_id], - tag_item_id: data[:tag_item_id], - o_id: data[:o_id], + tag_item_id: data[:tag_item_id], + o_id: data[:o_id], ) result.each(&:destroy) @@ -123,7 +123,7 @@ remove all tags of certain object # create history result = Tag.where( tag_object_id: data[:tag_object_id], - o_id: data[:o_id], + o_id: data[:o_id], ) result.each(&:destroy) true @@ -150,7 +150,7 @@ returns tag_search = Tag.where( tag_object_id: tag_object_id_requested, - o_id: data[:o_id], + o_id: data[:o_id], ).order(:id) tag_search.each_with_object([]) do |tag, result| @@ -235,8 +235,8 @@ rename tag items if Tag.find_by(tag_object_id: tag.tag_object_id, o_id: tag.o_id, tag_item_id: already_existing_tag.id) Tag.tag_remove( tag_object_id: tag.tag_object_id, - o_id: tag.o_id, - tag_item_id: old_tag_item.id, + o_id: tag.o_id, + tag_item_id: old_tag_item.id, ) next end @@ -249,7 +249,7 @@ rename tag items # touch reference objects Tag.touch_reference_by_params( object: tag_object.name, - o_id: tag.o_id, + o_id: tag.o_id, ) end @@ -269,7 +269,7 @@ rename tag items tag_object = Tag::Object.lookup(id: tag.tag_object_id) Tag.touch_reference_by_params( object: tag_object.name, - o_id: tag.o_id, + o_id: tag.o_id, ) end @@ -292,7 +292,7 @@ remove tag item (destroy with reverences) tag.destroy Tag.touch_reference_by_params( object: tag_object.name, - o_id: tag.o_id, + o_id: tag.o_id, ) end Tag::Item.find(id).destroy diff --git a/app/models/taskbar.rb b/app/models/taskbar.rb index 0826c8b7a..992093d55 100644 --- a/app/models/taskbar.rb +++ b/app/models/taskbar.rb @@ -104,19 +104,19 @@ class Taskbar < ApplicationModel local_last_contact = taskbar.last_contact end task = { - id: taskbar.id, - user_id: taskbar.user_id, + id: taskbar.id, + user_id: taskbar.user_id, last_contact: local_last_contact, - changed: local_changed, + changed: local_changed, } preferences[:tasks].push task end if !id changed = state_changed? task = { - user_id: user_id, + user_id: user_id, last_contact: last_contact, - changed: changed, + changed: changed, } preferences[:tasks].push task end @@ -145,9 +145,9 @@ class Taskbar < ApplicationModel data = { event: 'taskbar:preferences', - data: { - id: id, - key: key, + data: { + id: id, + key: key, preferences: preferences, }, } diff --git a/app/models/text_module.rb b/app/models/text_module.rb index 06c80c4b4..edd890a0b 100644 --- a/app/models/text_module.rb +++ b/app/models/text_module.rb @@ -85,13 +85,13 @@ push text_modules to online result = UserAgent.post( url, { - locale: locale, - text_modules: text_modules_to_push, - fqdn: Setting.get('fqdn'), + locale: locale, + text_modules: text_modules_to_push, + fqdn: Setting.get('fqdn'), translator_key: translator_key, }, { - json: true, + json: true, open_timeout: 6, read_timeout: 16, } diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 6b11c4aac..de2217b5f 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -154,11 +154,11 @@ returns # send notification Transaction::BackgroundJob.run( - object: 'Ticket', - type: 'reminder_reached', - object_id: ticket.id, + object: 'Ticket', + type: 'reminder_reached', + object_id: ticket.id, article_id: article_id, - user_id: 1, + user_id: 1, ) result.push ticket @@ -201,11 +201,11 @@ returns # send escalation if ticket.escalation_at < Time.zone.now Transaction::BackgroundJob.run( - object: 'Ticket', - type: 'escalation', - object_id: ticket.id, + object: 'Ticket', + type: 'escalation', + object_id: ticket.id, article_id: article_id, - user_id: 1, + user_id: 1, ) result.push ticket next @@ -213,11 +213,11 @@ returns # check if warning need to be sent Transaction::BackgroundJob.run( - object: 'Ticket', - type: 'escalation_warning', - object_id: ticket.id, + object: 'Ticket', + type: 'escalation_warning', + object_id: ticket.id, article_id: article_id, - user_id: 1, + user_id: 1, ) result.push ticket end @@ -308,11 +308,11 @@ returns # create new merge article Ticket::Article.create( - ticket_id: id, - type_id: Ticket::Article::Type.lookup(name: 'note').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Agent').id, - body: 'merged', - internal: false, + ticket_id: id, + type_id: Ticket::Article::Type.lookup(name: 'note').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Agent').id, + body: 'merged', + internal: false, created_by_id: data[:user_id], updated_by_id: data[:user_id], ) @@ -322,21 +322,21 @@ returns # reassign links to the new ticket # rubocop:disable Rails/SkipsModelValidations Link.where( - link_object_source_id: Link::Object.find_by(name: 'Ticket').id, + link_object_source_id: Link::Object.find_by(name: 'Ticket').id, link_object_source_value: id, ).update_all(link_object_source_value: data[:ticket_id]) Link.where( - link_object_target_id: Link::Object.find_by(name: 'Ticket').id, + link_object_target_id: Link::Object.find_by(name: 'Ticket').id, link_object_target_value: id, ).update_all(link_object_target_value: data[:ticket_id]) # rubocop:enable Rails/SkipsModelValidations # link tickets Link.add( - link_type: 'parent', - link_object_source: 'Ticket', + link_type: 'parent', + link_object_source: 'Ticket', link_object_source_value: data[:ticket_id], - link_object_target: 'Ticket', + link_object_target: 'Ticket', link_object_target_value: id ) @@ -1057,7 +1057,7 @@ perform active triggers on ticket # check if ticket selector is matching condition['ticket.id'] = { operator: 'is', - value: ticket.id, + value: ticket.id, } next if article_selector && !article @@ -1065,7 +1065,7 @@ perform active triggers on ticket if article_selector condition['article.id'] = { operator: 'is', - value: article.id, + value: article.id, } end @@ -1184,7 +1184,7 @@ result end { history: list, - assets: assets, + assets: assets, } end @@ -1278,7 +1278,7 @@ result # (see https://github.com/zammad/zammad/issues/1543) def build_notification_template_objects(article) { - ticket: self, + ticket: self, article: article || articles.last } end @@ -1378,9 +1378,9 @@ result # loop protection / check if maximal count of trigger mail has reached map = { - 10 => 10, - 30 => 15, - 60 => 25, + 10 => 10, + 30 => 15, + 60 => 25, 180 => 50, 600 => 100, } @@ -1388,8 +1388,8 @@ result map.each do |minutes, count| already_sent = Ticket::Article.where( ticket_id: id, - sender: Ticket::Article::Sender.find_by(name: 'System'), - type: Ticket::Article::Type.find_by(name: 'email'), + sender: Ticket::Article::Sender.find_by(name: 'System'), + type: Ticket::Article::Type.find_by(name: 'email'), ).where('ticket_articles.created_at > ? AND ticket_articles.to LIKE ?', Time.zone.now - minutes.minutes, "%#{recipient_email.strip}%").count next if already_sent < count @@ -1400,9 +1400,9 @@ result next if skip map = { - 10 => 30, - 30 => 60, - 60 => 120, + 10 => 30, + 30 => 60, + 60 => 120, 180 => 240, 600 => 360, } @@ -1410,7 +1410,7 @@ result map.each do |minutes, count| already_sent = Ticket::Article.where( sender: Ticket::Article::Sender.find_by(name: 'System'), - type: Ticket::Article::Type.find_by(name: 'email'), + type: Ticket::Article::Type.find_by(name: 'email'), ).where('ticket_articles.created_at > ? AND ticket_articles.to LIKE ?', Time.zone.now - minutes.minutes, "%#{recipient_email.strip}%").count next if already_sent < count @@ -1449,31 +1449,31 @@ result # get subject subject = NotificationFactory::Mailer.template( templateInline: value['subject'], - locale: 'en-en', - objects: objects, - quote: false, + locale: 'en-en', + objects: objects, + quote: false, ) subject = subject_build(subject) body = NotificationFactory::Mailer.template( templateInline: value['body'], - locale: 'en-en', - objects: objects, - quote: true, + locale: 'en-en', + objects: objects, + quote: true, ) (body, attachments_inline) = HtmlSanitizer.replace_inline_images(body, id) message = Ticket::Article.create( - ticket_id: id, - to: recipient_string, - subject: subject, - content_type: 'text/html', - body: body, - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'System'), - type: Ticket::Article::Type.find_by(name: 'email'), - preferences: { + ticket_id: id, + to: recipient_string, + subject: subject, + content_type: 'text/html', + body: body, + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'System'), + type: Ticket::Article::Type.find_by(name: 'email'), + preferences: { perform_origin: perform_origin, }, updated_by_id: 1, @@ -1482,10 +1482,10 @@ result attachments_inline.each do |attachment| Store.add( - object: 'Ticket::Article', - o_id: message.id, - data: attachment[:data], - filename: attachment[:filename], + object: 'Ticket::Article', + o_id: message.id, + data: attachment[:data], + filename: attachment[:filename], preferences: attachment[:preferences], ) end @@ -1547,17 +1547,17 @@ result # attributes content_type is not needed for SMS article = Ticket::Article.create( - ticket_id: id, - subject: 'SMS notification', - to: sms_recipients_to, - body: body, - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'System'), - type: Ticket::Article::Type.find_by(name: 'sms'), - preferences: { + ticket_id: id, + subject: 'SMS notification', + to: sms_recipients_to, + body: body, + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'System'), + type: Ticket::Article::Type.find_by(name: 'sms'), + preferences: { perform_origin: perform_origin, sms_recipients: sms_recipients.map(&:mobile), - channel_id: channel.id, + channel_id: channel.id, }, updated_by_id: 1, created_by_id: 1, diff --git a/app/models/ticket/article.rb b/app/models/ticket/article.rb index ef9a9852d..cc40862cb 100644 --- a/app/models/ticket/article.rb +++ b/app/models/ticket/article.rb @@ -195,7 +195,7 @@ returns: def as_raw list = Store.list( object: 'Ticket::Article::Mail', - o_id: id, + o_id: id, ) return if list.blank? @@ -217,11 +217,11 @@ returns: def save_as_raw(msg) Store.add( - object: 'Ticket::Article::Mail', - o_id: id, - data: msg, - filename: "ticket-#{ticket.number}-#{id}.eml", - preferences: {}, + object: 'Ticket::Article::Mail', + o_id: id, + data: msg, + filename: "ticket-#{ticket.number}-#{id}.eml", + preferences: {}, created_by_id: created_by_id, ) end diff --git a/app/models/ticket/escalation.rb b/app/models/ticket/escalation.rb index 132b6ec1a..dd793a9dd 100644 --- a/app/models/ticket/escalation.rb +++ b/app/models/ticket/escalation.rb @@ -266,12 +266,12 @@ returns # remember already counted time to do on next update only the diff preferences[:escalation_calculation] = { - first_response_at: first_response_at, - last_update_at: last_update_at, - close_at: close_at, - sla_id: sla.id, - sla_updated_at: sla.updated_at, - calendar_id: calendar.id, + first_response_at: first_response_at, + last_update_at: last_update_at, + close_at: close_at, + sla_id: sla.id, + sla_updated_at: sla.updated_at, + calendar_id: calendar.id, calendar_updated_at: calendar.updated_at, escalation_disabled: escalation_disabled, } @@ -372,10 +372,10 @@ returns local_updated_at = saved_change_to_attribute('updated_at')[1] end history_item = { - 'attribute' => 'state', + 'attribute' => 'state', 'created_at' => local_updated_at, 'value_from' => Ticket::State.find(saved_change_to_attribute('state_id')[0]).name, - 'value_to' => Ticket::State.find(saved_change_to_attribute('state_id')[1]).name, + 'value_to' => Ticket::State.find(saved_change_to_attribute('state_id')[1]).name, } if last_history_state last_history_state = history_item diff --git a/app/models/ticket/overviews.rb b/app/models/ticket/overviews.rb index 1edfb5928..5914d8b12 100644 --- a/app/models/ticket/overviews.rb +++ b/app/models/ticket/overviews.rb @@ -127,7 +127,7 @@ returns tickets = ticket_result.map do |ticket| { - id: ticket[0], + id: ticket[0], updated_at: ticket[1], } end @@ -135,13 +135,13 @@ returns count = Ticket.distinct.where(access_condition).where(query_condition, *bind_condition).joins(tables).count() item = { overview: { - name: overview.name, - id: overview.id, - view: overview.link, + name: overview.name, + id: overview.id, + view: overview.link, updated_at: overview.updated_at, }, - tickets: tickets, - count: count, + tickets: tickets, + count: count, } list.push item diff --git a/app/models/ticket/screen_options.rb b/app/models/ticket/screen_options.rb index 4eba8c727..ebf485a26 100644 --- a/app/models/ticket/screen_options.rb +++ b/app/models/ticket/screen_options.rb @@ -183,7 +183,7 @@ returns # get tickets tickets_open = Ticket.where( customer_id: data[:customer_id], - state_id: state_list_open + state_id: state_list_open ).limit( data[:limit] || 15 ).order('created_at DESC') assets = {} ticket_ids_open = [] @@ -194,7 +194,7 @@ returns tickets_closed = Ticket.where( customer_id: data[:customer_id], - state_id: state_list_closed + state_id: state_list_closed ).limit( data[:limit] || 15 ).order('created_at DESC') ticket_ids_closed = [] tickets_closed.each do |ticket| @@ -203,9 +203,9 @@ returns end { - ticket_ids_open: ticket_ids_open, + ticket_ids_open: ticket_ids_open, ticket_ids_closed: ticket_ids_closed, - assets: assets, + assets: assets, } end end diff --git a/app/models/ticket/search.rb b/app/models/ticket/search.rb index e883d3eb4..b6de60896 100644 --- a/app/models/ticket/search.rb +++ b/app/models/ticket/search.rb @@ -30,7 +30,7 @@ returns if user has no permissions to search def search_preferences(_current_user) { - prio: 3000, + prio: 3000, direct_search_index: false, } end @@ -154,11 +154,11 @@ returns query_extension['bool']['must'].push access_condition - items = SearchIndexBackend.search(query, 'Ticket', limit: limit, + items = SearchIndexBackend.search(query, 'Ticket', limit: limit, query_extension: query_extension, - from: offset, - sort_by: sort_by, - order_by: order_by) + from: offset, + sort_by: sort_by, + order_by: order_by) if !full ids = [] items.each do |item| diff --git a/app/models/transaction/notification.rb b/app/models/transaction/notification.rb index a1a5313e7..36d653bd3 100644 --- a/app/models/transaction/notification.rb +++ b/app/models/transaction/notification.rb @@ -151,12 +151,12 @@ class Transaction::Notification end OnlineNotification.add( - type: @item[:type], - object: 'Ticket', - o_id: ticket.id, - seen: seen, + type: @item[:type], + object: 'Ticket', + o_id: ticket.id, + seen: seen, created_by_id: created_by_id, - user_id: user.id, + user_id: user.id, ) Rails.logger.debug { "sent ticket online notifiaction to agent (#{@item[:type]}/#{ticket.id}/#{user.email})" } end @@ -197,18 +197,18 @@ class Transaction::Notification attachments = article.attachments_inline end NotificationFactory::Mailer.notification( - template: template, - user: user, - objects: { - ticket: ticket, - article: article, - recipient: user, + template: template, + user: user, + objects: { + ticket: ticket, + article: article, + recipient: user, current_user: current_user, - changes: changes, - reason: recipients_reason[user.id], + changes: changes, + reason: recipients_reason[user.id], }, - message_id: "", - references: ticket.get_references, + message_id: "", + references: ticket.get_references, main_object: ticket, attachments: attachments, ) @@ -226,11 +226,11 @@ class Transaction::Notification end recipient_list = "#{identifier}(#{type}:#{channels.join(',')})" History.add( - o_id: ticket.id, - history_type: 'notification', + o_id: ticket.id, + history_type: 'notification', history_object: 'Ticket', - value_to: recipient_list, - created_by_id: @item[:user_id] || 1 + value_to: recipient_list, + created_by_id: @item[:user_id] || 1 ) end diff --git a/app/models/transaction/slack.rb b/app/models/transaction/slack.rb index 7f631230c..5b972f792 100644 --- a/app/models/transaction/slack.rb +++ b/app/models/transaction/slack.rb @@ -84,12 +84,12 @@ class Transaction::Slack result = NotificationFactory::Slack.template( template: template, - locale: user[:preferences][:locale], - objects: { - ticket: ticket, - article: article, + locale: user[:preferences][:locale], + objects: { + ticket: ticket, + article: article, current_user: current_user, - changes: changes, + changes: changes, }, ) @@ -166,10 +166,10 @@ class Transaction::Slack notifier = Slack::Notifier.new( local_config['webhook'], - channel: local_config['channel'], - username: local_config['username'], - icon_url: logo_url, - mrkdwn: true, + channel: local_config['channel'], + username: local_config['username'], + icon_url: logo_url, + mrkdwn: true, http_client: Transaction::Slack::Client, ) if local_config['expand'] @@ -177,9 +177,9 @@ class Transaction::Slack result = notifier.ping body else attachment = { - text: result[:body], + text: result[:body], mrkdwn_in: ['text'], - color: color, + color: color, } result = notifier.ping result[:subject], attachments: [attachment] @@ -293,10 +293,10 @@ class Transaction::Slack uri.to_s, params, { - open_timeout: 4, - read_timeout: 10, + open_timeout: 4, + read_timeout: 10, total_timeout: 20, - log: { + log: { facility: 'slack_webhook', } }, diff --git a/app/models/translation.rb b/app/models/translation.rb index 5baf74ecf..acef5a6e5 100644 --- a/app/models/translation.rb +++ b/app/models/translation.rb @@ -75,13 +75,13 @@ push translations to online result = UserAgent.post( url, { - locale: locale, - translations: translations_to_push, - fqdn: Setting.get('fqdn'), + locale: locale, + translations: translations_to_push, + fqdn: Setting.get('fqdn'), translator_key: translator_key, }, { - json: true, + json: true, open_timeout: 8, read_timeout: 24, } @@ -267,7 +267,7 @@ all: version: version, }, { - json: true, + json: true, open_timeout: 8, read_timeout: 24, } diff --git a/app/models/user.rb b/app/models/user.rb index a0f413ec9..a0d097248 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -370,15 +370,15 @@ returns end begin data = { - login: hash['info']['nickname'] || hash['uid'], - firstname: hash['info']['name'] || hash['info']['display_name'], - email: hash['info']['email'], - image_source: hash['info']['image'], - web: url, - address: hash['info']['location'], - note: hash['info']['description'], - source: hash['provider'], - role_ids: Role.signup_role_ids, + login: hash['info']['nickname'] || hash['uid'], + firstname: hash['info']['name'] || hash['info']['display_name'], + email: hash['info']['email'], + image_source: hash['info']['image'], + web: url, + address: hash['info']['location'], + note: hash['info']['description'], + source: hash['provider'], + role_ids: Role.signup_role_ids, updated_by_id: 1, created_by_id: 1, } @@ -570,7 +570,7 @@ returns { token: token, - user: user, + user: user, } end @@ -662,7 +662,7 @@ returns { token: token, - user: user, + user: user, } end @@ -1191,10 +1191,10 @@ raise 'Minimum one user need to have admin permissions' # save/update avatar avatar = Avatar.auto_detection( - object: 'User', - o_id: id, - url: email, - source: 'app', + object: 'User', + o_id: id, + url: email, + source: 'app', updated_by_id: updated_by_id, created_by_id: updated_by_id, ) @@ -1220,7 +1220,7 @@ raise 'Minimum one user need to have admin permissions' ::Token.where(user_id: id).destroy_all ::StatsStore.remove( object: 'User', - o_id: id, + o_id: id, ) true end diff --git a/app/models/user/assets.rb b/app/models/user/assets.rb index 0ae1f264e..706b609c6 100644 --- a/app/models/user/assets.rb +++ b/app/models/user/assets.rb @@ -48,7 +48,7 @@ returns authorizations = self.authorizations() authorizations.each do |authorization| local_accounts[authorization.provider] = { - uid: authorization[:uid], + uid: authorization[:uid], username: authorization[:username] } end diff --git a/app/models/user/search.rb b/app/models/user/search.rb index 006b18d94..b5d2f9cd6 100644 --- a/app/models/user/search.rb +++ b/app/models/user/search.rb @@ -34,7 +34,7 @@ returns if user has no permissions to search return false if !current_user.permissions?('ticket.agent') && !current_user.permissions?('admin.user') { - prio: 2000, + prio: 2000, direct_search_index: true, } end @@ -114,11 +114,11 @@ returns query_extension['bool']['must'].push access_condition end - items = SearchIndexBackend.search(query, 'User', limit: limit, + items = SearchIndexBackend.search(query, 'User', limit: limit, query_extension: query_extension, - from: offset, - sort_by: sort_by, - order_by: order_by) + from: offset, + sort_by: sort_by, + order_by: order_by) users = [] items.each do |item| user = User.lookup(id: item[:id]) diff --git a/app/models/user_device.rb b/app/models/user_device.rb index d9718bab0..deca18d5b 100644 --- a/app/models/user_device.rb +++ b/app/models/user_device.rb @@ -40,7 +40,7 @@ store new device for user if device not already known if fingerprint.present? UserDevice.fingerprint_validation(fingerprint) user_devices = UserDevice.where( - user_id: user_id, + user_id: user_id, fingerprint: fingerprint, ) user_devices.each do |local_user_device| @@ -54,7 +54,7 @@ store new device for user if device not already known device_exists_by_user_agent = false if %w[basic_auth token_auth].include?(type) user_devices = UserDevice.where( - user_id: user_id, + user_id: user_id, user_agent: user_agent, ) user_devices.each do |local_user_device| @@ -69,9 +69,9 @@ store new device for user if device not already known if user_agent != 'unknown' browser = Browser.new(user_agent, accept_language: 'en-us') browser = { - plattform: browser.platform.to_s.camelize, - name: browser.name, - version: browser.version, + plattform: browser.platform.to_s.camelize, + name: browser.name, + version: browser.version, full_version: browser.full_version, } end @@ -99,10 +99,10 @@ store new device for user if device not already known # check if exists user_device = find_by( - user_id: user_id, - os: browser[:plattform], - browser: browser[:name], - location: location, + user_id: user_id, + os: browser[:plattform], + browser: browser[:name], + location: location, fingerprint: fingerprint, ) @@ -112,16 +112,16 @@ store new device for user if device not already known # create new device user_device = create!( - user_id: user_id, - name: name, - os: browser[:plattform], - browser: browser[:name], - location: location, - device_details: browser, + user_id: user_id, + name: name, + os: browser[:plattform], + browser: browser[:name], + location: location, + device_details: browser, location_details: location_details, - user_agent: user_agent, - ip: ip, - fingerprint: fingerprint, + user_agent: user_agent, + ip: ip, + fingerprint: fingerprint, ) # send notification if needed @@ -206,10 +206,10 @@ send user notification about new device or new location for device NotificationFactory::Mailer.notification( template: template, - user: user, - objects: { + user: user, + objects: { user_device: self, - user: user, + user: user, } ) end diff --git a/config/application.rb b/config/application.rb index 5588e39a0..3629b661a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -64,47 +64,47 @@ module Zammad 'ticket.agent' => { notification_config: { matrix: { - create: { + create: { criteria: { - owned_by_me: true, + owned_by_me: true, owned_by_nobody: true, - no: false, + no: false, }, - channel: { - email: true, + channel: { + email: true, online: true, } }, - update: { + update: { criteria: { - owned_by_me: true, + owned_by_me: true, owned_by_nobody: true, - no: false, + no: false, }, - channel: { - email: true, + channel: { + email: true, online: true, } }, reminder_reached: { criteria: { - owned_by_me: true, + owned_by_me: true, owned_by_nobody: false, - no: false, + no: false, }, - channel: { - email: true, + channel: { + email: true, online: true, } }, - escalation: { + escalation: { criteria: { - owned_by_me: true, + owned_by_me: true, owned_by_nobody: false, - no: false, + no: false, }, - channel: { - email: true, + channel: { + email: true, online: true, } } diff --git a/config/environments/development.rb b/config/environments/development.rb index 8813ec693..d31be1d28 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -37,9 +37,9 @@ Rails.application.configure do config.middleware.insert_after( ActionDispatch::Static, Rack::LiveReload, - no_swf: true, - min_delay: 500, # default 1000 - max_delay: 10_000, # default 60_000 + no_swf: true, + min_delay: 500, # default 1000 + max_delay: 10_000, # default 60_000 live_reload_port: 35_738 ) end diff --git a/config/initializers/html_sanitizer.rb b/config/initializers/html_sanitizer.rb index 021996387..8f6eef190 100644 --- a/config/initializers/html_sanitizer.rb +++ b/config/initializers/html_sanitizer.rb @@ -48,12 +48,12 @@ Rails.application.config.html_sanitizer_attributes_whitelist = { # only this css properties are allowed Rails.application.config.html_sanitizer_css_properties_whitelist = { - 'img' => %w[ + 'img' => %w[ width height max-width min-width max-height min-height ], - 'span' => %w[ + 'span' => %w[ color ], 'table' => %w[ @@ -67,7 +67,7 @@ Rails.application.config.html_sanitizer_css_properties_whitelist = { border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style ], - 'th' => %w[ + 'th' => %w[ background background-color color font-size vertical-align margin margin-top margin-right margin-bottom margin-left padding padding-top padding-right padding-bottom padding-left @@ -78,7 +78,7 @@ Rails.application.config.html_sanitizer_css_properties_whitelist = { border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style ], - 'tr' => %w[ + 'tr' => %w[ background background-color color font-size vertical-align margin margin-top margin-right margin-bottom margin-left padding padding-top padding-right padding-bottom padding-left @@ -89,7 +89,7 @@ Rails.application.config.html_sanitizer_css_properties_whitelist = { border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style ], - 'td' => %w[ + 'td' => %w[ background background-color color font-size vertical-align margin margin-top margin-right margin-bottom margin-left padding padding-top padding-right padding-bottom padding-left @@ -111,7 +111,7 @@ Rails.application.config.html_sanitizer_css_values_backlist = { 'display:none', 'visibility:hidden', ], - 'th' => [ + 'th' => [ 'font-size:0', 'font-size:0px', 'font-size:0em', @@ -119,7 +119,7 @@ Rails.application.config.html_sanitizer_css_values_backlist = { 'display:none', 'visibility:hidden', ], - 'tr' => [ + 'tr' => [ 'font-size:0', 'font-size:0px', 'font-size:0em', @@ -127,7 +127,7 @@ Rails.application.config.html_sanitizer_css_values_backlist = { 'display:none', 'visibility:hidden', ], - 'td' => [ + 'td' => [ 'font-size:0', 'font-size:0px', 'font-size:0em', diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 24c91e0e5..99391fc43 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -4,7 +4,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do provider :twitter_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database', { client_options: { authorize_path: '/oauth/authorize', - site: 'https://api.twitter.com', + site: 'https://api.twitter.com', } } @@ -17,7 +17,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do # google database connect provider :google_oauth2_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database', { authorize_options: { - access_type: 'online', + access_type: 'online', approval_prompt: '', } } @@ -28,9 +28,9 @@ Rails.application.config.middleware.use OmniAuth::Builder do # gitlab database connect provider :gitlab_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database', { client_options: { - site: 'https://not_change_will_be_set_by_database', + site: 'https://not_change_will_be_set_by_database', authorize_url: '/oauth/authorize', - token_url: '/oauth/token' + token_url: '/oauth/token' }, } @@ -40,9 +40,9 @@ Rails.application.config.middleware.use OmniAuth::Builder do # oauth2 database connect provider :oauth2_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database', { client_options: { - site: 'https://not_change_will_be_set_by_database', + site: 'https://not_change_will_be_set_by_database', authorize_url: '/oauth/authorize', - token_url: '/oauth/token', + token_url: '/oauth/token', }, } diff --git a/db/migrate/20160217000001_object_manager_update_user.rb b/db/migrate/20160217000001_object_manager_update_user.rb index 5a9dded3c..a5ad46081 100644 --- a/db/migrate/20160217000001_object_manager_update_user.rb +++ b/db/migrate/20160217000001_object_manager_update_user.rb @@ -6,58 +6,58 @@ class ObjectManagerUpdateUser < ActiveRecord::Migration[4.2] UserInfo.current_user_id = 1 ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'login', - display: 'Login', - data_type: 'input', + force: true, + object: 'User', + name: 'login', + display: 'Login', + data_type: 'input', data_option: { - type: 'text', - maxlength: 100, - null: true, + type: 'text', + maxlength: 100, + null: true, autocapitalize: false, - item_class: 'formGroup--halfSize', + item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: {}, - view: { + edit: {}, + view: { '-all-' => { shown: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 100, + to_create: false, + to_migrate: false, + to_delete: false, + position: 100, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'firstname', - display: 'Firstname', - data_type: 'input', + force: true, + object: 'User', + name: 'firstname', + display: 'Firstname', + data_type: 'input', data_option: { - type: 'text', - maxlength: 150, - null: false, + type: 'text', + maxlength: 150, + null: false, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: { + editable: false, + active: true, + screens: { + signup: { '-all-' => { null: false, }, }, - invite_agent: { + invite_agent: { '-all-' => { null: false, }, @@ -67,44 +67,44 @@ class ObjectManagerUpdateUser < ActiveRecord::Migration[4.2] null: false, }, }, - edit: { + edit: { '-all-' => { null: false, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 200, + to_create: false, + to_migrate: false, + to_delete: false, + position: 200, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'lastname', - display: 'Lastname', - data_type: 'input', + force: true, + object: 'User', + name: 'lastname', + display: 'Lastname', + data_type: 'input', data_option: { - type: 'text', - maxlength: 150, - null: false, + type: 'text', + maxlength: 150, + null: false, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: { + editable: false, + active: true, + screens: { + signup: { '-all-' => { null: false, }, }, - invite_agent: { + invite_agent: { '-all-' => { null: false, }, @@ -114,44 +114,44 @@ class ObjectManagerUpdateUser < ActiveRecord::Migration[4.2] null: false, }, }, - edit: { + edit: { '-all-' => { null: false, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 300, + to_create: false, + to_migrate: false, + to_delete: false, + position: 300, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'email', - display: 'Email', - data_type: 'input', + force: true, + object: 'User', + name: 'email', + display: 'Email', + data_type: 'input', data_option: { - type: 'email', - maxlength: 150, - null: false, + type: 'email', + maxlength: 150, + null: false, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: { + editable: false, + active: true, + screens: { + signup: { '-all-' => { null: false, }, }, - invite_agent: { + invite_agent: { '-all-' => { null: false, }, @@ -161,433 +161,433 @@ class ObjectManagerUpdateUser < ActiveRecord::Migration[4.2] null: false, }, }, - edit: { + edit: { '-all-' => { null: false, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 400, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'web', - display: 'Web', - data_type: 'input', + force: true, + object: 'User', + name: 'web', + display: 'Web', + data_type: 'input', data_option: { - type: 'url', - maxlength: 250, - null: true, + type: 'url', + maxlength: 250, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 500, + to_create: false, + to_migrate: false, + to_delete: false, + position: 500, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'phone', - display: 'Phone', - data_type: 'input', + force: true, + object: 'User', + name: 'phone', + display: 'Phone', + data_type: 'input', data_option: { - type: 'tel', - maxlength: 100, - null: true, + type: 'tel', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 600, + to_create: false, + to_migrate: false, + to_delete: false, + position: 600, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'mobile', - display: 'Mobile', - data_type: 'input', + force: true, + object: 'User', + name: 'mobile', + display: 'Mobile', + data_type: 'input', data_option: { - type: 'tel', - maxlength: 100, - null: true, + type: 'tel', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 700, + to_create: false, + to_migrate: false, + to_delete: false, + position: 700, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'fax', - display: 'Fax', - data_type: 'input', + force: true, + object: 'User', + name: 'fax', + display: 'Fax', + data_type: 'input', data_option: { - type: 'tel', - maxlength: 100, - null: true, + type: 'tel', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 800, + to_create: false, + to_migrate: false, + to_delete: false, + position: 800, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'organization_id', - display: 'Organization', - data_type: 'autocompletion_ajax', + force: true, + object: 'User', + name: 'organization_id', + display: 'Organization', + data_type: 'autocompletion_ajax', data_option: { - multiple: false, + multiple: false, nulloption: true, - null: true, - relation: 'Organization', + null: true, + relation: 'Organization', item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 900, + to_create: false, + to_migrate: false, + to_delete: false, + position: 900, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'department', - display: 'Department', - data_type: 'input', + force: true, + object: 'User', + name: 'department', + display: 'Department', + data_type: 'input', data_option: { - type: 'text', - maxlength: 200, - null: true, + type: 'text', + maxlength: 200, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1000, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1000, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'street', - display: 'Street', - data_type: 'input', + force: true, + object: 'User', + name: 'street', + display: 'Street', + data_type: 'input', data_option: { - type: 'text', + type: 'text', maxlength: 100, - null: true, + null: true, }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1100, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1100, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'zip', - display: 'Zip', - data_type: 'input', + force: true, + object: 'User', + name: 'zip', + display: 'Zip', + data_type: 'input', data_option: { - type: 'text', - maxlength: 100, - null: true, + type: 'text', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1200, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1200, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'city', - display: 'City', - data_type: 'input', + force: true, + object: 'User', + name: 'city', + display: 'City', + data_type: 'input', data_option: { - type: 'text', - maxlength: 100, - null: true, + type: 'text', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1300, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1300, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'address', - display: 'Address', - data_type: 'textarea', + force: true, + object: 'User', + name: 'address', + display: 'Address', + data_type: 'textarea', data_option: { - type: 'text', - maxlength: 500, - null: true, + type: 'text', + maxlength: 500, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1350, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1350, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'password', - display: 'Password', - data_type: 'input', + force: true, + object: 'User', + name: 'password', + display: 'Password', + data_type: 'input', data_option: { - type: 'password', - maxlength: 100, - null: true, + type: 'password', + maxlength: 100, + null: true, autocomplete: 'off', - item_class: 'formGroup--halfSize', + item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: { + editable: false, + active: true, + screens: { + signup: { '-all-' => { null: false, }, }, - invite_agent: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { Admin: { null: true, }, }, - view: {} + view: {} }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1400, ) # rubocop:disable Lint/BooleanSymbol ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'vip', - display: 'VIP', - data_type: 'boolean', + force: true, + object: 'User', + name: 'vip', + display: 'VIP', + data_type: 'boolean', data_option: { - null: true, - default: false, + null: true, + default: false, item_class: 'formGroup--halfSize', - options: { + options: { false: 'no', - true: 'yes', + true: 'yes', }, - translate: true, + translate: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { Admin: { null: true, @@ -602,118 +602,118 @@ class ObjectManagerUpdateUser < ActiveRecord::Migration[4.2] }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1490, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1490, ) # rubocop:enable Lint/BooleanSymbol ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'note', - display: 'Note', - data_type: 'richtext', + force: true, + object: 'User', + name: 'note', + display: 'Note', + data_type: 'richtext', data_option: { - type: 'text', + type: 'text', maxlength: 250, - null: true, - note: 'Notes are visible to agents only, never to customers.', + null: true, + note: 'Notes are visible to agents only, never to customers.', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1500, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1500, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'role_ids', - display: 'Roles', - data_type: 'checkbox', + force: true, + object: 'User', + name: 'role_ids', + display: 'Roles', + data_type: 'checkbox', data_option: { - default: '', + default: '', multiple: true, - null: false, + null: false, relation: 'Role', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { Admin: { null: false, }, }, - view: { + view: { '-all-' => { shown: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1600, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1600, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'active', - display: 'Active', - data_type: 'active', + force: true, + object: 'User', + name: 'active', + display: 'Active', + data_type: 'active', data_option: { - null: true, + null: true, default: true, }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { Admin: { null: false, }, }, - view: { + view: { '-all-' => { shown: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1800, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1800, ) end diff --git a/db/migrate/20161112000001_organization_domain_based_assignment.rb b/db/migrate/20161112000001_organization_domain_based_assignment.rb index 176d8d538..f243cb352 100644 --- a/db/migrate/20161112000001_organization_domain_based_assignment.rb +++ b/db/migrate/20161112000001_organization_domain_based_assignment.rb @@ -9,25 +9,25 @@ class OrganizationDomainBasedAssignment < ActiveRecord::Migration[4.2] # rubocop:disable Lint/BooleanSymbol ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'domain_assignment', - display: 'Domain based assignment', - data_type: 'boolean', - data_option: { - null: true, - default: false, - note: 'Assign Users based on users domain.', + force: true, + object: 'Organization', + name: 'domain_assignment', + display: 'Domain based assignment', + data_type: 'boolean', + data_option: { + null: true, + default: false, + note: 'Assign Users based on users domain.', item_class: 'formGroup--halfSize', - options: { - true: 'yes', + options: { + true: 'yes', false: 'no', }, - translate: true, + translate: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { Admin: { null: false, @@ -39,30 +39,30 @@ class OrganizationDomainBasedAssignment < ActiveRecord::Migration[4.2] }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1410, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1410, updated_by_id: 1, created_by_id: 1, ) # rubocop:enable Lint/BooleanSymbol ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'domain', - display: 'Domain', - data_type: 'input', - data_option: { - type: 'text', - maxlength: 150, - null: true, + force: true, + object: 'Organization', + name: 'domain', + display: 'Domain', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 150, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: true, @@ -74,10 +74,10 @@ class OrganizationDomainBasedAssignment < ActiveRecord::Migration[4.2] }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1420, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1420, updated_by_id: 1, created_by_id: 1, ) diff --git a/db/migrate/20161117000002_ticket_number_generator_issue_427.rb b/db/migrate/20161117000002_ticket_number_generator_issue_427.rb index 0200184e2..22f87c03a 100644 --- a/db/migrate/20161117000002_ticket_number_generator_issue_427.rb +++ b/db/migrate/20161117000002_ticket_number_generator_issue_427.rb @@ -6,20 +6,20 @@ class TicketNumberGeneratorIssue427 < ActiveRecord::Migration[4.2] setting = Setting.find_by(name: 'ticket_number') setting.preferences = { settings_included: %w[ticket_number_increment ticket_number_date], - controller: 'SettingsAreaTicketNumber', - permission: ['admin.ticket'], + controller: 'SettingsAreaTicketNumber', + permission: ['admin.ticket'], } setting.save! setting = Setting.find_by(name: 'ticket_number_increment') setting.preferences = { permission: ['admin.ticket'], - hidden: true, + hidden: true, } setting.save! setting = Setting.find_by(name: 'ticket_number_date') setting.preferences = { permission: ['admin.ticket'], - hidden: true, + hidden: true, } # just to make sure that value is saved correctly - https://github.com/zammad/zammad/issues/413 @@ -36,12 +36,12 @@ class TicketNumberGeneratorIssue427 < ActiveRecord::Migration[4.2] setting.options = { form: [ { - display: '', - null: true, - name: 'ticket_hook_position', - tag: 'select', + display: '', + null: true, + name: 'ticket_hook_position', + tag: 'select', translate: true, - options: { + options: { 'left' => 'left', 'right' => 'right', 'none' => 'none', diff --git a/db/migrate/20161117000003_store_config_name_update_issue_428.rb b/db/migrate/20161117000003_store_config_name_update_issue_428.rb index e68c6e184..52cd9f3b2 100644 --- a/db/migrate/20161117000003_store_config_name_update_issue_428.rb +++ b/db/migrate/20161117000003_store_config_name_update_issue_428.rb @@ -10,22 +10,22 @@ class StoreConfigNameUpdateIssue428 < ActiveRecord::Migration[4.2] setting.options = { form: [ { - display: '', - null: true, - name: 'storage_provider', - tag: 'select', + display: '', + null: true, + name: 'storage_provider', + tag: 'select', tranlate: true, - options: { - 'DB' => 'Database', + options: { + 'DB' => 'Database', 'File' => 'Filesystem', }, }, ], } setting.preferences = { - controller: 'SettingsAreaStorageProvider', + controller: 'SettingsAreaStorageProvider', online_service_disable: true, - permission: ['admin.system'], + permission: ['admin.system'], } setting.save! end diff --git a/db/migrate/20161122000001_monitoring_issue_453.rb b/db/migrate/20161122000001_monitoring_issue_453.rb index 03535fe45..bebbfb817 100644 --- a/db/migrate/20161122000001_monitoring_issue_453.rb +++ b/db/migrate/20161122000001_monitoring_issue_453.rb @@ -4,30 +4,30 @@ class MonitoringIssue453 < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Monitoring Token', - name: 'monitoring_token', - area: 'HealthCheck::Base', + title: 'Monitoring Token', + name: 'monitoring_token', + area: 'HealthCheck::Base', description: 'Token for Monitoring.', - options: { + options: { form: [ { display: '', - null: false, - name: 'monitoring_token', - tag: 'input', + null: false, + name: 'monitoring_token', + tag: 'input', }, ], }, - state: SecureRandom.urlsafe_base64(40), + state: SecureRandom.urlsafe_base64(40), preferences: { permission: ['admin.monitoring'], }, - frontend: false, + frontend: false, ) Permission.create_if_not_exists( - name: 'admin.monitoring', - note: 'Manage %s', + name: 'admin.monitoring', + note: 'Manage %s', preferences: { translations: ['Monitoring'] }, diff --git a/db/migrate/20170116000002_fixed_typos_622.rb b/db/migrate/20170116000002_fixed_typos_622.rb index 7bbad1284..d0b224b26 100644 --- a/db/migrate/20170116000002_fixed_typos_622.rb +++ b/db/migrate/20170116000002_fixed_typos_622.rb @@ -12,11 +12,11 @@ class FixedTypos622 < ActiveRecord::Migration[4.2] setting.save! setting_map = { - 'password_min_size' => 'Password needs to have at least minimal size of characters.', + 'password_min_size' => 'Password needs to have at least minimal size of characters.', 'password_min_2_lower_2_upper_characters' => 'Password needs to contain 2 lower and 2 upper characters.', - 'password_need_digit' => 'Password needs to have at least one digit.', - 'ticket_subject_size' => 'Max size of the subject in an email reply.', - 'postmaster_follow_up_search_in' => 'In default the follow up check is done via the subject of an email. With this setting you can add more fields where the follow up check is executed.', + 'password_need_digit' => 'Password needs to have at least one digit.', + 'ticket_subject_size' => 'Max size of the subject in an email reply.', + 'postmaster_follow_up_search_in' => 'In default the follow up check is done via the subject of an email. With this setting you can add more fields where the follow up check is executed.', } setting_map.each do |key, description| diff --git a/db/migrate/20170117000001_unable_to_enable_time_accounting_633.rb b/db/migrate/20170117000001_unable_to_enable_time_accounting_633.rb index 3e57eb1ad..c05ba0828 100644 --- a/db/migrate/20170117000001_unable_to_enable_time_accounting_633.rb +++ b/db/migrate/20170117000001_unable_to_enable_time_accounting_633.rb @@ -5,17 +5,17 @@ class UnableToEnableTimeAccounting633 < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Time Accounting', - name: 'time_accounting', - area: 'Web::Base', + title: 'Time Accounting', + name: 'time_accounting', + area: 'Web::Base', description: 'Enable time accounting.', - options: { + options: { form: [ { display: '', - null: true, - name: 'time_accounting', - tag: 'boolean', + null: true, + name: 'time_accounting', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -25,28 +25,28 @@ class UnableToEnableTimeAccounting633 < ActiveRecord::Migration[4.2] }, preferences: { authentication: true, - permission: ['admin.time_accounting'], + permission: ['admin.time_accounting'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Time Accounting Selector', - name: 'time_accounting_selector', - area: 'Web::Base', + title: 'Time Accounting Selector', + name: 'time_accounting_selector', + area: 'Web::Base', description: 'Enable time accounting for this tickets.', - options: { + options: { form: [ {}, ], }, preferences: { authentication: true, - permission: ['admin.time_accounting'], + permission: ['admin.time_accounting'], }, - state: {}, - frontend: true + state: {}, + frontend: true ) end end diff --git a/db/migrate/20170123000001_ui_ticket_zoom_article_new_internal.rb b/db/migrate/20170123000001_ui_ticket_zoom_article_new_internal.rb index bf48384d6..d29e606c9 100644 --- a/db/migrate/20170123000001_ui_ticket_zoom_article_new_internal.rb +++ b/db/migrate/20170123000001_ui_ticket_zoom_article_new_internal.rb @@ -5,31 +5,31 @@ class UiTicketZoomArticleNewInternal < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Define default visibility of new a new article', - name: 'ui_ticket_zoom_article_new_internal', - area: 'UI::TicketZoom', + title: 'Define default visibility of new a new article', + name: 'ui_ticket_zoom_article_new_internal', + area: 'UI::TicketZoom', description: 'Set default visibility of new a new article.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_new_internal', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_new_internal', + tag: 'boolean', translate: true, - options: { + options: { true => 'internal', false => 'public', }, }, ], }, - state: true, + state: true, preferences: { - prio: 1, + prio: 1, permission: ['admin.ui'], }, - frontend: true + frontend: true ) end end diff --git a/db/migrate/20170126091128_application_secret_setting.rb b/db/migrate/20170126091128_application_secret_setting.rb index 7529caf65..0fbd50075 100644 --- a/db/migrate/20170126091128_application_secret_setting.rb +++ b/db/migrate/20170126091128_application_secret_setting.rb @@ -5,16 +5,16 @@ class ApplicationSecretSetting < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Application secret', - name: 'application_secret', - area: 'Core', + title: 'Application secret', + name: 'application_secret', + area: 'Core', description: 'Defines the random application secret.', - options: {}, - state: SecureRandom.hex(128), + options: {}, + state: SecureRandom.hex(128), preferences: { permission: ['admin'], }, - frontend: false + frontend: false ) end end diff --git a/db/migrate/20170130000001_follow_up_possible_check_643.rb b/db/migrate/20170130000001_follow_up_possible_check_643.rb index 392b4a58b..80b8110c9 100644 --- a/db/migrate/20170130000001_follow_up_possible_check_643.rb +++ b/db/migrate/20170130000001_follow_up_possible_check_643.rb @@ -5,49 +5,49 @@ class FollowUpPossibleCheck643 < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Define postmaster filter.', - name: '0200_postmaster_filter_follow_up_possible_check', - area: 'Postmaster::PreFilter', + title: 'Define postmaster filter.', + name: '0200_postmaster_filter_follow_up_possible_check', + area: 'Postmaster::PreFilter', description: 'Define postmaster filter to check if follow ups get created (based on admin settings).', - options: {}, - state: 'Channel::Filter::FollowUpPossibleCheck', - frontend: false + options: {}, + state: 'Channel::Filter::FollowUpPossibleCheck', + frontend: false ) ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'follow_up_possible', - display: 'Follow up possible', - data_type: 'select', + force: true, + object: 'Group', + name: 'follow_up_possible', + display: 'Follow up possible', + data_type: 'select', data_option: { - default: 'yes', - options: { - yes: 'yes', + default: 'yes', + options: { + yes: 'yes', new_ticket: 'do not reopen Ticket but create new Ticket' }, - null: false, - note: 'Follow up for closed ticket possible or not.', + null: false, + note: 'Follow up for closed ticket possible or not.', translate: true }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 400, ) end diff --git a/db/migrate/20170203000003_do_not_import_onw_notifications_731.rb b/db/migrate/20170203000003_do_not_import_onw_notifications_731.rb index f0811e96b..3e6198468 100644 --- a/db/migrate/20170203000003_do_not_import_onw_notifications_731.rb +++ b/db/migrate/20170203000003_do_not_import_onw_notifications_731.rb @@ -5,13 +5,13 @@ class DoNotImportOnwNotifications731 < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Define postmaster filter.', - name: '0014_postmaster_filter_own_notification_loop_detection', - area: 'Postmaster::PreFilter', + title: 'Define postmaster filter.', + name: '0014_postmaster_filter_own_notification_loop_detection', + area: 'Postmaster::PreFilter', description: 'Define postmaster filter to check if email is a own created notification email, then ignore it to prevent email loops.', - options: {}, - state: 'Channel::Filter::OwnNotificationLoopDetection', - frontend: false + options: {}, + state: 'Channel::Filter::OwnNotificationLoopDetection', + frontend: false ) end diff --git a/db/migrate/20170215000001_telegram_support.rb b/db/migrate/20170215000001_telegram_support.rb index d9ac61ee8..9d4da9dba 100644 --- a/db/migrate/20170215000001_telegram_support.rb +++ b/db/migrate/20170215000001_telegram_support.rb @@ -5,15 +5,15 @@ class TelegramSupport < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Permission.create_if_not_exists( - name: 'admin.channel_telegram', - note: 'Manage %s', + name: 'admin.channel_telegram', + note: 'Manage %s', preferences: { translations: ['Channel - Telegram'] }, ) Ticket::Article::Type.create_if_not_exists( - name: 'telegram personal-message', + name: 'telegram personal-message', communication: true, updated_by_id: 1, created_by_id: 1, diff --git a/db/migrate/20170403000001_fixed_admin_user_permission_920.rb b/db/migrate/20170403000001_fixed_admin_user_permission_920.rb index a80073b67..4ca888bce 100644 --- a/db/migrate/20170403000001_fixed_admin_user_permission_920.rb +++ b/db/migrate/20170403000001_fixed_admin_user_permission_920.rb @@ -5,510 +5,510 @@ class FixedAdminUserPermission920 < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'customer_id', - display: 'Customer', - data_type: 'user_autocompletion', + force: true, + object: 'Ticket', + name: 'customer_id', + display: 'Customer', + data_type: 'user_autocompletion', data_option: { - relation: 'User', + relation: 'User', autocapitalize: false, - multiple: false, - guess: true, - null: false, - limit: 200, - placeholder: 'Enter Person or Organization/Company', - minLengt: 2, - translate: false, - permission: ['ticket.agent'], + multiple: false, + guess: true, + null: false, + limit: 200, + placeholder: 'Enter Person or Organization/Company', + minLengt: 2, + translate: false, + permission: ['ticket.agent'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_top: { '-all-' => { null: false, }, }, - edit: {}, + edit: {}, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 10, + to_create: false, + to_migrate: false, + to_delete: false, + position: 10, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'type', - display: 'Type', - data_type: 'select', + force: true, + object: 'Ticket', + name: 'type', + display: 'Type', + data_type: 'select', data_option: { - default: '', - options: { - 'Incident' => 'Incident', - 'Problem' => 'Problem', + default: '', + options: { + 'Incident' => 'Incident', + 'Problem' => 'Problem', 'Request for Change' => 'Request for Change', }, nulloption: true, - multiple: false, - null: true, - translate: true, + multiple: false, + null: true, + translate: true, }, - editable: true, - active: false, - screens: { + editable: true, + active: false, + screens: { create_middle: { '-all-' => { - null: false, + null: false, item_class: 'column', }, }, - edit: { + edit: { 'ticket.agent' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 20, + to_create: false, + to_migrate: false, + to_delete: false, + position: 20, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'group_id', - display: 'Group', - data_type: 'select', + force: true, + object: 'Ticket', + name: 'group_id', + display: 'Group', + data_type: 'select', data_option: { - default: '', - relation: 'Group', - relation_condition: { access: 'full' }, - nulloption: true, - multiple: false, - null: false, - translate: false, + default: '', + relation: 'Group', + relation_condition: { access: 'full' }, + nulloption: true, + multiple: false, + null: false, + translate: false, only_shown_if_selectable: true, - permission: ['ticket.agent', 'ticket.customer'], + permission: ['ticket.agent', 'ticket.customer'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: { '-all-' => { - null: false, + null: false, item_class: 'column', }, }, - edit: { + edit: { 'ticket.agent' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 25, + to_create: false, + to_migrate: false, + to_delete: false, + position: 25, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'owner_id', - display: 'Owner', - data_type: 'select', + force: true, + object: 'Ticket', + name: 'owner_id', + display: 'Owner', + data_type: 'select', data_option: { - default: '', - relation: 'User', + default: '', + relation: 'User', relation_condition: { roles: 'Agent' }, - nulloption: true, - multiple: false, - null: true, - translate: false, - permission: ['ticket.agent'], + nulloption: true, + multiple: false, + null: true, + translate: false, + permission: ['ticket.agent'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: { '-all-' => { - null: true, + null: true, item_class: 'column', }, }, - edit: { + edit: { '-all-' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 30, + to_create: false, + to_migrate: false, + to_delete: false, + position: 30, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'state_id', - display: 'State', - data_type: 'select', + force: true, + object: 'Ticket', + name: 'state_id', + display: 'State', + data_type: 'select', data_option: { - relation: 'TicketState', + relation: 'TicketState', nulloption: true, - multiple: false, - null: false, - default: Ticket::State.find_by(default_follow_up: true).id, - translate: true, - filter: Ticket::State.by_category(:viewable).pluck(:id), + multiple: false, + null: false, + default: Ticket::State.find_by(default_follow_up: true).id, + translate: true, + filter: Ticket::State.by_category(:viewable).pluck(:id), }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: { - 'ticket.agent' => { - null: false, + 'ticket.agent' => { + null: false, item_class: 'column', - filter: Ticket::State.by_category(:viewable_agent_new).pluck(:id), + filter: Ticket::State.by_category(:viewable_agent_new).pluck(:id), }, 'ticket.customer' => { item_class: 'column', nulloption: false, - null: true, - filter: Ticket::State.by_category(:viewable_customer_new).pluck(:id), - default: Ticket::State.find_by(name: 'new').id, + null: true, + filter: Ticket::State.by_category(:viewable_customer_new).pluck(:id), + default: Ticket::State.find_by(name: 'new').id, }, }, - edit: { - 'ticket.agent' => { + edit: { + 'ticket.agent' => { nulloption: false, - null: false, - filter: Ticket::State.by_category(:viewable_agent_edit).pluck(:id), + null: false, + filter: Ticket::State.by_category(:viewable_agent_edit).pluck(:id), }, 'ticket.customer' => { nulloption: false, - null: true, - filter: Ticket::State.by_category(:viewable_customer_edit).pluck(:id), - default: Ticket::State.find_by(name: 'open').id, + null: true, + filter: Ticket::State.by_category(:viewable_customer_edit).pluck(:id), + default: Ticket::State.find_by(name: 'open').id, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 40, + to_create: false, + to_migrate: false, + to_delete: false, + position: 40, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'pending_time', - display: 'Pending till', - data_type: 'datetime', + force: true, + object: 'Ticket', + name: 'pending_time', + display: 'Pending till', + data_type: 'datetime', data_option: { - future: true, - past: false, - diff: 24, - null: true, - translate: true, + future: true, + past: false, + diff: 24, + null: true, + translate: true, required_if: { state_id: Ticket::State.by_category(:pending).pluck(:id), }, - shown_if: { + shown_if: { state_id: Ticket::State.by_category(:pending).pluck(:id), }, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: { '-all-' => { - null: false, + null: false, item_class: 'column', }, }, - edit: { + edit: { '-all-' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 41, + to_create: false, + to_migrate: false, + to_delete: false, + position: 41, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'priority_id', - display: 'Priority', - data_type: 'select', + force: true, + object: 'Ticket', + name: 'priority_id', + display: 'Priority', + data_type: 'select', data_option: { - relation: 'TicketPriority', + relation: 'TicketPriority', nulloption: false, - multiple: false, - null: false, - default: Ticket::Priority.find_by(default_create: true).id, - translate: true, + multiple: false, + null: false, + default: Ticket::Priority.find_by(default_create: true).id, + translate: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: { 'ticket.agent' => { - null: false, + null: false, item_class: 'column', }, }, - edit: { + edit: { 'ticket.agent' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 80, + to_create: false, + to_migrate: false, + to_delete: false, + position: 80, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'tags', - display: 'Tags', - data_type: 'tag', + force: true, + object: 'Ticket', + name: 'tags', + display: 'Tags', + data_type: 'tag', data_option: { - type: 'text', - null: true, + type: 'text', + null: true, translate: false, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_bottom: { 'ticket.agent' => { null: true, }, }, - edit: {}, + edit: {}, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 900, + to_create: false, + to_migrate: false, + to_delete: false, + position: 900, ) ObjectManager::Attribute.add( - force: true, - object: 'TicketArticle', - name: 'type_id', - display: 'Type', - data_type: 'select', + force: true, + object: 'TicketArticle', + name: 'type_id', + display: 'Type', + data_type: 'select', data_option: { - relation: 'TicketArticleType', + relation: 'TicketArticleType', nulloption: false, - multiple: false, - null: false, - default: Ticket::Article::Type.lookup(name: 'note').id, - translate: true, + multiple: false, + null: false, + default: Ticket::Article::Type.lookup(name: 'note').id, + translate: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: {}, - edit: { + edit: { 'ticket.agent' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 100, + to_create: false, + to_migrate: false, + to_delete: false, + position: 100, ) # rubocop:disable Lint/BooleanSymbol ObjectManager::Attribute.add( - force: true, - object: 'TicketArticle', - name: 'internal', - display: 'Visibility', - data_type: 'select', + force: true, + object: 'TicketArticle', + name: 'internal', + display: 'Visibility', + data_type: 'select', data_option: { - options: { + options: { true: 'internal', false: 'public' }, nulloption: false, - multiple: false, - null: true, - default: false, - translate: true, + multiple: false, + null: true, + default: false, + translate: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: {}, - edit: { + edit: { 'ticket.agent' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 200, + to_create: false, + to_migrate: false, + to_delete: false, + position: 200, ) # rubocop:enable Lint/BooleanSymbol ObjectManager::Attribute.add( - force: true, - object: 'TicketArticle', - name: 'to', - display: 'To', - data_type: 'input', + force: true, + object: 'TicketArticle', + name: 'to', + display: 'To', + data_type: 'input', data_option: { - type: 'text', + type: 'text', maxlength: 1000, - null: true, + null: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: {}, - edit: { + edit: { 'ticket.agent' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 300, + to_create: false, + to_migrate: false, + to_delete: false, + position: 300, ) ObjectManager::Attribute.add( - force: true, - object: 'TicketArticle', - name: 'cc', - display: 'Cc', - data_type: 'input', + force: true, + object: 'TicketArticle', + name: 'cc', + display: 'Cc', + data_type: 'input', data_option: { - type: 'text', + type: 'text', maxlength: 1000, - null: true, + null: true, }, - editable: false, - active: true, - screens: { - create_top: {}, + editable: false, + active: true, + screens: { + create_top: {}, create_middle: {}, - edit: { + edit: { 'ticket.agent' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 400, ) ObjectManager::Attribute.add( - force: true, - object: 'TicketArticle', - name: 'body', - display: 'Text', - data_type: 'richtext', + force: true, + object: 'TicketArticle', + name: 'body', + display: 'Text', + data_type: 'richtext', data_option: { - type: 'richtext', + type: 'richtext', maxlength: 20_000, - upload: true, - rows: 8, - null: true, + upload: true, + rows: 8, + null: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_top: { '-all-' => { null: false, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 600, + to_create: false, + to_migrate: false, + to_delete: false, + position: 600, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'password', - display: 'Password', - data_type: 'input', + force: true, + object: 'User', + name: 'password', + display: 'Password', + data_type: 'input', data_option: { - type: 'password', - maxlength: 100, - null: true, + type: 'password', + maxlength: 100, + null: true, autocomplete: 'off', - item_class: 'formGroup--halfSize', + item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: { + editable: false, + active: true, + screens: { + signup: { '-all-' => { null: false, }, }, - invite_agent: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { 'admin.user' => { null: true, }, }, - view: {} + view: {} }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1400, ) # rubocop:disable Lint/BooleanSymbol ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'vip', - display: 'VIP', - data_type: 'boolean', + force: true, + object: 'User', + name: 'vip', + display: 'VIP', + data_type: 'boolean', data_option: { - null: true, - default: false, + null: true, + default: false, item_class: 'formGroup--halfSize', - options: { + options: { false: 'no', - true: 'yes', + true: 'yes', }, - translate: true, + translate: true, permission: ['admin.user', 'ticket.agent'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: true, @@ -520,108 +520,108 @@ class FixedAdminUserPermission920 < ActiveRecord::Migration[4.2] }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1490, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1490, ) # rubocop:enable Lint/BooleanSymbol ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'role_ids', - display: 'Permissions', - data_type: 'user_permission', + force: true, + object: 'User', + name: 'role_ids', + display: 'Permissions', + data_type: 'user_permission', data_option: { - null: false, + null: false, item_class: 'checkbox', permission: ['admin.user'], }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: { '-all-' => { - null: false, + null: false, default: [Role.lookup(name: 'Agent').id], }, }, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1600, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1600, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'active', - display: 'Active', - data_type: 'active', + force: true, + object: 'User', + name: 'active', + display: 'Active', + data_type: 'active', data_option: { - null: true, - default: true, + null: true, + default: true, permission: ['admin.user', 'ticket.agent'], }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: false, }, }, - view: { + view: { '-all-' => { shown: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1800, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1800, ) # rubocop:disable Lint/BooleanSymbol ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'shared', - display: 'Shared organization', - data_type: 'boolean', + force: true, + object: 'Organization', + name: 'shared', + display: 'Shared organization', + data_type: 'boolean', data_option: { - null: true, - default: true, - note: 'Customers in the organization can view each other items.', + null: true, + default: true, + note: 'Customers in the organization can view each other items.', item_class: 'formGroup--halfSize', - options: { - true: 'yes', + options: { + true: 'yes', false: 'no', }, - translate: true, + translate: true, permission: ['admin.organization'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: false, @@ -633,33 +633,33 @@ class FixedAdminUserPermission920 < ActiveRecord::Migration[4.2] }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1400, ) ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'domain_assignment', - display: 'Domain based assignment', - data_type: 'boolean', + force: true, + object: 'Organization', + name: 'domain_assignment', + display: 'Domain based assignment', + data_type: 'boolean', data_option: { - null: true, - default: false, - note: 'Assign Users based on users domain.', + null: true, + default: false, + note: 'Assign Users based on users domain.', item_class: 'formGroup--halfSize', - options: { - true: 'yes', + options: { + true: 'yes', false: 'no', }, - translate: true, + translate: true, permission: ['admin.organization'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: false, @@ -671,27 +671,27 @@ class FixedAdminUserPermission920 < ActiveRecord::Migration[4.2] }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1410, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1410, ) # rubocop:enable Lint/BooleanSymbol ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'active', - display: 'Active', - data_type: 'active', + force: true, + object: 'Organization', + name: 'active', + display: 'Active', + data_type: 'active', data_option: { - null: true, - default: true, + null: true, + default: true, permission: ['admin.organization'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: false, @@ -703,51 +703,51 @@ class FixedAdminUserPermission920 < ActiveRecord::Migration[4.2] }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1800, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1800, ) ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'active', - display: 'Active', - data_type: 'active', + force: true, + object: 'Group', + name: 'active', + display: 'Active', + data_type: 'active', data_option: { - null: true, - default: true, + null: true, + default: true, permission: ['admin.group'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-': { null: false, }, }, - view: { + view: { '-all-' => { shown: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1800, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1800, ) map = { - Admin: 'admin', - Agent: 'ticket.agent', + Admin: 'admin', + Agent: 'ticket.agent', Customer: 'ticket.customer', } ObjectManager::Attribute.all.each do |attribute| diff --git a/db/migrate/20170418000001_validate_agent_limit.rb b/db/migrate/20170418000001_validate_agent_limit.rb index 32e9f30b6..6c6f4fd40 100644 --- a/db/migrate/20170418000001_validate_agent_limit.rb +++ b/db/migrate/20170418000001_validate_agent_limit.rb @@ -4,14 +4,14 @@ class ValidateAgentLimit < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Set limit of agents', - name: 'system_agent_limit', - area: 'Core::Online', + title: 'Set limit of agents', + name: 'system_agent_limit', + area: 'Core::Online', description: 'Defines the limit of the agents.', - options: {}, - state: false, + options: {}, + state: false, preferences: { online_service_disable: true }, - frontend: false + frontend: false ) end end diff --git a/db/migrate/20170419000001_ldap_support.rb b/db/migrate/20170419000001_ldap_support.rb index 5984098d0..c460e8757 100644 --- a/db/migrate/20170419000001_ldap_support.rb +++ b/db/migrate/20170419000001_ldap_support.rb @@ -21,34 +21,34 @@ class LdapSupport < ActiveRecord::Migration[4.2] end Setting.create_or_update( - title: 'Authentication via %s', - name: 'auth_ldap', - area: 'Security::Authentication', + title: 'Authentication via %s', + name: 'auth_ldap', + area: 'Security::Authentication', description: 'Enables user authentication via %s.', preferences: { - title_i18n: ['LDAP'], + title_i18n: ['LDAP'], description_i18n: ['LDAP'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: { + state: { adapter: 'Auth::Ldap', login_attributes: %w[login email], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'LDAP integration', - name: 'ldap_integration', - area: 'Integration::Switch', + title: 'LDAP integration', + name: 'ldap_integration', + area: 'Integration::Switch', description: 'Defines if LDAP is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ldap_integration', - tag: 'boolean', + null: true, + name: 'ldap_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -56,26 +56,26 @@ class LdapSupport < ActiveRecord::Migration[4.2] }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'LDAP config', - name: 'ldap_config', - area: 'Integration::LDAP', + title: 'LDAP config', + name: 'ldap_config', + area: 'Integration::LDAP', description: 'Defines the LDAP config.', - options: {}, - state: {}, + options: {}, + state: {}, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Scheduler.create_or_update( @@ -98,7 +98,7 @@ class LdapSupport < ActiveRecord::Migration[4.2] preferences: { permission: ['admin'], }, - frontend: false + frontend: false ) end diff --git a/db/migrate/20170421000001_pretty_date_options_added.rb b/db/migrate/20170421000001_pretty_date_options_added.rb index 18ab212e2..3ed947a66 100644 --- a/db/migrate/20170421000001_pretty_date_options_added.rb +++ b/db/migrate/20170421000001_pretty_date_options_added.rb @@ -5,17 +5,17 @@ class PrettyDateOptionsAdded < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_or_update( - title: 'Pretty Date', - name: 'pretty_date_format', - area: 'System::Branding', + title: 'Pretty Date', + name: 'pretty_date_format', + area: 'System::Branding', description: 'Defines pretty date format.', - options: { + options: { form: [ { display: '', - null: false, - name: 'pretty_date_format', - tag: 'select', + null: false, + name: 'pretty_date_format', + tag: 'select', options: { 'relative': 'relative - e. g. "2 hours ago" or "2 days and 15 minutes ago"', 'absolute': 'absolute - e. g. "Monday 09:30" or "Tuesday 23. Feb 14:20"', @@ -24,12 +24,12 @@ class PrettyDateOptionsAdded < ActiveRecord::Migration[4.2] ], }, preferences: { - render: true, - prio: 10, + render: true, + prio: 10, permission: ['admin.branding'], }, - state: 'relative', - frontend: true + state: 'relative', + frontend: true ) Scheduler.create_or_update( diff --git a/db/migrate/20170504144100_follow_up_merged.rb b/db/migrate/20170504144100_follow_up_merged.rb index 73f31c66b..e8056f295 100644 --- a/db/migrate/20170504144100_follow_up_merged.rb +++ b/db/migrate/20170504144100_follow_up_merged.rb @@ -5,13 +5,13 @@ class FollowUpMerged < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0110_postmaster_filter_follow_up_merged', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0110_postmaster_filter_follow_up_merged', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify follow-up ticket for merged tickets.', - options: {}, - state: 'Channel::Filter::FollowUpMerged', - frontend: false + options: {}, + state: 'Channel::Filter::FollowUpMerged', + frontend: false ) end end diff --git a/db/migrate/20170525000001_reply_to_sender_feature.rb b/db/migrate/20170525000001_reply_to_sender_feature.rb index 25982e6fa..72ed3a9d1 100644 --- a/db/migrate/20170525000001_reply_to_sender_feature.rb +++ b/db/migrate/20170525000001_reply_to_sender_feature.rb @@ -5,17 +5,17 @@ class ReplyToSenderFeature < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Sender based on Reply-To header', - name: 'postmaster_sender_based_on_reply_to', - area: 'Email::Base', + title: 'Sender based on Reply-To header', + name: 'postmaster_sender_based_on_reply_to', + area: 'Email::Base', description: 'Set/overwrite sender/from of email based on reply-to header. Useful to set correct customer if email is received from a third party system on behalf of a customer.', - options: { + options: { form: [ { display: '', - null: true, - name: 'postmaster_sender_based_on_reply_to', - tag: 'select', + null: true, + name: 'postmaster_sender_based_on_reply_to', + tag: 'select', options: { '' => '-', 'as_sender_of_email' => 'Take reply-to header as sender/from of email.', @@ -24,21 +24,21 @@ class ReplyToSenderFeature < ActiveRecord::Migration[4.2] }, ], }, - state: '', + state: '', preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0011_postmaster_sender_based_on_reply_to', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0011_postmaster_sender_based_on_reply_to', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to set the sender/from of emails based on reply-to header.', - options: {}, - state: 'Channel::Filter::ReplyToBasedSender', - frontend: false + options: {}, + state: 'Channel::Filter::ReplyToBasedSender', + frontend: false ) end diff --git a/db/migrate/20170529000002_setting_delivery_permanent_failed.rb b/db/migrate/20170529000002_setting_delivery_permanent_failed.rb index c830e1a90..dbc39dea1 100644 --- a/db/migrate/20170529000002_setting_delivery_permanent_failed.rb +++ b/db/migrate/20170529000002_setting_delivery_permanent_failed.rb @@ -11,23 +11,23 @@ class SettingDeliveryPermanentFailed < ActiveRecord::Migration[4.2] setting.save! else Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0900_postmaster_filter_bounce_follow_up_check', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0900_postmaster_filter_bounce_follow_up_check', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify postmaster bounced - to handle it as follow-up of the original ticket.', - options: {}, - state: 'Channel::Filter::BounceFollowUpCheck', - frontend: false + options: {}, + state: 'Channel::Filter::BounceFollowUpCheck', + frontend: false ) end Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0950_postmaster_filter_bounce_delivery_permanent_failed', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0950_postmaster_filter_bounce_delivery_permanent_failed', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify postmaster bounced - disable sending notification on permanent deleivery failed.', - options: {}, - state: 'Channel::Filter::BounceDeliveryPermanentFailed', - frontend: false + options: {}, + state: 'Channel::Filter::BounceDeliveryPermanentFailed', + frontend: false ) end diff --git a/db/migrate/20170628000001_form_group_selection.rb b/db/migrate/20170628000001_form_group_selection.rb index 08ab93599..ed2e7e367 100644 --- a/db/migrate/20170628000001_form_group_selection.rb +++ b/db/migrate/20170628000001_form_group_selection.rb @@ -13,90 +13,90 @@ class FormGroupSelection < ActiveRecord::Migration[4.2] group_id = group.id end Setting.create_if_not_exists( - title: 'Group selection for Ticket creation', - name: 'form_ticket_create_group_id', - area: 'Form::Base', + title: 'Group selection for Ticket creation', + name: 'form_ticket_create_group_id', + area: 'Form::Base', description: 'Defines if group of created tickets via web form.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'form_ticket_create_group_id', - tag: 'select', + display: '', + null: true, + name: 'form_ticket_create_group_id', + tag: 'select', relation: 'Group', }, ], }, - state: group_id, + state: group_id, preferences: { permission: ['admin.channel_formular'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Limit tickets by ip per hour', - name: 'form_ticket_create_by_ip_per_hour', - area: 'Form::Base', + title: 'Limit tickets by ip per hour', + name: 'form_ticket_create_by_ip_per_hour', + area: 'Form::Base', description: 'Defines limit of tickets by ip per hour via web form.', - options: { + options: { form: [ { display: '', - null: true, - name: 'form_ticket_create_by_ip_per_hour', - tag: 'input', + null: true, + name: 'form_ticket_create_by_ip_per_hour', + tag: 'input', }, ], }, - state: 20, + state: 20, preferences: { permission: ['admin.channel_formular'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Limit tickets by ip per day', - name: 'form_ticket_create_by_ip_per_day', - area: 'Form::Base', + title: 'Limit tickets by ip per day', + name: 'form_ticket_create_by_ip_per_day', + area: 'Form::Base', description: 'Defines limit of tickets by ip per day via web form.', - options: { + options: { form: [ { display: '', - null: true, - name: 'form_ticket_create_by_ip_per_day', - tag: 'input', + null: true, + name: 'form_ticket_create_by_ip_per_day', + tag: 'input', }, ], }, - state: 240, + state: 240, preferences: { permission: ['admin.channel_formular'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Limit tickets per day', - name: 'form_ticket_create_per_day', - area: 'Form::Base', + title: 'Limit tickets per day', + name: 'form_ticket_create_per_day', + area: 'Form::Base', description: 'Defines limit of tickets per day via web form.', - options: { + options: { form: [ { display: '', - null: true, - name: 'form_ticket_create_per_day', - tag: 'input', + null: true, + name: 'form_ticket_create_per_day', + tag: 'input', }, ], }, - state: 5000, + state: 5000, preferences: { permission: ['admin.channel_formular'], }, - frontend: false, + frontend: false, ) end diff --git a/db/migrate/20170629000001_exchange_integration.rb b/db/migrate/20170629000001_exchange_integration.rb index 0db4f53ab..2d715a750 100644 --- a/db/migrate/20170629000001_exchange_integration.rb +++ b/db/migrate/20170629000001_exchange_integration.rb @@ -7,30 +7,30 @@ class ExchangeIntegration < ActiveRecord::Migration[4.2] Setting.set('import_backends', ['Import::Ldap', 'Import::Exchange']) Setting.create_if_not_exists( - title: 'Exchange config', - name: 'exchange_config', - area: 'Integration::Exchange', + title: 'Exchange config', + name: 'exchange_config', + area: 'Integration::Exchange', description: 'Defines the Exchange config.', - options: {}, - state: {}, + options: {}, + state: {}, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Exchange integration', - name: 'exchange_integration', - area: 'Integration::Switch', + title: 'Exchange integration', + name: 'exchange_integration', + area: 'Integration::Switch', description: 'Defines if Exchange is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'exchange_integration', - tag: 'boolean', + null: true, + name: 'exchange_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -38,13 +38,13 @@ class ExchangeIntegration < ActiveRecord::Migration[4.2] }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) end diff --git a/db/migrate/20170713000001_omniauth_office365_setting.rb b/db/migrate/20170713000001_omniauth_office365_setting.rb index f7a3c85b6..553aeafd8 100644 --- a/db/migrate/20170713000001_omniauth_office365_setting.rb +++ b/db/migrate/20170713000001_omniauth_office365_setting.rb @@ -5,17 +5,17 @@ class OmniauthOffice365Setting < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_microsoft_office365', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_microsoft_office365', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_microsoft_office365', - tag: 'boolean', + null: true, + name: 'auth_microsoft_office365', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -24,41 +24,41 @@ class OmniauthOffice365Setting < ActiveRecord::Migration[4.2] ], }, preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_microsoft_office365_credentials'], - title_i18n: ['Office 365'], + controller: 'SettingsAreaSwitch', + sub: ['auth_microsoft_office365_credentials'], + title_i18n: ['Office 365'], description_i18n: ['Office 365', 'Microsoft Application Registration Portal', 'https://apps.dev.microsoft.com'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Office 365 App Credentials', - name: 'auth_microsoft_office365_credentials', - area: 'Security::ThirdPartyAuthentication::Office365', + title: 'Office 365 App Credentials', + name: 'auth_microsoft_office365_credentials', + area: 'Security::ThirdPartyAuthentication::Office365', description: 'Enables user authentication via Office 365.', - options: { + options: { form: [ { display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', + null: true, + name: 'app_id', + tag: 'input', }, { display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', + null: true, + name: 'app_secret', + tag: 'input', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) end end diff --git a/db/migrate/20170713000002_ticket_zoom_setting2.rb b/db/migrate/20170713000002_ticket_zoom_setting2.rb index a8025af44..ec397a5d8 100644 --- a/db/migrate/20170713000002_ticket_zoom_setting2.rb +++ b/db/migrate/20170713000002_ticket_zoom_setting2.rb @@ -14,112 +14,112 @@ class TicketZoomSetting2 < ActiveRecord::Migration[4.2] setting.save! end Setting.create_if_not_exists( - title: 'Note - default visibility', - name: 'ui_ticket_zoom_article_note_new_internal', - area: 'UI::TicketZoom', + title: 'Note - default visibility', + name: 'ui_ticket_zoom_article_note_new_internal', + area: 'UI::TicketZoom', description: 'Default visibility for new articles.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_note_new_internal', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_note_new_internal', + tag: 'boolean', translate: true, - options: { + options: { true => 'internal', false => 'public', }, }, ], }, - state: true, + state: true, preferences: { - prio: 100, + prio: 100, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Email - subject field', - name: 'ui_ticket_zoom_article_email_subject', - area: 'UI::TicketZoom', + title: 'Email - subject field', + name: 'ui_ticket_zoom_article_email_subject', + area: 'UI::TicketZoom', description: 'Use subject field for emails. If disabled, the ticket title will be used as subject.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_email_subject', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_email_subject', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { - prio: 200, + prio: 200, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Email - full quote', - name: 'ui_ticket_zoom_article_email_full_quote', - area: 'UI::TicketZoom', + title: 'Email - full quote', + name: 'ui_ticket_zoom_article_email_full_quote', + area: 'UI::TicketZoom', description: 'Enable if you want to quote the full email in your answer. The quoted email will be put at the end of your answer. If you just want to quote a certain phrase, just mark the text and press reply (this feature is always available).', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_email_full_quote', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_email_full_quote', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { - prio: 220, + prio: 220, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Twitter - tweet initials', - name: 'ui_ticket_zoom_article_twitter_initials', - area: 'UI::TicketZoom', + title: 'Twitter - tweet initials', + name: 'ui_ticket_zoom_article_twitter_initials', + area: 'UI::TicketZoom', description: 'Add sender initials to end of a tweet.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_twitter_initials', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_twitter_initials', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: true, + state: true, preferences: { - prio: 300, + prio: 300, permission: ['admin.ui'], }, - frontend: true + frontend: true ) end diff --git a/db/migrate/20170714000001_object_manager_user_email_optional.rb b/db/migrate/20170714000001_object_manager_user_email_optional.rb index 447b5f257..7733b2c25 100644 --- a/db/migrate/20170714000001_object_manager_user_email_optional.rb +++ b/db/migrate/20170714000001_object_manager_user_email_optional.rb @@ -5,26 +5,26 @@ class ObjectManagerUserEmailOptional < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'email', - display: 'Email', - data_type: 'input', + force: true, + object: 'User', + name: 'email', + display: 'Email', + data_type: 'input', data_option: { - type: 'email', - maxlength: 150, - null: true, + type: 'email', + maxlength: 150, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: { + editable: false, + active: true, + screens: { + signup: { '-all-' => { null: false, }, }, - invite_agent: { + invite_agent: { '-all-' => { null: false, }, @@ -34,21 +34,21 @@ class ObjectManagerUserEmailOptional < ActiveRecord::Migration[4.2] null: false, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 400, ) end end diff --git a/db/migrate/20170714000002_user_email_multiple_use.rb b/db/migrate/20170714000002_user_email_multiple_use.rb index e260307bc..da0323db0 100644 --- a/db/migrate/20170714000002_user_email_multiple_use.rb +++ b/db/migrate/20170714000002_user_email_multiple_use.rb @@ -5,17 +5,17 @@ class UserEmailMultipleUse < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'User email for muliple users', - name: 'user_email_multiple_use', - area: 'Model::User', + title: 'User email for muliple users', + name: 'user_email_multiple_use', + area: 'Model::User', description: 'Allow to use email address for muliple users.', - options: { + options: { form: [ { display: '', - null: true, - name: 'user_email_multiple_use', - tag: 'boolean', + null: true, + name: 'user_email_multiple_use', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -23,11 +23,11 @@ class UserEmailMultipleUse < ActiveRecord::Migration[4.2] }, ], }, - state: false, + state: false, preferences: { permission: ['admin'], }, - frontend: false + frontend: false ) end diff --git a/db/migrate/20170714000003_cleanup_cti_log.rb b/db/migrate/20170714000003_cleanup_cti_log.rb index d46902091..726c4463b 100644 --- a/db/migrate/20170714000003_cleanup_cti_log.rb +++ b/db/migrate/20170714000003_cleanup_cti_log.rb @@ -5,11 +5,11 @@ class CleanupCtiLog < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Scheduler.create_if_not_exists( - name: 'Cleanup Cti::Log', - method: 'Cti::Log.cleanup', - period: 1.month, - prio: 2, - active: true, + name: 'Cleanup Cti::Log', + method: 'Cti::Log.cleanup', + period: 1.month, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) diff --git a/db/migrate/20170727000001_setting_proxy.rb b/db/migrate/20170727000001_setting_proxy.rb index 0f69b9ed5..328951274 100644 --- a/db/migrate/20170727000001_setting_proxy.rb +++ b/db/migrate/20170727000001_setting_proxy.rb @@ -5,53 +5,53 @@ class SettingProxy < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Proxy Settings', - name: 'proxy', - area: 'System::Network', + title: 'Proxy Settings', + name: 'proxy', + area: 'System::Network', description: 'Address of the proxy server for http and https resources.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'proxy', - tag: 'input', + display: '', + null: false, + name: 'proxy', + tag: 'input', placeholder: 'proxy.example.com:3128', }, ], }, - state: '', + state: '', preferences: { online_service_disable: true, - controller: 'SettingsAreaProxy', - prio: 1, - permission: ['admin.system'], + controller: 'SettingsAreaProxy', + prio: 1, + permission: ['admin.system'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Proxy User', - name: 'proxy_username', - area: 'System::Network', + title: 'Proxy User', + name: 'proxy_username', + area: 'System::Network', description: 'Username for proxy connection.', - options: { + options: { form: [ { display: '', - null: false, - name: 'proxy_username', - tag: 'input', + null: false, + name: 'proxy_username', + tag: 'input', }, ], }, - state: '', + state: '', preferences: { - disabled: true, + disabled: true, online_service_disable: true, - prio: 2, - permission: ['admin.system'], + prio: 2, + permission: ['admin.system'], }, - frontend: false + frontend: false ) # fix typo setting = Setting.find_by(name: 'proxy_password') @@ -60,53 +60,53 @@ class SettingProxy < ActiveRecord::Migration[4.2] setting.save! else Setting.create_if_not_exists( - title: 'Proxy Password', - name: 'proxy_password', - area: 'System::Network', + title: 'Proxy Password', + name: 'proxy_password', + area: 'System::Network', description: 'Password for proxy connection.', - options: { + options: { form: [ { display: '', - null: false, - name: 'proxy_password', - tag: 'input', + null: false, + name: 'proxy_password', + tag: 'input', }, ], }, - state: '', + state: '', preferences: { - disabled: true, + disabled: true, online_service_disable: true, - prio: 3, - permission: ['admin.system'], + prio: 3, + permission: ['admin.system'], }, - frontend: false + frontend: false ) end Setting.create_if_not_exists( - title: 'No Proxy', - name: 'proxy_no', - area: 'System::Network', + title: 'No Proxy', + name: 'proxy_no', + area: 'System::Network', description: 'No proxy for the following hosts.', - options: { + options: { form: [ { display: '', - null: false, - name: 'proxy_no', - tag: 'input', + null: false, + name: 'proxy_no', + tag: 'input', }, ], }, - state: 'localhost,127.0.0.0,::1', + state: 'localhost,127.0.0.0,::1', preferences: { - disabled: true, + disabled: true, online_service_disable: true, - prio: 4, - permission: ['admin.system'], + prio: 4, + permission: ['admin.system'], }, - frontend: false + frontend: false ) end diff --git a/db/migrate/20170816000001_idoit_support.rb b/db/migrate/20170816000001_idoit_support.rb index acf8d7123..66b6bc48e 100644 --- a/db/migrate/20170816000001_idoit_support.rb +++ b/db/migrate/20170816000001_idoit_support.rb @@ -5,17 +5,17 @@ class IdoitSupport < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'i-doit integration', - name: 'idoit_integration', - area: 'Integration::Switch', + title: 'i-doit integration', + name: 'idoit_integration', + area: 'Integration::Switch', description: 'Defines if i-doit (http://www.i-doit) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'idoit_integration', - tag: 'boolean', + null: true, + name: 'idoit_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -23,26 +23,26 @@ class IdoitSupport < ActiveRecord::Migration[4.2] }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'i-doit config', - name: 'idoit_config', - area: 'Integration::Idoit', + title: 'i-doit config', + name: 'idoit_config', + area: 'Integration::Idoit', description: 'Defines the i-doit config.', - options: {}, - state: {}, + options: {}, + state: {}, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) end diff --git a/db/migrate/20170910000002_out_of_office2.rb b/db/migrate/20170910000002_out_of_office2.rb index dae2ce062..262769a47 100644 --- a/db/migrate/20170910000002_out_of_office2.rb +++ b/db/migrate/20170910000002_out_of_office2.rb @@ -24,29 +24,29 @@ class OutOfOffice2 < ActiveRecord::Migration[4.2] role_ids = Role.with_permissions(['ticket.agent']).map(&:id) overview_role = Role.find_by(name: 'Agent') Overview.create_or_update( - name: 'My replacement Tickets', - link: 'my_replacement_tickets', - prio: 1080, - role_ids: role_ids, + name: 'My replacement Tickets', + link: 'my_replacement_tickets', + prio: 1080, + role_ids: role_ids, out_of_office: true, - condition: { - 'ticket.state_id' => { + condition: { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:open).pluck(:id), + value: Ticket::State.by_category(:open).pluck(:id), }, 'ticket.out_of_office_replacement_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer group owner escalation_at], - s: %w[title customer group owner escalation_at], - m: %w[number title customer group owner escalation_at], + view: { + d: %w[title customer group owner escalation_at], + s: %w[title customer group owner escalation_at], + m: %w[number title customer group owner escalation_at], view_mode_default: 's', }, updated_by_id: 1, diff --git a/db/migrate/20170924054554_weibo_oauth2.rb b/db/migrate/20170924054554_weibo_oauth2.rb index 39df6a38f..02ecad20f 100644 --- a/db/migrate/20170924054554_weibo_oauth2.rb +++ b/db/migrate/20170924054554_weibo_oauth2.rb @@ -5,17 +5,17 @@ class WeiboOauth2 < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_weibo', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_weibo', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_weibo', - tag: 'boolean', + null: true, + name: 'auth_weibo', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -24,41 +24,41 @@ class WeiboOauth2 < ActiveRecord::Migration[4.2] ], }, preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_weibo_credentials'], - title_i18n: ['Weibo'], + controller: 'SettingsAreaSwitch', + sub: ['auth_weibo_credentials'], + title_i18n: ['Weibo'], description_i18n: ['Weibo', 'Sina Weibo Open Portal', 'http://open.weibo.com'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Weibo App Credentials', - name: 'auth_weibo_credentials', - area: 'Security::ThirdPartyAuthentication::Weibo', + title: 'Weibo App Credentials', + name: 'auth_weibo_credentials', + area: 'Security::ThirdPartyAuthentication::Weibo', description: 'Enables user authentication via Sina Weibo.', - options: { + options: { form: [ { display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', + null: true, + name: 'app_id', + tag: 'input', }, { display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', + null: true, + name: 'app_secret', + tag: 'input', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) end end diff --git a/db/migrate/20171024000001_monit_integration.rb b/db/migrate/20171024000001_monit_integration.rb index 0e9e1009e..56d22522a 100644 --- a/db/migrate/20171024000001_monit_integration.rb +++ b/db/migrate/20171024000001_monit_integration.rb @@ -5,17 +5,17 @@ class MonitIntegration < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Monit integration', - name: 'monit_integration', - area: 'Integration::Switch', + title: 'Monit integration', + name: 'monit_integration', + area: 'Integration::Switch', description: 'Defines if Monit (https://mmonit.com/monit/) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'monit_integration', - tag: 'boolean', + null: true, + name: 'monit_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -23,49 +23,49 @@ class MonitIntegration < ActiveRecord::Migration[4.2] }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Sender', - name: 'monit_sender', - area: 'Integration::Monit', + title: 'Sender', + name: 'monit_sender', + area: 'Integration::Monit', description: 'Defines the sender email address of the service emails.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'monit_sender', - tag: 'input', + display: '', + null: false, + name: 'monit_sender', + tag: 'input', placeholder: 'monit@monitoring.example.com', }, ], }, - state: 'monit@monitoring.example.com', + state: 'monit@monitoring.example.com', preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Auto close', - name: 'monit_auto_close', - area: 'Integration::Monit', + title: 'Auto close', + name: 'monit_auto_close', + area: 'Integration::Monit', description: 'Defines if tickets should be closed if service is recovered.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'monit_auto_close', - tag: 'boolean', - options: { + display: '', + null: true, + name: 'monit_auto_close', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, @@ -73,45 +73,45 @@ class MonitIntegration < ActiveRecord::Migration[4.2] }, ], }, - state: true, + state: true, preferences: { - prio: 3, + prio: 3, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Auto close state', - name: 'monit_auto_close_state_id', - area: 'Integration::Monit', + title: 'Auto close state', + name: 'monit_auto_close_state_id', + area: 'Integration::Monit', description: 'Defines the state of auto closed tickets.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'monit_auto_close_state_id', - tag: 'select', - relation: 'TicketState', + display: '', + null: false, + name: 'monit_auto_close_state_id', + tag: 'select', + relation: 'TicketState', translate: true, }, ], }, - state: 4, + state: 4, preferences: { - prio: 4, + prio: 4, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '5300_postmaster_filter_monit', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '5300_postmaster_filter_monit', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to manage Monit (https://mmonit.com/monit/) emails.', - options: {}, - state: 'Channel::Filter::Monit', - frontend: false + options: {}, + state: 'Channel::Filter::Monit', + frontend: false ) end diff --git a/db/migrate/20171024000002_check_mk_integration2.rb b/db/migrate/20171024000002_check_mk_integration2.rb index 9b38e652b..a8ad18669 100644 --- a/db/migrate/20171024000002_check_mk_integration2.rb +++ b/db/migrate/20171024000002_check_mk_integration2.rb @@ -5,17 +5,17 @@ class CheckMkIntegration2 < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Check_MK integration', - name: 'check_mk_integration', - area: 'Integration::Switch', + title: 'Check_MK integration', + name: 'check_mk_integration', + area: 'Integration::Switch', description: 'Defines if Check_MK (http://mathias-kettner.com/check_mk.html) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'check_mk_integration', - tag: 'boolean', + null: true, + name: 'check_mk_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -23,72 +23,72 @@ class CheckMkIntegration2 < ActiveRecord::Migration[4.2] }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Sender', - name: 'check_mk_sender', - area: 'Integration::CheckMK', + title: 'Sender', + name: 'check_mk_sender', + area: 'Integration::CheckMK', description: 'Defines the sender email address of the service emails.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'check_mk_sender', - tag: 'input', + display: '', + null: false, + name: 'check_mk_sender', + tag: 'input', placeholder: 'check_mk@monitoring.example.com', }, ], }, - state: 'check_mk@monitoring.example.com', + state: 'check_mk@monitoring.example.com', preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Group', - name: 'check_mk_group_id', - area: 'Integration::CheckMK', + title: 'Group', + name: 'check_mk_group_id', + area: 'Integration::CheckMK', description: 'Defines the group of created tickets.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'check_mk_group_id', - tag: 'select', + display: '', + null: false, + name: 'check_mk_group_id', + tag: 'select', relation: 'Group', }, ], }, - state: 1, + state: 1, preferences: { - prio: 3, + prio: 3, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Auto close', - name: 'check_mk_auto_close', - area: 'Integration::CheckMK', + title: 'Auto close', + name: 'check_mk_auto_close', + area: 'Integration::CheckMK', description: 'Defines if tickets should be closed if service is recovered.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'check_mk_auto_close', - tag: 'boolean', - options: { + display: '', + null: true, + name: 'check_mk_auto_close', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, @@ -96,57 +96,57 @@ class CheckMkIntegration2 < ActiveRecord::Migration[4.2] }, ], }, - state: true, + state: true, preferences: { - prio: 4, + prio: 4, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Auto close state', - name: 'check_mk_auto_close_state_id', - area: 'Integration::CheckMK', + title: 'Auto close state', + name: 'check_mk_auto_close_state_id', + area: 'Integration::CheckMK', description: 'Defines the state of auto closed tickets.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'check_mk_auto_close_state_id', - tag: 'select', - relation: 'TicketState', + display: '', + null: false, + name: 'check_mk_auto_close_state_id', + tag: 'select', + relation: 'TicketState', translate: true, }, ], }, - state: 4, + state: 4, preferences: { - prio: 5, + prio: 5, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Check_MK tolen', - name: 'check_mk_token', - area: 'Core', + title: 'Check_MK tolen', + name: 'check_mk_token', + area: 'Core', description: 'Defines the Check_MK token for allowing updates.', - options: {}, - state: SecureRandom.hex(16), + options: {}, + state: SecureRandom.hex(16), preferences: { permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '5200_postmaster_filter_check_mk', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '5200_postmaster_filter_check_mk', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to manage Check_MK (http://mathias-kettner.com/check_mk.html) emails.', - options: {}, - state: 'Channel::Filter::CheckMk', - frontend: false + options: {}, + state: 'Channel::Filter::CheckMk', + frontend: false ) end diff --git a/db/migrate/20171102000001_last_owner_update2.rb b/db/migrate/20171102000001_last_owner_update2.rb index 68e042744..a0d402c17 100644 --- a/db/migrate/20171102000001_last_owner_update2.rb +++ b/db/migrate/20171102000001_last_owner_update2.rb @@ -18,11 +18,11 @@ class LastOwnerUpdate2 < ActiveRecord::Migration[5.1] end Scheduler.create_if_not_exists( - name: 'Process auto unassign tickets', - method: 'Ticket.process_auto_unassign', - period: 10.minutes, - prio: 1, - active: true, + name: 'Process auto unassign tickets', + method: 'Ticket.process_auto_unassign', + period: 10.minutes, + prio: 1, + active: true, updated_by_id: 1, created_by_id: 1, ) diff --git a/db/migrate/20171123000001_email_process_customer_selection_based_on_sender_recipient.rb b/db/migrate/20171123000001_email_process_customer_selection_based_on_sender_recipient.rb index 54f04157f..89010f620 100644 --- a/db/migrate/20171123000001_email_process_customer_selection_based_on_sender_recipient.rb +++ b/db/migrate/20171123000001_email_process_customer_selection_based_on_sender_recipient.rb @@ -5,17 +5,17 @@ class EmailProcessCustomerSelectionBasedOnSenderRecipient < ActiveRecord::Migrat return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Customer selection based on sender and receiver list', - name: 'postmaster_sender_is_agent_search_for_customer', - area: 'Email::Base', + title: 'Customer selection based on sender and receiver list', + name: 'postmaster_sender_is_agent_search_for_customer', + area: 'Email::Base', description: 'If the sender is an agent, set the first user in the recipient list as a customer.', - options: { + options: { form: [ { display: '', - null: true, - name: 'postmaster_sender_is_agent_search_for_customer', - tag: 'boolean', + null: true, + name: 'postmaster_sender_is_agent_search_for_customer', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -23,11 +23,11 @@ class EmailProcessCustomerSelectionBasedOnSenderRecipient < ActiveRecord::Migrat }, ], }, - state: true, + state: true, preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) end diff --git a/db/migrate/20171203000001_setting_es_pipeline.rb b/db/migrate/20171203000001_setting_es_pipeline.rb index 81988acc1..ab4813f2a 100644 --- a/db/migrate/20171203000001_setting_es_pipeline.rb +++ b/db/migrate/20171203000001_setting_es_pipeline.rb @@ -5,13 +5,13 @@ class SettingEsPipeline < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Elasticsearch Pipeline Name', - name: 'es_pipeline', - area: 'SearchIndex::Elasticsearch', + title: 'Elasticsearch Pipeline Name', + name: 'es_pipeline', + area: 'SearchIndex::Elasticsearch', description: 'Define pipeline name for Elasticsearch.', - state: '', + state: '', preferences: { online_service_disable: true }, - frontend: false + frontend: false ) end end diff --git a/db/migrate/20171206000001_setting_default_locale2.rb b/db/migrate/20171206000001_setting_default_locale2.rb index 73b0cf1ba..6892b6973 100644 --- a/db/migrate/20171206000001_setting_default_locale2.rb +++ b/db/migrate/20171206000001_setting_default_locale2.rb @@ -12,24 +12,24 @@ class SettingDefaultLocale2 < ActiveRecord::Migration[5.1] end Setting.create_if_not_exists( - title: 'Locale', - name: 'locale_default', - area: 'System::Branding', + title: 'Locale', + name: 'locale_default', + area: 'System::Branding', description: 'Defines the system default language.', - options: { + options: { form: [ { name: 'locale_default', } ], }, - state: 'en-us', + state: 'en-us', preferences: { - prio: 8, + prio: 8, controller: 'SettingsAreaItemDefaultLocale', permission: ['admin.system'], }, - frontend: true + frontend: true ) end diff --git a/db/migrate/20171207000001_permission_user_preferences_out_of_office.rb b/db/migrate/20171207000001_permission_user_preferences_out_of_office.rb index b4191afd6..75b81087a 100644 --- a/db/migrate/20171207000001_permission_user_preferences_out_of_office.rb +++ b/db/migrate/20171207000001_permission_user_preferences_out_of_office.rb @@ -5,11 +5,11 @@ class PermissionUserPreferencesOutOfOffice < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Permission.create_if_not_exists( - name: 'user_preferences.out_of_office', - note: 'Change %s', + name: 'user_preferences.out_of_office', + note: 'Change %s', preferences: { translations: ['Out of Office'], - required: ['ticket.agent'], + required: ['ticket.agent'], }, ) end diff --git a/db/migrate/20180116000001_setting_ticket_number_ignore_system_id_support.rb b/db/migrate/20180116000001_setting_ticket_number_ignore_system_id_support.rb index d696691ca..ee094b1e3 100644 --- a/db/migrate/20180116000001_setting_ticket_number_ignore_system_id_support.rb +++ b/db/migrate/20180116000001_setting_ticket_number_ignore_system_id_support.rb @@ -5,17 +5,17 @@ class SettingTicketNumberIgnoreSystemIdSupport < ActiveRecord::Migration[4.2] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Ticket Number ignore system_id', - name: 'ticket_number_ignore_system_id', - area: 'Ticket::Core', + title: 'Ticket Number ignore system_id', + name: 'ticket_number_ignore_system_id', + area: 'Ticket::Core', description: '-', - options: { + options: { form: [ { display: 'Ignore system_id', - null: true, - name: 'ticket_number_ignore_system_id', - tag: 'boolean', + null: true, + name: 'ticket_number_ignore_system_id', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -23,14 +23,14 @@ class SettingTicketNumberIgnoreSystemIdSupport < ActiveRecord::Migration[4.2] }, ], }, - state: { + state: { ticket_number_ignore_system_id: false }, preferences: { permission: ['admin.ticket'], - hidden: true, + hidden: true, }, - frontend: false + frontend: false ) end diff --git a/db/migrate/20180202000001_sidebar_customer_open_ticket_colored.rb b/db/migrate/20180202000001_sidebar_customer_open_ticket_colored.rb index 594cc298b..8f509451d 100644 --- a/db/migrate/20180202000001_sidebar_customer_open_ticket_colored.rb +++ b/db/migrate/20180202000001_sidebar_customer_open_ticket_colored.rb @@ -5,30 +5,30 @@ class SidebarCustomerOpenTicketColored < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Open ticket indicator', - name: 'ui_sidebar_open_ticket_indicator_colored', - area: 'UI::Sidebar', + title: 'Open ticket indicator', + name: 'ui_sidebar_open_ticket_indicator_colored', + area: 'UI::Sidebar', description: 'Color representation of the open ticket indicator in the sidebar.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_sidebar_open_ticket_indicator_colored', - tag: 'boolean', + display: '', + null: true, + name: 'ui_sidebar_open_ticket_indicator_colored', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { permission: ['admin.ui'], }, - frontend: true + frontend: true ) end end diff --git a/db/migrate/20180220000001_setting_attachment_preview.rb b/db/migrate/20180220000001_setting_attachment_preview.rb index ef2357438..c68580c44 100644 --- a/db/migrate/20180220000001_setting_attachment_preview.rb +++ b/db/migrate/20180220000001_setting_attachment_preview.rb @@ -5,58 +5,58 @@ class SettingAttachmentPreview < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Sidebar Attachments', - name: 'ui_ticket_zoom_attachments_preview', - area: 'UI::TicketZoom::Preview', + title: 'Sidebar Attachments', + name: 'ui_ticket_zoom_attachments_preview', + area: 'UI::TicketZoom::Preview', description: 'Enables preview of attachments.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_attachments_preview', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_attachments_preview', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { - prio: 400, + prio: 400, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Sidebar Attachments', - name: 'ui_ticket_zoom_sidebar_article_attachments', - area: 'UI::TicketZoom::Preview', + title: 'Sidebar Attachments', + name: 'ui_ticket_zoom_sidebar_article_attachments', + area: 'UI::TicketZoom::Preview', description: 'Enables a sidebar to show an overview of all attachments.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_sidebar_article_attachments', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_sidebar_article_attachments', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { - prio: 500, + prio: 500, permission: ['admin.ui'], }, - frontend: true + frontend: true ) end end diff --git a/db/migrate/20180220000002_setting_user_organization_selector_with_email.rb b/db/migrate/20180220000002_setting_user_organization_selector_with_email.rb index 156ffedf2..c722ddce4 100644 --- a/db/migrate/20180220000002_setting_user_organization_selector_with_email.rb +++ b/db/migrate/20180220000002_setting_user_organization_selector_with_email.rb @@ -5,31 +5,31 @@ class SettingUserOrganizationSelectorWithEmail < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'User Organization Selector - email', - name: 'ui_user_organization_selector_with_email', - area: 'UI::UserOrganizatiomSelector', + title: 'User Organization Selector - email', + name: 'ui_user_organization_selector_with_email', + area: 'UI::UserOrganizatiomSelector', description: 'Display of the e-mail in the result of the user/organization widget.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_user_organization_selector_with_email', - tag: 'boolean', + display: '', + null: true, + name: 'ui_user_organization_selector_with_email', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { - prio: 100, + prio: 100, permission: ['admin.ui'], }, - frontend: true + frontend: true ) end end diff --git a/db/migrate/20180306084119_custom_html_email_css_font.rb b/db/migrate/20180306084119_custom_html_email_css_font.rb index a6f3dd1ad..1d7b0e6f3 100644 --- a/db/migrate/20180306084119_custom_html_email_css_font.rb +++ b/db/migrate/20180306084119_custom_html_email_css_font.rb @@ -5,16 +5,16 @@ class CustomHtmlEmailCssFont < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'HTML Email CSS Font', - name: 'html_email_css_font', - area: 'Core', + title: 'HTML Email CSS Font', + name: 'html_email_css_font', + area: 'Core', description: 'Defines the CSS font information for HTML Emails.', - options: {}, - state: "font-family:'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif; font-size: 12px;", + options: {}, + state: "font-family:'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif; font-size: 12px;", preferences: { permission: ['admin'], }, - frontend: false + frontend: false ) end diff --git a/db/migrate/20180320000001_setting_table_group_by_show_count.rb b/db/migrate/20180320000001_setting_table_group_by_show_count.rb index f415e5b14..a5a8641dc 100644 --- a/db/migrate/20180320000001_setting_table_group_by_show_count.rb +++ b/db/migrate/20180320000001_setting_table_group_by_show_count.rb @@ -5,30 +5,30 @@ class SettingTableGroupByShowCount < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Open ticket indicator', - name: 'ui_table_group_by_show_count', - area: 'UI::Base', + title: 'Open ticket indicator', + name: 'ui_table_group_by_show_count', + area: 'UI::Base', description: 'Total display of the number of objects in a grouping.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_table_group_by_show_count', - tag: 'boolean', + display: '', + null: true, + name: 'ui_table_group_by_show_count', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { permission: ['admin.ui'], }, - frontend: true + frontend: true ) end end diff --git a/db/migrate/20180418000001_setting_third_party_link_account_at_login.rb b/db/migrate/20180418000001_setting_third_party_link_account_at_login.rb index c43872708..e563a4d64 100644 --- a/db/migrate/20180418000001_setting_third_party_link_account_at_login.rb +++ b/db/migrate/20180418000001_setting_third_party_link_account_at_login.rb @@ -5,17 +5,17 @@ class SettingThirdPartyLinkAccountAtLogin < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Automatic account link on initial logon', - name: 'auth_third_party_auto_link_at_inital_login', - area: 'Security::ThirdPartyAuthentication', + title: 'Automatic account link on initial logon', + name: 'auth_third_party_auto_link_at_inital_login', + area: 'Security::ThirdPartyAuthentication', description: 'Enables the automatic linking of an existing account on initial login via a third party application. If this is disabled, an existing user must first log into Zammad and then link his "Third Party" account to his Zammad account via Profile -> Linked Accounts.', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_third_party_auto_link_at_inital_login', - tag: 'boolean', + null: true, + name: 'auth_third_party_auto_link_at_inital_login', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -25,10 +25,10 @@ class SettingThirdPartyLinkAccountAtLogin < ActiveRecord::Migration[5.1] }, preferences: { permission: ['admin.security'], - prio: 10, + prio: 10, }, - state: false, - frontend: false + state: false, + frontend: false ) end end diff --git a/db/migrate/20180508182850_ticket_create_types_setting_issue_1987.rb b/db/migrate/20180508182850_ticket_create_types_setting_issue_1987.rb index 73f94cfc7..fe2c9dec2 100644 --- a/db/migrate/20180508182850_ticket_create_types_setting_issue_1987.rb +++ b/db/migrate/20180508182850_ticket_create_types_setting_issue_1987.rb @@ -4,59 +4,59 @@ class TicketCreateTypesSettingIssue1987 < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Default type for a new ticket', - name: 'ui_ticket_create_default_type', - area: 'UI::TicketCreate', + title: 'Default type for a new ticket', + name: 'ui_ticket_create_default_type', + area: 'UI::TicketCreate', description: 'Select default ticket type', - options: { + options: { form: [ { - display: '', - null: false, + display: '', + null: false, multiple: false, - name: 'ui_ticket_create_default_type', - tag: 'select', - options: { - 'phone-in' => '1. Phone inbound', + name: 'ui_ticket_create_default_type', + tag: 'select', + options: { + 'phone-in' => '1. Phone inbound', 'phone-out' => '2. Phone outbound', 'email-out' => '3. Email outbound', }, }, ], }, - state: 'phone-in', + state: 'phone-in', preferences: { permission: ['admin.ui'] }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Available types for a new ticket', - name: 'ui_ticket_create_available_types', - area: 'UI::TicketCreate', + title: 'Available types for a new ticket', + name: 'ui_ticket_create_available_types', + area: 'UI::TicketCreate', description: 'Set available ticket types', - options: { + options: { form: [ { - display: '', - null: false, + display: '', + null: false, multiple: true, - name: 'ui_ticket_create_available_types', - tag: 'select', - options: { - 'phone-in' => '1. Phone inbound', + name: 'ui_ticket_create_available_types', + tag: 'select', + options: { + 'phone-in' => '1. Phone inbound', 'phone-out' => '2. Phone outbound', 'email-out' => '3. Email outbound', }, }, ], }, - state: %w[phone-in phone-out email-out], + state: %w[phone-in phone-out email-out], preferences: { permission: ['admin.ui'] }, - frontend: true + frontend: true ) end end diff --git a/db/migrate/20180518000001_issue2029_sipgate_integration_enable.rb b/db/migrate/20180518000001_issue2029_sipgate_integration_enable.rb index c9080b38d..d848c3542 100644 --- a/db/migrate/20180518000001_issue2029_sipgate_integration_enable.rb +++ b/db/migrate/20180518000001_issue2029_sipgate_integration_enable.rb @@ -7,17 +7,17 @@ class Issue2029SipgateIntegrationEnable < ActiveRecord::Migration[5.1] return if Setting.get('sipgate_config').present? Setting.create_or_update( - title: 'sipgate.io config', - name: 'sipgate_config', - area: 'Integration::Sipgate', + title: 'sipgate.io config', + name: 'sipgate_config', + area: 'Integration::Sipgate', description: 'Defines the sipgate.io config.', - options: {}, - state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, + options: {}, + state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) end diff --git a/db/migrate/20180518100316_email_forward_prefix_setting_issue_1730.rb b/db/migrate/20180518100316_email_forward_prefix_setting_issue_1730.rb index dec4b5cf0..6be0478c6 100644 --- a/db/migrate/20180518100316_email_forward_prefix_setting_issue_1730.rb +++ b/db/migrate/20180518100316_email_forward_prefix_setting_issue_1730.rb @@ -4,25 +4,25 @@ class EmailForwardPrefixSettingIssue1730 < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Ticket Subject Forward', - name: 'ticket_subject_fwd', - area: 'Email::Base', + title: 'Ticket Subject Forward', + name: 'ticket_subject_fwd', + area: 'Email::Base', description: 'The text at the beginning of the subject in an email forward, e. g. FWD.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ticket_subject_fwd', - tag: 'input', + null: true, + name: 'ticket_subject_fwd', + tag: 'input', }, ], }, - state: 'FWD', + state: 'FWD', preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) end end diff --git a/db/migrate/20180521141004_ticket_last_contact_behavior.rb b/db/migrate/20180521141004_ticket_last_contact_behavior.rb index 30d3828e7..f9bf1c65e 100644 --- a/db/migrate/20180521141004_ticket_last_contact_behavior.rb +++ b/db/migrate/20180521141004_ticket_last_contact_behavior.rb @@ -4,30 +4,30 @@ class TicketLastContactBehavior < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Ticket Last Contact Behaviour', - name: 'ticket_last_contact_behaviour', - area: 'Ticket::Base', + title: 'Ticket Last Contact Behaviour', + name: 'ticket_last_contact_behaviour', + area: 'Ticket::Base', description: 'Sets the last customer contact based on the last contact of a customer or on the last contact of a customer to whom an agent has not yet responded.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ticket_last_contact_behaviour', - tag: 'select', + display: '', + null: true, + name: 'ticket_last_contact_behaviour', + tag: 'select', translate: true, - options: { - 'based_on_customer_reaction' => 'Last customer contact (without consideration an agent has replied to it)', + options: { + 'based_on_customer_reaction' => 'Last customer contact (without consideration an agent has replied to it)', 'check_if_agent_already_replied' => 'Last customer contact (with consideration an agent has replied to it)', }, }, ], }, - state: 'check_if_agent_already_replied', + state: 'check_if_agent_already_replied', preferences: { permission: ['admin.ticket'], }, - frontend: false + frontend: false ) end end diff --git a/db/migrate/20180524182518_sms_support.rb b/db/migrate/20180524182518_sms_support.rb index e80f6dc89..3857c3e94 100644 --- a/db/migrate/20180524182518_sms_support.rb +++ b/db/migrate/20180524182518_sms_support.rb @@ -5,8 +5,8 @@ class SmsSupport < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Permission.create_if_not_exists( - name: 'admin.channel_sms', - note: 'Manage %s', + name: 'admin.channel_sms', + note: 'Manage %s', preferences: { translations: ['Channel - SMS'] }, diff --git a/db/migrate/20180529000001_issue_2035_recursive_ticket_trigger.rb b/db/migrate/20180529000001_issue_2035_recursive_ticket_trigger.rb index ea4a5e91a..c215f8a11 100644 --- a/db/migrate/20180529000001_issue_2035_recursive_ticket_trigger.rb +++ b/db/migrate/20180529000001_issue_2035_recursive_ticket_trigger.rb @@ -5,17 +5,17 @@ class Issue2035RecursiveTicketTrigger < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Recursive Ticket Triggers', - name: 'ticket_trigger_recursive', - area: 'Ticket::Core', + title: 'Recursive Ticket Triggers', + name: 'ticket_trigger_recursive', + area: 'Ticket::Core', description: 'Activate the recursive processing of ticket triggers.', - options: { + options: { form: [ { display: 'Recursive Ticket Triggers', - null: true, - name: 'ticket_trigger_recursive', - tag: 'boolean', + null: true, + name: 'ticket_trigger_recursive', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -23,35 +23,35 @@ class Issue2035RecursiveTicketTrigger < ActiveRecord::Migration[5.1] }, ], }, - state: false, + state: false, preferences: { permission: ['admin.ticket'], - hidden: true, + hidden: true, }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Recursive Ticket Triggers Loop Max.', - name: 'ticket_trigger_recursive_max_loop', - area: 'Ticket::Core', + title: 'Recursive Ticket Triggers Loop Max.', + name: 'ticket_trigger_recursive_max_loop', + area: 'Ticket::Core', description: 'Maximum number of recursively executed triggers.', - options: { + options: { form: [ { display: 'Recursive Ticket Triggers', - null: true, - name: 'ticket_trigger_recursive_max_loop', - tag: 'select', + null: true, + name: 'ticket_trigger_recursive_max_loop', + tag: 'select', options: { - 1 => ' 1', - 2 => ' 2', - 3 => ' 3', - 4 => ' 4', - 5 => ' 5', - 6 => ' 6', - 7 => ' 7', - 8 => ' 8', - 9 => ' 9', + 1 => ' 1', + 2 => ' 2', + 3 => ' 3', + 4 => ' 4', + 5 => ' 5', + 6 => ' 6', + 7 => ' 7', + 8 => ' 8', + 9 => ' 9', 10 => '10', 11 => '11', 12 => '12', @@ -67,12 +67,12 @@ class Issue2035RecursiveTicketTrigger < ActiveRecord::Migration[5.1] }, ], }, - state: 10, + state: 10, preferences: { permission: ['admin.ticket'], - hidden: true, + hidden: true, }, - frontend: false + frontend: false ) end diff --git a/db/migrate/20180604000001_setting_add_ticket_auto_assignment2.rb b/db/migrate/20180604000001_setting_add_ticket_auto_assignment2.rb index 61cadc108..90fa0472a 100644 --- a/db/migrate/20180604000001_setting_add_ticket_auto_assignment2.rb +++ b/db/migrate/20180604000001_setting_add_ticket_auto_assignment2.rb @@ -5,17 +5,17 @@ class SettingAddTicketAutoAssignment2 < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Auto Assigment', - name: 'ticket_auto_assignment', - area: 'Web::Base', + title: 'Auto Assigment', + name: 'ticket_auto_assignment', + area: 'Web::Base', description: 'Enable ticket auto assignment.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ticket_auto_assignment', - tag: 'boolean', + null: true, + name: 'ticket_auto_assignment', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -25,44 +25,44 @@ class SettingAddTicketAutoAssignment2 < ActiveRecord::Migration[5.1] }, preferences: { authentication: true, - permission: ['admin.ticket_auto_assignment'], + permission: ['admin.ticket_auto_assignment'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Time Accounting Selector', - name: 'ticket_auto_assignment_selector', - area: 'Web::Base', + title: 'Time Accounting Selector', + name: 'ticket_auto_assignment_selector', + area: 'Web::Base', description: 'Enable auto assignment for following matching tickets.', - options: { + options: { form: [ {}, ], }, preferences: { authentication: true, - permission: ['admin.ticket_auto_assignment'], + permission: ['admin.ticket_auto_assignment'], }, - state: { condition: { 'ticket.state_id' => { operator: 'is', value: Ticket::State.by_category(:work_on).pluck(:id) } } }, - frontend: true + state: { condition: { 'ticket.state_id' => { operator: 'is', value: Ticket::State.by_category(:work_on).pluck(:id) } } }, + frontend: true ) Setting.create_or_update( - title: 'Time Accounting Selector', - name: 'ticket_auto_assignment_user_ids_ignore', - area: 'Web::Base', + title: 'Time Accounting Selector', + name: 'ticket_auto_assignment_user_ids_ignore', + area: 'Web::Base', description: 'Define an exception of "automatic assignment" for certain users (e.g. executives).', - options: { + options: { form: [ {}, ], }, preferences: { authentication: true, - permission: ['admin.ticket_auto_assignment'], + permission: ['admin.ticket_auto_assignment'], }, - state: [], - frontend: true + state: [], + frontend: true ) end end diff --git a/db/migrate/20180622140531_sequencer_log_level_setting.rb b/db/migrate/20180622140531_sequencer_log_level_setting.rb index 083011a06..ba3dbc3da 100644 --- a/db/migrate/20180622140531_sequencer_log_level_setting.rb +++ b/db/migrate/20180622140531_sequencer_log_level_setting.rb @@ -16,27 +16,27 @@ class SequencerLogLevelSetting < ActiveRecord::Migration[5.1] unit: :debug, result: :debug, }, - state: { - optional: :debug, - set: :debug, - get: :debug, - attribute_initialization: { + state: { + optional: :debug, + set: :debug, + get: :debug, + attribute_initialization: { start_finish: :debug, attributes: :debug, }, - parameter_initialization: { + parameter_initialization: { parameters: :debug, start_finish: :debug, unused: :debug, }, expectations_initialization: :debug, - cleanup: { + cleanup: { start_finish: :debug, remove: :debug, } } }, - frontend: false, + frontend: false, ) end end diff --git a/db/migrate/20180711080554_issue_2100_utf8_encode_http_logs.rb b/db/migrate/20180711080554_issue_2100_utf8_encode_http_logs.rb index cb25522e3..b2936424c 100644 --- a/db/migrate/20180711080554_issue_2100_utf8_encode_http_logs.rb +++ b/db/migrate/20180711080554_issue_2100_utf8_encode_http_logs.rb @@ -4,7 +4,7 @@ class Issue2100Utf8EncodeHttpLogs < ActiveRecord::Migration[5.1] .limit(100_000) .order(created_at: :desc) .find_each do |log| - log.update(request: log.request.transform_values(&:utf8_encode), + log.update(request: log.request.transform_values(&:utf8_encode), response: log.response.transform_values(&:utf8_encode)) end end diff --git a/db/migrate/20180716060129_issue_2019_fix_double_domain_links_in_trigger_emails.rb b/db/migrate/20180716060129_issue_2019_fix_double_domain_links_in_trigger_emails.rb index a02c73a45..6514a0579 100644 --- a/db/migrate/20180716060129_issue_2019_fix_double_domain_links_in_trigger_emails.rb +++ b/db/migrate/20180716060129_issue_2019_fix_double_domain_links_in_trigger_emails.rb @@ -1,5 +1,5 @@ class Issue2019FixDoubleDomainLinksInTriggerEmails < ActiveRecord::Migration[5.1] - DOUBLE_DOMAIN_REGEX = %r{(?<=)} + DOUBLE_DOMAIN_REGEX = %r{(?<=)}.freeze def up return if !Setting.find_by(name: 'system_init_done') diff --git a/db/migrate/20180719033247_add_confidential_to_doorkeeper_application.rb b/db/migrate/20180719033247_add_confidential_to_doorkeeper_application.rb index f563a9669..16ac5c33e 100644 --- a/db/migrate/20180719033247_add_confidential_to_doorkeeper_application.rb +++ b/db/migrate/20180719033247_add_confidential_to_doorkeeper_application.rb @@ -6,7 +6,7 @@ class AddConfidentialToDoorkeeperApplication < ActiveRecord::Migration[5.1] :oauth_applications, :confidential, :boolean, - null: false, + null: false, default: true # maintaining backwards compatibility: require secrets ) end diff --git a/db/migrate/20180809000001_cti_generic_api.rb b/db/migrate/20180809000001_cti_generic_api.rb index 7b2494bc4..0bb55aabe 100644 --- a/db/migrate/20180809000001_cti_generic_api.rb +++ b/db/migrate/20180809000001_cti_generic_api.rb @@ -5,17 +5,17 @@ class CtiGenericApi < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'cti integration', - name: 'cti_integration', - area: 'Integration::Switch', + title: 'cti integration', + name: 'cti_integration', + area: 'Integration::Switch', description: 'Defines if generic CTI is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'cti_integration', - tag: 'boolean', + null: true, + name: 'cti_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -23,48 +23,48 @@ class CtiGenericApi < ActiveRecord::Migration[5.1] }, ], }, - state: false, + state: false, preferences: { - prio: 1, - trigger: ['menu:render', 'cti:reload'], + prio: 1, + trigger: ['menu:render', 'cti:reload'], authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'cti config', - name: 'cti_config', - area: 'Integration::Cti', + title: 'cti config', + name: 'cti_config', + area: 'Integration::Cti', description: 'Defines the cti config.', - options: {}, - state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, + options: {}, + state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'CTI Token', - name: 'cti_token', - area: 'Integration::Cti', + title: 'CTI Token', + name: 'cti_token', + area: 'Integration::Cti', description: 'Token for cti.', - options: { + options: { form: [ { display: '', - null: false, - name: 'cti_token', - tag: 'input', + null: false, + name: 'cti_token', + tag: 'input', }, ], }, - state: SecureRandom.urlsafe_base64(20), + state: SecureRandom.urlsafe_base64(20), preferences: { permission: ['admin.integration'], }, - frontend: false + frontend: false ) add_column :cti_logs, :queue, :string, limit: 250, null: true if !column_exists?(:cti_logs, :queue) diff --git a/db/migrate/20180830000001_setting_delivery_temporary_failed.rb b/db/migrate/20180830000001_setting_delivery_temporary_failed.rb index e1ed92dab..a9bc1dc05 100644 --- a/db/migrate/20180830000001_setting_delivery_temporary_failed.rb +++ b/db/migrate/20180830000001_setting_delivery_temporary_failed.rb @@ -5,13 +5,13 @@ class SettingDeliveryTemporaryFailed < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0955_postmaster_filter_bounce_delivery_temporary_failed', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0955_postmaster_filter_bounce_delivery_temporary_failed', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify postmaster bounced - reopen ticket on permanent temporary failed.', - options: {}, - state: 'Channel::Filter::BounceDeliveryTemporaryFailed', - frontend: false + options: {}, + state: 'Channel::Filter::BounceDeliveryTemporaryFailed', + frontend: false ) end diff --git a/db/migrate/20180913000001_setting_add_system_bcc.rb b/db/migrate/20180913000001_setting_add_system_bcc.rb index 9b9796964..11e39ed8c 100644 --- a/db/migrate/20180913000001_setting_add_system_bcc.rb +++ b/db/migrate/20180913000001_setting_add_system_bcc.rb @@ -5,14 +5,14 @@ class SettingAddSystemBcc < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Bcc address for all outgoing emails', - name: 'system_bcc', - area: 'Email::Enhanced', + title: 'Bcc address for all outgoing emails', + name: 'system_bcc', + area: 'Email::Enhanced', description: 'To archive all outgoing emails from Zammad to external, you can store a bcc email address here.', - options: {}, - state: '', + options: {}, + state: '', preferences: { online_service_disable: true }, - frontend: false + frontend: false ) end diff --git a/db/migrate/20180913000002_permission_add_time_accounting.rb b/db/migrate/20180913000002_permission_add_time_accounting.rb index 5776f63b8..79d609480 100644 --- a/db/migrate/20180913000002_permission_add_time_accounting.rb +++ b/db/migrate/20180913000002_permission_add_time_accounting.rb @@ -5,8 +5,8 @@ class PermissionAddTimeAccounting < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Permission.create_if_not_exists( - name: 'admin.time_accounting', - note: 'Manage %s', + name: 'admin.time_accounting', + note: 'Manage %s', preferences: { translations: ['Time Accounting'] }, diff --git a/db/migrate/20181010000000_setting_add_sipgate_alternative_fqdn.rb b/db/migrate/20181010000000_setting_add_sipgate_alternative_fqdn.rb index 512008d44..6e3a7da35 100644 --- a/db/migrate/20181010000000_setting_add_sipgate_alternative_fqdn.rb +++ b/db/migrate/20181010000000_setting_add_sipgate_alternative_fqdn.rb @@ -5,25 +5,25 @@ class SettingAddSipgateAlternativeFqdn < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'sipgate.io alternative fqdn', - name: 'sipgate_alternative_fqdn', - area: 'Integration::Sipgate::Expert', + title: 'sipgate.io alternative fqdn', + name: 'sipgate_alternative_fqdn', + area: 'Integration::Sipgate::Expert', description: 'Alternative FQDN for callbacks if you operate Zammad in internal network.', - options: { + options: { form: [ { display: '', - null: false, - name: 'sipgate_alternative_fqdn', - tag: 'input', + null: false, + name: 'sipgate_alternative_fqdn', + tag: 'input', }, ], }, - state: '', + state: '', preferences: { permission: ['admin.integration'], }, - frontend: false + frontend: false ) end diff --git a/db/migrate/20181030000001_setting_add_placetel1.rb b/db/migrate/20181030000001_setting_add_placetel1.rb index 5cb6cea3d..d2b25d04a 100644 --- a/db/migrate/20181030000001_setting_add_placetel1.rb +++ b/db/migrate/20181030000001_setting_add_placetel1.rb @@ -5,17 +5,17 @@ class SettingAddPlacetel1 < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Placetel integration', - name: 'placetel_integration', - area: 'Integration::Switch', + title: 'Placetel integration', + name: 'placetel_integration', + area: 'Integration::Switch', description: 'Defines if Placetel (http://www.placetel.de) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'placetel_integration', - tag: 'boolean', + null: true, + name: 'placetel_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -23,55 +23,55 @@ class SettingAddPlacetel1 < ActiveRecord::Migration[5.1] }, ], }, - state: false, + state: false, preferences: { - prio: 1, - trigger: ['menu:render', 'cti:reload'], + prio: 1, + trigger: ['menu:render', 'cti:reload'], authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) placetel_config = Setting.find_by(name: 'placetel_config') if !placetel_config Setting.create!( - title: 'Placetel config', - name: 'placetel_config', - area: 'Integration::Placetel', + title: 'Placetel config', + name: 'placetel_config', + area: 'Integration::Placetel', description: 'Defines the Placetel config.', - options: {}, - state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, + options: {}, + state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], - cache: ['placetelGetVoipUsers'], + cache: ['placetelGetVoipUsers'], }, - frontend: false, + frontend: false, ) else placetel_config.preferences[:cache] = ['placetelGetVoipUsers'] placetel_config.save! end Setting.create_if_not_exists( - title: 'PLACETEL Token', - name: 'placetel_token', - area: 'Integration::Placetel', + title: 'PLACETEL Token', + name: 'placetel_token', + area: 'Integration::Placetel', description: 'Token for placetel.', - options: { + options: { form: [ { display: '', - null: false, - name: 'placetel_token', - tag: 'input', + null: false, + name: 'placetel_token', + tag: 'input', }, ], }, - state: ENV['PLACETEL_TOKEN'] || SecureRandom.urlsafe_base64(20), + state: ENV['PLACETEL_TOKEN'] || SecureRandom.urlsafe_base64(20), preferences: { permission: ['admin.integration'], }, - frontend: false + frontend: false ) end end diff --git a/db/migrate/20181108123847_add_country_attribute_to_users.rb b/db/migrate/20181108123847_add_country_attribute_to_users.rb index e3d6efd0f..479304391 100644 --- a/db/migrate/20181108123847_add_country_attribute_to_users.rb +++ b/db/migrate/20181108123847_add_country_attribute_to_users.rb @@ -11,38 +11,38 @@ class AddCountryAttributeToUsers < ActiveRecord::Migration[5.1] return if current_country_attribute.present? ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'country', - display: 'Country', - data_type: 'input', - data_option: { - type: 'text', - maxlength: 100, - null: true, + force: true, + object: 'User', + name: 'country', + display: 'Country', + data_type: 'input', + data_option: { + type: 'text', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: true, - active: false, - screens: { - signup: {}, - invite_agent: {}, + editable: true, + active: false, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1325, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1325, created_by_id: 1, updated_by_id: 1, ) diff --git a/db/migrate/20181203000000_setting_add_email_full_quote_header.rb b/db/migrate/20181203000000_setting_add_email_full_quote_header.rb index 937d2c9d6..bb32d63d2 100644 --- a/db/migrate/20181203000000_setting_add_email_full_quote_header.rb +++ b/db/migrate/20181203000000_setting_add_email_full_quote_header.rb @@ -4,31 +4,31 @@ class SettingAddEmailFullQuoteHeader < ActiveRecord::Migration[5.1] return if !Setting.find_by(name: 'system_init_done') Setting.create_if_not_exists( - title: 'Email - quote header', - name: 'ui_ticket_zoom_article_email_full_quote_header', - area: 'UI::TicketZoom', + title: 'Email - quote header', + name: 'ui_ticket_zoom_article_email_full_quote_header', + area: 'UI::TicketZoom', description: 'Enable if you want a timestamped reply header to be automatically inserted in front of quoted messages.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_email_full_quote_header', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_email_full_quote_header', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: true, + state: true, preferences: { - prio: 240, + prio: 240, permission: ['admin.ui'], }, - frontend: true + frontend: true ) end end diff --git a/db/seeds.rb b/db/seeds.rb index edc5e5869..e713dfc80 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -27,8 +27,8 @@ DbHelper.import_post # install locales and translations Locale.create_if_not_exists( locale: 'en-us', - alias: 'en', - name: 'English (United States)', + alias: 'en', + name: 'English (United States)', ) Locale.sync Translation.sync diff --git a/db/seeds/channels.rb b/db/seeds/channels.rb index 94bdf200f..a6e5f8d0d 100644 --- a/db/seeds/channels.rb +++ b/db/seeds/channels.rb @@ -1,27 +1,27 @@ Channel.create_if_not_exists( - area: 'Email::Notification', - options: { + area: 'Email::Notification', + options: { outbound: { adapter: 'smtp', options: { - host: 'host.example.com', - user: '', + host: 'host.example.com', + user: '', password: '', - ssl: true, + ssl: true, }, }, }, - group_id: 1, + group_id: 1, preferences: { online_service_disable: true }, - active: false, + active: false, ) Channel.create_if_not_exists( - area: 'Email::Notification', - options: { + area: 'Email::Notification', + options: { outbound: { adapter: 'sendmail', }, }, preferences: { online_service_disable: true }, - active: true, + active: true, ) diff --git a/db/seeds/chats.rb b/db/seeds/chats.rb index 79f6b7314..982e62a54 100644 --- a/db/seeds/chats.rb +++ b/db/seeds/chats.rb @@ -1,8 +1,8 @@ Chat.create_if_not_exists( - name: 'default', - max_queue: 5, - note: '', - active: true, + name: 'default', + max_queue: 5, + note: '', + active: true, updated_by_id: 1, created_by_id: 1, ) diff --git a/db/seeds/community_user_resources.rb b/db/seeds/community_user_resources.rb index 12e467557..5f5daf4c2 100644 --- a/db/seeds/community_user_resources.rb +++ b/db/seeds/community_user_resources.rb @@ -1,16 +1,16 @@ org_community = Organization.create_if_not_exists( - id: 1, + id: 1, name: 'Zammad Foundation', ) user_community = User.create_or_update( - id: 2, - login: 'nicole.braun@zammad.org', - firstname: 'Nicole', - lastname: 'Braun', - email: 'nicole.braun@zammad.org', - password: '', - active: true, - roles: [ Role.find_by(name: 'Customer') ], + id: 2, + login: 'nicole.braun@zammad.org', + firstname: 'Nicole', + lastname: 'Braun', + email: 'nicole.braun@zammad.org', + password: '', + active: true, + roles: [ Role.find_by(name: 'Customer') ], organization_id: org_community.id, ) @@ -18,16 +18,16 @@ UserInfo.current_user_id = user_community.id if Ticket.count.zero? ticket = Ticket.create!( - group_id: Group.find_by(name: 'Users').id, + group_id: Group.find_by(name: 'Users').id, customer_id: User.find_by(login: 'nicole.braun@zammad.org').id, - title: 'Welcome to Zammad!', + title: 'Welcome to Zammad!', ) Ticket::Article.create!( ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'phone').id, + type_id: Ticket::Article::Type.find_by(name: 'phone').id, sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - from: 'Zammad Feedback ', - body: 'Welcome! + from: 'Zammad Feedback ', + body: 'Welcome! Thank you for choosing Zammad. @@ -39,7 +39,7 @@ if Ticket.count.zero? Your Zammad Team ', - internal: false, + internal: false, ) end diff --git a/db/seeds/groups.rb b/db/seeds/groups.rb index 994a22639..81c7ba40c 100644 --- a/db/seeds/groups.rb +++ b/db/seeds/groups.rb @@ -1,8 +1,8 @@ Group.create_if_not_exists( - id: 1, - name: 'Users', - signature_id: Signature.first.id, - note: 'Standard Group/Pool for Tickets.', + id: 1, + name: 'Users', + signature_id: Signature.first.id, + note: 'Standard Group/Pool for Tickets.', updated_by_id: 1, created_by_id: 1 ) diff --git a/db/seeds/karma_activities.rb b/db/seeds/karma_activities.rb index b6a6e0cc0..8f076fafa 100644 --- a/db/seeds/karma_activities.rb +++ b/db/seeds/karma_activities.rb @@ -1,66 +1,66 @@ Karma::Activity.create_or_update( - name: 'ticket create', + name: 'ticket create', description: 'You have created a ticket', - score: 10, - once_ttl: 60, + score: 10, + once_ttl: 60, ) Karma::Activity.create_or_update( - name: 'ticket close', + name: 'ticket close', description: 'You have closed a ticket', - score: 5, - once_ttl: 60, + score: 5, + once_ttl: 60, ) Karma::Activity.create_or_update( - name: 'ticket answer 1h', + name: 'ticket answer 1h', description: 'You have answered a ticket within 1h', - score: 25, - once_ttl: 60, + score: 25, + once_ttl: 60, ) Karma::Activity.create_or_update( - name: 'ticket answer 2h', + name: 'ticket answer 2h', description: 'You have answered a ticket within 2h', - score: 20, - once_ttl: 60, + score: 20, + once_ttl: 60, ) Karma::Activity.create_or_update( - name: 'ticket answer 12h', + name: 'ticket answer 12h', description: 'You have answered a ticket within 12h', - score: 10, - once_ttl: 60, + score: 10, + once_ttl: 60, ) Karma::Activity.create_or_update( - name: 'ticket answer 24h', + name: 'ticket answer 24h', description: 'You have answered a ticket within 24h', - score: 5, - once_ttl: 60, + score: 5, + once_ttl: 60, ) Karma::Activity.create_or_update( - name: 'ticket pending state', + name: 'ticket pending state', description: 'Usage of advanced features', - score: 2, - once_ttl: 60, + score: 2, + once_ttl: 60, ) Karma::Activity.create_or_update( - name: 'ticket escalated', + name: 'ticket escalated', description: 'You have escalated tickets', - score: -5, - once_ttl: 60 * 60 * 24, + score: -5, + once_ttl: 60 * 60 * 24, ) Karma::Activity.create_or_update( - name: 'ticket reminder overdue (+2 days)', + name: 'ticket reminder overdue (+2 days)', description: 'You have tickets that are over 2 days overdue', - score: -5, - once_ttl: 60 * 60 * 24, + score: -5, + once_ttl: 60 * 60 * 24, ) Karma::Activity.create_or_update( - name: 'text module', + name: 'text module', description: 'Usage of advanced features', - score: 4, - once_ttl: 60 * 30, + score: 4, + once_ttl: 60 * 30, ) Karma::Activity.create_or_update( - name: 'tagging', + name: 'tagging', description: 'Usage of advanced features', - score: 4, - once_ttl: 60 * 60 * 4, + score: 4, + once_ttl: 60 * 60 * 4, ) diff --git a/db/seeds/macros.rb b/db/seeds/macros.rb index 38909b5d3..997b961ca 100644 --- a/db/seeds/macros.rb +++ b/db/seeds/macros.rb @@ -1,19 +1,19 @@ Macro.create_if_not_exists( - name: 'Close & Tag as Spam', - perform: { + name: 'Close & Tag as Spam', + perform: { 'ticket.state_id' => { value: Ticket::State.by_category(:closed).first.id, }, - 'ticket.tags' => { + 'ticket.tags' => { operator: 'add', - value: 'spam', + value: 'spam', }, 'ticket.owner_id' => { pre_condition: 'current_user.id', - value: '', + value: '', }, }, ux_flow_next_up: 'next_task', - note: 'example macro', - active: true, + note: 'example macro', + active: true, ) diff --git a/db/seeds/object_manager_attributes.rb b/db/seeds/object_manager_attributes.rb index 7eb41f229..c8a3ae0a4 100644 --- a/db/seeds/object_manager_attributes.rb +++ b/db/seeds/object_manager_attributes.rb @@ -1,530 +1,530 @@ ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'title', - display: 'Title', - data_type: 'input', + force: true, + object: 'Ticket', + name: 'title', + display: 'Title', + data_type: 'input', data_option: { - type: 'text', + type: 'text', maxlength: 200, - null: false, + null: false, translate: false, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_top: { '-all-' => { null: false, }, }, - edit: {}, + edit: {}, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 15, + to_create: false, + to_migrate: false, + to_delete: false, + position: 15, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'customer_id', - display: 'Customer', - data_type: 'user_autocompletion', + force: true, + object: 'Ticket', + name: 'customer_id', + display: 'Customer', + data_type: 'user_autocompletion', data_option: { - relation: 'User', + relation: 'User', autocapitalize: false, - multiple: false, - guess: true, - null: false, - limit: 200, - placeholder: 'Enter Person or Organization/Company', - minLengt: 2, - translate: false, - permission: ['ticket.agent'], + multiple: false, + guess: true, + null: false, + limit: 200, + placeholder: 'Enter Person or Organization/Company', + minLengt: 2, + translate: false, + permission: ['ticket.agent'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_top: { '-all-' => { null: false, }, }, - edit: {}, + edit: {}, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 10, + to_create: false, + to_migrate: false, + to_delete: false, + position: 10, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'type', - display: 'Type', - data_type: 'select', + force: true, + object: 'Ticket', + name: 'type', + display: 'Type', + data_type: 'select', data_option: { - default: '', - options: { - 'Incident' => 'Incident', - 'Problem' => 'Problem', + default: '', + options: { + 'Incident' => 'Incident', + 'Problem' => 'Problem', 'Request for Change' => 'Request for Change', }, nulloption: true, - multiple: false, - null: true, - translate: true, + multiple: false, + null: true, + translate: true, }, - editable: true, - active: false, - screens: { + editable: true, + active: false, + screens: { create_middle: { '-all-' => { - null: false, + null: false, item_class: 'column', }, }, - edit: { + edit: { 'ticket.agent' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 20, + to_create: false, + to_migrate: false, + to_delete: false, + position: 20, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'group_id', - display: 'Group', - data_type: 'select', + force: true, + object: 'Ticket', + name: 'group_id', + display: 'Group', + data_type: 'select', data_option: { - default: '', - relation: 'Group', - relation_condition: { access: 'full' }, - nulloption: true, - multiple: false, - null: false, - translate: false, + default: '', + relation: 'Group', + relation_condition: { access: 'full' }, + nulloption: true, + multiple: false, + null: false, + translate: false, only_shown_if_selectable: true, - permission: ['ticket.agent', 'ticket.customer'], + permission: ['ticket.agent', 'ticket.customer'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: { '-all-' => { - null: false, + null: false, item_class: 'column', }, }, - edit: { + edit: { 'ticket.agent' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 25, + to_create: false, + to_migrate: false, + to_delete: false, + position: 25, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'owner_id', - display: 'Owner', - data_type: 'select', + force: true, + object: 'Ticket', + name: 'owner_id', + display: 'Owner', + data_type: 'select', data_option: { - default: '', - relation: 'User', + default: '', + relation: 'User', relation_condition: { roles: 'Agent' }, - nulloption: true, - multiple: false, - null: true, - translate: false, - permission: ['ticket.agent'], + nulloption: true, + multiple: false, + null: true, + translate: false, + permission: ['ticket.agent'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: { '-all-' => { - null: true, + null: true, item_class: 'column', }, }, - edit: { + edit: { '-all-' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 30, + to_create: false, + to_migrate: false, + to_delete: false, + position: 30, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'state_id', - display: 'State', - data_type: 'select', + force: true, + object: 'Ticket', + name: 'state_id', + display: 'State', + data_type: 'select', data_option: { - relation: 'TicketState', + relation: 'TicketState', nulloption: true, - multiple: false, - null: false, - default: Ticket::State.find_by(default_follow_up: true).id, - translate: true, - filter: Ticket::State.by_category(:viewable).pluck(:id), + multiple: false, + null: false, + default: Ticket::State.find_by(default_follow_up: true).id, + translate: true, + filter: Ticket::State.by_category(:viewable).pluck(:id), }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: { - 'ticket.agent' => { - null: false, + 'ticket.agent' => { + null: false, item_class: 'column', - filter: Ticket::State.by_category(:viewable_agent_new).pluck(:id), + filter: Ticket::State.by_category(:viewable_agent_new).pluck(:id), }, 'ticket.customer' => { item_class: 'column', nulloption: false, - null: true, - filter: Ticket::State.by_category(:viewable_customer_new).pluck(:id), - default: Ticket::State.find_by(default_create: true).id, + null: true, + filter: Ticket::State.by_category(:viewable_customer_new).pluck(:id), + default: Ticket::State.find_by(default_create: true).id, }, }, - edit: { - 'ticket.agent' => { + edit: { + 'ticket.agent' => { nulloption: false, - null: false, - filter: Ticket::State.by_category(:viewable_agent_edit).pluck(:id), + null: false, + filter: Ticket::State.by_category(:viewable_agent_edit).pluck(:id), }, 'ticket.customer' => { nulloption: false, - null: true, - filter: Ticket::State.by_category(:viewable_customer_edit).pluck(:id), - default: Ticket::State.find_by(default_follow_up: true).id, + null: true, + filter: Ticket::State.by_category(:viewable_customer_edit).pluck(:id), + default: Ticket::State.find_by(default_follow_up: true).id, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 40, + to_create: false, + to_migrate: false, + to_delete: false, + position: 40, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'pending_time', - display: 'Pending till', - data_type: 'datetime', + force: true, + object: 'Ticket', + name: 'pending_time', + display: 'Pending till', + data_type: 'datetime', data_option: { - future: true, - past: false, - diff: 24, - null: true, - translate: true, + future: true, + past: false, + diff: 24, + null: true, + translate: true, required_if: { state_id: Ticket::State.by_category(:pending).pluck(:id), }, - shown_if: { + shown_if: { state_id: Ticket::State.by_category(:pending).pluck(:id), }, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: { '-all-' => { - null: false, + null: false, item_class: 'column', }, }, - edit: { + edit: { '-all-' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 41, + to_create: false, + to_migrate: false, + to_delete: false, + position: 41, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'priority_id', - display: 'Priority', - data_type: 'select', + force: true, + object: 'Ticket', + name: 'priority_id', + display: 'Priority', + data_type: 'select', data_option: { - relation: 'TicketPriority', + relation: 'TicketPriority', nulloption: false, - multiple: false, - null: false, - default: Ticket::Priority.find_by(default_create: true).id, - translate: true, + multiple: false, + null: false, + default: Ticket::Priority.find_by(default_create: true).id, + translate: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: { 'ticket.agent' => { - null: false, + null: false, item_class: 'column', }, }, - edit: { + edit: { 'ticket.agent' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 80, + to_create: false, + to_migrate: false, + to_delete: false, + position: 80, ) ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'tags', - display: 'Tags', - data_type: 'tag', + force: true, + object: 'Ticket', + name: 'tags', + display: 'Tags', + data_type: 'tag', data_option: { - type: 'text', - null: true, + type: 'text', + null: true, translate: false, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_bottom: { 'ticket.agent' => { null: true, }, }, - edit: {}, + edit: {}, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 900, + to_create: false, + to_migrate: false, + to_delete: false, + position: 900, ) ObjectManager::Attribute.add( - force: true, - object: 'TicketArticle', - name: 'type_id', - display: 'Type', - data_type: 'select', + force: true, + object: 'TicketArticle', + name: 'type_id', + display: 'Type', + data_type: 'select', data_option: { - relation: 'TicketArticleType', + relation: 'TicketArticleType', nulloption: false, - multiple: false, - null: false, - default: Ticket::Article::Type.lookup(name: 'note').id, - translate: true, + multiple: false, + null: false, + default: Ticket::Article::Type.lookup(name: 'note').id, + translate: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: {}, - edit: { + edit: { 'ticket.agent' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 100, + to_create: false, + to_migrate: false, + to_delete: false, + position: 100, ) ObjectManager::Attribute.add( - force: true, - object: 'TicketArticle', - name: 'internal', - display: 'Visibility', - data_type: 'select', + force: true, + object: 'TicketArticle', + name: 'internal', + display: 'Visibility', + data_type: 'select', data_option: { - options: { + options: { true: 'internal', false: 'public' }, nulloption: false, - multiple: false, - null: true, - default: false, - translate: true, + multiple: false, + null: true, + default: false, + translate: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: {}, - edit: { + edit: { 'ticket.agent' => { null: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 200, + to_create: false, + to_migrate: false, + to_delete: false, + position: 200, ) ObjectManager::Attribute.add( - force: true, - object: 'TicketArticle', - name: 'to', - display: 'To', - data_type: 'input', + force: true, + object: 'TicketArticle', + name: 'to', + display: 'To', + data_type: 'input', data_option: { - type: 'text', + type: 'text', maxlength: 1000, - null: true, + null: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_middle: {}, - edit: { + edit: { 'ticket.agent' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 300, + to_create: false, + to_migrate: false, + to_delete: false, + position: 300, ) ObjectManager::Attribute.add( - force: true, - object: 'TicketArticle', - name: 'cc', - display: 'Cc', - data_type: 'input', + force: true, + object: 'TicketArticle', + name: 'cc', + display: 'Cc', + data_type: 'input', data_option: { - type: 'text', + type: 'text', maxlength: 1000, - null: true, + null: true, }, - editable: false, - active: true, - screens: { - create_top: {}, + editable: false, + active: true, + screens: { + create_top: {}, create_middle: {}, - edit: { + edit: { 'ticket.agent' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 400, ) ObjectManager::Attribute.add( - force: true, - object: 'TicketArticle', - name: 'body', - display: 'Text', - data_type: 'richtext', + force: true, + object: 'TicketArticle', + name: 'body', + display: 'Text', + data_type: 'richtext', data_option: { - type: 'richtext', + type: 'richtext', maxlength: 20_000, - upload: true, - rows: 8, - null: true, + upload: true, + rows: 8, + null: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create_top: { '-all-' => { null: false, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 600, + to_create: false, + to_migrate: false, + to_delete: false, + position: 600, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'login', - display: 'Login', - data_type: 'input', + force: true, + object: 'User', + name: 'login', + display: 'Login', + data_type: 'input', data_option: { - type: 'text', - maxlength: 100, - null: true, + type: 'text', + maxlength: 100, + null: true, autocapitalize: false, - item_class: 'formGroup--halfSize', + item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: {}, - view: { + edit: {}, + view: { '-all-' => { shown: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 100, + to_create: false, + to_migrate: false, + to_delete: false, + position: 100, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'firstname', - display: 'Firstname', - data_type: 'input', + force: true, + object: 'User', + name: 'firstname', + display: 'Firstname', + data_type: 'input', data_option: { - type: 'text', - maxlength: 150, - null: false, + type: 'text', + maxlength: 150, + null: false, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: { + editable: false, + active: true, + screens: { + signup: { '-all-' => { null: false, }, }, - invite_agent: { + invite_agent: { '-all-' => { null: false, }, @@ -534,44 +534,44 @@ ObjectManager::Attribute.add( null: false, }, }, - edit: { + edit: { '-all-' => { null: false, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 200, + to_create: false, + to_migrate: false, + to_delete: false, + position: 200, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'lastname', - display: 'Lastname', - data_type: 'input', + force: true, + object: 'User', + name: 'lastname', + display: 'Lastname', + data_type: 'input', data_option: { - type: 'text', - maxlength: 150, - null: false, + type: 'text', + maxlength: 150, + null: false, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: { + editable: false, + active: true, + screens: { + signup: { '-all-' => { null: false, }, }, - invite_agent: { + invite_agent: { '-all-' => { null: false, }, @@ -581,44 +581,44 @@ ObjectManager::Attribute.add( null: false, }, }, - edit: { + edit: { '-all-' => { null: false, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 300, + to_create: false, + to_migrate: false, + to_delete: false, + position: 300, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'email', - display: 'Email', - data_type: 'input', + force: true, + object: 'User', + name: 'email', + display: 'Email', + data_type: 'input', data_option: { - type: 'email', - maxlength: 150, - null: true, + type: 'email', + maxlength: 150, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: { + editable: false, + active: true, + screens: { + signup: { '-all-' => { null: false, }, }, - invite_agent: { + invite_agent: { '-all-' => { null: false, }, @@ -628,468 +628,468 @@ ObjectManager::Attribute.add( null: false, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 400, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'web', - display: 'Web', - data_type: 'input', + force: true, + object: 'User', + name: 'web', + display: 'Web', + data_type: 'input', data_option: { - type: 'url', - maxlength: 250, - null: true, + type: 'url', + maxlength: 250, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 500, + to_create: false, + to_migrate: false, + to_delete: false, + position: 500, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'phone', - display: 'Phone', - data_type: 'input', + force: true, + object: 'User', + name: 'phone', + display: 'Phone', + data_type: 'input', data_option: { - type: 'tel', - maxlength: 100, - null: true, + type: 'tel', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 600, + to_create: false, + to_migrate: false, + to_delete: false, + position: 600, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'mobile', - display: 'Mobile', - data_type: 'input', + force: true, + object: 'User', + name: 'mobile', + display: 'Mobile', + data_type: 'input', data_option: { - type: 'tel', - maxlength: 100, - null: true, + type: 'tel', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 700, + to_create: false, + to_migrate: false, + to_delete: false, + position: 700, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'fax', - display: 'Fax', - data_type: 'input', + force: true, + object: 'User', + name: 'fax', + display: 'Fax', + data_type: 'input', data_option: { - type: 'tel', - maxlength: 100, - null: true, + type: 'tel', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 800, + to_create: false, + to_migrate: false, + to_delete: false, + position: 800, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'organization_id', - display: 'Organization', - data_type: 'autocompletion_ajax', + force: true, + object: 'User', + name: 'organization_id', + display: 'Organization', + data_type: 'autocompletion_ajax', data_option: { - multiple: false, + multiple: false, nulloption: true, - null: true, - relation: 'Organization', + null: true, + relation: 'Organization', item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 900, + to_create: false, + to_migrate: false, + to_delete: false, + position: 900, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'department', - display: 'Department', - data_type: 'input', + force: true, + object: 'User', + name: 'department', + display: 'Department', + data_type: 'input', data_option: { - type: 'text', - maxlength: 200, - null: true, + type: 'text', + maxlength: 200, + null: true, item_class: 'formGroup--halfSize', }, - editable: true, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: true, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1000, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1000, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'street', - display: 'Street', - data_type: 'input', + force: true, + object: 'User', + name: 'street', + display: 'Street', + data_type: 'input', data_option: { - type: 'text', + type: 'text', maxlength: 100, - null: true, + null: true, }, - editable: true, - active: false, - screens: { - signup: {}, - invite_agent: {}, + editable: true, + active: false, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1100, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1100, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'zip', - display: 'Zip', - data_type: 'input', + force: true, + object: 'User', + name: 'zip', + display: 'Zip', + data_type: 'input', data_option: { - type: 'text', - maxlength: 100, - null: true, + type: 'text', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: true, - active: false, - screens: { - signup: {}, - invite_agent: {}, + editable: true, + active: false, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1200, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1200, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'city', - display: 'City', - data_type: 'input', + force: true, + object: 'User', + name: 'city', + display: 'City', + data_type: 'input', data_option: { - type: 'text', - maxlength: 100, - null: true, + type: 'text', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: true, - active: false, - screens: { - signup: {}, - invite_agent: {}, + editable: true, + active: false, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1300, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1300, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'country', - display: 'Country', - data_type: 'input', + force: true, + object: 'User', + name: 'country', + display: 'Country', + data_type: 'input', data_option: { - type: 'text', - maxlength: 100, - null: true, + type: 'text', + maxlength: 100, + null: true, item_class: 'formGroup--halfSize', }, - editable: true, - active: false, - screens: { - signup: {}, - invite_agent: {}, + editable: true, + active: false, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1325, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1325, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'address', - display: 'Address', - data_type: 'textarea', + force: true, + object: 'User', + name: 'address', + display: 'Address', + data_type: 'textarea', data_option: { - type: 'text', - maxlength: 500, - null: true, + type: 'text', + maxlength: 500, + null: true, item_class: 'formGroup--halfSize', }, - editable: true, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: true, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1350, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1350, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'password', - display: 'Password', - data_type: 'input', + force: true, + object: 'User', + name: 'password', + display: 'Password', + data_type: 'input', data_option: { - type: 'password', - maxlength: 100, - null: true, + type: 'password', + maxlength: 100, + null: true, autocomplete: 'new-password', - item_class: 'formGroup--halfSize', + item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { - signup: { + editable: false, + active: true, + screens: { + signup: { '-all-' => { null: false, }, }, - invite_agent: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { 'admin.user' => { null: true, }, }, - view: {} + view: {} }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1400, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'vip', - display: 'VIP', - data_type: 'boolean', + force: true, + object: 'User', + name: 'vip', + display: 'VIP', + data_type: 'boolean', data_option: { - null: true, - default: false, + null: true, + default: false, item_class: 'formGroup--halfSize', - options: { + options: { false: 'no', - true: 'yes', + true: 'yes', }, - translate: true, + translate: true, permission: ['admin.user', 'ticket.agent'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: true, @@ -1101,139 +1101,139 @@ ObjectManager::Attribute.add( }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1490, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1490, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'note', - display: 'Note', - data_type: 'richtext', + force: true, + object: 'User', + name: 'note', + display: 'Note', + data_type: 'richtext', data_option: { - type: 'text', + type: 'text', maxlength: 5000, - null: true, - note: 'Notes are visible to agents only, never to customers.', + null: true, + note: 'Notes are visible to agents only, never to customers.', }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1500, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1500, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'role_ids', - display: 'Permissions', - data_type: 'user_permission', + force: true, + object: 'User', + name: 'role_ids', + display: 'Permissions', + data_type: 'user_permission', data_option: { - null: false, + null: false, item_class: 'checkbox', permission: ['admin.user'], }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: { + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: { '-all-' => { - null: false, + null: false, default: [Role.lookup(name: 'Agent').id], }, }, invite_customer: {}, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1600, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1600, ) ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'active', - display: 'Active', - data_type: 'active', + force: true, + object: 'User', + name: 'active', + display: 'Active', + data_type: 'active', data_option: { - null: true, - default: true, + null: true, + default: true, permission: ['admin.user', 'ticket.agent'], }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, invite_customer: {}, - edit: { + edit: { '-all-' => { null: false, }, }, - view: { + view: { '-all-' => { shown: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1800, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1800, ) ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'name', - display: 'Name', - data_type: 'input', + force: true, + object: 'Organization', + name: 'name', + display: 'Name', + data_type: 'input', data_option: { - type: 'text', - maxlength: 150, - null: false, + type: 'text', + maxlength: 150, + null: false, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: false, @@ -1245,33 +1245,33 @@ ObjectManager::Attribute.add( }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 200, + to_create: false, + to_migrate: false, + to_delete: false, + position: 200, ) ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'shared', - display: 'Shared organization', - data_type: 'boolean', + force: true, + object: 'Organization', + name: 'shared', + display: 'Shared organization', + data_type: 'boolean', data_option: { - null: true, - default: true, - note: 'Customers in the organization can view each other items.', + null: true, + default: true, + note: 'Customers in the organization can view each other items.', item_class: 'formGroup--halfSize', - options: { - true: 'yes', + options: { + true: 'yes', false: 'no', }, - translate: true, + translate: true, permission: ['admin.organization'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: false, @@ -1283,33 +1283,33 @@ ObjectManager::Attribute.add( }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1400, ) ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'domain_assignment', - display: 'Domain based assignment', - data_type: 'boolean', + force: true, + object: 'Organization', + name: 'domain_assignment', + display: 'Domain based assignment', + data_type: 'boolean', data_option: { - null: true, - default: false, - note: 'Assign Users based on users domain.', + null: true, + default: false, + note: 'Assign Users based on users domain.', item_class: 'formGroup--halfSize', - options: { - true: 'yes', + options: { + true: 'yes', false: 'no', }, - translate: true, + translate: true, permission: ['admin.organization'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: false, @@ -1321,27 +1321,27 @@ ObjectManager::Attribute.add( }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1410, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1410, ) ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'domain', - display: 'Domain', - data_type: 'input', + force: true, + object: 'Organization', + name: 'domain', + display: 'Domain', + data_type: 'input', data_option: { - type: 'text', - maxlength: 150, - null: true, + type: 'text', + maxlength: 150, + null: true, item_class: 'formGroup--halfSize', }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: true, @@ -1353,27 +1353,27 @@ ObjectManager::Attribute.add( }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1420, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1420, ) ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'note', - display: 'Note', - data_type: 'richtext', + force: true, + object: 'Organization', + name: 'note', + display: 'Note', + data_type: 'richtext', data_option: { - type: 'text', + type: 'text', maxlength: 5000, - null: true, - note: 'Notes are visible to agents only, never to customers.', + null: true, + note: 'Notes are visible to agents only, never to customers.', }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: true, @@ -1385,26 +1385,26 @@ ObjectManager::Attribute.add( }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1500, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1500, ) ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'active', - display: 'Active', - data_type: 'active', + force: true, + object: 'Organization', + name: 'active', + display: 'Active', + data_type: 'active', data_option: { - null: true, - default: true, + null: true, + default: true, permission: ['admin.organization'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { edit: { '-all-' => { null: false, @@ -1416,290 +1416,290 @@ ObjectManager::Attribute.add( }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1800, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1800, ) ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'name', - display: 'Name', - data_type: 'input', + force: true, + object: 'Group', + name: 'name', + display: 'Name', + data_type: 'input', data_option: { - type: 'text', + type: 'text', maxlength: 150, - null: false, + null: false, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create: { '-all-' => { null: false, }, }, - edit: { + edit: { '-all-' => { null: false, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 200, + to_create: false, + to_migrate: false, + to_delete: false, + position: 200, ) ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'assignment_timeout', - display: 'Assignment Timeout', - data_type: 'integer', + force: true, + object: 'Group', + name: 'assignment_timeout', + display: 'Assignment Timeout', + data_type: 'integer', data_option: { maxlength: 150, - null: true, - note: 'Assignment timeout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend.', - min: 0, - max: 999_999, + null: true, + note: 'Assignment timeout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend.', + min: 0, + max: 999_999, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 300, + to_create: false, + to_migrate: false, + to_delete: false, + position: 300, ) ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'follow_up_possible', - display: 'Follow up possible', - data_type: 'select', + force: true, + object: 'Group', + name: 'follow_up_possible', + display: 'Follow up possible', + data_type: 'select', data_option: { - default: 'yes', - options: { - yes: 'yes', + default: 'yes', + options: { + yes: 'yes', new_ticket: 'do not reopen Ticket but create new Ticket' }, - null: false, - note: 'Follow up for closed ticket possible or not.', + null: false, + note: 'Follow up for closed ticket possible or not.', translate: true }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 400, + to_create: false, + to_migrate: false, + to_delete: false, + position: 400, ) ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'follow_up_assignment', - display: 'Assign Follow Ups', - data_type: 'select', + force: true, + object: 'Group', + name: 'follow_up_assignment', + display: 'Assign Follow Ups', + data_type: 'select', data_option: { - default: 'yes', - options: { - true: 'yes', + default: 'yes', + options: { + true: 'yes', false: 'no', }, - null: false, - note: 'Assign follow up to latest agent again.', + null: false, + note: 'Assign follow up to latest agent again.', translate: true }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 500, + to_create: false, + to_migrate: false, + to_delete: false, + position: 500, ) ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'email_address_id', - display: 'Email', - data_type: 'select', + force: true, + object: 'Group', + name: 'email_address_id', + display: 'Email', + data_type: 'select', data_option: { - default: '', - multiple: false, - null: true, - relation: 'EmailAddress', + default: '', + multiple: false, + null: true, + relation: 'EmailAddress', nulloption: true, do_not_log: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 600, + to_create: false, + to_migrate: false, + to_delete: false, + position: 600, ) ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'signature_id', - display: 'Signature', - data_type: 'select', + force: true, + object: 'Group', + name: 'signature_id', + display: 'Signature', + data_type: 'select', data_option: { - default: '', - multiple: false, - null: true, - relation: 'Signature', + default: '', + multiple: false, + null: true, + relation: 'Signature', nulloption: true, do_not_log: true, }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 600, + to_create: false, + to_migrate: false, + to_delete: false, + position: 600, ) ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'note', - display: 'Note', - data_type: 'richtext', + force: true, + object: 'Group', + name: 'note', + display: 'Note', + data_type: 'richtext', data_option: { - type: 'text', + type: 'text', maxlength: 250, - null: true, - note: 'Notes are visible to agents only, never to customers.', + null: true, + note: 'Notes are visible to agents only, never to customers.', }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-' => { null: true, }, }, - view: { + view: { '-all-' => { shown: true, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1500, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1500, ) ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'active', - display: 'Active', - data_type: 'active', + force: true, + object: 'Group', + name: 'active', + display: 'Active', + data_type: 'active', data_option: { - null: true, - default: true, + null: true, + default: true, permission: ['admin.group'], }, - editable: false, - active: true, - screens: { + editable: false, + active: true, + screens: { create: { '-all-' => { null: true, }, }, - edit: { + edit: { '-all-': { null: false, }, }, - view: { + view: { '-all-' => { shown: false, }, }, }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1800, + to_create: false, + to_migrate: false, + to_delete: false, + position: 1800, ) diff --git a/db/seeds/overviews.rb b/db/seeds/overviews.rb index 65db69d50..f67c69f2d 100644 --- a/db/seeds/overviews.rb +++ b/db/seeds/overviews.rb @@ -1,244 +1,244 @@ overview_role = Role.find_by(name: 'Agent') Overview.create_if_not_exists( - name: 'My assigned Tickets', - link: 'my_assigned', - prio: 1000, - role_ids: [overview_role.id], + name: 'My assigned Tickets', + link: 'my_assigned', + prio: 1000, + role_ids: [overview_role.id], condition: { 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:open).pluck(:id), + value: Ticket::State.by_category(:open).pluck(:id), }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) Overview.create_if_not_exists( - name: 'Unassigned & Open', - link: 'all_unassigned', - prio: 1010, - role_ids: [overview_role.id], + name: 'Unassigned & Open', + link: 'all_unassigned', + prio: 1010, + role_ids: [overview_role.id], condition: { 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:work_on_all).pluck(:id), + value: Ticket::State.by_category(:work_on_all).pluck(:id), }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'not_set', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) Overview.create_if_not_exists( - name: 'My pending reached Tickets', - link: 'my_pending_reached', - prio: 1020, - role_ids: [overview_role.id], + name: 'My pending reached Tickets', + link: 'my_pending_reached', + prio: 1020, + role_ids: [overview_role.id], condition: { - 'ticket.state_id' => { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:pending_reminder).pluck(:id), + value: Ticket::State.by_category(:pending_reminder).pluck(:id), }, - 'ticket.owner_id' => { - operator: 'is', + 'ticket.owner_id' => { + operator: 'is', pre_condition: 'current_user.id', }, 'ticket.pending_time' => { operator: 'within next (relative)', - value: 0, - range: 'minute', + value: 0, + range: 'minute', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) Overview.create_if_not_exists( - name: 'Open', - link: 'all_open', - prio: 1030, - role_ids: [overview_role.id], + name: 'Open', + link: 'all_open', + prio: 1030, + role_ids: [overview_role.id], condition: { 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:work_on_all).pluck(:id), + value: Ticket::State.by_category(:work_on_all).pluck(:id), }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group state owner created_at], - s: %w[title customer group state owner created_at], - m: %w[number title customer group state owner created_at], + view: { + d: %w[title customer group state owner created_at], + s: %w[title customer group state owner created_at], + m: %w[number title customer group state owner created_at], view_mode_default: 's', }, ) Overview.create_if_not_exists( - name: 'Pending reached', - link: 'all_pending_reached', - prio: 1040, - role_ids: [overview_role.id], + name: 'Pending reached', + link: 'all_pending_reached', + prio: 1040, + role_ids: [overview_role.id], condition: { - 'ticket.state_id' => { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:pending_reminder).pluck(:id), + value: Ticket::State.by_category(:pending_reminder).pluck(:id), }, 'ticket.pending_time' => { operator: 'within next (relative)', - value: 0, - range: 'minute', + value: 0, + range: 'minute', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group owner created_at], - s: %w[title customer group owner created_at], - m: %w[number title customer group owner created_at], + view: { + d: %w[title customer group owner created_at], + s: %w[title customer group owner created_at], + m: %w[number title customer group owner created_at], view_mode_default: 's', }, ) Overview.create_if_not_exists( - name: 'Escalated', - link: 'all_escalated', - prio: 1050, - role_ids: [overview_role.id], + name: 'Escalated', + link: 'all_escalated', + prio: 1050, + role_ids: [overview_role.id], condition: { 'ticket.escalation_at' => { operator: 'within next (relative)', - value: '10', - range: 'minute', + value: '10', + range: 'minute', }, }, - order: { - by: 'escalation_at', + order: { + by: 'escalation_at', direction: 'ASC', }, - view: { - d: %w[title customer group owner escalation_at], - s: %w[title customer group owner escalation_at], - m: %w[number title customer group owner escalation_at], + view: { + d: %w[title customer group owner escalation_at], + s: %w[title customer group owner escalation_at], + m: %w[number title customer group owner escalation_at], view_mode_default: 's', }, ) Overview.create_if_not_exists( - name: 'My replacement Tickets', - link: 'my_replacement_tickets', - prio: 1080, - role_ids: [overview_role.id], + name: 'My replacement Tickets', + link: 'my_replacement_tickets', + prio: 1080, + role_ids: [overview_role.id], out_of_office: true, - condition: { - 'ticket.state_id' => { + condition: { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:open).pluck(:id), + value: Ticket::State.by_category(:open).pluck(:id), }, 'ticket.out_of_office_replacement_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer group owner escalation_at], - s: %w[title customer group owner escalation_at], - m: %w[number title customer group owner escalation_at], + view: { + d: %w[title customer group owner escalation_at], + s: %w[title customer group owner escalation_at], + m: %w[number title customer group owner escalation_at], view_mode_default: 's', }, ) overview_role = Role.find_by(name: 'Customer') Overview.create_if_not_exists( - name: 'My Tickets', - link: 'my_tickets', - prio: 1100, - role_ids: [overview_role.id], + name: 'My Tickets', + link: 'my_tickets', + prio: 1100, + role_ids: [overview_role.id], condition: { - 'ticket.state_id' => { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:viewable).pluck(:id), + value: Ticket::State.by_category(:viewable).pluck(:id), }, 'ticket.customer_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title state created_at], - m: %w[number title state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title state created_at], + m: %w[number title state created_at], view_mode_default: 's', }, ) Overview.create_if_not_exists( - name: 'My Organization Tickets', - link: 'my_organization_tickets', - prio: 1200, - role_ids: [overview_role.id], + name: 'My Organization Tickets', + link: 'my_organization_tickets', + prio: 1200, + role_ids: [overview_role.id], organization_shared: true, - condition: { - 'ticket.state_id' => { + condition: { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:viewable).pluck(:id), + value: Ticket::State.by_category(:viewable).pluck(:id), }, 'ticket.organization_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.organization_id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, ) diff --git a/db/seeds/permissions.rb b/db/seeds/permissions.rb index 7cecf6955..7532e23eb 100644 --- a/db/seeds/permissions.rb +++ b/db/seeds/permissions.rb @@ -1,366 +1,366 @@ Permission.create_if_not_exists( - name: 'admin', - note: 'Admin Interface', + name: 'admin', + note: 'Admin Interface', preferences: {}, ) Permission.create_if_not_exists( - name: 'admin.user', - note: 'Manage %s', + name: 'admin.user', + note: 'Manage %s', preferences: { translations: ['Users'] }, ) Permission.create_if_not_exists( - name: 'admin.group', - note: 'Manage %s', + name: 'admin.group', + note: 'Manage %s', preferences: { translations: ['Groups'] }, ) Permission.create_if_not_exists( - name: 'admin.role', - note: 'Manage %s', + name: 'admin.role', + note: 'Manage %s', preferences: { translations: ['Roles'] }, ) Permission.create_if_not_exists( - name: 'admin.organization', - note: 'Manage %s', + name: 'admin.organization', + note: 'Manage %s', preferences: { translations: ['Organizations'] }, ) Permission.create_if_not_exists( - name: 'admin.overview', - note: 'Manage %s', + name: 'admin.overview', + note: 'Manage %s', preferences: { translations: ['Overviews'] }, ) Permission.create_if_not_exists( - name: 'admin.text_module', - note: 'Manage %s', + name: 'admin.text_module', + note: 'Manage %s', preferences: { translations: ['Text Modules'] }, ) Permission.create_if_not_exists( - name: 'admin.time_accounting', - note: 'Manage %s', + name: 'admin.time_accounting', + note: 'Manage %s', preferences: { translations: ['Time Accounting'] }, ) Permission.create_if_not_exists( - name: 'admin.macro', - note: 'Manage %s', + name: 'admin.macro', + note: 'Manage %s', preferences: { translations: ['Macros'] }, ) Permission.create_if_not_exists( - name: 'admin.tag', - note: 'Manage %s', + name: 'admin.tag', + note: 'Manage %s', preferences: { translations: ['Tags'] }, ) Permission.create_if_not_exists( - name: 'admin.calendar', - note: 'Manage %s', + name: 'admin.calendar', + note: 'Manage %s', preferences: { translations: ['Calendar'] }, ) Permission.create_if_not_exists( - name: 'admin.sla', - note: 'Manage %s', + name: 'admin.sla', + note: 'Manage %s', preferences: { translations: ['SLA'] }, ) Permission.create_if_not_exists( - name: 'admin.scheduler', - note: 'Manage %s', + name: 'admin.scheduler', + note: 'Manage %s', preferences: { translations: ['Scheduler'] }, ) Permission.create_if_not_exists( - name: 'admin.report_profile', - note: 'Manage %s', + name: 'admin.report_profile', + note: 'Manage %s', preferences: { translations: ['Report Profiles'] }, ) Permission.create_if_not_exists( - name: 'admin.channel_web', - note: 'Manage %s', + name: 'admin.channel_web', + note: 'Manage %s', preferences: { translations: ['Channel - Web'] }, ) Permission.create_if_not_exists( - name: 'admin.channel_formular', - note: 'Manage %s', + name: 'admin.channel_formular', + note: 'Manage %s', preferences: { translations: ['Channel - Formular'] }, ) Permission.create_if_not_exists( - name: 'admin.channel_email', - note: 'Manage %s', + name: 'admin.channel_email', + note: 'Manage %s', preferences: { translations: ['Channel - Email'] }, ) Permission.create_if_not_exists( - name: 'admin.channel_twitter', - note: 'Manage %s', + name: 'admin.channel_twitter', + note: 'Manage %s', preferences: { translations: ['Channel - Twitter'] }, ) Permission.create_if_not_exists( - name: 'admin.channel_facebook', - note: 'Manage %s', + name: 'admin.channel_facebook', + note: 'Manage %s', preferences: { translations: ['Channel - Facebook'] }, ) Permission.create_if_not_exists( - name: 'admin.channel_telegram', - note: 'Manage %s', + name: 'admin.channel_telegram', + note: 'Manage %s', preferences: { translations: ['Channel - Telegram'] }, ) Permission.create_if_not_exists( - name: 'admin.channel_sms', - note: 'Manage %s', + name: 'admin.channel_sms', + note: 'Manage %s', preferences: { translations: ['Channel - SMS'] }, ) Permission.create_if_not_exists( - name: 'admin.channel_chat', - note: 'Manage %s', + name: 'admin.channel_chat', + note: 'Manage %s', preferences: { translations: ['Channel - Chat'] }, ) Permission.create_if_not_exists( - name: 'admin.branding', - note: 'Manage %s', + name: 'admin.branding', + note: 'Manage %s', preferences: { translations: ['Branding'] }, ) Permission.create_if_not_exists( - name: 'admin.setting_system', - note: 'Manage %s Settings', + name: 'admin.setting_system', + note: 'Manage %s Settings', preferences: { translations: ['System'] }, ) Permission.create_if_not_exists( - name: 'admin.security', - note: 'Manage %s Settings', + name: 'admin.security', + note: 'Manage %s Settings', preferences: { translations: ['Security'] }, ) Permission.create_if_not_exists( - name: 'admin.ticket', - note: 'Manage %s Settings', + name: 'admin.ticket', + note: 'Manage %s Settings', preferences: { translations: ['Ticket'] }, ) Permission.create_if_not_exists( - name: 'admin.package', - note: 'Manage %s', + name: 'admin.package', + note: 'Manage %s', preferences: { translations: ['Packages'] }, ) Permission.create_if_not_exists( - name: 'admin.integration', - note: 'Manage %s', + name: 'admin.integration', + note: 'Manage %s', preferences: { translations: ['Integrations'] }, ) Permission.create_if_not_exists( - name: 'admin.api', - note: 'Manage %s', + name: 'admin.api', + note: 'Manage %s', preferences: { translations: ['API'] }, ) Permission.create_if_not_exists( - name: 'admin.object', - note: 'Manage %s', + name: 'admin.object', + note: 'Manage %s', preferences: { translations: ['Objects'] }, ) Permission.create_if_not_exists( - name: 'admin.translation', - note: 'Manage %s', + name: 'admin.translation', + note: 'Manage %s', preferences: { translations: ['Translations'] }, ) Permission.create_if_not_exists( - name: 'admin.monitoring', - note: 'Manage %s', + name: 'admin.monitoring', + note: 'Manage %s', preferences: { translations: ['Monitoring'] }, ) Permission.create_if_not_exists( - name: 'admin.maintenance', - note: 'Manage %s', + name: 'admin.maintenance', + note: 'Manage %s', preferences: { translations: ['Maintenance'] }, ) Permission.create_if_not_exists( - name: 'admin.session', - note: 'Manage %s', + name: 'admin.session', + note: 'Manage %s', preferences: { translations: ['Sessions'] }, ) Permission.create_if_not_exists( - name: 'user_preferences', - note: 'User Preferences', + name: 'user_preferences', + note: 'User Preferences', preferences: {}, ) Permission.create_if_not_exists( - name: 'user_preferences.password', - note: 'Change %s', + name: 'user_preferences.password', + note: 'Change %s', preferences: { translations: ['Password'] }, ) Permission.create_if_not_exists( - name: 'user_preferences.notifications', - note: 'Manage %s', + name: 'user_preferences.notifications', + note: 'Manage %s', preferences: { translations: ['Notifications'], - required: ['ticket.agent'], + required: ['ticket.agent'], }, ) Permission.create_if_not_exists( - name: 'user_preferences.access_token', - note: 'Manage %s', + name: 'user_preferences.access_token', + note: 'Manage %s', preferences: { translations: ['Token Access'] }, ) Permission.create_if_not_exists( - name: 'user_preferences.language', - note: 'Change %s', + name: 'user_preferences.language', + note: 'Change %s', preferences: { translations: ['Language'] }, ) Permission.create_if_not_exists( - name: 'user_preferences.linked_accounts', - note: 'Manage %s', + name: 'user_preferences.linked_accounts', + note: 'Manage %s', preferences: { translations: ['Linked Accounts'] }, ) Permission.create_if_not_exists( - name: 'user_preferences.device', - note: 'Manage %s', + name: 'user_preferences.device', + note: 'Manage %s', preferences: { translations: ['Devices'] }, ) Permission.create_if_not_exists( - name: 'user_preferences.avatar', - note: 'Manage %s', + name: 'user_preferences.avatar', + note: 'Manage %s', preferences: { translations: ['Avatar'] }, ) Permission.create_if_not_exists( - name: 'user_preferences.calendar', - note: 'Access to %s', + name: 'user_preferences.calendar', + note: 'Access to %s', preferences: { translations: ['Calendars'], - required: ['ticket.agent'], + required: ['ticket.agent'], }, ) Permission.create_if_not_exists( - name: 'user_preferences.out_of_office', - note: 'Change %s', + name: 'user_preferences.out_of_office', + note: 'Change %s', preferences: { translations: ['Out of Office'], - required: ['ticket.agent'], + required: ['ticket.agent'], }, ) Permission.create_if_not_exists( - name: 'report', - note: 'Report Interface', + name: 'report', + note: 'Report Interface', preferences: {}, ) Permission.create_if_not_exists( - name: 'ticket', - note: 'Ticket Interface', + name: 'ticket', + note: 'Ticket Interface', preferences: { disabled: true }, ) Permission.create_if_not_exists( - name: 'ticket.agent', - note: 'Access to Agent Tickets based on Group Access', + name: 'ticket.agent', + note: 'Access to Agent Tickets based on Group Access', preferences: { - not: ['ticket.customer'], + not: ['ticket.customer'], plugin: ['groups'] }, ) Permission.create_if_not_exists( - name: 'ticket.customer', - note: 'Access to Customer Tickets based on current_user and organization', + name: 'ticket.customer', + note: 'Access to Customer Tickets based on current_user and organization', preferences: { not: ['ticket.agent'], }, ) Permission.create_if_not_exists( - name: 'chat', - note: 'Access to %s', + name: 'chat', + note: 'Access to %s', preferences: { translations: ['Chat'] }, ) Permission.create_if_not_exists( - name: 'chat.agent', - note: 'Access to %s', + name: 'chat.agent', + note: 'Access to %s', preferences: { translations: ['Chat'], - not: ['chat.customer'], + not: ['chat.customer'], }, ) Permission.create_if_not_exists( - name: 'cti', - note: 'CTI', + name: 'cti', + note: 'CTI', preferences: { disabled: true }, ) Permission.create_if_not_exists( - name: 'cti.agent', - note: 'Access to %s', + name: 'cti.agent', + note: 'Access to %s', preferences: { translations: ['CTI'], - not: ['cti.customer'], + not: ['cti.customer'], }, ) diff --git a/db/seeds/report_profiles.rb b/db/seeds/report_profiles.rb index 803bce862..83d0a8352 100644 --- a/db/seeds/report_profiles.rb +++ b/db/seeds/report_profiles.rb @@ -1,7 +1,7 @@ Report::Profile.create_if_not_exists( - name: '-all-', - condition: {}, - active: true, + name: '-all-', + condition: {}, + active: true, updated_by_id: 1, created_by_id: 1, ) diff --git a/db/seeds/roles.rb b/db/seeds/roles.rb index 5f1a643af..0f6a9d60c 100644 --- a/db/seeds/roles.rb +++ b/db/seeds/roles.rb @@ -1,33 +1,33 @@ Role.create_if_not_exists( - id: 1, - name: 'Admin', - note: 'To configure your system.', - preferences: { + id: 1, + name: 'Admin', + note: 'To configure your system.', + preferences: { not: ['Customer'], }, default_at_signup: false, - updated_by_id: 1, - created_by_id: 1 + updated_by_id: 1, + created_by_id: 1 ) Role.create_if_not_exists( - id: 2, - name: 'Agent', - note: 'To work on Tickets.', + id: 2, + name: 'Agent', + note: 'To work on Tickets.', default_at_signup: false, - preferences: { + preferences: { not: ['Customer'], }, - updated_by_id: 1, - created_by_id: 1 + updated_by_id: 1, + created_by_id: 1 ) Role.create_if_not_exists( - id: 3, - name: 'Customer', - note: 'People who create Tickets ask for help.', - preferences: { + id: 3, + name: 'Customer', + note: 'People who create Tickets ask for help.', + preferences: { not: %w[Agent Admin], }, default_at_signup: true, - updated_by_id: 1, - created_by_id: 1 + updated_by_id: 1, + created_by_id: 1 ) diff --git a/db/seeds/schedulers.rb b/db/seeds/schedulers.rb index 05bf45568..a123b344b 100644 --- a/db/seeds/schedulers.rb +++ b/db/seeds/schedulers.rb @@ -1,174 +1,174 @@ Scheduler.create_if_not_exists( - name: 'Process pending tickets', + name: 'Process pending tickets', method: 'Ticket.process_pending', period: 15.minutes, - prio: 1, + prio: 1, active: true, ) Scheduler.create_if_not_exists( - name: 'Process escalation tickets', + name: 'Process escalation tickets', method: 'Ticket.process_escalation', period: 5.minutes, - prio: 1, + prio: 1, active: true, ) Scheduler.create_if_not_exists( - name: 'Process auto unassign tickets', + name: 'Process auto unassign tickets', method: 'Ticket.process_auto_unassign', period: 10.minutes, - prio: 1, + prio: 1, active: true, ) Scheduler.create_if_not_exists( - name: 'Import OTRS diff load', - method: 'Import::OTRS.diff_worker', - period: 3.minutes, - prio: 1, - active: true, + name: 'Import OTRS diff load', + method: 'Import::OTRS.diff_worker', + period: 3.minutes, + prio: 1, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_if_not_exists( - name: 'Check Channels', - method: 'Channel.fetch', - period: 30.seconds, - prio: 1, - active: true, + name: 'Check Channels', + method: 'Channel.fetch', + period: 30.seconds, + prio: 1, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_if_not_exists( - name: 'Check streams for Channel', - method: 'Channel.stream', - period: 60.seconds, - prio: 1, - active: true, + name: 'Check streams for Channel', + method: 'Channel.stream', + period: 60.seconds, + prio: 1, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_if_not_exists( - name: 'Generate Session data', - method: 'Sessions.jobs', - period: 60.seconds, - prio: 1, - active: true, + name: 'Generate Session data', + method: 'Sessions.jobs', + period: 60.seconds, + prio: 1, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_if_not_exists( - name: 'Execute jobs', - method: 'Job.run', - period: 5.minutes, - prio: 2, - active: true, + name: 'Execute jobs', + method: 'Job.run', + period: 5.minutes, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_if_not_exists( - name: 'Cleanup expired sessions', - method: 'SessionHelper.cleanup_expired', - period: 60 * 60 * 12, - prio: 2, - active: true, + name: 'Cleanup expired sessions', + method: 'SessionHelper.cleanup_expired', + period: 60 * 60 * 12, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_if_not_exists( - name: 'Delete old activity stream entries.', - method: 'ActivityStream.cleanup', - period: 1.day, - prio: 2, - active: true, + name: 'Delete old activity stream entries.', + method: 'ActivityStream.cleanup', + period: 1.day, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_if_not_exists( - name: 'Delete old entries.', - method: 'RecentView.cleanup', - period: 1.day, - prio: 2, - active: true, + name: 'Delete old entries.', + method: 'RecentView.cleanup', + period: 1.day, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_or_update( - name: 'Delete old online notification entries.', - method: 'OnlineNotification.cleanup', - period: 2.hours, - prio: 2, - active: true, + name: 'Delete old online notification entries.', + method: 'OnlineNotification.cleanup', + period: 2.hours, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_or_update( - name: 'Delete old token entries.', - method: 'Token.cleanup', - period: 30.days, - prio: 2, - active: true, + name: 'Delete old token entries.', + method: 'Token.cleanup', + period: 30.days, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_or_update( - name: 'Closed chat sessions where participients are offline.', - method: 'Chat.cleanup_close', - period: 15.minutes, - prio: 2, - active: true, + name: 'Closed chat sessions where participients are offline.', + method: 'Chat.cleanup_close', + period: 15.minutes, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_or_update( - name: 'Cleanup closed sessions.', - method: 'Chat.cleanup', - period: 5.days, - prio: 2, - active: true, + name: 'Cleanup closed sessions.', + method: 'Chat.cleanup', + period: 5.days, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_or_update( - name: 'Sync calendars with ical feeds.', - method: 'Calendar.sync', - period: 1.day, - prio: 2, - active: true, + name: 'Sync calendars with ical feeds.', + method: 'Calendar.sync', + period: 1.day, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_or_update( - name: 'Generate user based stats.', - method: 'Stats.generate', - period: 11.minutes, - prio: 2, - active: true, + name: 'Generate user based stats.', + method: 'Stats.generate', + period: 11.minutes, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_or_update( - name: 'Delete old stats store entries.', - method: 'StatsStore.cleanup', - period: 31.days, - prio: 2, - active: true, + name: 'Delete old stats store entries.', + method: 'StatsStore.cleanup', + period: 31.days, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_if_not_exists( - name: 'Cleanup HttpLog', - method: 'HttpLog.cleanup', - period: 1.day, - prio: 2, - active: true, + name: 'Cleanup HttpLog', + method: 'HttpLog.cleanup', + period: 1.day, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) Scheduler.create_if_not_exists( - name: 'Cleanup Cti::Log', - method: 'Cti::Log.cleanup', - period: 1.month, - prio: 2, - active: true, + name: 'Cleanup Cti::Log', + method: 'Cti::Log.cleanup', + period: 1.month, + prio: 2, + active: true, updated_by_id: 1, created_by_id: 1, ) diff --git a/db/seeds/settings.rb b/db/seeds/settings.rb index f00f9a681..8fe8d4d84 100644 --- a/db/seeds/settings.rb +++ b/db/seeds/settings.rb @@ -1,208 +1,208 @@ Setting.create_if_not_exists( - title: 'Application secret', - name: 'application_secret', - area: 'Core', + title: 'Application secret', + name: 'application_secret', + area: 'Core', description: 'Defines the random application secret.', - options: {}, - state: SecureRandom.hex(128), + options: {}, + state: SecureRandom.hex(128), preferences: { permission: ['admin'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'System Init Done', - name: 'system_init_done', - area: 'Core', + title: 'System Init Done', + name: 'system_init_done', + area: 'Core', description: 'Defines if application is in init mode.', - options: {}, - state: false, + options: {}, + state: false, preferences: { online_service_disable: true }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'App Version', - name: 'app_version', - area: 'Core::WebApp', + title: 'App Version', + name: 'app_version', + area: 'Core::WebApp', description: 'Only used internally to propagate current web app version to clients.', - options: {}, - state: '', + options: {}, + state: '', preferences: { online_service_disable: true }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Maintenance Mode', - name: 'maintenance_mode', - area: 'Core::WebApp', + title: 'Maintenance Mode', + name: 'maintenance_mode', + area: 'Core::WebApp', description: 'Enable or disable the maintenance mode of Zammad. If enabled, all non-administrators get logged out and only administrators can start a new session.', - options: {}, - state: false, + options: {}, + state: false, preferences: { permission: ['admin.maintenance'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Maintenance Login', - name: 'maintenance_login', - area: 'Core::WebApp', + title: 'Maintenance Login', + name: 'maintenance_login', + area: 'Core::WebApp', description: 'Put a message on the login page. To change it, click on the text area below and change it inline.', - options: {}, - state: false, + options: {}, + state: false, preferences: { permission: ['admin.maintenance'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Maintenance Login', - name: 'maintenance_login_message', - area: 'Core::WebApp', + title: 'Maintenance Login', + name: 'maintenance_login_message', + area: 'Core::WebApp', description: 'Message for login page.', - options: {}, - state: 'Something about to share. Click here to change.', + options: {}, + state: 'Something about to share. Click here to change.', preferences: { permission: ['admin.maintenance'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Developer System', - name: 'developer_mode', - area: 'Core::Develop', + title: 'Developer System', + name: 'developer_mode', + area: 'Core::Develop', description: 'Defines if application is in developer mode (useful for developer, all users have the same password, password reset will work without email delivery).', - options: {}, - state: false, + options: {}, + state: false, preferences: { online_service_disable: true }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Online Service', - name: 'system_online_service', - area: 'Core', + title: 'Online Service', + name: 'system_online_service', + area: 'Core', description: 'Defines if application is used as online service.', - options: {}, - state: false, + options: {}, + state: false, preferences: { online_service_disable: true }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Product Name', - name: 'product_name', - area: 'System::Branding', + title: 'Product Name', + name: 'product_name', + area: 'System::Branding', description: 'Defines the name of the application, shown in the web interface, tabs and title bar of the web browser.', - options: { + options: { form: [ { display: '', - null: false, - name: 'product_name', - tag: 'input', + null: false, + name: 'product_name', + tag: 'input', }, ], }, preferences: { - render: true, - prio: 1, + render: true, + prio: 1, placeholder: true, - permission: ['admin.branding'], + permission: ['admin.branding'], }, - state: 'Zammad Helpdesk', - frontend: true + state: 'Zammad Helpdesk', + frontend: true ) Setting.create_if_not_exists( - title: 'Logo', - name: 'product_logo', - area: 'System::Branding', + title: 'Logo', + name: 'product_logo', + area: 'System::Branding', description: 'Defines the logo of the application, shown in the web interface.', - options: { + options: { form: [ { display: '', - null: false, - name: 'product_logo', - tag: 'input', + null: false, + name: 'product_logo', + tag: 'input', }, ], }, preferences: { - prio: 3, + prio: 3, controller: 'SettingsAreaLogo', permission: ['admin.branding'], }, - state: 'logo.svg', - frontend: true + state: 'logo.svg', + frontend: true ) Setting.create_if_not_exists( - title: 'Organization', - name: 'organization', - area: 'System::Branding', + title: 'Organization', + name: 'organization', + area: 'System::Branding', description: 'Will be shown in the app and is included in email footers.', - options: { + options: { form: [ { display: '', - null: false, - name: 'organization', - tag: 'input', + null: false, + name: 'organization', + tag: 'input', }, ], }, - state: '', + state: '', preferences: { - prio: 2, + prio: 2, placeholder: true, - permission: ['admin.branding'], + permission: ['admin.branding'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Locale', - name: 'locale_default', - area: 'System::Branding', + title: 'Locale', + name: 'locale_default', + area: 'System::Branding', description: 'Defines the system default language.', - options: { + options: { form: [ { name: 'locale_default', } ], }, - state: 'en-us', + state: 'en-us', preferences: { - prio: 8, + prio: 8, controller: 'SettingsAreaItemDefaultLocale', permission: ['admin.system'], }, - frontend: true + frontend: true ) Setting.create_or_update( - title: 'Pretty Date', - name: 'pretty_date_format', - area: 'System::Branding', + title: 'Pretty Date', + name: 'pretty_date_format', + area: 'System::Branding', description: 'Defines pretty date format.', - options: { + options: { form: [ { display: '', - null: false, - name: 'pretty_date_format', - tag: 'select', + null: false, + name: 'pretty_date_format', + tag: 'select', options: { - 'relative': 'relative - e. g. "2 hours ago" or "2 days and 15 minutes ago"', - 'absolute': 'absolute - e. g. "Monday 09:30" or "Tuesday 23. Feb 14:20"', + 'relative': 'relative - e. g. "2 hours ago" or "2 days and 15 minutes ago"', + 'absolute': 'absolute - e. g. "Monday 09:30" or "Tuesday 23. Feb 14:20"', 'timestamp': 'timestamp - e. g. "2018-08-30 14:30"', }, }, ], }, preferences: { - render: true, - prio: 10, + render: true, + prio: 10, permission: ['admin.branding'], }, - state: 'relative', - frontend: true + state: 'relative', + frontend: true ) options = {} (10..99).each do |item| @@ -210,84 +210,84 @@ options = {} end system_id = rand(10..99) Setting.create_if_not_exists( - title: 'SystemID', - name: 'system_id', - area: 'System::Base', + title: 'SystemID', + name: 'system_id', + area: 'System::Base', description: 'Defines the system identifier. Every ticket number contains this ID. This ensures that only tickets which belong to your system will be processed as follow-ups (useful when communicating between two instances of Zammad).', - options: { + options: { form: [ { display: '', - null: true, - name: 'system_id', - tag: 'select', + null: true, + name: 'system_id', + tag: 'select', options: options, }, ], }, - state: system_id, + state: system_id, preferences: { online_service_disable: true, - placeholder: true, - authentication: true, - permission: ['admin.system'], + placeholder: true, + authentication: true, + permission: ['admin.system'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Fully Qualified Domain Name', - name: 'fqdn', - area: 'System::Base', + title: 'Fully Qualified Domain Name', + name: 'fqdn', + area: 'System::Base', description: 'Defines the fully qualified domain name of the system. This setting is used as a variable, #{setting.fqdn} which is found in all forms of messaging used by the application, to build links to the tickets within your system.', # rubocop:disable Lint/InterpolationCheck - options: { + options: { form: [ { display: '', - null: false, - name: 'fqdn', - tag: 'input', + null: false, + name: 'fqdn', + tag: 'input', }, ], }, - state: 'zammad.example.com', + state: 'zammad.example.com', preferences: { online_service_disable: true, - placeholder: true, - permission: ['admin.system'], + placeholder: true, + permission: ['admin.system'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Websocket port', - name: 'websocket_port', - area: 'System::WebSocket', + title: 'Websocket port', + name: 'websocket_port', + area: 'System::WebSocket', description: 'Defines the port of the websocket server.', - options: { + options: { form: [ { display: '', - null: false, - name: 'websocket_port', - tag: 'input', + null: false, + name: 'websocket_port', + tag: 'input', }, ], }, - state: '6042', + state: '6042', preferences: { online_service_disable: true }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'HTTP type', - name: 'http_type', - area: 'System::Base', + title: 'HTTP type', + name: 'http_type', + area: 'System::Base', description: 'Define the http protocol of your instance.', - options: { + options: { form: [ { display: '', - null: true, - name: 'http_type', - tag: 'select', + null: true, + name: 'http_type', + tag: 'select', options: { 'https' => 'https', 'http' => 'http', @@ -295,262 +295,262 @@ Setting.create_if_not_exists( }, ], }, - state: 'http', + state: 'http', preferences: { online_service_disable: true, - placeholder: true, - permission: ['admin.system'], + placeholder: true, + permission: ['admin.system'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Storage Mechanism', - name: 'storage_provider', - area: 'System::Storage', + title: 'Storage Mechanism', + name: 'storage_provider', + area: 'System::Storage', description: '"Database" stores all attachments in the database (not recommended for storing large amounts of data). "Filesystem" stores the data in the filesystem. You can switch between the modules even on a system that is already in production without any loss of data.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'storage_provider', - tag: 'select', + display: '', + null: true, + name: 'storage_provider', + tag: 'select', tranlate: true, - options: { - 'DB' => 'Database', + options: { + 'DB' => 'Database', 'File' => 'Filesystem', }, }, ], }, - state: 'DB', + state: 'DB', preferences: { - controller: 'SettingsAreaStorageProvider', + controller: 'SettingsAreaStorageProvider', online_service_disable: true, - permission: ['admin.system'], + permission: ['admin.system'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Image Service', - name: 'image_backend', - area: 'System::Services', + title: 'Image Service', + name: 'image_backend', + area: 'System::Services', description: 'Defines the backend for user and organization image lookups.', - options: { + options: { form: [ { display: '', - null: true, - name: 'image_backend', - tag: 'select', + null: true, + name: 'image_backend', + tag: 'select', options: { - '' => '-', + '' => '-', 'Service::Image::Zammad' => 'Zammad Image Service', }, }, ], }, - state: 'Service::Image::Zammad', + state: 'Service::Image::Zammad', preferences: { - prio: 1, + prio: 1, permission: ['admin.system'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Geo IP Service', - name: 'geo_ip_backend', - area: 'System::Services', + title: 'Geo IP Service', + name: 'geo_ip_backend', + area: 'System::Services', description: 'Defines the backend for geo IP lookups. Shows also location of an IP address if an IP address is shown.', - options: { + options: { form: [ { display: '', - null: true, - name: 'geo_ip_backend', - tag: 'select', + null: true, + name: 'geo_ip_backend', + tag: 'select', options: { - '' => '-', + '' => '-', 'Service::GeoIp::Zammad' => 'Zammad GeoIP Service', }, }, ], }, - state: 'Service::GeoIp::Zammad', + state: 'Service::GeoIp::Zammad', preferences: { - prio: 2, + prio: 2, permission: ['admin.system'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Geo Location Service', - name: 'geo_location_backend', - area: 'System::Services', + title: 'Geo Location Service', + name: 'geo_location_backend', + area: 'System::Services', description: 'Defines the backend for geo location lookups to store geo locations for addresses.', - options: { + options: { form: [ { display: '', - null: true, - name: 'geo_location_backend', - tag: 'select', + null: true, + name: 'geo_location_backend', + tag: 'select', options: { - '' => '-', + '' => '-', 'Service::GeoLocation::Gmaps' => 'Google Maps', }, }, ], }, - state: 'Service::GeoLocation::Gmaps', + state: 'Service::GeoLocation::Gmaps', preferences: { - prio: 3, + prio: 3, permission: ['admin.system'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Geo Calendar Service', - name: 'geo_calendar_backend', - area: 'System::Services', + title: 'Geo Calendar Service', + name: 'geo_calendar_backend', + area: 'System::Services', description: 'Defines the backend for geo calendar lookups. Used for initial calendar succession.', - options: { + options: { form: [ { display: '', - null: true, - name: 'geo_calendar_backend', - tag: 'select', + null: true, + name: 'geo_calendar_backend', + tag: 'select', options: { - '' => '-', + '' => '-', 'Service::GeoCalendar::Zammad' => 'Zammad GeoCalendar Service', }, }, ], }, - state: 'Service::GeoCalendar::Zammad', + state: 'Service::GeoCalendar::Zammad', preferences: { - prio: 2, + prio: 2, permission: ['admin.system'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Proxy Settings', - name: 'proxy', - area: 'System::Network', + title: 'Proxy Settings', + name: 'proxy', + area: 'System::Network', description: 'Address of the proxy server for http and https resources.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'proxy', - tag: 'input', + display: '', + null: false, + name: 'proxy', + tag: 'input', placeholder: 'proxy.example.com:3128', }, ], }, - state: '', + state: '', preferences: { online_service_disable: true, - controller: 'SettingsAreaProxy', - prio: 1, - permission: ['admin.system'], + controller: 'SettingsAreaProxy', + prio: 1, + permission: ['admin.system'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Proxy User', - name: 'proxy_username', - area: 'System::Network', + title: 'Proxy User', + name: 'proxy_username', + area: 'System::Network', description: 'Username for proxy connection.', - options: { + options: { form: [ { display: '', - null: false, - name: 'proxy_username', - tag: 'input', + null: false, + name: 'proxy_username', + tag: 'input', }, ], }, - state: '', + state: '', preferences: { - disabled: true, + disabled: true, online_service_disable: true, - prio: 2, - permission: ['admin.system'], + prio: 2, + permission: ['admin.system'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Proxy Password', - name: 'proxy_password', - area: 'System::Network', + title: 'Proxy Password', + name: 'proxy_password', + area: 'System::Network', description: 'Password for proxy connection.', - options: { + options: { form: [ { display: '', - null: false, - name: 'proxy_password', - tag: 'input', + null: false, + name: 'proxy_password', + tag: 'input', }, ], }, - state: '', + state: '', preferences: { - disabled: true, + disabled: true, online_service_disable: true, - prio: 3, - permission: ['admin.system'], + prio: 3, + permission: ['admin.system'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'No Proxy', - name: 'proxy_no', - area: 'System::Network', + title: 'No Proxy', + name: 'proxy_no', + area: 'System::Network', description: 'No proxy for the following hosts.', - options: { + options: { form: [ { display: '', - null: false, - name: 'proxy_no', - tag: 'input', + null: false, + name: 'proxy_no', + tag: 'input', }, ], }, - state: 'localhost,127.0.0.0,::1', + state: 'localhost,127.0.0.0,::1', preferences: { - disabled: true, + disabled: true, online_service_disable: true, - prio: 4, - permission: ['admin.system'], + prio: 4, + permission: ['admin.system'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Send client stats', - name: 'ui_send_client_stats', - area: 'System::UI', + title: 'Send client stats', + name: 'ui_send_client_stats', + area: 'System::UI', description: 'Send client stats/error message to central server to improve the usability.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ui_send_client_stats', - tag: 'boolean', + null: true, + name: 'ui_send_client_stats', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -558,25 +558,25 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, permission: ['admin.system'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Client storage', - name: 'ui_client_storage', - area: 'System::UI', + title: 'Client storage', + name: 'ui_client_storage', + area: 'System::UI', description: 'Use client storage to cache data to enhance performance of application.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ui_client_storage', - tag: 'boolean', + null: true, + name: 'ui_client_storage', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -584,367 +584,367 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 2, + prio: 2, permission: ['admin.system'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'User Organization Selector - email', - name: 'ui_user_organization_selector_with_email', - area: 'UI::UserOrganizatiomSelector', + title: 'User Organization Selector - email', + name: 'ui_user_organization_selector_with_email', + area: 'UI::UserOrganizatiomSelector', description: 'Display of the e-mail in the result of the user/organization widget.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_user_organization_selector_with_email', - tag: 'boolean', + display: '', + null: true, + name: 'ui_user_organization_selector_with_email', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { - prio: 100, + prio: 100, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Note - default visibility', - name: 'ui_ticket_zoom_article_note_new_internal', - area: 'UI::TicketZoom', + title: 'Note - default visibility', + name: 'ui_ticket_zoom_article_note_new_internal', + area: 'UI::TicketZoom', description: 'Default visibility for new note.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_note_new_internal', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_note_new_internal', + tag: 'boolean', translate: true, - options: { + options: { true => 'internal', false => 'public', }, }, ], }, - state: true, + state: true, preferences: { - prio: 100, + prio: 100, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Email - subject field', - name: 'ui_ticket_zoom_article_email_subject', - area: 'UI::TicketZoom', + title: 'Email - subject field', + name: 'ui_ticket_zoom_article_email_subject', + area: 'UI::TicketZoom', description: 'Use subject field for emails. If disabled, the ticket title will be used as subject.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_email_subject', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_email_subject', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { - prio: 200, + prio: 200, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Email - full quote', - name: 'ui_ticket_zoom_article_email_full_quote', - area: 'UI::TicketZoom', + title: 'Email - full quote', + name: 'ui_ticket_zoom_article_email_full_quote', + area: 'UI::TicketZoom', description: 'Enable if you want to quote the full email in your answer. The quoted email will be put at the end of your answer. If you just want to quote a certain phrase, just mark the text and press reply (this feature is always available).', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_email_full_quote', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_email_full_quote', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { - prio: 220, + prio: 220, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Email - quote header', - name: 'ui_ticket_zoom_article_email_full_quote_header', - area: 'UI::TicketZoom', + title: 'Email - quote header', + name: 'ui_ticket_zoom_article_email_full_quote_header', + area: 'UI::TicketZoom', description: 'Enable if you want a timestamped reply header to be automatically inserted in front of quoted messages.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_email_full_quote_header', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_email_full_quote_header', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: true, + state: true, preferences: { - prio: 240, + prio: 240, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Twitter - tweet initials', - name: 'ui_ticket_zoom_article_twitter_initials', - area: 'UI::TicketZoom', + title: 'Twitter - tweet initials', + name: 'ui_ticket_zoom_article_twitter_initials', + area: 'UI::TicketZoom', description: 'Add sender initials to end of a tweet.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_article_twitter_initials', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_article_twitter_initials', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: true, + state: true, preferences: { - prio: 300, + prio: 300, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Sidebar Attachments', - name: 'ui_ticket_zoom_attachments_preview', - area: 'UI::TicketZoom::Preview', + title: 'Sidebar Attachments', + name: 'ui_ticket_zoom_attachments_preview', + area: 'UI::TicketZoom::Preview', description: 'Enables preview of attachments.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_attachments_preview', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_attachments_preview', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { - prio: 400, + prio: 400, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Sidebar Attachments', - name: 'ui_ticket_zoom_sidebar_article_attachments', - area: 'UI::TicketZoom::Preview', + title: 'Sidebar Attachments', + name: 'ui_ticket_zoom_sidebar_article_attachments', + area: 'UI::TicketZoom::Preview', description: 'Enables a sidebar to show an overview of all attachments.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_ticket_zoom_sidebar_article_attachments', - tag: 'boolean', + display: '', + null: true, + name: 'ui_ticket_zoom_sidebar_article_attachments', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { - prio: 500, + prio: 500, permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Set notes for ticket create types.', - name: 'ui_ticket_create_notes', - area: 'UI::TicketCreate', + title: 'Set notes for ticket create types.', + name: 'ui_ticket_create_notes', + area: 'UI::TicketCreate', description: 'Set notes for ticket create types by selecting type.', - options: {}, - state: { + options: {}, + state: { #'email-out' => 'Attention: When creating a ticket an e-mail is sent.', }, preferences: { permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Default type for a new ticket', - name: 'ui_ticket_create_default_type', - area: 'UI::TicketCreate', + title: 'Default type for a new ticket', + name: 'ui_ticket_create_default_type', + area: 'UI::TicketCreate', description: 'Select default ticket type', - options: { + options: { form: [ { - display: '', - null: false, + display: '', + null: false, multiple: false, - name: 'ui_ticket_create_default_type', - tag: 'select', - options: { - 'phone-in' => '1. Phone inbound', + name: 'ui_ticket_create_default_type', + tag: 'select', + options: { + 'phone-in' => '1. Phone inbound', 'phone-out' => '2. Phone outbound', 'email-out' => '3. Email outbound', }, }, ], }, - state: 'phone-in', + state: 'phone-in', preferences: { permission: ['admin.ui'] }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Available types for a new ticket', - name: 'ui_ticket_create_available_types', - area: 'UI::TicketCreate', + title: 'Available types for a new ticket', + name: 'ui_ticket_create_available_types', + area: 'UI::TicketCreate', description: 'Set available ticket types', - options: { + options: { form: [ { - display: '', - null: false, + display: '', + null: false, multiple: true, - name: 'ui_ticket_create_available_types', - tag: 'select', - options: { - 'phone-in' => '1. Phone inbound', + name: 'ui_ticket_create_available_types', + tag: 'select', + options: { + 'phone-in' => '1. Phone inbound', 'phone-out' => '2. Phone outbound', 'email-out' => '3. Email outbound', }, }, ], }, - state: %w[phone-in phone-out email-out], + state: %w[phone-in phone-out email-out], preferences: { permission: ['admin.ui'] }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Open ticket indicator', - name: 'ui_sidebar_open_ticket_indicator_colored', - area: 'UI::Sidebar', + title: 'Open ticket indicator', + name: 'ui_sidebar_open_ticket_indicator_colored', + area: 'UI::Sidebar', description: 'Color representation of the open ticket indicator in the sidebar.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_sidebar_open_ticket_indicator_colored', - tag: 'boolean', + display: '', + null: true, + name: 'ui_sidebar_open_ticket_indicator_colored', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Open ticket indicator', - name: 'ui_table_group_by_show_count', - area: 'UI::Base', + title: 'Open ticket indicator', + name: 'ui_table_group_by_show_count', + area: 'UI::Base', description: 'Total display of the number of objects in a grouping.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ui_table_group_by_show_count', - tag: 'boolean', + display: '', + null: true, + name: 'ui_table_group_by_show_count', + tag: 'boolean', translate: true, - options: { + options: { true => 'yes', false => 'no', }, }, ], }, - state: false, + state: false, preferences: { permission: ['admin.ui'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'New User Accounts', - name: 'user_create_account', - area: 'Security::Base', + title: 'New User Accounts', + name: 'user_create_account', + area: 'Security::Base', description: 'Enables users to create their own account via web interface.', - options: { + options: { form: [ { display: '', - null: true, - name: 'user_create_account', - tag: 'boolean', + null: true, + name: 'user_create_account', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -952,24 +952,24 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: true, preferences: { permission: ['admin.security'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Lost Password', - name: 'user_lost_password', - area: 'Security::Base', + title: 'Lost Password', + name: 'user_lost_password', + area: 'Security::Base', description: 'Activates lost password feature for users.', - options: { + options: { form: [ { display: '', - null: true, - name: 'user_lost_password', - tag: 'boolean', + null: true, + name: 'user_lost_password', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -977,24 +977,24 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: true, preferences: { permission: ['admin.security'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'User email for muliple users', - name: 'user_email_multiple_use', - area: 'Model::User', + title: 'User email for muliple users', + name: 'user_email_multiple_use', + area: 'Model::User', description: 'Allow to use email address for muliple users.', - options: { + options: { form: [ { display: '', - null: true, - name: 'user_email_multiple_use', - tag: 'boolean', + null: true, + name: 'user_email_multiple_use', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1002,54 +1002,54 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { permission: ['admin'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_ldap', - area: 'Security::Authentication', + title: 'Authentication via %s', + name: 'auth_ldap', + area: 'Security::Authentication', description: 'Enables user authentication via %s.', preferences: { - title_i18n: ['LDAP'], + title_i18n: ['LDAP'], description_i18n: ['LDAP'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: { - adapter: 'Auth::Ldap', - host: 'localhost', - port: 389, - bind_dn: 'cn=Manager,dc=example,dc=org', - bind_pw: 'example', - uid: 'mail', - base: 'dc=example,dc=org', + state: { + adapter: 'Auth::Ldap', + host: 'localhost', + port: 389, + bind_dn: 'cn=Manager,dc=example,dc=org', + bind_pw: 'example', + uid: 'mail', + base: 'dc=example,dc=org', always_filter: '', - always_roles: %w[Admin Agent], + always_roles: %w[Admin Agent], always_groups: ['Users'], - sync_params: { + sync_params: { firstname: 'sn', - lastname: 'givenName', - email: 'mail', - login: 'mail', + lastname: 'givenName', + email: 'mail', + login: 'mail', }, }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Automatic account link on initial logon', - name: 'auth_third_party_auto_link_at_inital_login', - area: 'Security::ThirdPartyAuthentication', + title: 'Automatic account link on initial logon', + name: 'auth_third_party_auto_link_at_inital_login', + area: 'Security::ThirdPartyAuthentication', description: 'Enables the automatic linking of an existing account on initial login via a third party application. If this is disabled, an existing user must first log into Zammad and then link his "Third Party" account to his Zammad account via Profile -> Linked Accounts.', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_third_party_auto_link_at_inital_login', - tag: 'boolean', + null: true, + name: 'auth_third_party_auto_link_at_inital_login', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1059,23 +1059,23 @@ Setting.create_if_not_exists( }, preferences: { permission: ['admin.security'], - prio: 10, + prio: 10, }, - state: false, - frontend: false + state: false, + frontend: false ) Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_twitter', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_twitter', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_twitter', - tag: 'boolean', + null: true, + name: 'auth_twitter', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1084,54 +1084,54 @@ Setting.create_if_not_exists( ], }, preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_twitter_credentials'], - title_i18n: ['Twitter'], + controller: 'SettingsAreaSwitch', + sub: ['auth_twitter_credentials'], + title_i18n: ['Twitter'], description_i18n: ['Twitter', 'Twitter Developer Site', 'https://dev.twitter.com/apps'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Twitter App Credentials', - name: 'auth_twitter_credentials', - area: 'Security::ThirdPartyAuthentication::Twitter', + title: 'Twitter App Credentials', + name: 'auth_twitter_credentials', + area: 'Security::ThirdPartyAuthentication::Twitter', description: 'App credentials for Twitter.', - options: { + options: { form: [ { display: 'Twitter Key', - null: true, - name: 'key', - tag: 'input', + null: true, + name: 'key', + tag: 'input', }, { display: 'Twitter Secret', - null: true, - name: 'secret', - tag: 'input', + null: true, + name: 'secret', + tag: 'input', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_facebook', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_facebook', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_facebook', - tag: 'boolean', + null: true, + name: 'auth_facebook', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1140,56 +1140,56 @@ Setting.create_if_not_exists( ], }, preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_facebook_credentials'], - title_i18n: ['Facebook'], + controller: 'SettingsAreaSwitch', + sub: ['auth_facebook_credentials'], + title_i18n: ['Facebook'], description_i18n: ['Facebook', 'Facebook Developer Site', 'https://developers.facebook.com/apps/'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Facebook App Credentials', - name: 'auth_facebook_credentials', - area: 'Security::ThirdPartyAuthentication::Facebook', + title: 'Facebook App Credentials', + name: 'auth_facebook_credentials', + area: 'Security::ThirdPartyAuthentication::Facebook', description: 'App credentials for Facebook.', - options: { + options: { form: [ { display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', + null: true, + name: 'app_id', + tag: 'input', }, { display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', + null: true, + name: 'app_secret', + tag: 'input', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_google_oauth2', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_google_oauth2', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_google_oauth2', - tag: 'boolean', + null: true, + name: 'auth_google_oauth2', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1198,55 +1198,55 @@ Setting.create_if_not_exists( ], }, preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_google_oauth2_credentials'], - title_i18n: ['Google'], + controller: 'SettingsAreaSwitch', + sub: ['auth_google_oauth2_credentials'], + title_i18n: ['Google'], description_i18n: ['Google', 'Google API Console Site', 'https://console.developers.google.com/apis/credentials'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Google App Credentials', - name: 'auth_google_oauth2_credentials', - area: 'Security::ThirdPartyAuthentication::Google', + title: 'Google App Credentials', + name: 'auth_google_oauth2_credentials', + area: 'Security::ThirdPartyAuthentication::Google', description: 'Enables user authentication via Google.', - options: { + options: { form: [ { display: 'Client ID', - null: true, - name: 'client_id', - tag: 'input', + null: true, + name: 'client_id', + tag: 'input', }, { display: 'Client Secret', - null: true, - name: 'client_secret', - tag: 'input', + null: true, + name: 'client_secret', + tag: 'input', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_linkedin', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_linkedin', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_linkedin', - tag: 'boolean', + null: true, + name: 'auth_linkedin', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1255,55 +1255,55 @@ Setting.create_if_not_exists( ], }, preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_linkedin_credentials'], - title_i18n: ['LinkedIn'], + controller: 'SettingsAreaSwitch', + sub: ['auth_linkedin_credentials'], + title_i18n: ['LinkedIn'], description_i18n: ['LinkedIn', 'Linkedin Developer Site', 'https://www.linkedin.com/developer/apps'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'LinkedIn App Credentials', - name: 'auth_linkedin_credentials', - area: 'Security::ThirdPartyAuthentication::Linkedin', + title: 'LinkedIn App Credentials', + name: 'auth_linkedin_credentials', + area: 'Security::ThirdPartyAuthentication::Linkedin', description: 'Enables user authentication via LinkedIn.', - options: { + options: { form: [ { display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', + null: true, + name: 'app_id', + tag: 'input', }, { display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', + null: true, + name: 'app_secret', + tag: 'input', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_github', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_github', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_github', - tag: 'boolean', + null: true, + name: 'auth_github', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1312,55 +1312,55 @@ Setting.create_if_not_exists( ], }, preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_github_credentials'], - title_i18n: ['Github'], + controller: 'SettingsAreaSwitch', + sub: ['auth_github_credentials'], + title_i18n: ['Github'], description_i18n: ['Github', 'Github OAuth Applications', 'https://github.com/settings/applications'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Github App Credentials', - name: 'auth_github_credentials', - area: 'Security::ThirdPartyAuthentication::Github', + title: 'Github App Credentials', + name: 'auth_github_credentials', + area: 'Security::ThirdPartyAuthentication::Github', description: 'Enables user authentication via Github.', - options: { + options: { form: [ { display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', + null: true, + name: 'app_id', + tag: 'input', }, { display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', + null: true, + name: 'app_secret', + tag: 'input', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_gitlab', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_gitlab', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_gitlab', - tag: 'boolean', + null: true, + name: 'auth_gitlab', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1369,62 +1369,62 @@ Setting.create_if_not_exists( ], }, preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_gitlab_credentials'], - title_i18n: ['Gitlab'], + controller: 'SettingsAreaSwitch', + sub: ['auth_gitlab_credentials'], + title_i18n: ['Gitlab'], description_i18n: ['Gitlab', 'Gitlab Applications', 'https://your-gitlab-host/admin/applications'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Gitlab App Credentials', - name: 'auth_gitlab_credentials', - area: 'Security::ThirdPartyAuthentication::Gitlab', + title: 'Gitlab App Credentials', + name: 'auth_gitlab_credentials', + area: 'Security::ThirdPartyAuthentication::Gitlab', description: 'Enables user authentication via Gitlab.', - options: { + options: { form: [ { display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', + null: true, + name: 'app_id', + tag: 'input', }, { display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', + null: true, + name: 'app_secret', + tag: 'input', }, { - display: 'Site', - null: true, - name: 'site', - tag: 'input', + display: 'Site', + null: true, + name: 'site', + tag: 'input', placeholder: 'https://gitlab.YOURDOMAIN.com', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_microsoft_office365', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_microsoft_office365', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_microsoft_office365', - tag: 'boolean', + null: true, + name: 'auth_microsoft_office365', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1433,55 +1433,55 @@ Setting.create_if_not_exists( ], }, preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_microsoft_office365_credentials'], - title_i18n: ['Office 365'], + controller: 'SettingsAreaSwitch', + sub: ['auth_microsoft_office365_credentials'], + title_i18n: ['Office 365'], description_i18n: ['Office 365', 'Microsoft Application Registration Portal', 'https://apps.dev.microsoft.com'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Office 365 App Credentials', - name: 'auth_microsoft_office365_credentials', - area: 'Security::ThirdPartyAuthentication::Office365', + title: 'Office 365 App Credentials', + name: 'auth_microsoft_office365_credentials', + area: 'Security::ThirdPartyAuthentication::Office365', description: 'Enables user authentication via Office 365.', - options: { + options: { form: [ { display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', + null: true, + name: 'app_id', + tag: 'input', }, { display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', + null: true, + name: 'app_secret', + tag: 'input', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_oauth2', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_oauth2', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via generic OAuth2. Register your app first.', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_oauth2', - tag: 'boolean', + null: true, + name: 'auth_oauth2', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1491,81 +1491,81 @@ Setting.create_if_not_exists( }, preferences: { controller: 'SettingsAreaSwitch', - sub: ['auth_oauth2_credentials'], + sub: ['auth_oauth2_credentials'], title_i18n: ['Generic OAuth2'], permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Generic OAuth2 App Credentials', - name: 'auth_oauth2_credentials', - area: 'Security::ThirdPartyAuthentication::GenericOAuth', + title: 'Generic OAuth2 App Credentials', + name: 'auth_oauth2_credentials', + area: 'Security::ThirdPartyAuthentication::GenericOAuth', description: 'Enables user authentication via generic OAuth2.', - options: { + options: { form: [ { - display: 'Name', - null: true, - name: 'name', - tag: 'input', + display: 'Name', + null: true, + name: 'name', + tag: 'input', placeholder: 'Some Provider Name', }, { display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', + null: true, + name: 'app_id', + tag: 'input', }, { display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', + null: true, + name: 'app_secret', + tag: 'input', }, { - display: 'Site', - null: true, - name: 'site', - tag: 'input', + display: 'Site', + null: true, + name: 'site', + tag: 'input', placeholder: 'https://oauth.YOURDOMAIN.com', }, { - display: 'authorize_url', - null: true, - name: 'authorize_url', - tag: 'input', + display: 'authorize_url', + null: true, + name: 'authorize_url', + tag: 'input', placeholder: '/oauth/authorize', }, { - display: 'token_url', - null: true, - name: 'token_url', - tag: 'input', + display: 'token_url', + null: true, + name: 'token_url', + tag: 'input', placeholder: '/oauth/token', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_weibo', - area: 'Security::ThirdPartyAuthentication', + title: 'Authentication via %s', + name: 'auth_weibo', + area: 'Security::ThirdPartyAuthentication', description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { + options: { form: [ { display: '', - null: true, - name: 'auth_weibo', - tag: 'boolean', + null: true, + name: 'auth_weibo', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1574,62 +1574,62 @@ Setting.create_if_not_exists( ], }, preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_weibo_credentials'], - title_i18n: ['Weibo'], + controller: 'SettingsAreaSwitch', + sub: ['auth_weibo_credentials'], + title_i18n: ['Weibo'], description_i18n: ['Sina Weibo', 'Sina Weibo Open Protal', 'http://open.weibo.com'], - permission: ['admin.security'], + permission: ['admin.security'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Weibo App Credentials', - name: 'auth_weibo_credentials', - area: 'Security::ThirdPartyAuthentication::Weibo', + title: 'Weibo App Credentials', + name: 'auth_weibo_credentials', + area: 'Security::ThirdPartyAuthentication::Weibo', description: 'Enables user authentication via Weibo.', - options: { + options: { form: [ { display: 'App ID', - null: true, - name: 'client_id', - tag: 'input', + null: true, + name: 'client_id', + tag: 'input', }, { display: 'App Secret', - null: true, - name: 'client_secret', - tag: 'input', + null: true, + name: 'client_secret', + tag: 'input', }, ], }, - state: {}, + state: {}, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Minimum length', - name: 'password_min_size', - area: 'Security::Password', + title: 'Minimum length', + name: 'password_min_size', + area: 'Security::Password', description: 'Password needs to have at least a minimal number of characters.', - options: { + options: { form: [ { display: '', - null: true, - name: 'password_min_size', - tag: 'select', + null: true, + name: 'password_min_size', + tag: 'select', options: { - 4 => ' 4', - 5 => ' 5', - 6 => ' 6', - 7 => ' 7', - 8 => ' 8', - 9 => ' 9', + 4 => ' 4', + 5 => ' 5', + 6 => ' 6', + 7 => ' 7', + 8 => ' 8', + 9 => ' 9', 10 => '10', 11 => '11', 12 => '12', @@ -1645,24 +1645,24 @@ Setting.create_if_not_exists( }, ], }, - state: 6, + state: 6, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: '2 lower and 2 upper characters', - name: 'password_min_2_lower_2_upper_characters', - area: 'Security::Password', + title: '2 lower and 2 upper characters', + name: 'password_min_2_lower_2_upper_characters', + area: 'Security::Password', description: 'Password needs to contain 2 lower and 2 upper characters.', - options: { + options: { form: [ { display: '', - null: true, - name: 'password_min_2_lower_2_upper_characters', - tag: 'select', + null: true, + name: 'password_min_2_lower_2_upper_characters', + tag: 'select', options: { 1 => 'yes', 0 => 'no', @@ -1670,24 +1670,24 @@ Setting.create_if_not_exists( }, ], }, - state: 0, + state: 0, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Digit required', - name: 'password_need_digit', - area: 'Security::Password', + title: 'Digit required', + name: 'password_need_digit', + area: 'Security::Password', description: 'Password needs to contain at least one digit.', - options: { + options: { form: [ { display: 'Needed', - null: true, - name: 'password_need_digit', - tag: 'select', + null: true, + name: 'password_need_digit', + tag: 'select', options: { 1 => 'yes', 0 => 'no', @@ -1695,31 +1695,31 @@ Setting.create_if_not_exists( }, ], }, - state: 1, + state: 1, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Maximum failed logins', - name: 'password_max_login_failed', - area: 'Security::Password', + title: 'Maximum failed logins', + name: 'password_max_login_failed', + area: 'Security::Password', description: 'Number of failed logins after account will be deactivated.', - options: { + options: { form: [ { display: '', - null: true, - name: 'password_max_login_failed', - tag: 'select', + null: true, + name: 'password_max_login_failed', + tag: 'select', options: { - 4 => ' 4', - 5 => ' 5', - 6 => ' 6', - 7 => ' 7', - 8 => ' 8', - 9 => ' 9', + 4 => ' 4', + 5 => ' 5', + 6 => ' 6', + 7 => ' 7', + 8 => ' 8', + 9 => ' 9', 10 => '10', 11 => '11', 13 => '13', @@ -1734,75 +1734,75 @@ Setting.create_if_not_exists( }, ], }, - state: 10, + state: 10, preferences: { permission: ['admin.security'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Ticket Hook', - name: 'ticket_hook', - area: 'Ticket::Base', + title: 'Ticket Hook', + name: 'ticket_hook', + area: 'Ticket::Base', description: 'The identifier for a ticket, e. g. Ticket#, Call#, MyTicket#. The default is Ticket#.', - options: { + options: { form: [ { display: '', - null: false, - name: 'ticket_hook', - tag: 'input', + null: false, + name: 'ticket_hook', + tag: 'input', }, ], }, preferences: { - render: true, - placeholder: true, + render: true, + placeholder: true, authentication: true, - permission: ['admin.ticket'], + permission: ['admin.ticket'], }, - state: 'Ticket#', - frontend: true + state: 'Ticket#', + frontend: true ) Setting.create_if_not_exists( - title: 'Ticket Hook Divider', - name: 'ticket_hook_divider', - area: 'Ticket::Base::Shadow', + title: 'Ticket Hook Divider', + name: 'ticket_hook_divider', + area: 'Ticket::Base::Shadow', description: 'The divider between TicketHook and ticket number. E. g. \': \'.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ticket_hook_divider', - tag: 'input', + null: true, + name: 'ticket_hook_divider', + tag: 'input', }, ], }, - state: '', + state: '', preferences: { permission: ['admin.ticket'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Ticket Hook Position', - name: 'ticket_hook_position', - area: 'Ticket::Base', + title: 'Ticket Hook Position', + name: 'ticket_hook_position', + area: 'Ticket::Base', description: "The format of the subject. * **Right** means **Some Subject [Ticket#12345]** * **Left** means **[Ticket#12345] Some Subject** * **None** means **Some Subject** (without ticket number). In the last case you should enable *postmaster_follow_up_search_in* to recognize follow-ups based on email headers and/or body.", - options: { + options: { form: [ { - display: '', - null: true, - name: 'ticket_hook_position', - tag: 'select', + display: '', + null: true, + name: 'ticket_hook_position', + tag: 'select', translate: true, - options: { + options: { 'left' => 'left', 'right' => 'right', 'none' => 'none', @@ -1810,81 +1810,81 @@ Setting.create_if_not_exists( }, ], }, - state: 'right', + state: 'right', preferences: { controller: 'SettingsAreaTicketHookPosition', permission: ['admin.ticket'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Ticket Last Contact Behaviour', - name: 'ticket_last_contact_behaviour', - area: 'Ticket::Base', + title: 'Ticket Last Contact Behaviour', + name: 'ticket_last_contact_behaviour', + area: 'Ticket::Base', description: 'Sets the last customer contact based on the last contact of a customer or on the last contact of a customer to whom an agent has not yet responded.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'ticket_last_contact_behaviour', - tag: 'select', + display: '', + null: true, + name: 'ticket_last_contact_behaviour', + tag: 'select', translate: true, - options: { - 'based_on_customer_reaction' => 'Last customer contact (without consideration an agent has replied to it)', + options: { + 'based_on_customer_reaction' => 'Last customer contact (without consideration an agent has replied to it)', 'check_if_agent_already_replied' => 'Last customer contact (with consideration an agent has replied to it)', }, }, ], }, - state: 'check_if_agent_already_replied', + state: 'check_if_agent_already_replied', preferences: { permission: ['admin.ticket'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Ticket Number Format', - name: 'ticket_number', - area: 'Ticket::Number', + title: 'Ticket Number Format', + name: 'ticket_number', + area: 'Ticket::Number', description: "Selects the ticket number generator module. * **Increment** increments the ticket number, the SystemID and the counter are used with SystemID.Counter format (e.g. 1010138, 1010139). * With **Date** the ticket numbers will be generated by the current date, the SystemID and the counter. The format looks like Year.Month.Day.SystemID.counter (e.g. 201206231010138, 201206231010139).", - options: { + options: { form: [ { - display: '', - null: true, - name: 'ticket_number', - tag: 'select', + display: '', + null: true, + name: 'ticket_number', + tag: 'select', translate: true, - options: { + options: { 'Ticket::Number::Increment' => 'Increment (SystemID.Counter)', 'Ticket::Number::Date' => 'Date (Year.Month.Day.SystemID.Counter)', }, }, ], }, - state: 'Ticket::Number::Increment', + state: 'Ticket::Number::Increment', preferences: { settings_included: %w[ticket_number_increment ticket_number_date], - controller: 'SettingsAreaTicketNumber', - permission: ['admin.ticket'], + controller: 'SettingsAreaTicketNumber', + permission: ['admin.ticket'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Ticket Number Increment', - name: 'ticket_number_increment', - area: 'Ticket::Number', + title: 'Ticket Number Increment', + name: 'ticket_number_increment', + area: 'Ticket::Number', description: '-', - options: { + options: { form: [ { display: 'Checksum', - null: true, - name: 'checksum', - tag: 'boolean', + null: true, + name: 'checksum', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1892,19 +1892,19 @@ Setting.create_if_not_exists( }, { display: 'Min. size of number', - null: true, - name: 'min_size', - tag: 'select', + null: true, + name: 'min_size', + tag: 'select', options: { - 1 => ' 1', - 2 => ' 2', - 3 => ' 3', - 4 => ' 4', - 5 => ' 5', - 6 => ' 6', - 7 => ' 7', - 8 => ' 8', - 9 => ' 9', + 1 => ' 1', + 2 => ' 2', + 3 => ' 3', + 4 => ' 4', + 5 => ' 5', + 6 => ' 6', + 7 => ' 7', + 8 => ' 8', + 9 => ' 9', 10 => '10', 11 => '11', 12 => '12', @@ -1920,28 +1920,28 @@ Setting.create_if_not_exists( }, ], }, - state: { + state: { checksum: false, min_size: 5, }, preferences: { permission: ['admin.ticket'], - hidden: true, + hidden: true, }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Ticket Number Increment Date', - name: 'ticket_number_date', - area: 'Ticket::Number', + title: 'Ticket Number Increment Date', + name: 'ticket_number_date', + area: 'Ticket::Number', description: '-', - options: { + options: { form: [ { display: 'Checksum', - null: true, - name: 'checksum', - tag: 'boolean', + null: true, + name: 'checksum', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1949,28 +1949,28 @@ Setting.create_if_not_exists( }, ], }, - state: { + state: { checksum: false }, preferences: { permission: ['admin.ticket'], - hidden: true, + hidden: true, }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Auto Assigment', - name: 'ticket_auto_assignment', - area: 'Web::Base', + title: 'Auto Assigment', + name: 'ticket_auto_assignment', + area: 'Web::Base', description: 'Enable ticket auto assignment.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ticket_auto_assignment', - tag: 'boolean', + null: true, + name: 'ticket_auto_assignment', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -1980,57 +1980,57 @@ Setting.create_if_not_exists( }, preferences: { authentication: true, - permission: ['admin.ticket_auto_assignment'], + permission: ['admin.ticket_auto_assignment'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Time Accounting Selector', - name: 'ticket_auto_assignment_selector', - area: 'Web::Base', + title: 'Time Accounting Selector', + name: 'ticket_auto_assignment_selector', + area: 'Web::Base', description: 'Enable auto assignment for following matching tickets.', - options: { + options: { form: [ {}, ], }, preferences: { authentication: true, - permission: ['admin.ticket_auto_assignment'], + permission: ['admin.ticket_auto_assignment'], }, - state: { condition: { 'ticket.state_id' => { operator: 'is', value: Ticket::State.by_category(:work_on).pluck(:id) } } }, - frontend: true + state: { condition: { 'ticket.state_id' => { operator: 'is', value: Ticket::State.by_category(:work_on).pluck(:id) } } }, + frontend: true ) Setting.create_or_update( - title: 'Time Accounting Selector', - name: 'ticket_auto_assignment_user_ids_ignore', - area: 'Web::Base', + title: 'Time Accounting Selector', + name: 'ticket_auto_assignment_user_ids_ignore', + area: 'Web::Base', description: 'Define an exception of "automatic assignment" for certain users (e.g. executives).', - options: { + options: { form: [ {}, ], }, preferences: { authentication: true, - permission: ['admin.ticket_auto_assignment'], + permission: ['admin.ticket_auto_assignment'], }, - state: [], - frontend: true + state: [], + frontend: true ) Setting.create_if_not_exists( - title: 'Ticket Number ignore system_id', - name: 'ticket_number_ignore_system_id', - area: 'Ticket::Core', + title: 'Ticket Number ignore system_id', + name: 'ticket_number_ignore_system_id', + area: 'Ticket::Core', description: '-', - options: { + options: { form: [ { display: 'Ignore system_id', - null: true, - name: 'ticket_number_ignore_system_id', - tag: 'boolean', + null: true, + name: 'ticket_number_ignore_system_id', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -2038,28 +2038,28 @@ Setting.create_if_not_exists( }, ], }, - state: { + state: { ticket_number_ignore_system_id: false }, preferences: { permission: ['admin.ticket'], - hidden: true, + hidden: true, }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Recursive Ticket Triggers', - name: 'ticket_trigger_recursive', - area: 'Ticket::Core', + title: 'Recursive Ticket Triggers', + name: 'ticket_trigger_recursive', + area: 'Ticket::Core', description: 'Activate the recursive processing of ticket triggers.', - options: { + options: { form: [ { display: 'Recursive Ticket Triggers', - null: true, - name: 'ticket_trigger_recursive', - tag: 'boolean', + null: true, + name: 'ticket_trigger_recursive', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -2067,35 +2067,35 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { permission: ['admin.ticket'], - hidden: true, + hidden: true, }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Recursive Ticket Triggers Loop Max.', - name: 'ticket_trigger_recursive_max_loop', - area: 'Ticket::Core', + title: 'Recursive Ticket Triggers Loop Max.', + name: 'ticket_trigger_recursive_max_loop', + area: 'Ticket::Core', description: 'Maximum number of recursively executed triggers.', - options: { + options: { form: [ { display: 'Recursive Ticket Triggers', - null: true, - name: 'ticket_trigger_recursive_max_loop', - tag: 'select', + null: true, + name: 'ticket_trigger_recursive_max_loop', + tag: 'select', options: { - 1 => ' 1', - 2 => ' 2', - 3 => ' 3', - 4 => ' 4', - 5 => ' 5', - 6 => ' 6', - 7 => ' 7', - 8 => ' 8', - 9 => ' 9', + 1 => ' 1', + 2 => ' 2', + 3 => ' 3', + 4 => ' 4', + 5 => ' 5', + 6 => ' 6', + 7 => ' 7', + 8 => ' 8', + 9 => ' 9', 10 => '10', 11 => '11', 12 => '12', @@ -2111,26 +2111,26 @@ Setting.create_if_not_exists( }, ], }, - state: 10, + state: 10, preferences: { permission: ['admin.ticket'], - hidden: true, + hidden: true, }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Enable Ticket creation', - name: 'customer_ticket_create', - area: 'CustomerWeb::Base', + title: 'Enable Ticket creation', + name: 'customer_ticket_create', + area: 'CustomerWeb::Base', description: 'Defines if a customer can create tickets via the web interface.', - options: { + options: { form: [ { display: '', - null: true, - name: 'customer_ticket_create', - tag: 'boolean', + null: true, + name: 'customer_ticket_create', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -2138,52 +2138,52 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: true, preferences: { authentication: true, - permission: ['admin.channel_web'], + permission: ['admin.channel_web'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Group selection for Ticket creation', - name: 'customer_ticket_create_group_ids', - area: 'CustomerWeb::Base', + title: 'Group selection for Ticket creation', + name: 'customer_ticket_create_group_ids', + area: 'CustomerWeb::Base', description: 'Defines groups for which a customer can create tickets via web interface. "-" means all groups are available.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'group_ids', - tag: 'select', - multiple: true, + display: '', + null: true, + name: 'group_ids', + tag: 'select', + multiple: true, nulloption: true, - relation: 'Group', + relation: 'Group', }, ], }, - state: '', + state: '', preferences: { authentication: true, - permission: ['admin.channel_web'], + permission: ['admin.channel_web'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Enable Ticket creation', - name: 'form_ticket_create', - area: 'Form::Base', + title: 'Enable Ticket creation', + name: 'form_ticket_create', + area: 'Form::Base', description: 'Defines if tickets can be created via web form.', - options: { + options: { form: [ { display: '', - null: true, - name: 'form_ticket_create', - tag: 'boolean', + null: true, + name: 'form_ticket_create', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -2191,11 +2191,11 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { permission: ['admin.channel_formular'], }, - frontend: false, + frontend: false, ) group = Group.where(active: true).first @@ -2207,240 +2207,240 @@ if group group_id = group.id end Setting.create_if_not_exists( - title: 'Group selection for Ticket creation', - name: 'form_ticket_create_group_id', - area: 'Form::Base', + title: 'Group selection for Ticket creation', + name: 'form_ticket_create_group_id', + area: 'Form::Base', description: 'Defines if group of created tickets via web form.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'form_ticket_create_group_id', - tag: 'select', + display: '', + null: true, + name: 'form_ticket_create_group_id', + tag: 'select', relation: 'Group', }, ], }, - state: group_id, + state: group_id, preferences: { permission: ['admin.channel_formular'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Limit tickets by ip per hour', - name: 'form_ticket_create_by_ip_per_hour', - area: 'Form::Base', + title: 'Limit tickets by ip per hour', + name: 'form_ticket_create_by_ip_per_hour', + area: 'Form::Base', description: 'Defines limit of tickets by ip per hour via web form.', - options: { + options: { form: [ { display: '', - null: true, - name: 'form_ticket_create_by_ip_per_hour', - tag: 'input', + null: true, + name: 'form_ticket_create_by_ip_per_hour', + tag: 'input', }, ], }, - state: 20, + state: 20, preferences: { permission: ['admin.channel_formular'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Limit tickets by ip per day', - name: 'form_ticket_create_by_ip_per_day', - area: 'Form::Base', + title: 'Limit tickets by ip per day', + name: 'form_ticket_create_by_ip_per_day', + area: 'Form::Base', description: 'Defines limit of tickets by ip per day via web form.', - options: { + options: { form: [ { display: '', - null: true, - name: 'form_ticket_create_by_ip_per_day', - tag: 'input', + null: true, + name: 'form_ticket_create_by_ip_per_day', + tag: 'input', }, ], }, - state: 240, + state: 240, preferences: { permission: ['admin.channel_formular'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Limit tickets per day', - name: 'form_ticket_create_per_day', - area: 'Form::Base', + title: 'Limit tickets per day', + name: 'form_ticket_create_per_day', + area: 'Form::Base', description: 'Defines limit of tickets per day via web form.', - options: { + options: { form: [ { display: '', - null: true, - name: 'form_ticket_create_per_day', - tag: 'input', + null: true, + name: 'form_ticket_create_per_day', + tag: 'input', }, ], }, - state: 5000, + state: 5000, preferences: { permission: ['admin.channel_formular'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Ticket Subject Size', - name: 'ticket_subject_size', - area: 'Email::Base', + title: 'Ticket Subject Size', + name: 'ticket_subject_size', + area: 'Email::Base', description: 'Max. length of the subject in an email reply.', - options: { + options: { form: [ { display: '', - null: false, - name: 'ticket_subject_size', - tag: 'input', + null: false, + name: 'ticket_subject_size', + tag: 'input', }, ], }, - state: '110', + state: '110', preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Ticket Subject Reply', - name: 'ticket_subject_re', - area: 'Email::Base', + title: 'Ticket Subject Reply', + name: 'ticket_subject_re', + area: 'Email::Base', description: 'The text at the beginning of the subject in an email reply, e. g. RE, AW, or AS.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ticket_subject_re', - tag: 'input', + null: true, + name: 'ticket_subject_re', + tag: 'input', }, ], }, - state: 'RE', + state: 'RE', preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Ticket Subject Forward', - name: 'ticket_subject_fwd', - area: 'Email::Base', + title: 'Ticket Subject Forward', + name: 'ticket_subject_fwd', + area: 'Email::Base', description: 'The text at the beginning of the subject in an email forward, e. g. FWD.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ticket_subject_fwd', - tag: 'input', + null: true, + name: 'ticket_subject_fwd', + tag: 'input', }, ], }, - state: 'FWD', + state: 'FWD', preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Sender Format', - name: 'ticket_define_email_from', - area: 'Email::Base', + title: 'Sender Format', + name: 'ticket_define_email_from', + area: 'Email::Base', description: 'Defines how the From field of emails (sent from answers and email tickets) should look like.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ticket_define_email_from', - tag: 'select', + null: true, + name: 'ticket_define_email_from', + tag: 'select', options: { - SystemAddressName: 'System Address Display Name', + SystemAddressName: 'System Address Display Name', AgentNameSystemAddressName: 'Agent Name + FromSeparator + System Address Display Name', }, }, ], }, - state: 'AgentNameSystemAddressName', + state: 'AgentNameSystemAddressName', preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Sender Format Separator', - name: 'ticket_define_email_from_separator', - area: 'Email::Base', + title: 'Sender Format Separator', + name: 'ticket_define_email_from_separator', + area: 'Email::Base', description: 'Defines the separator between the agent\'s real name and the given group email address.', - options: { + options: { form: [ { display: '', - null: false, - name: 'ticket_define_email_from_separator', - tag: 'input', + null: false, + name: 'ticket_define_email_from_separator', + tag: 'input', }, ], }, - state: 'via', + state: 'via', preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Maximum Email Size', - name: 'postmaster_max_size', - area: 'Email::Base', + title: 'Maximum Email Size', + name: 'postmaster_max_size', + area: 'Email::Base', description: 'Maximum size in MB of emails.', - options: { + options: { form: [ { display: '', - null: true, - name: 'postmaster_max_size', - tag: 'select', + null: true, + name: 'postmaster_max_size', + tag: 'select', options: { - 1 => ' 1', - 2 => ' 2', - 3 => ' 3', - 4 => ' 4', - 5 => ' 5', - 6 => ' 6', - 7 => ' 7', - 8 => ' 8', - 9 => ' 9', - 10 => ' 10', - 15 => ' 15', - 20 => ' 20', - 25 => ' 25', - 30 => ' 30', - 35 => ' 35', - 40 => ' 40', - 45 => ' 45', - 50 => ' 50', - 60 => ' 60', - 70 => ' 70', - 80 => ' 80', - 90 => ' 90', + 1 => ' 1', + 2 => ' 2', + 3 => ' 3', + 4 => ' 4', + 5 => ' 5', + 6 => ' 6', + 7 => ' 7', + 8 => ' 8', + 9 => ' 9', + 10 => ' 10', + 15 => ' 15', + 20 => ' 20', + 25 => ' 25', + 30 => ' 30', + 35 => ' 35', + 40 => ' 40', + 45 => ' 45', + 50 => ' 50', + 60 => ' 60', + 70 => ' 70', + 80 => ' 80', + 90 => ' 90', 100 => '100', 125 => '125', 150 => '150', @@ -2448,26 +2448,26 @@ Setting.create_if_not_exists( }, ], }, - state: 10, + state: 10, preferences: { online_service_disable: true, - permission: ['admin.channel_email'], + permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Additional follow-up detection', - name: 'postmaster_follow_up_search_in', - area: 'Email::Base', + title: 'Additional follow-up detection', + name: 'postmaster_follow_up_search_in', + area: 'Email::Base', description: 'By default the follow-up check is done via the subject of an email. With this setting you can add more fields for which the follow-up check will be executed.', - options: { + options: { form: [ { display: '', - null: true, - name: 'postmaster_follow_up_search_in', - tag: 'checkbox', + null: true, + name: 'postmaster_follow_up_search_in', + tag: 'checkbox', options: { 'references' => 'References - Search for follow up also in In-Reply-To or References headers.', 'body' => 'Body - Search for follow up also in mail body.', @@ -2476,25 +2476,25 @@ Setting.create_if_not_exists( }, ], }, - state: [], + state: [], preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Sender based on Reply-To header', - name: 'postmaster_sender_based_on_reply_to', - area: 'Email::Base', + title: 'Sender based on Reply-To header', + name: 'postmaster_sender_based_on_reply_to', + area: 'Email::Base', description: 'Set/overwrite sender/from of email based on reply-to header. Useful to set correct customer if email is received from a third party system on behalf of a customer.', - options: { + options: { form: [ { display: '', - null: true, - name: 'postmaster_sender_based_on_reply_to', - tag: 'select', + null: true, + name: 'postmaster_sender_based_on_reply_to', + tag: 'select', options: { '' => '-', 'as_sender_of_email' => 'Take reply-to header as sender/from of email.', @@ -2503,25 +2503,25 @@ Setting.create_if_not_exists( }, ], }, - state: [], + state: [], preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Customer selection based on sender and receiver list', - name: 'postmaster_sender_is_agent_search_for_customer', - area: 'Email::Base', + title: 'Customer selection based on sender and receiver list', + name: 'postmaster_sender_is_agent_search_for_customer', + area: 'Email::Base', description: 'If the sender is an agent, set the first user in the recipient list as a customer.', - options: { + options: { form: [ { display: '', - null: true, - name: 'postmaster_sender_is_agent_search_for_customer', - tag: 'boolean', + null: true, + name: 'postmaster_sender_is_agent_search_for_customer', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -2529,82 +2529,82 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: true, preferences: { permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Notification Sender', - name: 'notification_sender', - area: 'Email::Base', + title: 'Notification Sender', + name: 'notification_sender', + area: 'Email::Base', description: 'Defines the sender of email notifications.', - options: { + options: { form: [ { display: '', - null: false, - name: 'notification_sender', - tag: 'input', + null: false, + name: 'notification_sender', + tag: 'input', }, ], }, - state: 'Notification Master ', # rubocop:disable Lint/InterpolationCheck + state: 'Notification Master ', # rubocop:disable Lint/InterpolationCheck preferences: { online_service_disable: true, - permission: ['admin.channel_email'], + permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Block Notifications', - name: 'send_no_auto_response_reg_exp', - area: 'Email::Base', + title: 'Block Notifications', + name: 'send_no_auto_response_reg_exp', + area: 'Email::Base', description: 'If this regex matches, no notification will be sent by the sender.', - options: { + options: { form: [ { display: '', - null: false, - name: 'send_no_auto_response_reg_exp', - tag: 'input', + null: false, + name: 'send_no_auto_response_reg_exp', + tag: 'input', }, ], }, - state: '(mailer-daemon|postmaster|abuse|root|noreply|noreply.+?|no-reply|no-reply.+?)@.+?', + state: '(mailer-daemon|postmaster|abuse|root|noreply|noreply.+?|no-reply|no-reply.+?)@.+?', preferences: { online_service_disable: true, - permission: ['admin.channel_email'], + permission: ['admin.channel_email'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Bcc address for all outgoing emails', - name: 'system_bcc', - area: 'Email::Enhanced', + title: 'Bcc address for all outgoing emails', + name: 'system_bcc', + area: 'Email::Enhanced', description: 'To archive all outgoing emails from Zammad to external, you can store a bcc email address here.', - options: {}, - state: '', + options: {}, + state: '', preferences: { online_service_disable: true }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'API Token Access', - name: 'api_token_access', - area: 'API::Base', + title: 'API Token Access', + name: 'api_token_access', + area: 'API::Base', description: 'Enable REST API using tokens (not username/email address and password). Each user needs to create its own access tokens in user profile.', - options: { + options: { form: [ { display: '', - null: true, - name: 'api_token_access', - tag: 'boolean', + null: true, + name: 'api_token_access', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -2612,24 +2612,24 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: true, preferences: { permission: ['admin.api'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'API Password Access', - name: 'api_password_access', - area: 'API::Base', + title: 'API Password Access', + name: 'api_password_access', + area: 'API::Base', description: 'Enable REST API access using the username/email address and password for the authentication user.', - options: { + options: { form: [ { display: '', - null: true, - name: 'api_password_access', - tag: 'boolean', + null: true, + name: 'api_password_access', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -2637,47 +2637,47 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: true, preferences: { permission: ['admin.api'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Monitoring Token', - name: 'monitoring_token', - area: 'HealthCheck::Base', + title: 'Monitoring Token', + name: 'monitoring_token', + area: 'HealthCheck::Base', description: 'Token for monitoring.', - options: { + options: { form: [ { display: '', - null: false, - name: 'monitoring_token', - tag: 'input', + null: false, + name: 'monitoring_token', + tag: 'input', }, ], }, - state: ENV['MONITORING_TOKEN'] || SecureRandom.urlsafe_base64(40), + state: ENV['MONITORING_TOKEN'] || SecureRandom.urlsafe_base64(40), preferences: { permission: ['admin.monitoring'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Enable Chat', - name: 'chat', - area: 'Chat::Base', + title: 'Enable Chat', + name: 'chat', + area: 'Chat::Base', description: 'Enable/disable online chat.', - options: { + options: { form: [ { display: '', - null: true, - name: 'chat', - tag: 'boolean', + null: true, + name: 'chat', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -2686,134 +2686,134 @@ Setting.create_if_not_exists( ], }, preferences: { - trigger: ['menu:render', 'chat:rerender'], + trigger: ['menu:render', 'chat:rerender'], permission: ['admin.channel_chat'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Agent idle timeout', - name: 'chat_agent_idle_timeout', - area: 'Chat::Extended', + title: 'Agent idle timeout', + name: 'chat_agent_idle_timeout', + area: 'Chat::Extended', description: 'Idle timeout in seconds until agent is set offline automatically.', - options: { + options: { form: [ { display: '', - null: false, - name: 'chat_agent_idle_timeout', - tag: 'input', + null: false, + name: 'chat_agent_idle_timeout', + tag: 'input', }, ], }, - state: '120', + state: '120', preferences: { permission: ['admin.channel_chat'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Defines searchable models.', - name: 'models_searchable', - area: 'Models::Base', + title: 'Defines searchable models.', + name: 'models_searchable', + area: 'Models::Base', description: 'Defines the searchable models.', - options: {}, - state: Models.searchable.map(&:to_s), + options: {}, + state: Models.searchable.map(&:to_s), preferences: { authentication: true, }, - frontend: true, + frontend: true, ) Setting.create_if_not_exists( - title: 'Default Screen', - name: 'default_controller', - area: 'Core', + title: 'Default Screen', + name: 'default_controller', + area: 'Core', description: 'Defines the default screen.', - options: {}, - state: '#dashboard', - frontend: true + options: {}, + state: '#dashboard', + frontend: true ) Setting.create_if_not_exists( - title: 'Elasticsearch Endpoint URL', - name: 'es_url', - area: 'SearchIndex::Elasticsearch', + title: 'Elasticsearch Endpoint URL', + name: 'es_url', + area: 'SearchIndex::Elasticsearch', description: 'Defines endpoint of Elasticsearch.', - state: '', + state: '', preferences: { online_service_disable: true }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Elasticsearch Endpoint User', - name: 'es_user', - area: 'SearchIndex::Elasticsearch', + title: 'Elasticsearch Endpoint User', + name: 'es_user', + area: 'SearchIndex::Elasticsearch', description: 'Defines HTTP basic auth user of Elasticsearch.', - state: '', + state: '', preferences: { online_service_disable: true }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Elasticsearch Endpoint Password', - name: 'es_password', - area: 'SearchIndex::Elasticsearch', + title: 'Elasticsearch Endpoint Password', + name: 'es_password', + area: 'SearchIndex::Elasticsearch', description: 'Defines HTTP basic auth password of Elasticsearch.', - state: '', + state: '', preferences: { online_service_disable: true }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Elasticsearch Endpoint Index', - name: 'es_index', - area: 'SearchIndex::Elasticsearch', + title: 'Elasticsearch Endpoint Index', + name: 'es_index', + area: 'SearchIndex::Elasticsearch', description: 'Defines Elasticsearch index name.', - state: 'zammad', + state: 'zammad', preferences: { online_service_disable: true }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Elasticsearch Attachment Extensions', - name: 'es_attachment_ignore', - area: 'SearchIndex::Elasticsearch', + title: 'Elasticsearch Attachment Extensions', + name: 'es_attachment_ignore', + area: 'SearchIndex::Elasticsearch', description: 'Defines attachment extensions which will be ignored by Elasticsearch.', - state: [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ], + state: [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ], preferences: { online_service_disable: true }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Elasticsearch Attachment Size', - name: 'es_attachment_max_size_in_mb', - area: 'SearchIndex::Elasticsearch', + title: 'Elasticsearch Attachment Size', + name: 'es_attachment_max_size_in_mb', + area: 'SearchIndex::Elasticsearch', description: 'Define max. attachment size for Elasticsearch.', - state: 10, + state: 10, preferences: { online_service_disable: true }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Elasticsearch Pipeline Name', - name: 'es_pipeline', - area: 'SearchIndex::Elasticsearch', + title: 'Elasticsearch Pipeline Name', + name: 'es_pipeline', + area: 'SearchIndex::Elasticsearch', description: 'Define pipeline name for Elasticsearch.', - state: '', + state: '', preferences: { online_service_disable: true }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Import Mode', - name: 'import_mode', - area: 'Import::Base', + title: 'Import Mode', + name: 'import_mode', + area: 'Import::Base', description: 'Puts Zammad into import mode (disables some triggers).', - options: { + options: { form: [ { display: '', - null: true, - name: 'import_mode', - tag: 'boolean', + null: true, + name: 'import_mode', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -2821,30 +2821,30 @@ Setting.create_if_not_exists( }, ], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Import Backend', - name: 'import_backend', - area: 'Import::Base::Internal', + title: 'Import Backend', + name: 'import_backend', + area: 'Import::Base::Internal', description: 'Set backend which is being used for import.', - options: {}, - state: '', - frontend: true + options: {}, + state: '', + frontend: true ) Setting.create_if_not_exists( - title: 'Ignore Escalation/SLA Information', - name: 'import_ignore_sla', - area: 'Import::Base', + title: 'Ignore Escalation/SLA Information', + name: 'import_ignore_sla', + area: 'Import::Base', description: 'Ignore escalation/SLA information for import.', - options: { + options: { form: [ { display: '', - null: true, - name: 'import_ignore_sla', - tag: 'boolean', + null: true, + name: 'import_ignore_sla', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -2852,139 +2852,139 @@ Setting.create_if_not_exists( }, ], }, - state: false, - frontend: false + state: false, + frontend: false ) Setting.create_if_not_exists( - title: 'Import Endpoint', - name: 'import_otrs_endpoint', - area: 'Import::OTRS', + title: 'Import Endpoint', + name: 'import_otrs_endpoint', + area: 'Import::OTRS', description: 'Defines OTRS endpoint to import users, tickets, states and articles.', - options: { + options: { form: [ { display: '', - null: false, - name: 'import_otrs_endpoint', - tag: 'input', + null: false, + name: 'import_otrs_endpoint', + tag: 'input', }, ], }, - state: 'http://otrs_host/otrs', - frontend: false + state: 'http://otrs_host/otrs', + frontend: false ) Setting.create_if_not_exists( - title: 'Import Key', - name: 'import_otrs_endpoint_key', - area: 'Import::OTRS', + title: 'Import Key', + name: 'import_otrs_endpoint_key', + area: 'Import::OTRS', description: 'Defines OTRS endpoint authentication key.', - options: { + options: { form: [ { display: '', - null: false, - name: 'import_otrs_endpoint_key', - tag: 'input', + null: false, + name: 'import_otrs_endpoint_key', + tag: 'input', }, ], }, - state: '', - frontend: false + state: '', + frontend: false ) Setting.create_if_not_exists( - title: 'Import User for HTTP basic authentication', - name: 'import_otrs_user', - area: 'Import::OTRS', + title: 'Import User for HTTP basic authentication', + name: 'import_otrs_user', + area: 'Import::OTRS', description: 'Defines HTTP basic authentication user (only if OTRS is protected via HTTP basic auth).', - options: { + options: { form: [ { display: '', - null: true, - name: 'import_otrs_user', - tag: 'input', + null: true, + name: 'import_otrs_user', + tag: 'input', }, ], }, - state: '', - frontend: false + state: '', + frontend: false ) Setting.create_if_not_exists( - title: 'Import Password for http basic authentication', - name: 'import_otrs_password', - area: 'Import::OTRS', + title: 'Import Password for http basic authentication', + name: 'import_otrs_password', + area: 'Import::OTRS', description: 'Defines http basic authentication password (only if OTRS is protected via http basic auth).', - options: { + options: { form: [ { display: '', - null: true, - name: 'import_otrs_password', - tag: 'input', + null: true, + name: 'import_otrs_password', + tag: 'input', }, ], }, - state: '', - frontend: false + state: '', + frontend: false ) Setting.create_if_not_exists( - title: 'Import Endpoint', - name: 'import_zendesk_endpoint', - area: 'Import::Zendesk', + title: 'Import Endpoint', + name: 'import_zendesk_endpoint', + area: 'Import::Zendesk', description: 'Defines Zendesk endpoint to import users, ticket, states and articles.', - options: { + options: { form: [ { display: '', - null: false, - name: 'import_zendesk_endpoint', - tag: 'input', + null: false, + name: 'import_zendesk_endpoint', + tag: 'input', }, ], }, - state: 'https://yours.zendesk.com/api/v2', - frontend: false + state: 'https://yours.zendesk.com/api/v2', + frontend: false ) Setting.create_if_not_exists( - title: 'Import Key for requesting the Zendesk API', - name: 'import_zendesk_endpoint_key', - area: 'Import::Zendesk', + title: 'Import Key for requesting the Zendesk API', + name: 'import_zendesk_endpoint_key', + area: 'Import::Zendesk', description: 'Defines Zendesk endpoint authentication key.', - options: { + options: { form: [ { display: '', - null: false, - name: 'import_zendesk_endpoint_key', - tag: 'input', + null: false, + name: 'import_zendesk_endpoint_key', + tag: 'input', }, ], }, - state: '', - frontend: false + state: '', + frontend: false ) Setting.create_if_not_exists( - title: 'Import User for requesting the Zendesk API', - name: 'import_zendesk_endpoint_username', - area: 'Import::Zendesk', + title: 'Import User for requesting the Zendesk API', + name: 'import_zendesk_endpoint_username', + area: 'Import::Zendesk', description: 'Defines Zendesk endpoint authentication user.', - options: { + options: { form: [ { display: '', - null: true, - name: 'import_zendesk_endpoint_username', - tag: 'input', + null: true, + name: 'import_zendesk_endpoint_username', + tag: 'input', }, ], }, - state: '', - frontend: false + state: '', + frontend: false ) Setting.create_if_not_exists( title: 'Import Backends', @@ -2996,7 +2996,7 @@ Setting.create_if_not_exists( preferences: { permission: ['admin'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( @@ -3011,41 +3011,41 @@ Setting.create_if_not_exists( unit: :debug, result: :debug, }, - state: { - optional: :debug, - set: :debug, - get: :debug, - attribute_initialization: { + state: { + optional: :debug, + set: :debug, + get: :debug, + attribute_initialization: { start_finish: :debug, attributes: :debug, }, - parameter_initialization: { + parameter_initialization: { parameters: :debug, start_finish: :debug, unused: :debug, }, expectations_initialization: :debug, - cleanup: { + cleanup: { start_finish: :debug, remove: :debug, } } }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Time Accounting', - name: 'time_accounting', - area: 'Web::Base', + title: 'Time Accounting', + name: 'time_accounting', + area: 'Web::Base', description: 'Enable time accounting.', - options: { + options: { form: [ { display: '', - null: true, - name: 'time_accounting', - tag: 'boolean', + null: true, + name: 'time_accounting', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3055,42 +3055,42 @@ Setting.create_if_not_exists( }, preferences: { authentication: true, - permission: ['admin.time_accounting'], + permission: ['admin.time_accounting'], }, - state: false, - frontend: true + state: false, + frontend: true ) Setting.create_if_not_exists( - title: 'Time Accounting Selector', - name: 'time_accounting_selector', - area: 'Web::Base', + title: 'Time Accounting Selector', + name: 'time_accounting_selector', + area: 'Web::Base', description: 'Enable time accounting for these tickets.', - options: { + options: { form: [ {}, ], }, preferences: { authentication: true, - permission: ['admin.time_accounting'], + permission: ['admin.time_accounting'], }, - state: {}, - frontend: true + state: {}, + frontend: true ) Setting.create_if_not_exists( - title: 'New Tags', - name: 'tag_new', - area: 'Web::Base', + title: 'New Tags', + name: 'tag_new', + area: 'Web::Base', description: 'Allow users to create new tags.', - options: { + options: { form: [ { display: '', - null: true, - name: 'tag_new', - tag: 'boolean', + null: true, + name: 'tag_new', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3100,213 +3100,213 @@ Setting.create_if_not_exists( }, preferences: { authentication: true, - permission: ['admin.tag'], + permission: ['admin.tag'], }, - state: true, - frontend: true + state: true, + frontend: true ) Setting.create_if_not_exists( - title: 'Default calendar tickets subscriptions', - name: 'defaults_calendar_subscriptions_tickets', - area: 'Defaults::CalendarSubscriptions', + title: 'Default calendar tickets subscriptions', + name: 'defaults_calendar_subscriptions_tickets', + area: 'Defaults::CalendarSubscriptions', description: 'Defines the default calendar tickets subscription settings.', - options: {}, - state: { + options: {}, + state: { escalation: { - own: true, + own: true, not_assigned: false, }, - new_open: { - own: true, + new_open: { + own: true, not_assigned: false, }, - pending: { - own: true, + pending: { + own: true, not_assigned: false, } }, preferences: { authentication: true, }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Defines translator identifier.', - name: 'translator_key', - area: 'i18n::translator_key', + title: 'Defines translator identifier.', + name: 'translator_key', + area: 'i18n::translator_key', description: 'Defines the translator identifier for contributions.', - options: {}, - state: '', - frontend: false + options: {}, + state: '', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0010_postmaster_filter_trusted', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0010_postmaster_filter_trusted', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to remove X-Zammad headers from not trusted sources.', - options: {}, - state: 'Channel::Filter::Trusted', - frontend: false + options: {}, + state: 'Channel::Filter::Trusted', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0011_postmaster_sender_based_on_reply_to', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0011_postmaster_sender_based_on_reply_to', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to set the sender/from of emails based on reply-to header.', - options: {}, - state: 'Channel::Filter::ReplyToBasedSender', - frontend: false + options: {}, + state: 'Channel::Filter::ReplyToBasedSender', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0012_postmaster_filter_sender_is_system_address', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0012_postmaster_filter_sender_is_system_address', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to check if email has been created by Zammad itself and will set the article sender.', - options: {}, - state: 'Channel::Filter::SenderIsSystemAddress', - frontend: false + options: {}, + state: 'Channel::Filter::SenderIsSystemAddress', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0014_postmaster_filter_own_notification_loop_detection', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0014_postmaster_filter_own_notification_loop_detection', + area: 'Postmaster::PreFilter', description: 'Define postmaster filter to check if email is a own created notification email, then ignore it to prevent email loops.', - options: {}, - state: 'Channel::Filter::OwnNotificationLoopDetection', - frontend: false + options: {}, + state: 'Channel::Filter::OwnNotificationLoopDetection', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0015_postmaster_filter_identify_sender', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0015_postmaster_filter_identify_sender', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify sender user.', - options: {}, - state: 'Channel::Filter::IdentifySender', - frontend: false + options: {}, + state: 'Channel::Filter::IdentifySender', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0020_postmaster_filter_auto_response_check', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0020_postmaster_filter_auto_response_check', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify auto responses to prevent auto replies from Zammad.', - options: {}, - state: 'Channel::Filter::AutoResponseCheck', - frontend: false + options: {}, + state: 'Channel::Filter::AutoResponseCheck', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0030_postmaster_filter_out_of_office_check', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0030_postmaster_filter_out_of_office_check', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify out-of-office emails for follow-up detection and keeping current ticket state.', - options: {}, - state: 'Channel::Filter::OutOfOfficeCheck', - frontend: false + options: {}, + state: 'Channel::Filter::OutOfOfficeCheck', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0100_postmaster_filter_follow_up_check', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0100_postmaster_filter_follow_up_check', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify follow-ups (based on admin settings).', - options: {}, - state: 'Channel::Filter::FollowUpCheck', - frontend: false + options: {}, + state: 'Channel::Filter::FollowUpCheck', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0110_postmaster_filter_follow_up_merged', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0110_postmaster_filter_follow_up_merged', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify follow-up ticket for merged tickets.', - options: {}, - state: 'Channel::Filter::FollowUpMerged', - frontend: false + options: {}, + state: 'Channel::Filter::FollowUpMerged', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0200_postmaster_filter_follow_up_possible_check', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0200_postmaster_filter_follow_up_possible_check', + area: 'Postmaster::PreFilter', description: 'Define postmaster filter to check if follow ups get created (based on admin settings).', - options: {}, - state: 'Channel::Filter::FollowUpPossibleCheck', - frontend: false + options: {}, + state: 'Channel::Filter::FollowUpPossibleCheck', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0900_postmaster_filter_bounce_follow_up_check', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0900_postmaster_filter_bounce_follow_up_check', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify postmaster bounced - to handle it as follow-up of the original ticket.', - options: {}, - state: 'Channel::Filter::BounceFollowUpCheck', - frontend: false + options: {}, + state: 'Channel::Filter::BounceFollowUpCheck', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0950_postmaster_filter_bounce_delivery_permanent_failed', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0950_postmaster_filter_bounce_delivery_permanent_failed', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify postmaster bounced - disable sending notification on permanent deleivery failed.', - options: {}, - state: 'Channel::Filter::BounceDeliveryPermanentFailed', - frontend: false + options: {}, + state: 'Channel::Filter::BounceDeliveryPermanentFailed', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '0955_postmaster_filter_bounce_delivery_temporary_failed', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '0955_postmaster_filter_bounce_delivery_temporary_failed', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to identify postmaster bounced - reopen ticket on permanent temporary failed.', - options: {}, - state: 'Channel::Filter::BounceDeliveryTemporaryFailed', - frontend: false + options: {}, + state: 'Channel::Filter::BounceDeliveryTemporaryFailed', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '1000_postmaster_filter_database_check', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '1000_postmaster_filter_database_check', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter for filters managed via admin interface.', - options: {}, - state: 'Channel::Filter::Database', - frontend: false + options: {}, + state: 'Channel::Filter::Database', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '5000_postmaster_filter_icinga', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '5000_postmaster_filter_icinga', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to manage Icinga (http://www.icinga.org) emails.', - options: {}, - state: 'Channel::Filter::Icinga', - frontend: false + options: {}, + state: 'Channel::Filter::Icinga', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '5100_postmaster_filter_nagios', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '5100_postmaster_filter_nagios', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to manage Nagios (http://www.nagios.org) emails.', - options: {}, - state: 'Channel::Filter::Nagios', - frontend: false + options: {}, + state: 'Channel::Filter::Nagios', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines postmaster filter.', - name: '5300_postmaster_filter_monit', - area: 'Postmaster::PreFilter', + title: 'Defines postmaster filter.', + name: '5300_postmaster_filter_monit', + area: 'Postmaster::PreFilter', description: 'Defines postmaster filter to manage Monit (https://mmonit.com/monit/) emails.', - options: {}, - state: 'Channel::Filter::Monit', - frontend: false + options: {}, + state: 'Channel::Filter::Monit', + frontend: false ) Setting.create_if_not_exists( - title: 'Icinga integration', - name: 'icinga_integration', - area: 'Integration::Switch', + title: 'Icinga integration', + name: 'icinga_integration', + area: 'Integration::Switch', description: 'Defines if Icinga (http://www.icinga.org) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'icinga_integration', - tag: 'boolean', + null: true, + name: 'icinga_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3314,48 +3314,48 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Sender', - name: 'icinga_sender', - area: 'Integration::Icinga', + title: 'Sender', + name: 'icinga_sender', + area: 'Integration::Icinga', description: 'Defines the sender email address of Icinga emails.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'icinga_sender', - tag: 'input', + display: '', + null: false, + name: 'icinga_sender', + tag: 'input', placeholder: 'icinga@monitoring.example.com', }, ], }, - state: 'icinga@monitoring.example.com', + state: 'icinga@monitoring.example.com', preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Auto close', - name: 'icinga_auto_close', - area: 'Integration::Icinga', + title: 'Auto close', + name: 'icinga_auto_close', + area: 'Integration::Icinga', description: 'Defines if tickets should be closed if service is recovered.', - options: { + options: { form: [ { display: '', - null: true, - name: 'icinga_auto_close', - tag: 'boolean', + null: true, + name: 'icinga_auto_close', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3363,48 +3363,48 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: true, preferences: { - prio: 3, + prio: 3, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Auto close state', - name: 'icinga_auto_close_state_id', - area: 'Integration::Icinga', + title: 'Auto close state', + name: 'icinga_auto_close_state_id', + area: 'Integration::Icinga', description: 'Defines the state of auto closed tickets.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'icinga_auto_close_state_id', - tag: 'select', + display: '', + null: false, + name: 'icinga_auto_close_state_id', + tag: 'select', relation: 'TicketState', }, ], }, - state: 4, + state: 4, preferences: { - prio: 4, + prio: 4, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Nagios integration', - name: 'nagios_integration', - area: 'Integration::Switch', + title: 'Nagios integration', + name: 'nagios_integration', + area: 'Integration::Switch', description: 'Defines if Nagios (http://www.nagios.org) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'nagios_integration', - tag: 'boolean', + null: true, + name: 'nagios_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3412,48 +3412,48 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Sender', - name: 'nagios_sender', - area: 'Integration::Nagios', + title: 'Sender', + name: 'nagios_sender', + area: 'Integration::Nagios', description: 'Defines the sender email address of Nagios emails.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'nagios_sender', - tag: 'input', + display: '', + null: false, + name: 'nagios_sender', + tag: 'input', placeholder: 'nagios@monitoring.example.com', }, ], }, - state: 'nagios@monitoring.example.com', + state: 'nagios@monitoring.example.com', preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Auto close', - name: 'nagios_auto_close', - area: 'Integration::Nagios', + title: 'Auto close', + name: 'nagios_auto_close', + area: 'Integration::Nagios', description: 'Defines if tickets should be closed if service is recovered.', - options: { + options: { form: [ { display: '', - null: true, - name: 'nagios_auto_close', - tag: 'boolean', + null: true, + name: 'nagios_auto_close', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3461,48 +3461,48 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: true, preferences: { - prio: 3, + prio: 3, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Auto close state', - name: 'nagios_auto_close_state_id', - area: 'Integration::Nagios', + title: 'Auto close state', + name: 'nagios_auto_close_state_id', + area: 'Integration::Nagios', description: 'Defines the state of auto closed tickets.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'nagios_auto_close_state_id', - tag: 'select', + display: '', + null: false, + name: 'nagios_auto_close_state_id', + tag: 'select', relation: 'TicketState', }, ], }, - state: 4, + state: 4, preferences: { - prio: 4, + prio: 4, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Check_MK integration', - name: 'check_mk_integration', - area: 'Integration::Switch', + title: 'Check_MK integration', + name: 'check_mk_integration', + area: 'Integration::Switch', description: 'Defines if Check_MK (http://mathias-kettner.com/check_mk.html) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'check_mk_integration', - tag: 'boolean', + null: true, + name: 'check_mk_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3510,48 +3510,48 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Group', - name: 'check_mk_group_id', - area: 'Integration::CheckMK', + title: 'Group', + name: 'check_mk_group_id', + area: 'Integration::CheckMK', description: 'Defines the group of created tickets.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'check_mk_group_id', - tag: 'select', + display: '', + null: false, + name: 'check_mk_group_id', + tag: 'select', relation: 'Group', }, ], }, - state: 1, + state: 1, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Auto close', - name: 'check_mk_auto_close', - area: 'Integration::CheckMK', + title: 'Auto close', + name: 'check_mk_auto_close', + area: 'Integration::CheckMK', description: 'Defines if tickets should be closed if service is recovered.', - options: { + options: { form: [ { display: '', - null: true, - name: 'check_mk_auto_close', - tag: 'boolean', + null: true, + name: 'check_mk_auto_close', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3559,60 +3559,60 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: true, preferences: { - prio: 3, + prio: 3, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Auto close state', - name: 'check_mk_auto_close_state_id', - area: 'Integration::CheckMK', + title: 'Auto close state', + name: 'check_mk_auto_close_state_id', + area: 'Integration::CheckMK', description: 'Defines the state of auto closed tickets.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'check_mk_auto_close_state_id', - tag: 'select', + display: '', + null: false, + name: 'check_mk_auto_close_state_id', + tag: 'select', relation: 'TicketState', }, ], }, - state: 4, + state: 4, preferences: { - prio: 4, + prio: 4, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Check_MK tolen', - name: 'check_mk_token', - area: 'Core', + title: 'Check_MK tolen', + name: 'check_mk_token', + area: 'Core', description: 'Defines the Check_MK token for allowing updates.', - options: {}, - state: ENV['CHECK_MK_TOKEN'] || SecureRandom.hex(16), + options: {}, + state: ENV['CHECK_MK_TOKEN'] || SecureRandom.hex(16), preferences: { permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Monit integration', - name: 'monit_integration', - area: 'Integration::Switch', + title: 'Monit integration', + name: 'monit_integration', + area: 'Integration::Switch', description: 'Defines if Monit (https://mmonit.com/monit/) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'monit_integration', - tag: 'boolean', + null: true, + name: 'monit_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3620,49 +3620,49 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Sender', - name: 'monit_sender', - area: 'Integration::Monit', + title: 'Sender', + name: 'monit_sender', + area: 'Integration::Monit', description: 'Defines the sender email address of the service emails.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'monit_sender', - tag: 'input', + display: '', + null: false, + name: 'monit_sender', + tag: 'input', placeholder: 'monit@monitoring.example.com', }, ], }, - state: 'monit@monitoring.example.com', + state: 'monit@monitoring.example.com', preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Auto close', - name: 'monit_auto_close', - area: 'Integration::Monit', + title: 'Auto close', + name: 'monit_auto_close', + area: 'Integration::Monit', description: 'Defines if tickets should be closed if service is recovered.', - options: { + options: { form: [ { - display: '', - null: true, - name: 'monit_auto_close', - tag: 'boolean', - options: { + display: '', + null: true, + name: 'monit_auto_close', + tag: 'boolean', + options: { true => 'yes', false => 'no', }, @@ -3670,50 +3670,50 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: true, preferences: { - prio: 3, + prio: 3, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Auto close state', - name: 'monit_auto_close_state_id', - area: 'Integration::Monit', + title: 'Auto close state', + name: 'monit_auto_close_state_id', + area: 'Integration::Monit', description: 'Defines the state of auto closed tickets.', - options: { + options: { form: [ { - display: '', - null: false, - name: 'monit_auto_close_state_id', - tag: 'select', - relation: 'TicketState', + display: '', + null: false, + name: 'monit_auto_close_state_id', + tag: 'select', + relation: 'TicketState', translate: true, }, ], }, - state: 4, + state: 4, preferences: { - prio: 4, + prio: 4, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'LDAP integration', - name: 'ldap_integration', - area: 'Integration::Switch', + title: 'LDAP integration', + name: 'ldap_integration', + area: 'Integration::Switch', description: 'Defines if LDAP is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'ldap_integration', - tag: 'boolean', + null: true, + name: 'ldap_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3721,39 +3721,39 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Exchange config', - name: 'exchange_config', - area: 'Integration::Exchange', + title: 'Exchange config', + name: 'exchange_config', + area: 'Integration::Exchange', description: 'Defines the Exchange config.', - options: {}, - state: {}, + options: {}, + state: {}, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Exchange integration', - name: 'exchange_integration', - area: 'Integration::Switch', + title: 'Exchange integration', + name: 'exchange_integration', + area: 'Integration::Switch', description: 'Defines if Exchange is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'exchange_integration', - tag: 'boolean', + null: true, + name: 'exchange_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3761,39 +3761,39 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'LDAP config', - name: 'ldap_config', - area: 'Integration::LDAP', + title: 'LDAP config', + name: 'ldap_config', + area: 'Integration::LDAP', description: 'Defines the LDAP config.', - options: {}, - state: {}, + options: {}, + state: {}, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'i-doit integration', - name: 'idoit_integration', - area: 'Integration::Switch', + title: 'i-doit integration', + name: 'idoit_integration', + area: 'Integration::Switch', description: 'Defines if i-doit (http://www.i-doit) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'idoit_integration', - tag: 'boolean', + null: true, + name: 'idoit_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3801,75 +3801,75 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'i-doit config', - name: 'idoit_config', - area: 'Integration::Idoit', + title: 'i-doit config', + name: 'idoit_config', + area: 'Integration::Idoit', description: 'Defines the i-doit config.', - options: {}, - state: {}, + options: {}, + state: {}, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'Defines sync transaction backend.', - name: '0100_trigger', - area: 'Transaction::Backend::Sync', + title: 'Defines sync transaction backend.', + name: '0100_trigger', + area: 'Transaction::Backend::Sync', description: 'Defines the transaction backend to execute triggers.', - options: {}, - state: 'Transaction::Trigger', - frontend: false + options: {}, + state: 'Transaction::Trigger', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines transaction backend.', - name: '0100_notification', - area: 'Transaction::Backend::Async', + title: 'Defines transaction backend.', + name: '0100_notification', + area: 'Transaction::Backend::Async', description: 'Defines the transaction backend to send agent notifications.', - options: {}, - state: 'Transaction::Notification', - frontend: false + options: {}, + state: 'Transaction::Notification', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines transaction backend.', - name: '1000_signature_detection', - area: 'Transaction::Backend::Async', + title: 'Defines transaction backend.', + name: '1000_signature_detection', + area: 'Transaction::Backend::Async', description: 'Defines the transaction backend to detect customer signatures in emails.', - options: {}, - state: 'Transaction::SignatureDetection', - frontend: false + options: {}, + state: 'Transaction::SignatureDetection', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines transaction backend.', - name: '6000_slack_webhook', - area: 'Transaction::Backend::Async', + title: 'Defines transaction backend.', + name: '6000_slack_webhook', + area: 'Transaction::Backend::Async', description: 'Defines the transaction backend which posts messages to Slack (http://www.slack.com).', - options: {}, - state: 'Transaction::Slack', - frontend: false + options: {}, + state: 'Transaction::Slack', + frontend: false ) Setting.create_if_not_exists( - title: 'Slack integration', - name: 'slack_integration', - area: 'Integration::Switch', + title: 'Slack integration', + name: 'slack_integration', + area: 'Integration::Switch', description: 'Defines if Slack (http://www.slack.org) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'slack_integration', - tag: 'boolean', + null: true, + name: 'slack_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3877,40 +3877,40 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Slack config', - name: 'slack_config', - area: 'Integration::Slack', + title: 'Slack config', + name: 'slack_config', + area: 'Integration::Slack', description: 'Defines the slack config.', - options: {}, - state: { + options: {}, + state: { items: [] }, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'sipgate.io integration', - name: 'sipgate_integration', - area: 'Integration::Switch', + title: 'sipgate.io integration', + name: 'sipgate_integration', + area: 'Integration::Switch', description: 'Defines if sipgate.io (http://www.sipgate.io) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'sipgate_integration', - tag: 'boolean', + null: true, + name: 'sipgate_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3918,61 +3918,61 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, - trigger: ['menu:render', 'cti:reload'], + prio: 1, + trigger: ['menu:render', 'cti:reload'], authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'sipgate.io config', - name: 'sipgate_config', - area: 'Integration::Sipgate', + title: 'sipgate.io config', + name: 'sipgate_config', + area: 'Integration::Sipgate', description: 'Defines the sipgate.io config.', - options: {}, - state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, + options: {}, + state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'sipgate.io alternative fqdn', - name: 'sipgate_alternative_fqdn', - area: 'Integration::Sipgate::Expert', + title: 'sipgate.io alternative fqdn', + name: 'sipgate_alternative_fqdn', + area: 'Integration::Sipgate::Expert', description: 'Alternative FQDN for callbacks if you operate Zammad in internal network.', - options: { + options: { form: [ { display: '', - null: false, - name: 'sipgate_alternative_fqdn', - tag: 'input', + null: false, + name: 'sipgate_alternative_fqdn', + tag: 'input', }, ], }, - state: '', + state: '', preferences: { permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'cti integration', - name: 'cti_integration', - area: 'Integration::Switch', + title: 'cti integration', + name: 'cti_integration', + area: 'Integration::Switch', description: 'Defines if generic CTI is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'cti_integration', - tag: 'boolean', + null: true, + name: 'cti_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -3980,61 +3980,61 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, - trigger: ['menu:render', 'cti:reload'], + prio: 1, + trigger: ['menu:render', 'cti:reload'], authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'cti config', - name: 'cti_config', - area: 'Integration::Cti', + title: 'cti config', + name: 'cti_config', + area: 'Integration::Cti', description: 'Defines the cti config.', - options: {}, - state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, + options: {}, + state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'CTI Token', - name: 'cti_token', - area: 'Integration::Cti', + title: 'CTI Token', + name: 'cti_token', + area: 'Integration::Cti', description: 'Token for cti.', - options: { + options: { form: [ { display: '', - null: false, - name: 'cti_token', - tag: 'input', + null: false, + name: 'cti_token', + tag: 'input', }, ], }, - state: ENV['CTI_TOKEN'] || SecureRandom.urlsafe_base64(20), + state: ENV['CTI_TOKEN'] || SecureRandom.urlsafe_base64(20), preferences: { permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Placetel integration', - name: 'placetel_integration', - area: 'Integration::Switch', + title: 'Placetel integration', + name: 'placetel_integration', + area: 'Integration::Switch', description: 'Defines if Placetel (http://www.placetel.de) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'placetel_integration', - tag: 'boolean', + null: true, + name: 'placetel_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -4042,62 +4042,62 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, - trigger: ['menu:render', 'cti:reload'], + prio: 1, + trigger: ['menu:render', 'cti:reload'], authentication: true, - permission: ['admin.integration'], + permission: ['admin.integration'], }, - frontend: true + frontend: true ) Setting.create_if_not_exists( - title: 'Placetel config', - name: 'placetel_config', - area: 'Integration::Placetel', + title: 'Placetel config', + name: 'placetel_config', + area: 'Integration::Placetel', description: 'Defines the Placetel config.', - options: {}, - state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, + options: {}, + state: { 'outbound' => { 'routing_table' => [], 'default_caller_id' => '' }, 'inbound' => { 'block_caller_ids' => [] } }, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], - cache: ['placetelGetVoipUsers'], + cache: ['placetelGetVoipUsers'], }, - frontend: false, + frontend: false, ) Setting.create_if_not_exists( - title: 'PLACETEL Token', - name: 'placetel_token', - area: 'Integration::Placetel', + title: 'PLACETEL Token', + name: 'placetel_token', + area: 'Integration::Placetel', description: 'Token for Placetel.', - options: { + options: { form: [ { display: '', - null: false, - name: 'placetel_token', - tag: 'input', + null: false, + name: 'placetel_token', + tag: 'input', }, ], }, - state: ENV['PLACETEL_TOKEN'] || SecureRandom.urlsafe_base64(20), + state: ENV['PLACETEL_TOKEN'] || SecureRandom.urlsafe_base64(20), preferences: { permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Clearbit integration', - name: 'clearbit_integration', - area: 'Integration::Switch', + title: 'Clearbit integration', + name: 'clearbit_integration', + area: 'Integration::Switch', description: 'Defines if Clearbit (http://www.clearbit.com) is enabled or not.', - options: { + options: { form: [ { display: '', - null: true, - name: 'clearbit_integration', - tag: 'boolean', + null: true, + name: 'clearbit_integration', + tag: 'boolean', options: { true => 'yes', false => 'no', @@ -4105,123 +4105,123 @@ Setting.create_if_not_exists( }, ], }, - state: false, + state: false, preferences: { - prio: 1, + prio: 1, permission: ['admin.integration'], }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Clearbit config', - name: 'clearbit_config', - area: 'Integration::Clearbit', + title: 'Clearbit config', + name: 'clearbit_config', + area: 'Integration::Clearbit', description: 'Defines the Clearbit config.', - options: {}, - state: {}, - frontend: false, + options: {}, + state: {}, + frontend: false, preferences: { - prio: 2, + prio: 2, permission: ['admin.integration'], }, ) Setting.create_if_not_exists( - title: 'Defines transaction backend.', - name: '9000_clearbit_enrichment', - area: 'Transaction::Backend::Async', + title: 'Defines transaction backend.', + name: '9000_clearbit_enrichment', + area: 'Transaction::Backend::Async', description: 'Defines the transaction backend which will enrich customer and organization information from Clearbit (http://www.clearbit.com).', - options: {}, - state: 'Transaction::ClearbitEnrichment', - frontend: false + options: {}, + state: 'Transaction::ClearbitEnrichment', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines transaction backend.', - name: '9100_cti_caller_id_detection', - area: 'Transaction::Backend::Async', + title: 'Defines transaction backend.', + name: '9100_cti_caller_id_detection', + area: 'Transaction::Backend::Async', description: 'Defines the transaction backend which detects caller IDs in objects and store them for CTI lookups.', - options: {}, - state: 'Transaction::CtiCallerIdDetection', - frontend: false + options: {}, + state: 'Transaction::CtiCallerIdDetection', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines transaction backend.', - name: '9200_karma', - area: 'Transaction::Backend::Async', + title: 'Defines transaction backend.', + name: '9200_karma', + area: 'Transaction::Backend::Async', description: 'Defines the transaction backend which creates the karma score.', - options: {}, - state: 'Transaction::Karma', - frontend: false + options: {}, + state: 'Transaction::Karma', + frontend: false ) Setting.create_if_not_exists( - title: 'Defines karma levels.', - name: 'karma_levels', - area: 'Core::Karma', + title: 'Defines karma levels.', + name: 'karma_levels', + area: 'Core::Karma', description: 'Defines the karma levels.', - options: {}, - state: [ + options: {}, + state: [ { - name: 'Beginner', + name: 'Beginner', start: 0, - end: 499, + end: 499, }, { - name: 'Newbie', + name: 'Newbie', start: 500, - end: 1999, + end: 1999, }, { - name: 'Intermediate', + name: 'Intermediate', start: 2000, - end: 4999, + end: 4999, }, { - name: 'Professional', + name: 'Professional', start: 5000, - end: 6999, + end: 6999, }, { - name: 'Expert', + name: 'Expert', start: 7000, - end: 8999, + end: 8999, }, { - name: 'Master', + name: 'Master', start: 9000, - end: 18_999, + end: 18_999, }, { - name: 'Evangelist', + name: 'Evangelist', start: 19_000, - end: 45_999, + end: 45_999, }, { - name: 'Hero', + name: 'Hero', start: 50_000, - end: nil, + end: nil, }, ], - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'Set limit of agents', - name: 'system_agent_limit', - area: 'Core::Online', + title: 'Set limit of agents', + name: 'system_agent_limit', + area: 'Core::Online', description: 'Defines the limit of the agents.', - options: {}, - state: false, + options: {}, + state: false, preferences: { online_service_disable: true }, - frontend: false + frontend: false ) Setting.create_if_not_exists( - title: 'HTML Email CSS Font', - name: 'html_email_css_font', - area: 'Core', + title: 'HTML Email CSS Font', + name: 'html_email_css_font', + area: 'Core', description: 'Defines the CSS font information for HTML Emails.', - options: {}, - state: "font-family:'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif; font-size: 12px;", + options: {}, + state: "font-family:'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif; font-size: 12px;", preferences: { permission: ['admin'], }, - frontend: false + frontend: false ) diff --git a/db/seeds/signatures.rb b/db/seeds/signatures.rb index be0948bb5..425b6b0b0 100644 --- a/db/seeds/signatures.rb +++ b/db/seeds/signatures.rb @@ -1,7 +1,7 @@ Signature.create_if_not_exists( - id: 1, - name: 'default', - body: ' + id: 1, + name: 'default', + body: ' #{user.firstname} #{user.lastname} -- diff --git a/db/seeds/ticket_states.rb b/db/seeds/ticket_states.rb index e8529c04a..6073c2627 100644 --- a/db/seeds/ticket_states.rb +++ b/db/seeds/ticket_states.rb @@ -1,44 +1,44 @@ Ticket::State.create_if_not_exists( - id: 1, - name: 'new', - state_type_id: Ticket::StateType.find_by(name: 'new').id, + id: 1, + name: 'new', + state_type_id: Ticket::StateType.find_by(name: 'new').id, default_create: true, ) Ticket::State.create_if_not_exists( - id: 2, - name: 'open', - state_type_id: Ticket::StateType.find_by(name: 'open').id, + id: 2, + name: 'open', + state_type_id: Ticket::StateType.find_by(name: 'open').id, default_follow_up: true, ) Ticket::State.create_if_not_exists( - id: 3, - name: 'pending reminder', - state_type_id: Ticket::StateType.find_by(name: 'pending reminder').id, + id: 3, + name: 'pending reminder', + state_type_id: Ticket::StateType.find_by(name: 'pending reminder').id, ignore_escalation: true, ) Ticket::State.create_if_not_exists( - id: 4, - name: 'closed', - state_type_id: Ticket::StateType.find_by(name: 'closed').id, + id: 4, + name: 'closed', + state_type_id: Ticket::StateType.find_by(name: 'closed').id, ignore_escalation: true, ) Ticket::State.create_if_not_exists( - id: 5, - name: 'merged', - state_type_id: Ticket::StateType.find_by(name: 'merged').id, + id: 5, + name: 'merged', + state_type_id: Ticket::StateType.find_by(name: 'merged').id, ignore_escalation: true, ) Ticket::State.create_if_not_exists( - id: 6, - name: 'removed', - state_type_id: Ticket::StateType.find_by(name: 'removed').id, - active: false, + id: 6, + name: 'removed', + state_type_id: Ticket::StateType.find_by(name: 'removed').id, + active: false, ignore_escalation: true, ) Ticket::State.create_if_not_exists( - id: 7, - name: 'pending close', - state_type_id: Ticket::StateType.find_by(name: 'pending action').id, - next_state_id: Ticket::State.by_category(:closed).first.id, + id: 7, + name: 'pending close', + state_type_id: Ticket::StateType.find_by(name: 'pending action').id, + next_state_id: Ticket::State.by_category(:closed).first.id, ignore_escalation: true, ) diff --git a/db/seeds/triggers.rb b/db/seeds/triggers.rb index 8b07e0c57..becee4a4d 100644 --- a/db/seeds/triggers.rb +++ b/db/seeds/triggers.rb @@ -1,17 +1,17 @@ Trigger.create_or_update( - name: 'auto reply (on new tickets)', - condition: { - 'ticket.action' => { + name: 'auto reply (on new tickets)', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is not', - 'value' => Ticket::State.by_category(:closed).first.id, + 'value' => Ticket::State.by_category(:closed).first.id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, @@ -19,12 +19,12 @@ Trigger.create_or_update( }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '
Your request (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.
+ 'body' => '
Your request (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.

To provide additional information, please reply to this email or click on the following link (for initial login, please request a new password): #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -34,36 +34,36 @@ Trigger.create_or_update(
Zammad, your customer support system
', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck + 'subject' => 'Thanks for your inquiry (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck }, }, - active: true, + active: true, created_by_id: 1, updated_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply (on follow up of tickets)', - condition: { - 'ticket.action' => { + name: 'auto reply (on follow up of tickets)', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '
Your follow up for (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.
+ 'body' => '
Your follow up for (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.

To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -73,27 +73,27 @@ Trigger.create_or_update(
Zammad, your customer support system
', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your follow up (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck + 'subject' => 'Thanks for your follow up (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck }, }, - active: false, + active: false, created_by_id: 1, updated_by_id: 1, ) Trigger.create_or_update( - name: 'customer notification (on owner change)', - condition: { + name: 'customer notification (on owner change)', + condition: { 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', } }, - perform: { + perform: { 'notification.email' => { - 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed and is now "#{ticket.owner.firstname} #{ticket.owner.lastname}".

+ 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed and is now "#{ticket.owner.firstname} #{ticket.owner.lastname}".


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -101,10 +101,10 @@ Trigger.create_or_update(

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Owner has changed (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck + 'subject' => 'Owner has changed (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck }, }, - active: false, + active: false, created_by_id: 1, updated_by_id: 1, ) diff --git a/db/seeds/user_nr_1.rb b/db/seeds/user_nr_1.rb index 2f7032fac..72dc1dc7d 100644 --- a/db/seeds/user_nr_1.rb +++ b/db/seeds/user_nr_1.rb @@ -1,10 +1,10 @@ User.create_if_not_exists( - id: 1, - login: '-', - firstname: '-', - lastname: '', - email: '', - active: false, + id: 1, + login: '-', + firstname: '-', + lastname: '', + email: '', + active: false, updated_by_id: 1, created_by_id: 1 ) diff --git a/lib/app_version.rb b/lib/app_version.rb index 4668aeea0..3bc0a647f 100644 --- a/lib/app_version.rb +++ b/lib/app_version.rb @@ -71,8 +71,8 @@ returns def self.event_data(type = 'app_version') { event: 'maintenance', - data: { - type: type, + data: { + type: type, app_version: get, } } diff --git a/lib/auto_wizard.rb b/lib/auto_wizard.rb index f05522ab4..707cc37dd 100644 --- a/lib/auto_wizard.rb +++ b/lib/auto_wizard.rb @@ -90,7 +90,7 @@ returns # create Permissions/Organization model_map = { - 'Permissions' => 'Permission', + 'Permissions' => 'Permission', 'Organizations' => 'Organization', } model_map.each do |map_name, model| diff --git a/lib/calendar_subscriptions/tickets.rb b/lib/calendar_subscriptions/tickets.rb index 10d788591..7c10af8e2 100644 --- a/lib/calendar_subscriptions/tickets.rb +++ b/lib/calendar_subscriptions/tickets.rb @@ -59,11 +59,11 @@ class CalendarSubscriptions::Tickets condition = { 'ticket.owner_id' => { operator: 'is', - value: owner_ids, + value: owner_ids, }, 'ticket.state_id' => { operator: 'is', - value: Ticket::State.where( + value: Ticket::State.where( state_type_id: Ticket::StateType.where( name: %w[new open], ), @@ -73,7 +73,7 @@ class CalendarSubscriptions::Tickets tickets = Ticket.search( current_user: @user, - condition: condition, + condition: condition, ) user_locale = @user.preferences['locale'] || Setting.get('locale_default') || 'en-us' @@ -106,11 +106,11 @@ class CalendarSubscriptions::Tickets condition = { 'ticket.owner_id' => { operator: 'is', - value: owner_ids, + value: owner_ids, }, 'ticket.state_id' => { operator: 'is', - value: Ticket::State.where( + value: Ticket::State.where( state_type_id: Ticket::StateType.where( name: [ 'pending reminder', @@ -123,7 +123,7 @@ class CalendarSubscriptions::Tickets tickets = Ticket.search( current_user: @user, - condition: condition, + condition: condition, ) user_locale = @user.preferences['locale'] || Setting.get('locale_default') || 'en-us' @@ -168,19 +168,19 @@ class CalendarSubscriptions::Tickets return events_data if owner_ids.blank? condition = { - 'ticket.owner_id' => { + 'ticket.owner_id' => { operator: 'is', - value: owner_ids, + value: owner_ids, }, 'ticket.escalation_at' => { operator: 'is not', - value: nil, + value: nil, } } tickets = Ticket.search( current_user: @user, - condition: condition, + condition: condition, ) user_locale = @user.preferences['locale'] || Setting.get('locale_default') || 'en-us' diff --git a/lib/email_helper.rb b/lib/email_helper.rb index 2580ba486..b0de52a7c 100644 --- a/lib/email_helper.rb +++ b/lib/email_helper.rb @@ -24,7 +24,7 @@ returns def self.available_driver if Setting.get('system_online_service') return { - inbound: { + inbound: { imap: 'IMAP', pop3: 'POP3', }, @@ -34,12 +34,12 @@ returns } end { - inbound: { + inbound: { imap: 'IMAP', pop3: 'POP3', }, outbound: { - smtp: 'SMTP - configure your own outgoing SMTP settings', + smtp: 'SMTP - configure your own outgoing SMTP settings', sendmail: 'Local MTA (Sendmail/Postfix/Exim/...) - use server setup', }, } @@ -108,71 +108,71 @@ returns # check domain based attributes provider_map = { google_imap: { - domain: 'gmail|googlemail|google', - inbound: { + domain: 'gmail|googlemail|google', + inbound: { adapter: 'imap', options: { - host: 'imap.gmail.com', - port: 993, - ssl: true, - user: email, + host: 'imap.gmail.com', + port: 993, + ssl: true, + user: email, password: password, }, }, outbound: { adapter: 'smtp', options: { - host: 'smtp.gmail.com', - port: 25, + host: 'smtp.gmail.com', + port: 25, start_tls: true, - user: email, - password: password, + user: email, + password: password, } }, }, - microsoft: { - domain: 'outlook.com|hotmail.com', - inbound: { + microsoft: { + domain: 'outlook.com|hotmail.com', + inbound: { adapter: 'imap', options: { - host: 'imap-mail.outlook.com', - port: 993, - ssl: true, - user: email, + host: 'imap-mail.outlook.com', + port: 993, + ssl: true, + user: email, password: password, }, }, outbound: { adapter: 'smtp', options: { - host: 'smtp-mail.outlook.com', - port: 25, + host: 'smtp-mail.outlook.com', + port: 25, start_tls: true, - user: email, - password: password, + user: email, + password: password, } }, }, google_pop3: { - domain: 'gmail|googlemail|google', - inbound: { + domain: 'gmail|googlemail|google', + inbound: { adapter: 'pop3', options: { - host: 'pop.gmail.com', - port: 995, - ssl: true, - user: email, + host: 'pop.gmail.com', + port: 995, + ssl: true, + user: email, password: password, }, }, outbound: { adapter: 'smtp', options: { - host: 'smtp.gmail.com', - port: 25, + host: 'smtp.gmail.com', + port: 25, start_tls: true, - user: email, - password: password, + user: email, + password: password, } }, }, @@ -218,20 +218,20 @@ returns { adapter: 'imap', options: { - host: domain, - port: 993, - ssl: true, - user: user, + host: domain, + port: 993, + ssl: true, + user: user, password: password, }, }, { adapter: 'imap', options: { - host: domain, - port: 993, - ssl: true, - user: email, + host: domain, + port: 993, + ssl: true, + user: email, password: password, }, }, @@ -278,100 +278,100 @@ returns { adapter: 'imap', options: { - host: "mail.#{domain}", - port: 993, - ssl: true, - user: user, + host: "mail.#{domain}", + port: 993, + ssl: true, + user: user, password: password, }, }, { adapter: 'imap', options: { - host: "mail.#{domain}", - port: 993, - ssl: true, - user: email, + host: "mail.#{domain}", + port: 993, + ssl: true, + user: email, password: password, }, }, { adapter: 'imap', options: { - host: "imap.#{domain}", - port: 993, - ssl: true, - user: user, + host: "imap.#{domain}", + port: 993, + ssl: true, + user: user, password: password, }, }, { adapter: 'imap', options: { - host: "imap.#{domain}", - port: 993, - ssl: true, - user: email, + host: "imap.#{domain}", + port: 993, + ssl: true, + user: email, password: password, }, }, { adapter: 'pop3', options: { - host: "mail.#{domain}", - port: 995, - ssl: true, - user: user, + host: "mail.#{domain}", + port: 995, + ssl: true, + user: user, password: password, }, }, { adapter: 'pop3', options: { - host: "mail.#{domain}", - port: 995, - ssl: true, - user: email, + host: "mail.#{domain}", + port: 995, + ssl: true, + user: email, password: password, }, }, { adapter: 'pop3', options: { - host: "pop.#{domain}", - port: 995, - ssl: true, - user: user, + host: "pop.#{domain}", + port: 995, + ssl: true, + user: user, password: password, }, }, { adapter: 'pop3', options: { - host: "pop.#{domain}", - port: 995, - ssl: true, - user: email, + host: "pop.#{domain}", + port: 995, + ssl: true, + user: email, password: password, }, }, { adapter: 'pop3', options: { - host: "pop3.#{domain}", - port: 995, - ssl: true, - user: user, + host: "pop3.#{domain}", + port: 995, + ssl: true, + user: user, password: password, }, }, { adapter: 'pop3', options: { - host: "pop3.#{domain}", - port: 995, - ssl: true, - user: email, + host: "pop3.#{domain}", + port: 995, + ssl: true, + user: email, password: password, }, }, @@ -417,41 +417,41 @@ returns { adapter: 'smtp', options: { - host: domain, - port: 25, + host: domain, + port: 25, start_tls: true, - user: user, - password: password, + user: user, + password: password, }, }, { adapter: 'smtp', options: { - host: domain, - port: 25, + host: domain, + port: 25, start_tls: true, - user: email, - password: password, + user: email, + password: password, }, }, { adapter: 'smtp', options: { - host: domain, - port: 465, + host: domain, + port: 465, start_tls: true, - user: user, - password: password, + user: user, + password: password, }, }, { adapter: 'smtp', options: { - host: domain, - port: 465, + host: domain, + port: 465, start_tls: true, - user: email, - password: password, + user: email, + password: password, }, }, ] @@ -497,81 +497,81 @@ returns { adapter: 'smtp', options: { - host: "mail.#{domain}", - port: 25, + host: "mail.#{domain}", + port: 25, start_tls: true, - user: user, - password: password, + user: user, + password: password, }, }, { adapter: 'smtp', options: { - host: "mail.#{domain}", - port: 25, + host: "mail.#{domain}", + port: 25, start_tls: true, - user: email, - password: password, + user: email, + password: password, }, }, { adapter: 'smtp', options: { - host: "mail.#{domain}", - port: 465, + host: "mail.#{domain}", + port: 465, start_tls: true, - user: user, - password: password, + user: user, + password: password, }, }, { adapter: 'smtp', options: { - host: "mail.#{domain}", - port: 465, + host: "mail.#{domain}", + port: 465, start_tls: true, - user: email, - password: password, + user: email, + password: password, }, }, { adapter: 'smtp', options: { - host: "smtp.#{domain}", - port: 25, + host: "smtp.#{domain}", + port: 25, start_tls: true, - user: user, - password: password, + user: user, + password: password, }, }, { adapter: 'smtp', options: { - host: "smtp.#{domain}", - port: 25, + host: "smtp.#{domain}", + port: 25, start_tls: true, - user: email, - password: password, + user: email, + password: password, }, }, { adapter: 'smtp', options: { - host: "smtp.#{domain}", - port: 465, + host: "smtp.#{domain}", + port: 465, start_tls: true, - user: user, - password: password, + user: user, + password: password, }, }, { adapter: 'smtp', options: { - host: "smtp.#{domain}", - port: 465, + host: "smtp.#{domain}", + port: 465, start_tls: true, - user: email, - password: password, + user: email, + password: password, }, }, ] diff --git a/lib/email_helper/probe.rb b/lib/email_helper/probe.rb index 75ccbc18a..fcdad877a 100644 --- a/lib/email_helper/probe.rb +++ b/lib/email_helper/probe.rb @@ -54,7 +54,7 @@ returns on fail if !user || !domain return { - result: 'invalid', + result: 'invalid', messages: { email: 'Invalid email.' }, @@ -91,9 +91,9 @@ returns on fail next if result_outbound[:result] != 'ok' return { - result: 'ok', + result: 'ok', content_messages: result_inbound[:content_messages], - setting: settings, + setting: settings, } end end @@ -105,7 +105,7 @@ returns on fail inbound_guess = EmailHelper.provider_inbound_guess(user, params[:email], params[:password], domain) inbound_map = inbound_mx + inbound_guess result = { - result: 'ok', + result: 'ok', setting: {} } success = false @@ -213,7 +213,7 @@ returns on fail # validate adapter if !EmailHelper.available_driver[:inbound][adapter.to_sym] return { - result: 'failed', + result: 'failed', message: "Unknown adapter '#{adapter}'", } end @@ -228,9 +228,9 @@ returns on fail result_inbound = driver_instance.fetch(params[:options], nil, 'check') rescue => e return { - result: 'invalid', - settings: params, - message: e.message, + result: 'invalid', + settings: params, + message: e.message, message_human: translation(e.message), invalid_field: invalid_field(e.message), } @@ -287,7 +287,7 @@ returns on fail # validate adapter if !EmailHelper.available_driver[:outbound][adapter.to_sym] return { - result: 'failed', + result: 'failed', message: "Unknown adapter '#{adapter}'", } end @@ -331,7 +331,7 @@ returns on fail # check if sending email was ok, but mailserver rejected if !subject white_map = { - 'Recipient address rejected' => true, + 'Recipient address rejected' => true, 'Sender address rejected: Domain not found' => true, } white_map.each_key do |key| @@ -339,16 +339,16 @@ returns on fail next if e.message !~ /#{Regexp.escape(key)}/i return { - result: 'ok', + result: 'ok', settings: params, - notice: e.message, + notice: e.message, } end end return { - result: 'invalid', - settings: params, - message: e.message, + result: 'invalid', + settings: params, + message: e.message, message_human: translation(e.message), invalid_field: invalid_field(e.message), } diff --git a/lib/email_helper/verify.rb b/lib/email_helper/verify.rb index 3dcb91d49..c05f54d7a 100644 --- a/lib/email_helper/verify.rb +++ b/lib/email_helper/verify.rb @@ -67,7 +67,7 @@ or adapter = params[:inbound][:adapter].downcase if !EmailHelper.available_driver[:inbound][adapter.to_sym] return { - result: 'failed', + result: 'failed', message: "Unknown adapter '#{adapter}'", } end @@ -87,12 +87,12 @@ or fetch_result = driver_instance.fetch(params[:inbound][:options], self, 'verify', subject) rescue => e result = { - result: 'invalid', - source: 'inbound', - message: e.to_s, + result: 'invalid', + source: 'inbound', + message: e.to_s, message_human: EmailHelper::Probe.translation(e.message), invalid_field: EmailHelper::Probe.invalid_field(e.message), - subject: subject, + subject: subject, } return result end @@ -104,7 +104,7 @@ or end { - result: 'invalid', + result: 'invalid', message: 'Verification Email not found in mailbox.', subject: subject, } diff --git a/lib/enrichment/clearbit/user.rb b/lib/enrichment/clearbit/user.rb index ab44f6544..8f8e2c264 100644 --- a/lib/enrichment/clearbit/user.rb +++ b/lib/enrichment/clearbit/user.rb @@ -136,13 +136,13 @@ module Enrichment record = { direction: 'out', - facility: 'clearbit', - url: "clearbit -> #{@local_user.email}", - status: 200, - ip: nil, - request: { content: @local_user.email }, - response: {}, - method: 'GET', + facility: 'clearbit', + url: "clearbit -> #{@local_user.email}", + status: 200, + ip: nil, + request: { content: @local_user.email }, + response: {}, + method: 'GET', } begin diff --git a/lib/external_credential/facebook.rb b/lib/external_credential/facebook.rb index 5779ad0ec..bb6e6fb56 100644 --- a/lib/external_credential/facebook.rb +++ b/lib/external_credential/facebook.rb @@ -75,20 +75,20 @@ class ExternalCredential::Facebook # create channel Channel.create!( - area: 'Facebook::Account', - options: { + area: 'Facebook::Account', + options: { adapter: 'facebook', - auth: { + auth: { access_token: access_token }, - user: user, - pages: pages, - sync: { - wall: {}, + user: user, + pages: pages, + sync: { + wall: {}, pages: [], } }, - active: true, + active: true, created_by_id: 1, updated_by_id: 1, ) diff --git a/lib/external_credential/twitter.rb b/lib/external_credential/twitter.rb index b6840f4cf..621df43f2 100644 --- a/lib/external_credential/twitter.rb +++ b/lib/external_credential/twitter.rb @@ -50,9 +50,9 @@ class ExternalCredential::Twitter access_token = request_token.get_access_token(oauth_verifier: params[:oauth_verifier]) client = TwitterSync.new( - consumer_key: external_credential.credentials[:consumer_key], - consumer_secret: external_credential.credentials[:consumer_secret], - access_token: access_token.token, + consumer_key: external_credential.credentials[:consumer_key], + consumer_secret: external_credential.credentials[:consumer_secret], + access_token: access_token.token, access_token_secret: access_token.secret, ) client_user = client.who_am_i @@ -86,28 +86,28 @@ class ExternalCredential::Twitter # create channel channel = Channel.create!( - area: 'Twitter::Account', - options: { + area: 'Twitter::Account', + options: { adapter: 'twitter', - user: { - id: client_user_id, + user: { + id: client_user_id, screen_name: client_user.screen_name, - name: client_user.name, + name: client_user.name, }, - auth: { + auth: { external_credential_id: external_credential.id, oauth_token: access_token.token, oauth_token_secret: access_token.secret, }, - sync: { - limit: 20, - search: [], - mentions: {}, + sync: { + limit: 20, + search: [], + mentions: {}, direct_messages: {}, - track_retweets: false + track_retweets: false } }, - active: true, + active: true, created_by_id: 1, updated_by_id: 1, ) @@ -138,17 +138,17 @@ class ExternalCredential::Twitter env_name = params[:env] client = TwitterSync.new( - consumer_key: params[:consumer_key], - consumer_secret: params[:consumer_secret], - access_token: params[:oauth_token], + consumer_key: params[:consumer_key], + consumer_secret: params[:consumer_secret], + access_token: params[:oauth_token], access_token_secret: params[:oauth_token_secret], ) # needed for verify callback Cache.write('external_credential_twitter', { - consumer_key: params[:consumer_key], - consumer_secret: params[:consumer_secret], - access_token: params[:oauth_token], + consumer_key: params[:consumer_key], + consumer_secret: params[:consumer_secret], + access_token: params[:oauth_token], access_token_secret: params[:oauth_token_secret], }) diff --git a/lib/facebook.rb b/lib/facebook.rb index 32f697d41..7ac187d1f 100644 --- a/lib/facebook.rb +++ b/lib/facebook.rb @@ -167,11 +167,11 @@ result if user_data[:image_source] avatar = Avatar.add( - object: 'User', - o_id: user.id, - url: user_data[:image_source], - source: 'facebook', - deletable: true, + object: 'User', + o_id: user.id, + url: user_data[:image_source], + source: 'facebook', + deletable: true, updated_by_id: user.id, created_by_id: user.id, ) @@ -220,9 +220,9 @@ result state: state, priority: Ticket::Priority.find_by(name: '2 normal'), preferences: { - channel_id: channel.id, + channel_id: channel.id, channel_fb_object_id: page['id'], - facebook: { + facebook: { permalink_url: post['permalink_url'], } }, @@ -289,21 +289,21 @@ result end links = [ { - url: url, + url: url, target: '_blank', - name: 'on Facebook', + name: 'on Facebook', }, ] end article = { #to: @account['name'], - ticket_id: ticket.id, - internal: false, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + ticket_id: ticket.id, + internal: false, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, created_by_id: 1, updated_by_id: 1, - preferences: { + preferences: { links: links, }, }.merge(article) diff --git a/lib/fill_db.rb b/lib/fill_db.rb index 2f69f3a00..9a1a3f3ef 100644 --- a/lib/fill_db.rb +++ b/lib/fill_db.rb @@ -67,14 +67,14 @@ or if you only want to create 100 tickets ActiveRecord::Base.transaction do suffix = rand(99_999).to_s user = User.create_or_update( - login: "filldb-agent-#{suffix}", + login: "filldb-agent-#{suffix}", firstname: "agent #{suffix}", - lastname: "agent #{suffix}", - email: "filldb-agent-#{suffix}@example.com", - password: 'agentpw', - active: true, - roles: roles, - groups: groups_all, + lastname: "agent #{suffix}", + email: "filldb-agent-#{suffix}@example.com", + password: 'agentpw', + active: true, + roles: roles, + groups: groups_all, ) sleep nice agent_pool.push user @@ -99,14 +99,14 @@ or if you only want to create 100 tickets organization = organization_pool[ organization_pool.length - 1 ] end user = User.create_or_update( - login: "filldb-customer-#{suffix}", - firstname: "customer #{suffix}", - lastname: "customer #{suffix}", - email: "filldb-customer-#{suffix}@example.com", - password: 'customerpw', - active: true, + login: "filldb-customer-#{suffix}", + firstname: "customer #{suffix}", + lastname: "customer #{suffix}", + email: "filldb-customer-#{suffix}@example.com", + password: 'customerpw', + active: true, organization: organization, - roles: roles, + roles: roles, ) sleep nice customer_pool.push user @@ -144,25 +144,25 @@ or if you only want to create 100 tickets (1..overviews).each do ActiveRecord::Base.transaction do overview = Overview.create!( - name: "Filloverview::#{rand(999_999)}", - role_ids: [Role.find_by(name: 'Agent').id], + name: "Filloverview::#{rand(999_999)}", + role_ids: [Role.find_by(name: 'Agent').id], condition: { 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:work_on_all).pluck(:id), + value: Ticket::State.by_category(:work_on_all).pluck(:id), }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group state owner created_at], - s: %w[title customer group state owner created_at], - m: %w[number title customer group state owner created_at], + view: { + d: %w[title customer group state owner created_at], + s: %w[title customer group state owner created_at], + m: %w[number title customer group state owner created_at], view_mode_default: 's', }, - active: true + active: true ) end end @@ -179,27 +179,27 @@ or if you only want to create 100 tickets customer = customer_pool[ rand(customer_pool.length - 1) ] agent = agent_pool[ rand(agent_pool.length - 1) ] ticket = Ticket.create!( - title: "some title äöüß#{rand(999_999)}", - group: group_pool[ rand(group_pool.length - 1) ], - customer: customer, - owner: agent, - state: state_pool[ rand(state_pool.length - 1) ], - priority: priority_pool[ rand(priority_pool.length - 1) ], + title: "some title äöüß#{rand(999_999)}", + group: group_pool[ rand(group_pool.length - 1) ], + customer: customer, + owner: agent, + state: state_pool[ rand(state_pool.length - 1) ], + priority: priority_pool[ rand(priority_pool.length - 1) ], updated_by_id: agent.id, created_by_id: agent.id, ) # create article article = Ticket::Article.create!( - ticket_id: ticket.id, - from: customer.email, - to: 'some_recipient@example.com', - subject: "some subject#{rand(999_999)}", - message_id: "some@id-#{rand(999_999)}", - body: 'some message ...', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'phone').first, + ticket_id: ticket.id, + from: customer.email, + to: 'some_recipient@example.com', + subject: "some subject#{rand(999_999)}", + message_id: "some@id-#{rand(999_999)}", + body: 'some message ...', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'phone').first, updated_by_id: agent.id, created_by_id: agent.id, ) diff --git a/lib/html_sanitizer.rb b/lib/html_sanitizer.rb index 9e63deb74..3b5d8e588 100644 --- a/lib/html_sanitizer.rb +++ b/lib/html_sanitizer.rb @@ -448,12 +448,12 @@ reolace inline images with cid images filename = "image#{filename_counter}.#{file_attributes[:file_extention]}" end attachment = { - data: file_attributes[:content], - filename: filename, + data: file_attributes[:content], + filename: filename, preferences: { - 'Content-Type' => file_attributes[:mime_type], - 'Mime-Type' => file_attributes[:mime_type], - 'Content-ID' => cid, + 'Content-Type' => file_attributes[:mime_type], + 'Mime-Type' => file_attributes[:mime_type], + 'Content-ID' => cid, 'Content-Disposition' => 'inline', }, } diff --git a/lib/idoit.rb b/lib/idoit.rb index 4fda0c006..9bd120129 100644 --- a/lib/idoit.rb +++ b/lib/idoit.rb @@ -106,15 +106,15 @@ or with filter: result = UserAgent.post( url, { - method: method, - params: params, + method: method, + params: params, version: '2.0', }, { - json: true, + json: true, open_timeout: 6, read_timeout: 16, - log: { + log: { facility: 'idoit', }, }, diff --git a/lib/import/otrs/article.rb b/lib/import/otrs/article.rb index 3931f4de1..82e0c74cf 100644 --- a/lib/import/otrs/article.rb +++ b/lib/import/otrs/article.rb @@ -128,19 +128,19 @@ module Import type_id: article_type_id_lookup('email'), internal: true }, - 'note-external' => { + 'note-external' => { type_id: article_type_id_lookup('note'), internal: false }, - 'note-internal' => { + 'note-internal' => { type_id: article_type_id_lookup('note'), internal: true }, - 'phone' => { + 'phone' => { type_id: article_type_id_lookup('phone'), internal: false }, - 'webrequest' => { + 'webrequest' => { type_id: article_type_id_lookup('web'), internal: false }, diff --git a/lib/import/otrs/article/attachment_factory.rb b/lib/import/otrs/article/attachment_factory.rb index e7f799913..bdcf57540 100644 --- a/lib/import/otrs/article/attachment_factory.rb +++ b/lib/import/otrs/article/attachment_factory.rb @@ -37,11 +37,11 @@ module Import log "Ticket #{local_article.ticket_id}, Article #{local_article.id} - Starting import for fingerprint #{sha} (#{decoded_filename})... Queue: #{@sha_queue[sha]}." ActiveRecord::Base.transaction do Store.add( - object: 'Ticket::Article', - o_id: local_article.id, - filename: decoded_filename.force_encoding('utf-8'), - data: decoded_content, - preferences: { + object: 'Ticket::Article', + o_id: local_article.id, + filename: decoded_filename.force_encoding('utf-8'), + data: decoded_content, + preferences: { 'Mime-Type' => attachment['ContentType'], 'Content-ID' => attachment['ContentID'], 'content-alternative' => attachment['ContentAlternative'], diff --git a/lib/import/otrs/async.rb b/lib/import/otrs/async.rb index d5a7b0625..d5205a11a 100644 --- a/lib/import/otrs/async.rb +++ b/lib/import/otrs/async.rb @@ -13,7 +13,7 @@ module Import status_update_thread = Thread.new do loop do result = { - data: current_state, + data: current_state, result: 'in_progress', } Cache.write('import:state', result, expires_in: 10.minutes) @@ -31,7 +31,7 @@ module Import Rails.logger.error e result = { message: e.message, - result: 'error', + result: 'error', } Cache.write('import:state', result, expires_in: 10.hours) return false diff --git a/lib/import/otrs/dynamic_field.rb b/lib/import/otrs/dynamic_field.rb index b108d6aa6..1a82a27e3 100644 --- a/lib/import/otrs/dynamic_field.rb +++ b/lib/import/otrs/dynamic_field.rb @@ -34,10 +34,10 @@ module Import def initialize_attribute_config(dynamic_field) @attribute_config = { - object: dynamic_field['ObjectType'], - name: @internal_name, - display: dynamic_field['Label'], - screens: { + object: dynamic_field['ObjectType'], + name: @internal_name, + display: dynamic_field['Label'], + screens: { view: { '-all-' => { shown: true, diff --git a/lib/import/otrs/dynamic_field/checkbox.rb b/lib/import/otrs/dynamic_field/checkbox.rb index 33044c8c6..1c8798a09 100644 --- a/lib/import/otrs/dynamic_field/checkbox.rb +++ b/lib/import/otrs/dynamic_field/checkbox.rb @@ -6,8 +6,8 @@ module Import @attribute_config.merge!( data_type: 'boolean', data_option: { - default: dynamic_field['Config']['DefaultValue'] == '1', - options: { + default: dynamic_field['Config']['DefaultValue'] == '1', + options: { true => 'Yes', false => 'No', }, diff --git a/lib/import/otrs/history/article.rb b/lib/import/otrs/history/article.rb index 4145f7987..146c3b10e 100644 --- a/lib/import/otrs/history/article.rb +++ b/lib/import/otrs/history/article.rb @@ -4,14 +4,14 @@ module Import class Article < Import::OTRS::History def init_callback(history) @history_attributes = { - id: history['HistoryID'], - o_id: history['ArticleID'], - history_type: 'created', - history_object: 'Ticket::Article', - related_o_id: history['TicketID'], + id: history['HistoryID'], + o_id: history['ArticleID'], + history_type: 'created', + history_object: 'Ticket::Article', + related_o_id: history['TicketID'], related_history_object: 'Ticket', - created_at: history['CreateTime'], - created_by_id: history['CreateBy'] + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] } end end diff --git a/lib/import/otrs/history/move.rb b/lib/import/otrs/history/move.rb index b328e875e..4c07ac959 100644 --- a/lib/import/otrs/history/move.rb +++ b/lib/import/otrs/history/move.rb @@ -14,17 +14,17 @@ module Import to_id = $4 end @history_attributes = { - id: history['HistoryID'], - o_id: history['TicketID'], - history_type: 'updated', - history_object: 'Ticket', + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'group', - value_from: from, - value_to: to, - id_from: from_id, - id_to: to_id, - created_at: history['CreateTime'], - created_by_id: history['CreateBy'] + value_from: from, + value_to: to, + id_from: from_id, + id_to: to_id, + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] } end end diff --git a/lib/import/otrs/history/new_ticket.rb b/lib/import/otrs/history/new_ticket.rb index 5459f6ba2..4de937e71 100644 --- a/lib/import/otrs/history/new_ticket.rb +++ b/lib/import/otrs/history/new_ticket.rb @@ -4,12 +4,12 @@ module Import class NewTicket < Import::OTRS::History def init_callback(history) @history_attributes = { - id: history['HistoryID'], - o_id: history['TicketID'], - history_type: 'created', + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'created', history_object: 'Ticket', - created_at: history['CreateTime'], - created_by_id: history['CreateBy'] + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] } end end diff --git a/lib/import/otrs/history/priority_update.rb b/lib/import/otrs/history/priority_update.rb index 4659c148a..bad17f2e0 100644 --- a/lib/import/otrs/history/priority_update.rb +++ b/lib/import/otrs/history/priority_update.rb @@ -14,17 +14,17 @@ module Import to_id = $4 end @history_attributes = { - id: history['HistoryID'], - o_id: history['TicketID'], - history_type: 'updated', - history_object: 'Ticket', + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'priority', - value_from: from, - value_to: to, - id_from: from_id, - id_to: to_id, - created_at: history['CreateTime'], - created_by_id: history['CreateBy'] + value_from: from, + value_to: to, + id_from: from_id, + id_to: to_id, + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] } end end diff --git a/lib/import/otrs/history/state_update.rb b/lib/import/otrs/history/state_update.rb index a1b7ce280..0e199c517 100644 --- a/lib/import/otrs/history/state_update.rb +++ b/lib/import/otrs/history/state_update.rb @@ -20,17 +20,17 @@ module Import end end @history_attributes = { - id: history['HistoryID'], - o_id: history['TicketID'], - history_type: 'updated', - history_object: 'Ticket', + id: history['HistoryID'], + o_id: history['TicketID'], + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - value_from: from, - id_from: from_id, - value_to: to, - id_to: to_id, - created_at: history['CreateTime'], - created_by_id: history['CreateBy'] + value_from: from, + id_from: from_id, + value_to: to, + id_to: to_id, + created_at: history['CreateTime'], + created_by_id: history['CreateBy'] } end end diff --git a/lib/import/otrs/import_stats.rb b/lib/import/otrs/import_stats.rb index 5a9f84378..e783b5a0f 100644 --- a/lib/import/otrs/import_stats.rb +++ b/lib/import/otrs/import_stats.rb @@ -6,11 +6,11 @@ module Import def current_state { - Base: { + Base: { done: base_done, total: base_total, }, - User: { + User: { done: user_done, total: user_total, }, diff --git a/lib/import/otrs/requester.rb b/lib/import/otrs/requester.rb index d9564cd3e..3c7eae7ab 100644 --- a/lib/import/otrs/requester.rb +++ b/lib/import/otrs/requester.rb @@ -34,7 +34,7 @@ module Import result = request_result( Subaction: 'Export', Object: object, - Limit: opts[:limit] || '', + Limit: opts[:limit] || '', Offset: opts[:offset] || '', Diff: opts[:diff] ? 1 : 0 ) diff --git a/lib/import/otrs/ticket.rb b/lib/import/otrs/ticket.rb index ba430f93b..58303f2c3 100644 --- a/lib/import/otrs/ticket.rb +++ b/lib/import/otrs/ticket.rb @@ -7,19 +7,19 @@ module Import include Import::OTRS::Helper MAPPING = { - Changed: :updated_at, - Created: :created_at, - TicketNumber: :number, - QueueID: :group_id, - StateID: :state_id, - PriorityID: :priority_id, - Title: :title, - TicketID: :id, + Changed: :updated_at, + Created: :created_at, + TicketNumber: :number, + QueueID: :group_id, + StateID: :state_id, + PriorityID: :priority_id, + Title: :title, + TicketID: :id, FirstResponse: :first_response_at, #FirstResponseTimeDestinationDate: :first_response_escalation_at, #FirstResponseInMin: :first_response_in_min, #FirstResponseDiffInMin: :first_response_diff_in_min, - Closed: :close_at, + Closed: :close_at, #SoltutionTimeDestinationDate: :close_escalation_at, #CloseTimeInMin: :close_in_min, #CloseTimeDiffInMin: :close_diff_in_min, diff --git a/lib/import/zendesk/object_attribute/base.rb b/lib/import/zendesk/object_attribute/base.rb index 1858fb2d1..e429715e6 100644 --- a/lib/import/zendesk/object_attribute/base.rb +++ b/lib/import/zendesk/object_attribute/base.rb @@ -55,7 +55,7 @@ module Import edit: { Customer: { shown: attribute.visible_in_portal, - null: !attribute.required_in_portal, + null: !attribute.required_in_portal, }, }.merge(config) } diff --git a/lib/ldap/user.rb b/lib/ldap/user.rb index bb9689dfc..8d9fc6a67 100644 --- a/lib/ldap/user.rb +++ b/lib/ldap/user.rb @@ -101,8 +101,8 @@ class Ldap # @return [Boolean] The valid state of the username and password combination. def valid?(username, password) bind_success = @ldap.connection.bind_as( - base: @ldap.base_dn, - filter: "(#{login_attribute}=#{username})", + base: @ldap.base_dn, + filter: "(#{login_attribute}=#{username})", password: password ) diff --git a/lib/notification_factory/mailer.rb b/lib/notification_factory/mailer.rb index 7841d6513..2a5cf6d2b 100644 --- a/lib/notification_factory/mailer.rb +++ b/lib/notification_factory/mailer.rb @@ -90,20 +90,20 @@ returns if data['criteria']['owned_by_me'] && owned_by_me return { - user: user, + user: user, channels: channels } end if data['criteria']['owned_by_nobody'] && owned_by_nobody return { - user: user, + user: user, channels: channels } end return if !data['criteria']['no'] { - user: user, + user: user, channels: channels } end @@ -136,14 +136,14 @@ returns channel.deliver( { # in_reply_to: in_reply_to, - from: sender, - to: data[:recipient][:email], - subject: data[:subject], - message_id: data[:message_id], - references: data[:references], - body: data[:body], + from: sender, + to: data[:recipient][:email], + subject: data[:subject], + message_id: data[:message_id], + references: data[:references], + body: data[:body], content_type: content_type, - attachments: data[:attachments], + attachments: data[:attachments], }, true ) @@ -170,9 +170,9 @@ returns # get subject result = NotificationFactory::Mailer.template( - template: data[:template], - locale: data[:user][:preferences][:locale], - objects: data[:objects], + template: data[:template], + locale: data[:user][:preferences][:locale], + objects: data[:objects], standalone: data[:standalone], ) @@ -187,13 +187,13 @@ returns end NotificationFactory::Mailer.send( - recipient: data[:user], - subject: result[:subject], - body: result[:body], + recipient: data[:user], + subject: result[:subject], + body: result[:body], content_type: 'text/html', - message_id: data[:message_id], - references: data[:references], - attachments: data[:attachments], + message_id: data[:message_id], + references: data[:references], + attachments: data[:attachments], ) end @@ -270,10 +270,10 @@ returns end template = NotificationFactory.template_read( - locale: data[:locale] || Setting.get('locale_default') || 'en-us', + locale: data[:locale] || Setting.get('locale_default') || 'en-us', template: data[:template], - format: 'html', - type: 'mailer', + format: 'html', + type: 'mailer', ) message_subject = NotificationFactory::Renderer.new(data[:objects], data[:locale], template[:subject], false).render @@ -282,7 +282,7 @@ returns if !data[:raw] application_template = NotificationFactory.application_template_read( format: 'html', - type: 'mailer', + type: 'mailer', ) data[:objects][:message] = message_body data[:objects][:standalone] = data[:standalone] @@ -290,7 +290,7 @@ returns end { subject: message_subject, - body: message_body, + body: message_body, } end diff --git a/lib/notification_factory/renderer.rb b/lib/notification_factory/renderer.rb index 440734a39..a03876026 100644 --- a/lib/notification_factory/renderer.rb +++ b/lib/notification_factory/renderer.rb @@ -52,7 +52,7 @@ examples how to use # escape in html mode if escape no_escape = { - 'article.body_as_html' => true, + 'article.body_as_html' => true, 'article.body_as_text_with_quote.text2html' => true, } if no_escape[key] diff --git a/lib/notification_factory/slack.rb b/lib/notification_factory/slack.rb index 87221565a..78f0814e5 100644 --- a/lib/notification_factory/slack.rb +++ b/lib/notification_factory/slack.rb @@ -27,10 +27,10 @@ returns end template = NotificationFactory.template_read( - locale: data[:locale] || Setting.get('locale_default') || 'en-us', + locale: data[:locale] || Setting.get('locale_default') || 'en-us', template: data[:template], - format: 'md', - type: 'slack', + format: 'md', + type: 'slack', ) message_subject = NotificationFactory::Renderer.new(data[:objects], data[:locale], template[:subject], false).render @@ -39,7 +39,7 @@ returns if !data[:raw] application_template = NotificationFactory.application_template_read( format: 'md', - type: 'slack', + type: 'slack', ) data[:objects][:message] = message_body data[:objects][:standalone] = data[:standalone] @@ -47,7 +47,7 @@ returns end { subject: message_subject.strip!, - body: message_body.strip!, + body: message_body.strip!, } end diff --git a/lib/report/base.rb b/lib/report/base.rb index 9856e2878..56b448c6c 100644 --- a/lib/report/base.rb +++ b/lib/report/base.rb @@ -134,7 +134,7 @@ class Report::Base ticket_ids.push history.o_id end return { - count: count, + count: count, ticket_ids: ticket_ids, } end @@ -216,7 +216,7 @@ class Report::Base end end return { - count: count, + count: count, ticket_ids: ticket_ids, } end @@ -288,7 +288,7 @@ class Report::Base (time_min / 60).to_i end { - count: tickets, + count: tickets, ticket_ids: ticket_ids, } end @@ -327,7 +327,7 @@ class Report::Base (time_max / 60).to_i end { - count: tickets, + count: tickets, ticket_ids: ticket_ids, } end diff --git a/lib/report/ticket_first_solution.rb b/lib/report/ticket_first_solution.rb index b0b928140..fcf8c1e3c 100644 --- a/lib/report/ticket_first_solution.rb +++ b/lib/report/ticket_first_solution.rb @@ -125,9 +125,9 @@ returns assets = ticket_full.assets(assets) end { - count: count, + count: count, ticket_ids: ticket_ids, - assets: assets, + assets: assets, } end diff --git a/lib/report/ticket_generic_time.rb b/lib/report/ticket_generic_time.rb index d5c9df9ac..51e42182c 100644 --- a/lib/report/ticket_generic_time.rb +++ b/lib/report/ticket_generic_time.rb @@ -23,16 +23,16 @@ returns end aggs_interval = { - from: params[:range_start], - to: params[:range_end], + from: params[:range_start], + to: params[:range_end], interval: interval_es, # year, quarter, month, week, day, hour, minute, second - field: params[:params][:field], + field: params[:params][:field], } without_merged_tickets = { 'state' => { 'operator' => 'is not', - 'value' => 'merged' + 'value' => 'merged' } } @@ -141,8 +141,8 @@ returns def self.items(params) aggs_interval = { - from: params[:range_start], - to: params[:range_end], + from: params[:range_start], + to: params[:range_end], field: params[:params][:field], } @@ -154,7 +154,7 @@ returns without_merged_tickets = { 'state' => { 'operator' => 'is not', - 'value' => 'merged' + 'value' => 'merged' } } diff --git a/lib/report/ticket_moved.rb b/lib/report/ticket_moved.rb index 76f1ded24..2f94dbac3 100644 --- a/lib/report/ticket_moved.rb +++ b/lib/report/ticket_moved.rb @@ -71,12 +71,12 @@ returns local_selector.delete('ticket.group_id') end defaults = { - object: 'Ticket', - type: 'updated', + object: 'Ticket', + type: 'updated', attribute: 'group', - start: start, - end: stop, - selector: local_selector + start: start, + end: stop, + selector: local_selector } local_params = defaults.merge(local_params) count = history_count(local_params) @@ -111,7 +111,7 @@ returns if !selector return { - count: 0, + count: 0, ticket_ids: [], } end @@ -128,12 +128,12 @@ returns local_selector.delete('ticket.group_id') end defaults = { - object: 'Ticket', - type: 'updated', + object: 'Ticket', + type: 'updated', attribute: 'group', - start: params[:range_start], - end: params[:range_end], - selector: local_selector + start: params[:range_start], + end: params[:range_end], + selector: local_selector } local_params = defaults.merge(local_params) result = history(local_params) @@ -154,24 +154,24 @@ returns if params[:params][:type] == 'in' return { id_not_from: group_id, - id_to: group_id, + id_to: group_id, } else return { - id_from: group_id, + id_from: group_id, id_not_to: group_id, } end elsif selector['operator'] == 'is not' if params[:params][:type] == 'in' return { - id_from: group_id, + id_from: group_id, id_not_to: group_id, } else return { id_not_from: group_id, - id_to: group_id, + id_to: group_id, } end end diff --git a/lib/report/ticket_reopened.rb b/lib/report/ticket_reopened.rb index a8f21eeb2..565e0cc22 100644 --- a/lib/report/ticket_reopened.rb +++ b/lib/report/ticket_reopened.rb @@ -61,14 +61,14 @@ returns } params[:selector].merge!(without_merged_tickets) # do not show merged tickets in reports count = history_count( - object: 'Ticket', - type: 'updated', + object: 'Ticket', + type: 'updated', attribute: 'state', - id_from: ticket_state_ids, + id_from: ticket_state_ids, id_not_to: ticket_state_ids, - start: start, - end: stop, - selector: params[:selector] + start: start, + end: stop, + selector: params[:selector] ) result.push count start = stop @@ -97,14 +97,14 @@ returns def self.items(params) ticket_state_ids = ticket_ids result = history( - object: 'Ticket', - type: 'updated', + object: 'Ticket', + type: 'updated', attribute: 'state', - id_from: ticket_state_ids, + id_from: ticket_state_ids, id_not_to: ticket_state_ids, - start: params[:range_start], - end: params[:range_end], - selector: params[:selector] + start: params[:range_start], + end: params[:range_end], + selector: params[:selector] ) return result if params[:sheet].present? diff --git a/lib/search_index_backend.rb b/lib/search_index_backend.rb index 8629d8f9f..14202d321 100644 --- a/lib/search_index_backend.rb +++ b/lib/search_index_backend.rb @@ -19,11 +19,11 @@ info about used search index machine url, {}, { - json: true, + json: true, open_timeout: 8, read_timeout: 12, - user: Setting.get('es_user'), - password: Setting.get('es_password'), + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) Rails.logger.info "# #{response.code}" @@ -79,11 +79,11 @@ update processors response = UserAgent.delete( url, { - json: true, + json: true, open_timeout: 8, read_timeout: 12, - user: Setting.get('es_user'), - password: Setting.get('es_password'), + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) Rails.logger.info "# #{response.code}" @@ -103,11 +103,11 @@ update processors url, item, { - json: true, + json: true, open_timeout: 8, read_timeout: 12, - user: Setting.get('es_user'), - password: Setting.get('es_password'), + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) Rails.logger.info "# #{response.code}" @@ -178,11 +178,11 @@ create/update/delete index url, data[:data], { - json: true, + json: true, open_timeout: 8, read_timeout: 30, - user: Setting.get('es_user'), - password: Setting.get('es_password'), + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) Rails.logger.info "# #{response.code}" @@ -216,11 +216,11 @@ add new object to search index url, data, { - json: true, + json: true, open_timeout: 8, read_timeout: 16, - user: Setting.get('es_user'), - password: Setting.get('es_password'), + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) Rails.logger.info "# #{response.code}" @@ -255,8 +255,8 @@ remove whole data from index { open_timeout: 8, read_timeout: 16, - user: Setting.get('es_user'), - password: Setting.get('es_password'), + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) Rails.logger.info "# #{response.code}" @@ -345,7 +345,7 @@ remove whole data from index # real search condition condition = { 'query_string' => { - 'query' => append_wildcard_to_simple_query(query), + 'query' => append_wildcard_to_simple_query(query), 'default_operator' => 'AND', 'analyze_wildcard' => true, } @@ -360,11 +360,11 @@ remove whole data from index url, query_data, { - json: true, + json: true, open_timeout: 5, read_timeout: 14, - user: Setting.get('es_user'), - password: Setting.get('es_password'), + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) @@ -386,7 +386,7 @@ remove whole data from index Rails.logger.info "... #{item['_type']} #{item['_id']}" { - id: item['_id'], + id: item['_id'], type: item['_type'], } end @@ -495,11 +495,11 @@ get count of tickets and tickets which match on selector url, data, { - json: true, + json: true, open_timeout: 5, read_timeout: 14, - user: Setting.get('es_user'), - password: Setting.get('es_password'), + user: Setting.get('es_user'), + password: Setting.get('es_password'), } ) @@ -520,7 +520,7 @@ get count of tickets and tickets which match on selector ticket_ids.push item['_id'] end return { - count: response.data['hits']['total'], + count: response.data['hits']['total'], ticket_ids: ticket_ids, } end @@ -531,10 +531,10 @@ get count of tickets and tickets which match on selector query_must = [] query_must_not = [] relative_map = { - day: 'd', - year: 'y', - month: 'M', - hour: 'h', + day: 'd', + year: 'y', + month: 'M', + hour: 'h', minute: 'm', } if selector.present? @@ -622,7 +622,7 @@ get count of tickets and tickets which match on selector end data = { query: {}, - size: limit, + size: limit, } # add aggs to filter @@ -632,7 +632,7 @@ get count of tickets and tickets which match on selector data[:aggs] = { time_buckets: { date_histogram: { - field: aggs_interval[:field], + field: aggs_interval[:field], interval: aggs_interval[:interval], } } @@ -642,7 +642,7 @@ get count of tickets and tickets which match on selector r[:range] = {} r[:range][aggs_interval[:field]] = { from: aggs_interval[:from], - to: aggs_interval[:to], + to: aggs_interval[:to], } query_must.push r end diff --git a/lib/sequencer/unit/import/common/model/http_log.rb b/lib/sequencer/unit/import/common/model/http_log.rb index 9ee037138..2ae4aaf44 100644 --- a/lib/sequencer/unit/import/common/model/http_log.rb +++ b/lib/sequencer/unit/import/common/model/http_log.rb @@ -11,16 +11,16 @@ class Sequencer return if dry_run ::HttpLog.create( - direction: 'out', - facility: facility, - method: 'tcp', - url: "#{action} -> #{remote_id}", - status: status, - ip: nil, - request: { + direction: 'out', + facility: facility, + method: 'tcp', + url: "#{action} -> #{remote_id}", + status: status, + ip: nil, + request: { content: mapped, }, - response: { + response: { message: response }, created_by_id: 1, diff --git a/lib/sequencer/unit/import/zendesk/sub_sequence/mapped.rb b/lib/sequencer/unit/import/zendesk/sub_sequence/mapped.rb index 1c3d1d111..92313b460 100644 --- a/lib/sequencer/unit/import/zendesk/sub_sequence/mapped.rb +++ b/lib/sequencer/unit/import/zendesk/sub_sequence/mapped.rb @@ -62,7 +62,7 @@ class Sequencer parameters: default_params.merge( resource: resource ), - expecting: [expecting]) + expecting: [expecting]) end def mapping_value(expected_value) diff --git a/lib/sequencer/unit/import/zendesk/ticket/comment/attachment/add.rb b/lib/sequencer/unit/import/zendesk/ticket/comment/attachment/add.rb index abe9fadab..18e68dc6e 100644 --- a/lib/sequencer/unit/import/zendesk/ticket/comment/attachment/add.rb +++ b/lib/sequencer/unit/import/zendesk/ticket/comment/attachment/add.rb @@ -15,11 +15,11 @@ class Sequencer def process ::Store.add( - object: model_class.name, - o_id: instance.id, - data: response.body, - filename: resource.file_name, - preferences: { + object: model_class.name, + o_id: instance.id, + data: response.body, + filename: resource.file_name, + preferences: { 'Content-Type' => resource.content_type }, created_by_id: 1 diff --git a/lib/service/geo_calendar/zammad.rb b/lib/service/geo_calendar/zammad.rb index ea19e3400..4ba889b34 100644 --- a/lib/service/geo_calendar/zammad.rb +++ b/lib/service/geo_calendar/zammad.rb @@ -21,9 +21,9 @@ class Service::GeoCalendar::Zammad "#{host}#{url}", {}, { - json: true, - open_timeout: 2, - read_timeout: 4, + json: true, + open_timeout: 2, + read_timeout: 4, total_timeout: 12, }, ) diff --git a/lib/service/geo_ip/zammad.rb b/lib/service/geo_ip/zammad.rb index 109ecf993..106464324 100644 --- a/lib/service/geo_ip/zammad.rb +++ b/lib/service/geo_ip/zammad.rb @@ -19,9 +19,9 @@ class Service::GeoIp::Zammad "#{host}#{url}", {}, { - json: true, - open_timeout: 2, - read_timeout: 4, + json: true, + open_timeout: 2, + read_timeout: 4, total_timeout: 4, }, ) diff --git a/lib/service/geo_location/gmaps.rb b/lib/service/geo_location/gmaps.rb index 6b2dbbfba..3363c4c8f 100644 --- a/lib/service/geo_location/gmaps.rb +++ b/lib/service/geo_location/gmaps.rb @@ -8,8 +8,8 @@ class Service::GeoLocation::Gmaps url, {}, { - open_timeout: 2, - read_timeout: 4, + open_timeout: 2, + read_timeout: 4, total_timeout: 4, }, ) @@ -32,9 +32,9 @@ class Service::GeoLocation::Gmaps url, {}, { - json: true, - open_timeout: 2, - read_timeout: 4, + json: true, + open_timeout: 2, + read_timeout: 4, total_timeout: 4, }, ) diff --git a/lib/service/image/zammad.rb b/lib/service/image/zammad.rb index 312e2c7fd..335eed867 100644 --- a/lib/service/image/zammad.rb +++ b/lib/service/image/zammad.rb @@ -33,7 +33,7 @@ class Service::Image::Zammad Rails.logger.info "Fetched image for '#{email}', http code: #{response.code}" mime_type = 'image/jpeg' { - content: response.body, + content: response.body, mime_type: mime_type, } end @@ -67,7 +67,7 @@ class Service::Image::Zammad mime_type = 'image/png' { - content: response.body, + content: response.body, mime_type: mime_type, } end diff --git a/lib/sessions.rb b/lib/sessions.rb index 05b82213e..a9194b015 100644 --- a/lib/sessions.rb +++ b/lib/sessions.rb @@ -58,7 +58,7 @@ returns client_id, { event: 'ws:login', - data: { success: true }, + data: { success: true }, } ) end @@ -498,7 +498,7 @@ create spool messages path = "#{@path}/spool/" FileUtils.mkpath path data = { - msg: msg, + msg: msg, timestamp: Time.now.utc.to_i, } file_path = "#{path}/#{Time.now.utc.to_f}-#{rand(99_999)}" @@ -572,7 +572,7 @@ get spool messages end item = { - type: 'direct', + type: 'direct', message: message, } data.push item @@ -585,7 +585,7 @@ get spool messages message = message_parsed['data'] end item = { - type: 'broadcast', + type: 'broadcast', message: message, } data.push item diff --git a/lib/sessions/backend/activity_stream.rb b/lib/sessions/backend/activity_stream.rb index fbea4557f..0498d24d4 100644 --- a/lib/sessions/backend/activity_stream.rb +++ b/lib/sessions/backend/activity_stream.rb @@ -42,7 +42,7 @@ class Sessions::Backend::ActivityStream { record_ids: item_ids, - assets: assets, + assets: assets, } end @@ -65,17 +65,17 @@ class Sessions::Backend::ActivityStream if !@client return { - event: 'activity_stream_rebuild', + event: 'activity_stream_rebuild', collection: 'activity_stream', - data: data, + data: data, } end @client.log "push activity_stream #{data.first.class} for user #{@user.id}" @client.send( - event: 'activity_stream_rebuild', + event: 'activity_stream_rebuild', collection: 'activity_stream', - data: data, + data: data, ) end diff --git a/lib/sessions/backend/base.rb b/lib/sessions/backend/base.rb index ae7a9dccb..1f70fcf09 100644 --- a/lib/sessions/backend/base.rb +++ b/lib/sessions/backend/base.rb @@ -18,7 +18,7 @@ class Sessions::Backend::Base @asset_lookup[class_name] ||= {} @asset_lookup[class_name][record.id] = { updated_at: record.updated_at, - pushed_at: @time_now, + pushed_at: @time_now, } record.assets(assets) end diff --git a/lib/sessions/backend/collections/base.rb b/lib/sessions/backend/collections/base.rb index 66bf33877..ee22dbcd2 100644 --- a/lib/sessions/backend/collections/base.rb +++ b/lib/sessions/backend/collections/base.rb @@ -68,19 +68,19 @@ class Sessions::Backend::Collections::Base < Sessions::Backend::Base collection: { items.first.class.to_app_model => all, }, - assets: assets, + assets: assets, } end @client.log "push assets for push_collection #{items.first.class} for user #{@user.id}" @client.send( - data: assets, + data: assets, event: 'loadAssets', ) @client.log "push push_collection #{items.first.class} for user #{@user.id}" @client.send( event: 'resetCollection', - data: { + data: { items.first.class.to_app_model => all, }, ) diff --git a/lib/sessions/backend/ticket_create.rb b/lib/sessions/backend/ticket_create.rb index 2f224f626..1aa7b9771 100644 --- a/lib/sessions/backend/ticket_create.rb +++ b/lib/sessions/backend/ticket_create.rb @@ -38,14 +38,14 @@ class Sessions::Backend::TicketCreate < Sessions::Backend::Base if !@client return { event: 'ticket_create_attributes', - data: data, + data: data, } end @client.log "push ticket_create for user #{@user.id}" @client.send( event: 'ticket_create_attributes', - data: data, + data: data, ) end diff --git a/lib/sessions/backend/ticket_overview_list.rb b/lib/sessions/backend/ticket_overview_list.rb index 01e12ccbe..ab91f19d0 100644 --- a/lib/sessions/backend/ticket_overview_list.rb +++ b/lib/sessions/backend/ticket_overview_list.rb @@ -75,9 +75,9 @@ class Sessions::Backend::TicketOverviewList < Sessions::Backend::Base assets = {} overview = Overview.lookup(id: index[:overview][:id]) meta = { - name: overview.name, - prio: overview.prio, - link: overview.link, + name: overview.name, + prio: overview.prio, + link: overview.link, count: index[:count], } indexes.push meta @@ -86,7 +86,7 @@ class Sessions::Backend::TicketOverviewList < Sessions::Backend::Base @client.log "push overview_index for user #{@user.id}" @client.send( event: 'ticket_overview_index', - data: indexes, + data: indexes, ) end @@ -117,7 +117,7 @@ class Sessions::Backend::TicketOverviewList < Sessions::Backend::Base if !@client result = { event: 'ticket_overview_list', - data: data, + data: data, } results.push result else @@ -126,7 +126,7 @@ class Sessions::Backend::TicketOverviewList < Sessions::Backend::Base # send update to browser @client.send( event: 'ticket_overview_list', - data: data, + data: data, ) end end diff --git a/lib/sessions/event/base.rb b/lib/sessions/event/base.rb index b63ea228b..c892bc6fd 100644 --- a/lib/sessions/event/base.rb +++ b/lib/sessions/event/base.rb @@ -38,7 +38,7 @@ class Sessions::Event::Base if !@session error = { event: 'error', - data: { + data: { state: 'no_session', }, } @@ -48,7 +48,7 @@ class Sessions::Event::Base if !@session['id'] error = { event: 'error', - data: { + data: { state: 'no_session_user_id', }, } @@ -62,7 +62,7 @@ class Sessions::Event::Base if !@session error = { event: "#{event}_error", - data: { + data: { state: 'no_session', }, } @@ -72,7 +72,7 @@ class Sessions::Event::Base if @session['id'].blank? error = { event: "#{event}_error", - data: { + data: { state: 'no_session_user_id', }, } @@ -90,7 +90,7 @@ class Sessions::Event::Base if !user error = { event: "#{event}_error", - data: { + data: { state: 'no_such_user', }, } @@ -107,7 +107,7 @@ class Sessions::Event::Base if !user.permissions?(key) error = { event: "#{event}_error", - data: { + data: { state: 'no_permission', }, } diff --git a/lib/sessions/event/chat_agent_state.rb b/lib/sessions/event/chat_agent_state.rb index 90250fe8b..b6363b5ff 100644 --- a/lib/sessions/event/chat_agent_state.rb +++ b/lib/sessions/event/chat_agent_state.rb @@ -13,8 +13,8 @@ class Sessions::Event::ChatAgentState < Sessions::Event::ChatBase { event: 'chat_agent_state', - data: { - state: 'ok', + data: { + state: 'ok', active: @payload['data']['active'], }, } diff --git a/lib/sessions/event/chat_base.rb b/lib/sessions/event/chat_base.rb index 29978c3a8..b2fce56d6 100644 --- a/lib/sessions/event/chat_base.rb +++ b/lib/sessions/event/chat_base.rb @@ -8,7 +8,7 @@ class Sessions::Event::ChatBase < Sessions::Event::Base { event: 'chat_error', - data: { + data: { state: 'chat_disabled', }, } @@ -22,7 +22,7 @@ class Sessions::Event::ChatBase < Sessions::Event::Base if !@payload['data'] || !@payload['data']['session_id'] error = { event: 'chat_error', - data: { + data: { state: 'Need session_id.', }, } @@ -33,7 +33,7 @@ class Sessions::Event::ChatBase < Sessions::Event::Base error = { event: 'chat_error', - data: { + data: { state: "No such session id #{@payload['data']['session_id']}", }, } @@ -51,7 +51,7 @@ class Sessions::Event::ChatBase < Sessions::Event::Base error = { event: 'chat_error', - data: { + data: { state: 'no_such_chat', }, } diff --git a/lib/sessions/event/chat_session_close.rb b/lib/sessions/event/chat_session_close.rb index f6df119dc..ff29a8a61 100644 --- a/lib/sessions/event/chat_session_close.rb +++ b/lib/sessions/event/chat_session_close.rb @@ -21,9 +21,9 @@ class Sessions::Event::ChatSessionClose < Sessions::Event::ChatBase if participents_count < 2 || (@session && chat_session.user_id == @session['id']) message = { event: 'chat_session_closed', - data: { + data: { session_id: chat_session.session_id, - realname: realname, + realname: realname, }, } @@ -41,9 +41,9 @@ class Sessions::Event::ChatSessionClose < Sessions::Event::ChatBase else message = { event: 'chat_session_left', - data: { + data: { session_id: chat_session.session_id, - realname: realname, + realname: realname, }, } end @@ -52,8 +52,8 @@ class Sessions::Event::ChatSessionClose < Sessions::Event::ChatBase # notifiy participients { event: 'chat_status_close', - data: { - state: 'ok', + data: { + state: 'ok', session_id: chat_session.session_id, }, } diff --git a/lib/sessions/event/chat_session_init.rb b/lib/sessions/event/chat_session_init.rb index 0cc264360..d779d2bcf 100644 --- a/lib/sessions/event/chat_session_init.rb +++ b/lib/sessions/event/chat_session_init.rb @@ -27,15 +27,15 @@ class Sessions::Event::ChatSessionInit < Sessions::Event::ChatBase # create chat session chat_session = Chat::Session.create( - chat_id: @payload['data']['chat_id'], - name: '', - state: 'waiting', + chat_id: @payload['data']['chat_id'], + name: '', + state: 'waiting', preferences: { - url: @payload['data']['url'], + url: @payload['data']['url'], participants: [@client_id], - remote_ip: @remote_ip, - geo_ip: geo_ip, - dns_name: dns_name, + remote_ip: @remote_ip, + geo_ip: geo_ip, + dns_name: dns_name, }, ) @@ -45,9 +45,9 @@ class Sessions::Event::ChatSessionInit < Sessions::Event::ChatBase # return new session { event: 'chat_session_queue', - data: { - state: 'queue', - position: Chat.waiting_chat_count, + data: { + state: 'queue', + position: Chat.waiting_chat_count, session_id: chat_session.session_id, }, } diff --git a/lib/sessions/event/chat_session_message.rb b/lib/sessions/event/chat_session_message.rb index b2d199242..da7123de3 100644 --- a/lib/sessions/event/chat_session_message.rb +++ b/lib/sessions/event/chat_session_message.rb @@ -12,14 +12,14 @@ class Sessions::Event::ChatSessionMessage < Sessions::Event::ChatBase end chat_message = Chat::Message.create( chat_session_id: chat_session.id, - content: @payload['data']['content'], - created_by_id: user_id, + content: @payload['data']['content'], + created_by_id: user_id, ) message = { event: 'chat_session_message', - data: { + data: { session_id: chat_session.session_id, - message: chat_message, + message: chat_message, }, } @@ -29,9 +29,9 @@ class Sessions::Event::ChatSessionMessage < Sessions::Event::ChatBase # send chat_session_init to agent { event: 'chat_session_message', - data: { - session_id: chat_session.session_id, - message: chat_message, + data: { + session_id: chat_session.session_id, + message: chat_message, self_written: true, }, } diff --git a/lib/sessions/event/chat_session_notice.rb b/lib/sessions/event/chat_session_notice.rb index a02d29f5e..0dfe36c71 100644 --- a/lib/sessions/event/chat_session_notice.rb +++ b/lib/sessions/event/chat_session_notice.rb @@ -10,9 +10,9 @@ class Sessions::Event::ChatSessionNotice < Sessions::Event::ChatBase message = { event: 'chat_session_notice', - data: { + data: { session_id: chat_session.session_id, - message: @payload['data']['message'], + message: @payload['data']['message'], }, } chat_session.send_to_recipients(message, @client_id) diff --git a/lib/sessions/event/chat_session_start.rb b/lib/sessions/event/chat_session_start.rb index 6d291668c..9614a4e4a 100644 --- a/lib/sessions/event/chat_session_start.rb +++ b/lib/sessions/event/chat_session_start.rb @@ -9,8 +9,8 @@ class Sessions::Event::ChatSessionStart < Sessions::Event::ChatBase if !chat_session return { event: 'chat_session_start', - data: { - state: 'failed', + data: { + state: 'failed', message: 'No session available.', }, } @@ -27,16 +27,16 @@ class Sessions::Event::ChatSessionStart < Sessions::Event::ChatBase url = "#{Setting.get('http_type')}://#{Setting.get('fqdn')}/api/v1/users/image/#{chat_user.image}" end user = { - name: chat_user.fullname, + name: chat_user.fullname, avatar: url, } data = { event: 'chat_session_start', - data: { - state: 'ok', - agent: user, + data: { + state: 'ok', + agent: user, session_id: chat_session.session_id, - chat_id: chat_session.chat_id, + chat_id: chat_session.chat_id, }, } # send to customer @@ -45,7 +45,7 @@ class Sessions::Event::ChatSessionStart < Sessions::Event::ChatBase # send to agent data = { event: 'chat_session_start', - data: { + data: { session: chat_session.attributes, }, } diff --git a/lib/sessions/event/chat_session_typing.rb b/lib/sessions/event/chat_session_typing.rb index c084ee882..8b5dfcf4f 100644 --- a/lib/sessions/event/chat_session_typing.rb +++ b/lib/sessions/event/chat_session_typing.rb @@ -12,9 +12,9 @@ class Sessions::Event::ChatSessionTyping < Sessions::Event::ChatBase end message = { event: 'chat_session_typing', - data: { + data: { session_id: chat_session.session_id, - user_id: user_id, + user_id: user_id, }, } @@ -24,8 +24,8 @@ class Sessions::Event::ChatSessionTyping < Sessions::Event::ChatBase # send chat_session_init to agent { event: 'chat_session_typing', - data: { - session_id: chat_session.session_id, + data: { + session_id: chat_session.session_id, self_written: true, }, } diff --git a/lib/sessions/event/chat_status_agent.rb b/lib/sessions/event/chat_status_agent.rb index 9c91f53c2..82af10669 100644 --- a/lib/sessions/event/chat_status_agent.rb +++ b/lib/sessions/event/chat_status_agent.rb @@ -16,7 +16,7 @@ class Sessions::Event::ChatStatusAgent < Sessions::Event::ChatBase end { event: 'chat_status_agent', - data: Chat.agent_state_with_sessions(@session['id']), + data: Chat.agent_state_with_sessions(@session['id']), } end diff --git a/lib/sessions/event/chat_status_customer.rb b/lib/sessions/event/chat_status_customer.rb index dea2a5475..c1b12018b 100644 --- a/lib/sessions/event/chat_status_customer.rb +++ b/lib/sessions/event/chat_status_customer.rb @@ -20,9 +20,9 @@ class Sessions::Event::ChatStatusCustomer < Sessions::Event::ChatBase if @payload['data']['url'] message = { event: 'chat_session_notice', - data: { + data: { session_id: chat_session.session_id, - message: @payload['data']['url'], + message: @payload['data']['url'], }, } chat_session.send_to_recipients(message, @client_id) @@ -32,7 +32,7 @@ class Sessions::Event::ChatStatusCustomer < Sessions::Event::ChatBase { event: 'chat_status_customer', - data: current_chat.customer_state(session_id), + data: current_chat.customer_state(session_id), } end @@ -42,7 +42,7 @@ class Sessions::Event::ChatStatusCustomer < Sessions::Event::ChatBase error = { event: 'chat_error', - data: { + data: { state: 'chat_unavailable', }, } @@ -56,7 +56,7 @@ class Sessions::Event::ChatStatusCustomer < Sessions::Event::ChatBase error = { event: 'chat_error', - data: { + data: { state: 'chat_unavailable', }, } diff --git a/lib/sessions/event/spool.rb b/lib/sessions/event/spool.rb index 4da08cecb..3931fca9d 100644 --- a/lib/sessions/event/spool.rb +++ b/lib/sessions/event/spool.rb @@ -23,7 +23,7 @@ To execute this manually, just paste the following into the browser console log 'error', "Can't send spool, session not authenticated" return { event: 'error', - data: { + data: { error: 'Can\'t send spool, session not authenticated', }, } @@ -45,7 +45,7 @@ To execute this manually, just paste the following into the browser console log 'notice', 'send spool:sent event' { event: 'spool:sent', - data: { + data: { timestamp: Time.now.utc.to_i, }, } diff --git a/lib/sessions/event/who_am_i.rb b/lib/sessions/event/who_am_i.rb index 5f1a40f30..75ee4e476 100644 --- a/lib/sessions/event/who_am_i.rb +++ b/lib/sessions/event/who_am_i.rb @@ -16,7 +16,7 @@ To execute this manually, just paste the following into the browser console if !@session || !@session['id'] return { event: 'who_am_i', - data: { + data: { message: 'session not authenticated', }, } @@ -27,7 +27,7 @@ To execute this manually, just paste the following into the browser console if !user return { event: 'who_am_i', - data: { + data: { message: "No such user with id #{@session['id']}", }, } @@ -36,9 +36,9 @@ To execute this manually, just paste the following into the browser console attributes.delete('password') { event: 'who_am_i', - data: { + data: { message: 'session authenticated', - user: attributes, + user: attributes, }, } end diff --git a/lib/sessions/node.rb b/lib/sessions/node.rb index e80f7c469..b33d699fa 100644 --- a/lib/sessions/node.rb +++ b/lib/sessions/node.rb @@ -74,9 +74,9 @@ module Sessions::Node # write node status file data = { updated_at_human: Time.now.utc, - updated_at: Time.now.utc.to_i, - node_id: node_id.to_s, - pid: $PROCESS_ID, + updated_at: Time.now.utc.to_i, + node_id: node_id.to_s, + pid: $PROCESS_ID, } content = data.to_json @@ -126,10 +126,10 @@ module Sessions::Node # write node status file data = { updated_at_human: Time.now.utc, - updated_at: Time.now.utc.to_i, - node_id: node_id.to_s, - client_id: client_id.to_s, - pid: $PROCESS_ID, + updated_at: Time.now.utc.to_i, + node_id: node_id.to_s, + client_id: client_id.to_s, + pid: $PROCESS_ID, } content = data.to_json diff --git a/lib/signature_detection.rb b/lib/signature_detection.rb index d0da4b5d5..a6ee19278 100644 --- a/lib/signature_detection.rb +++ b/lib/signature_detection.rb @@ -184,8 +184,8 @@ returns type = Ticket::Article::Type.lookup(name: 'email') sender = Ticket::Article::Sender.lookup(name: 'Customer') tickets = Ticket.where( - created_by_id: user_id, - create_article_type_id: type.id, + created_by_id: user_id, + create_article_type_id: type.id, create_article_sender_id: sender.id ).limit(5).order(id: :desc) article_bodies = [] @@ -194,7 +194,7 @@ returns next if !article data = { - content: article.body, + content: article.body, content_type: article.content_type, } article_bodies.push data diff --git a/lib/static_assets.rb b/lib/static_assets.rb index 27fcfcdcf..1f694ef58 100644 --- a/lib/static_assets.rb +++ b/lib/static_assets.rb @@ -42,11 +42,11 @@ returns def self.store_raw(content, content_type) Store.remove(object: 'System::Logo', o_id: 1) file = Store.add( - object: 'System::Logo', - o_id: 1, - data: content, - filename: 'logo_raw', - preferences: { + object: 'System::Logo', + o_id: 1, + data: content, + filename: 'logo_raw', + preferences: { 'Content-Type' => content_type }, created_by_id: 1, @@ -90,11 +90,11 @@ returns def self.store(content, content_type) Store.remove(object: 'System::Logo', o_id: 2) file = Store.add( - object: 'System::Logo', - o_id: 2, - data: content, - filename: 'logo', - preferences: { + object: 'System::Logo', + o_id: 2, + data: content, + filename: 'logo', + preferences: { 'Content-Type' => content_type }, created_by_id: 1, diff --git a/lib/stats.rb b/lib/stats.rb index d1f6fa9ee..5ad4f7075 100644 --- a/lib/stats.rb +++ b/lib/stats.rb @@ -74,14 +74,14 @@ returns end state_store = StatsStore.sync( object: 'User', - o_id: user_id, - key: 'dashboard', - data: data_for_user, + o_id: user_id, + key: 'dashboard', + data: data_for_user, ) message = { event: 'resetCollection', - data: { + data: { state_store.class.to_app_model => [state_store], }, } diff --git a/lib/stats/ticket_channel_distribution.rb b/lib/stats/ticket_channel_distribution.rb index d94d390b7..f21e87bdb 100644 --- a/lib/stats/ticket_channel_distribution.rb +++ b/lib/stats/ticket_channel_distribution.rb @@ -14,19 +14,19 @@ class Stats::TicketChannelDistribution channels = [ { sender: 'email', - icon: 'email', + icon: 'email', }, { sender: 'phone', - icon: 'phone', + icon: 'phone', }, { sender: 'twitter', - icon: 'twitter', + icon: 'twitter', }, { sender: 'facebook', - icon: 'facebook', + icon: 'facebook', }, ] diff --git a/lib/stats/ticket_escalation.rb b/lib/stats/ticket_escalation.rb index 3358e3df5..8f8ad9a43 100644 --- a/lib/stats/ticket_escalation.rb +++ b/lib/stats/ticket_escalation.rb @@ -32,11 +32,11 @@ class Stats::TicketEscalation end { - used_for_average: own_escalated, + used_for_average: own_escalated, average_per_agent: average, - state: state, - own: own_escalated, - total: all_escalated, + state: state, + own: own_escalated, + total: all_escalated, } end diff --git a/lib/stats/ticket_in_process.rb b/lib/stats/ticket_in_process.rb index a617b36e1..1aacfbf42 100644 --- a/lib/stats/ticket_in_process.rb +++ b/lib/stats/ticket_in_process.rb @@ -44,12 +44,12 @@ class Stats::TicketInProcess end { - used_for_average: in_process_precent, + used_for_average: in_process_precent, average_per_agent: average_in_percent, - state: state, - in_process: count, - percent: in_process_precent, - total: total, + state: state, + in_process: count, + percent: in_process_precent, + total: total, } end diff --git a/lib/stats/ticket_load_measure.rb b/lib/stats/ticket_load_measure.rb index 8f9b992ba..0e1347b71 100644 --- a/lib/stats/ticket_load_measure.rb +++ b/lib/stats/ticket_load_measure.rb @@ -24,12 +24,12 @@ class Stats::TicketLoadMeasure load_measure_precent = ( count.to_f / (total.to_f / 100) ).round(1) end { - used_for_average: load_measure_precent, + used_for_average: load_measure_precent, average_per_agent: average, - percent: load_measure_precent, - state: state, - own: count, - total: total, + percent: load_measure_precent, + state: state, + own: count, + total: total, } end diff --git a/lib/stats/ticket_reopen.rb b/lib/stats/ticket_reopen.rb index b5b8d80ef..d74df3cd0 100644 --- a/lib/stats/ticket_reopen.rb +++ b/lib/stats/ticket_reopen.rb @@ -28,12 +28,12 @@ class Stats::TicketReopen reopen_in_precent = ( count.to_f / (total.to_f / 100) ).round(1) end { - used_for_average: reopen_in_precent, - percent: reopen_in_precent, + used_for_average: reopen_in_precent, + percent: reopen_in_precent, average_per_agent: '-', - state: 'good', - count: count, - total: total, + state: 'good', + count: count, + total: total, } end @@ -90,11 +90,11 @@ class Stats::TicketReopen return if state_type_now.name == 'closed' StatsStore.add( - object: 'User', - o_id: ticket.owner_id, - key: 'ticket:reopen', - data: { ticket_id: ticket.id }, - created_at: Time.zone.now, + object: 'User', + o_id: ticket.owner_id, + key: 'ticket:reopen', + data: { ticket_id: ticket.id }, + created_at: Time.zone.now, created_by_id: updated_by_id, updated_by_id: updated_by_id, ) diff --git a/lib/stats/ticket_response_time.rb b/lib/stats/ticket_response_time.rb index 4323679f9..154385c2b 100644 --- a/lib/stats/ticket_response_time.rb +++ b/lib/stats/ticket_response_time.rb @@ -39,10 +39,10 @@ class Stats::TicketResponseTime own = (own / count_own).round end { - used_for_average: 0, + used_for_average: 0, average_per_agent: '-', - own: own, - total: total, + own: own, + total: total, } end diff --git a/lib/stats/ticket_waiting_time.rb b/lib/stats/ticket_waiting_time.rb index 79036a7df..d8ff0a5ea 100644 --- a/lib/stats/ticket_waiting_time.rb +++ b/lib/stats/ticket_waiting_time.rb @@ -42,10 +42,10 @@ class Stats::TicketWaitingTime end { - handling_time: handling_time, + handling_time: handling_time, average_per_agent: average_per_agent, - state: state, - percent: percent, + state: state, + percent: percent, } end diff --git a/lib/tasks/search_index_es.rake b/lib/tasks/search_index_es.rake index 0c0d9d9a6..7c393c0d9 100644 --- a/lib/tasks/search_index_es.rake +++ b/lib/tasks/search_index_es.rake @@ -35,7 +35,7 @@ namespace :searchindex do # create indexes SearchIndexBackend.index( action: 'create', - data: { + data: { mappings: mapping, settings: settings, } @@ -73,21 +73,21 @@ namespace :searchindex do action: 'delete', }, { - action: 'create', + action: 'create', description: 'Extract zammad-attachment information from arrays', - processors: [ + processors: [ { foreach: { - field: 'article', + field: 'article', ignore_failure: true, - processor: { + processor: { foreach: { - field: '_ingest._value.attachment', + field: '_ingest._value.attachment', ignore_failure: true, - processor: { + processor: { attachment: { - target_field: '_ingest._value', - field: '_ingest._value._content', + target_field: '_ingest._value', + field: '_ingest._value._content', ignore_failure: true, } } @@ -183,7 +183,7 @@ def get_mapping_properties_object(object) object.columns_hash.each do |key, value| if value.type == :string && value.limit && value.limit <= 5000 && store_columns.exclude?(key) result[object.name][:properties][key] = { - type: 'string', + type: 'string', fields: { raw: { 'type': 'string', 'index': 'not_analyzed' } } @@ -198,7 +198,7 @@ def get_mapping_properties_object(object) } elsif value.type == :boolean result[object.name][:properties][key] = { - type: 'boolean', + type: 'boolean', fields: { raw: { 'type': 'boolean', 'index': 'not_analyzed' } } @@ -240,9 +240,9 @@ def get_mapping_properties_object(object) excludes: ['article.attachment'] } result[object.name][:properties][:article] = { - type: 'nested', + type: 'nested', include_in_parent: true, - properties: { + properties: { attachment: { type: 'attachment', } diff --git a/lib/telegram.rb b/lib/telegram.rb index 833e248b2..46f30a7ad 100644 --- a/lib/telegram.rb +++ b/lib/telegram.rb @@ -99,16 +99,16 @@ returns end channel.area = 'Telegram::Bot' channel.options = { - bot: { - id: bot['id'], - username: bot['username'], + bot: { + id: bot['id'], + username: bot['username'], first_name: bot['first_name'], - last_name: bot['last_name'], + last_name: bot['last_name'], }, callback_token: callback_token, - callback_url: callback_url, - api_token: token, - welcome: params[:welcome], + callback_url: callback_url, + api_token: token, + welcome: params[:welcome], } channel.group_id = group.id channel.active = true @@ -243,9 +243,9 @@ returns # create or update user login = message_user[:username] || message_user[:id] user_data = { - login: login, + login: login, firstname: message_user[:first_name], - lastname: message_user[:last_name], + lastname: message_user[:last_name], } if auth user = User.find(auth.user_id) @@ -329,15 +329,15 @@ returns end ticket = Ticket.new( - group_id: group_id, - title: title, - state_id: Ticket::State.find_by(default_create: true).id, + group_id: group_id, + title: title, + state_id: Ticket::State.find_by(default_create: true).id, priority_id: Ticket::Priority.find_by(default_create: true).id, customer_id: user.id, preferences: { channel_id: channel.id, - telegram: { - bid: params['bid'], + telegram: { + bid: params['bid'], chat_id: params[:message][:chat][:id] } }, @@ -361,27 +361,27 @@ returns if article article.preferences[:edited_message] = { - message: { + message: { created_at: params[:message][:date], message_id: params[:message][:message_id], - from: params[:message][:from], + from: params[:message][:from], }, update_id: params[:update_id], } else article = Ticket::Article.new( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'telegram personal-message').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - from: user(params)[:username], - to: "@#{channel[:options][:bot][:username]}", - message_id: Telegram.message_id(params), - internal: false, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.find_by(name: 'telegram personal-message').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, + from: user(params)[:username], + to: "@#{channel[:options][:bot][:username]}", + message_id: Telegram.message_id(params), + internal: false, preferences: { - message: { + message: { created_at: params[:message][:date], message_id: params[:message][:message_id], - from: params[:message][:from], + from: params[:message][:from], }, update_id: params[:update_id], } @@ -449,13 +449,13 @@ returns article.save! Store.remove( object: 'Ticket::Article', - o_id: article.id, + o_id: article.id, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: document_result.body, - filename: params[:message][:document][:file_name], + object: 'Ticket::Article', + o_id: article.id, + data: document_result.body, + filename: params[:message][:document][:file_name], preferences: { 'Mime-Type' => params[:message][:document][:mime_type], }, @@ -475,13 +475,13 @@ returns article.save! Store.remove( object: 'Ticket::Article', - o_id: article.id, + o_id: article.id, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: document_result.body, - filename: params[:message][:voice][:file_path] || "audio-#{params[:message][:voice][:file_id]}.ogg", + object: 'Ticket::Article', + o_id: article.id, + data: document_result.body, + filename: params[:message][:voice][:file_path] || "audio-#{params[:message][:voice][:file_id]}.ogg", preferences: { 'Mime-Type' => params[:message][:voice][:mime_type], }, @@ -514,13 +514,13 @@ returns document_result = download_file(params[:message][:sticker][:file_id]) Store.remove( object: 'Ticket::Article', - o_id: article.id, + o_id: article.id, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: document_result.body, - filename: params[:message][:sticker][:file_name] || "#{params[:message][:sticker][:set_name]}.webp", + object: 'Ticket::Article', + o_id: article.id, + data: document_result.body, + filename: params[:message][:sticker][:file_name] || "#{params[:message][:sticker][:set_name]}.webp", preferences: { 'Mime-Type' => 'image/webp', # mime type is not given from Telegram API but this is actually WebP }, @@ -550,56 +550,56 @@ returns # note: used .blank? which is a rails method. empty? does not work on integers (values like date, width, height) to check. # need delete_if to remove any empty hashes, .compact only removes keys with nil values. params[:message] = { - document: { + document: { file_name: params.dig(:channel_post, :document, :file_name), mime_type: params.dig(:channel_post, :document, :mime_type), - file_id: params.dig(:channel_post, :document, :file_id), + file_id: params.dig(:channel_post, :document, :file_id), file_size: params.dig(:channel_post, :document, :filesize), - thumb: { - file_id: params.dig(:channel_post, :document, :thumb, :file_id), + thumb: { + file_id: params.dig(:channel_post, :document, :thumb, :file_id), file_size: params.dig(:channel_post, :document, :thumb, :file_size), - width: params.dig(:channel_post, :document, :thumb, :width), - height: params.dig(:channel_post, :document, :thumb, :height) + width: params.dig(:channel_post, :document, :thumb, :width), + height: params.dig(:channel_post, :document, :thumb, :height) }.compact }.delete_if { |_, v| v.blank? }, - voice: { - duration: params.dig(:channel_post, :voice, :duration), + voice: { + duration: params.dig(:channel_post, :voice, :duration), mime_type: params.dig(:channel_post, :voice, :mime_type), - file_id: params.dig(:channel_post, :voice, :file_id), + file_id: params.dig(:channel_post, :voice, :file_id), file_size: params.dig(:channel_post, :voice, :file_size) }.compact, - sticker: { - width: params.dig(:channel_post, :sticker, :width), - height: params.dig(:channel_post, :sticker, :height), - emoji: params.dig(:channel_post, :sticker, :emoji), - set_name: params.dig(:channel_post, :sticker, :set_name), - file_id: params.dig(:channel_post, :sticker, :file_id), + sticker: { + width: params.dig(:channel_post, :sticker, :width), + height: params.dig(:channel_post, :sticker, :height), + emoji: params.dig(:channel_post, :sticker, :emoji), + set_name: params.dig(:channel_post, :sticker, :set_name), + file_id: params.dig(:channel_post, :sticker, :file_id), file_path: params.dig(:channel_post, :sticker, :file_path), - thumb: { - file_id: params.dig(:channel_post, :sticker, :thumb, :file_id), + thumb: { + file_id: params.dig(:channel_post, :sticker, :thumb, :file_id), file_size: params.dig(:channel_post, :sticker, :thumb, :file_size), - width: params.dig(:channel_post, :sticker, :thumb, :width), - height: params.dig(:channel_post, :sticker, :thumb, :file_id), + width: params.dig(:channel_post, :sticker, :thumb, :width), + height: params.dig(:channel_post, :sticker, :thumb, :file_id), file_path: params.dig(:channel_post, :sticker, :thumb, :file_path) }.compact }.delete_if { |_, v| v.blank? }, - chat: { - id: params.dig(:channel_post, :chat, :id), + chat: { + id: params.dig(:channel_post, :chat, :id), first_name: params.dig(:channel_post, :chat, :title), - last_name: 'Channel', - username: "channel#{params.dig(:channel_post, :chat, :id)}" + last_name: 'Channel', + username: "channel#{params.dig(:channel_post, :chat, :id)}" }, - from: { - id: params.dig(:channel_post, :chat, :id), + from: { + id: params.dig(:channel_post, :chat, :id), first_name: params.dig(:channel_post, :chat, :title), - last_name: 'Channel', - username: "channel#{params.dig(:channel_post, :chat, :id)}" + last_name: 'Channel', + username: "channel#{params.dig(:channel_post, :chat, :id)}" }, - caption: (params.dig(:channel_post, :caption) || {}), - date: params.dig(:channel_post, :date), + caption: (params.dig(:channel_post, :caption) || {}), + date: params.dig(:channel_post, :date), message_id: params.dig(:channel_post, :message_id), - text: params.dig(:channel_post, :text), - photo: (params[:channel_post][:photo].map { |photo| { file_id: photo[:file_id], file_size: photo[:file_size], width: photo[:width], height: photo[:height] } } if params.dig(:channel_post, :photo)) + text: params.dig(:channel_post, :text), + photo: (params[:channel_post][:photo].map { |photo| { file_id: photo[:file_id], file_size: photo[:file_size], width: photo[:width], height: photo[:height] } } if params.dig(:channel_post, :photo)) }.delete_if { |_, v| v.blank? } params.delete(:channel_post) # discard unused :channel_post hash end @@ -608,22 +608,22 @@ returns if params[:edited_channel_post] # updates on telegram can only be on messages, no attachments params[:edited_message] = { - chat: { - id: params.dig(:edited_channel_post, :chat, :id), + chat: { + id: params.dig(:edited_channel_post, :chat, :id), first_name: params.dig(:edited_channel_post, :chat, :title), - last_name: 'Channel', - username: "channel#{params.dig(:edited_channel_post, :chat, :id)}" + last_name: 'Channel', + username: "channel#{params.dig(:edited_channel_post, :chat, :id)}" }, - from: { - id: params.dig(:edited_channel_post, :chat, :id), + from: { + id: params.dig(:edited_channel_post, :chat, :id), first_name: params.dig(:edited_channel_post, :chat, :title), - last_name: 'Channel', - username: "channel#{params.dig(:edited_channel_post, :chat, :id)}" + last_name: 'Channel', + username: "channel#{params.dig(:edited_channel_post, :chat, :id)}" }, - date: params.dig(:edited_channel_post, :date), - edit_date: params.dig(:edited_channel_post, :edit_date), + date: params.dig(:edited_channel_post, :date), + edit_date: params.dig(:edited_channel_post, :edit_date), message_id: params.dig(:edited_channel_post, :message_id), - text: params.dig(:edited_channel_post, :text) + text: params.dig(:edited_channel_post, :text) } params.delete(:edited_channel_post) # discard unused :edited_channel_post hash end diff --git a/lib/twitter_sync.rb b/lib/twitter_sync.rb index 82781d531..3c1674381 100644 --- a/lib/twitter_sync.rb +++ b/lib/twitter_sync.rb @@ -47,8 +47,8 @@ class TwitterSync if auth user = User.find(auth.user_id) map = { - note: 'description', - web: 'website', + note: 'description', + web: 'website', address: 'location', } @@ -76,11 +76,11 @@ class TwitterSync if user_data[:image_source] avatar = Avatar.add( - object: 'User', - o_id: user.id, - url: user_data[:image_source], - source: 'twitter', - deletable: true, + object: 'User', + o_id: user.id, + url: user_data[:image_source], + source: 'twitter', + deletable: true, updated_by_id: user.id, created_by_id: user.id, ) @@ -170,7 +170,7 @@ class TwitterSync state: state, priority: Ticket::Priority.find_by(default_create: true), preferences: { - channel_id: channel.id, + channel_id: channel.id, channel_screen_name: channel.options['user']['screen_name'], }, ) @@ -214,13 +214,13 @@ class TwitterSync to = "@#{recipient_screen_name}" from = "@#{sender_screen_name}" twitter_preferences = { - created_at: item['created_timestamp'], - recipient_id: item['message_create']['target']['recipient_id'], + created_at: item['created_timestamp'], + recipient_id: item['message_create']['target']['recipient_id'], recipient_screen_name: recipient_screen_name, - sender_id: item['message_create']['sender_id'], - sender_screen_name: sender_screen_name, - app_id: app['app_id'], - app_name: app['app_name'], + sender_id: item['message_create']['sender_id'], + sender_screen_name: sender_screen_name, + app_id: app['app_id'], + app_name: app['app_name'], } elsif item['text'].present? message_id = item['id'] @@ -265,7 +265,7 @@ class TwitterSync attachment = { filename: url.sub(%r{^.*/(.+?)$}, '\1'), - content: result.body, + content: result.body, } attachments.push attachment @@ -275,16 +275,16 @@ class TwitterSync in_reply_to = item['in_reply_to_status_id'] twitter_preferences = { - mention_ids: mention_ids, - geo: item['geo'], - retweeted: item['retweeted'], - possibly_sensitive: item['possibly_sensitive'], + mention_ids: mention_ids, + geo: item['geo'], + retweeted: item['retweeted'], + possibly_sensitive: item['possibly_sensitive'], in_reply_to_user_id: item['in_reply_to_user_id'], - place: item['place'], - retweet_count: item['retweet_count'], - source: item['source'], - favorited: item['favorited'], - truncated: item['truncated'], + place: item['place'], + retweet_count: item['retweet_count'], + source: item['source'], + favorited: item['favorited'], + truncated: item['truncated'], } else @@ -302,11 +302,11 @@ class TwitterSync article_preferences = { twitter: self.class.preferences_cleanup(twitter_preferences), - links: [ + links: [ { - url: "https://twitter.com/statuses/#{item['id']}", + url: "https://twitter.com/statuses/#{item['id']}", target: '_blank', - name: 'on Twitter', + name: 'on Twitter', }, ], } @@ -326,10 +326,10 @@ class TwitterSync attachments.each do |attachment| Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: attachment[:content], - filename: attachment[:filename], + object: 'Ticket::Article', + o_id: article.id, + data: attachment[:content], + filename: attachment[:filename], preferences: {}, ) end @@ -366,16 +366,16 @@ class TwitterSync in_reply_to = tweet.in_reply_to_status_id twitter_preferences = { - mention_ids: mention_ids, - geo: tweet.geo, - retweeted: tweet.retweeted?, - possibly_sensitive: tweet.possibly_sensitive?, + mention_ids: mention_ids, + geo: tweet.geo, + retweeted: tweet.retweeted?, + possibly_sensitive: tweet.possibly_sensitive?, in_reply_to_user_id: tweet.in_reply_to_user_id, - place: tweet.place, - retweet_count: tweet.retweet_count, - source: tweet.source, - favorited: tweet.favorited?, - truncated: tweet.truncated?, + place: tweet.place, + retweet_count: tweet.retweet_count, + source: tweet.source, + favorited: tweet.favorited?, + truncated: tweet.truncated?, } UserInfo.current_user_id = user.id @@ -389,11 +389,11 @@ class TwitterSync article_preferences = { twitter: self.class.preferences_cleanup(twitter_preferences), - links: [ + links: [ { - url: "https://twitter.com/statuses/#{tweet.id}", + url: "https://twitter.com/statuses/#{tweet.id}", target: '_blank', - name: 'on Twitter', + name: 'on Twitter', }, ], } @@ -470,9 +470,9 @@ create a tweet ot direct message from an article data = { event: { - type: 'message_create', + type: 'message_create', message_create: { - target: { + target: { recipient_id: authorization.uid, }, message_data: { @@ -792,8 +792,8 @@ download public media file from twitter if auth user = User.find(auth.user_id) map = { - note: 'description', - web: 'url', + note: 'description', + web: 'url', address: 'location', } @@ -821,11 +821,11 @@ download public media file from twitter if user_data[:image_source].present? avatar = Avatar.add( - object: 'User', - o_id: user.id, - url: user_data[:image_source], - source: 'twitter', - deletable: true, + object: 'User', + o_id: user.id, + url: user_data[:image_source], + source: 'twitter', + deletable: true, updated_by_id: user.id, created_by_id: user.id, ) diff --git a/lib/user_agent.rb b/lib/user_agent.rb index 256c8a43f..86ee27502 100644 --- a/lib/user_agent.rb +++ b/lib/user_agent.rb @@ -66,9 +66,9 @@ returns rescue => e log(url, request, nil, options) return Result.new( - error: e.inspect, + error: e.inspect, success: false, - code: 0, + code: 0, ) end end @@ -119,9 +119,9 @@ returns rescue => e log(url, request, nil, options) return Result.new( - error: e.inspect, + error: e.inspect, success: false, - code: 0, + code: 0, ) end end @@ -171,9 +171,9 @@ returns rescue => e log(url, request, nil, options) return Result.new( - error: e.inspect, + error: e.inspect, success: false, - code: 0, + code: 0, ) end end @@ -216,9 +216,9 @@ returns rescue => e log(url, request, nil, options) return Result.new( - error: e.inspect, + error: e.inspect, success: false, - code: 0, + code: 0, ) end end @@ -328,10 +328,10 @@ returns # request request_data = { - content: '', - content_type: request['Content-Type'], + content: '', + content_type: request['Content-Type'], content_encoding: request['Content-Encoding'], - source: request['User-Agent'] || request['Server'], + source: request['User-Agent'] || request['Server'], } request.each_header do |key, value| request_data[:content] += "#{key}: #{value}\n" @@ -344,11 +344,11 @@ returns # response response_data = { - code: 0, - content: '', - content_type: nil, + code: 0, + content: '', + content_type: nil, content_encoding: nil, - source: nil, + source: nil, } if response response_data[:code] = response.code @@ -367,13 +367,13 @@ returns record = { direction: 'out', - facility: options[:log][:facility], - url: url, - status: response_data[:code], - ip: nil, - request: request_data, - response: response_data, - method: request.method, + facility: options[:log][:facility], + url: url, + status: response_data[:code], + ip: nil, + request: request_data, + response: response_data, + method: request.method, } HttpLog.create(record) end @@ -383,31 +383,31 @@ returns if !response return Result.new( - error: "Can't connect to #{uri}, got no response!", + error: "Can't connect to #{uri}, got no response!", success: false, - code: 0, + code: 0, ) end case response when Net::HTTPNotFound return Result.new( - error: "No such file #{uri}, 404!", + error: "No such file #{uri}, 404!", success: false, - code: response.code, + code: response.code, ) when Net::HTTPClientError return Result.new( - error: "Client Error: #{response.inspect}!", + error: "Client Error: #{response.inspect}!", success: false, - code: response.code, - body: response.body + code: response.code, + body: response.body ) when Net::HTTPInternalServerError return Result.new( - error: "Server Error: #{response.inspect}!", + error: "Server Error: #{response.inspect}!", success: false, - code: response.code, + code: response.code, ) when Net::HTTPRedirection raise 'Too many redirections for the original URL, halting.' if count <= 0 @@ -420,11 +420,11 @@ returns data = JSON.parse(response.body) end return Result.new( - data: data, - body: response.body, + data: data, + body: response.body, content_type: response['Content-Type'], - success: true, - code: response.code, + success: true, + code: response.code, ) when Net::HTTPCreated data = nil @@ -432,11 +432,11 @@ returns data = JSON.parse(response.body) end return Result.new( - data: data, - body: response.body, + data: data, + body: response.body, content_type: response['Content-Type'], - success: true, - code: response.code, + success: true, + code: response.code, ) end @@ -465,26 +465,26 @@ returns ftp.getbinaryfile(filename, temp_file) rescue => e return Result.new( - error: e.inspect, + error: e.inspect, success: false, - code: '550', + code: '550', ) end end rescue => e return Result.new( - error: e.inspect, + error: e.inspect, success: false, - code: 0, + code: 0, ) end contents = temp_file.read temp_file.close Result.new( - body: contents, + body: contents, success: true, - code: '200', + code: '200', ) end diff --git a/script/build/database_config.rb b/script/build/database_config.rb index c2ca45e08..124000447 100644 --- a/script/build/database_config.rb +++ b/script/build/database_config.rb @@ -18,7 +18,7 @@ db_settings_map = { 'password' => 'zammad', 'host' => 'postgresql', # db alias from gitlab-ci.yml }, - 'mysql' => { + 'mysql' => { 'adapter' => 'mysql2', 'username' => 'root', 'password' => 'zammad', diff --git a/script/websocket-server.rb b/script/websocket-server.rb index a4a425a45..53fde9ea3 100755 --- a/script/websocket-server.rb +++ b/script/websocket-server.rb @@ -188,13 +188,13 @@ EventMachine.run do if data['event'] log 'debug', "execute event '#{data['event']}'", client_id message = Sessions::Event.run( - event: data['event'], - payload: data, - session: @clients[client_id][:session], + event: data['event'], + payload: data, + session: @clients[client_id][:session], remote_ip: @clients[client_id][:remote_ip], client_id: client_id, - clients: @clients, - options: @options, + clients: @clients, + options: @options, ) if message websocket_send(client_id, message) diff --git a/spec/db/migrate/issue_1905_exchange_login_from_remote_id_spec.rb b/spec/db/migrate/issue_1905_exchange_login_from_remote_id_spec.rb index b687e2bea..55213d7b0 100644 --- a/spec/db/migrate/issue_1905_exchange_login_from_remote_id_spec.rb +++ b/spec/db/migrate/issue_1905_exchange_login_from_remote_id_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Issue1905ExchangeLoginFromRemoteId, type: :db_migration do valid_config = ActiveSupport::HashWithIndifferentAccess.new( attributes: { - some: 'other', + some: 'other', } ) diff --git a/spec/db/migrate/issue_2140_reset_ldap_config_spec.rb b/spec/db/migrate/issue_2140_reset_ldap_config_spec.rb index 46c2b39a7..1b4bc125b 100644 --- a/spec/db/migrate/issue_2140_reset_ldap_config_spec.rb +++ b/spec/db/migrate/issue_2140_reset_ldap_config_spec.rb @@ -6,10 +6,10 @@ RSpec.describe Issue2140ResetLdapConfig, type: :db_migration do context 'when LDAP config isn’t broken' do let(:config) do { 'wizardData' => - { 'backend_user_attributes' => - { 'foo' => 'bar' }, - 'user_attributes' => - { 'baz' => 'qux' } } }.with_indifferent_access + { 'backend_user_attributes' => + { 'foo' => 'bar' }, + 'user_attributes' => + { 'baz' => 'qux' } } }.with_indifferent_access end it 'makes no changes' do @@ -20,10 +20,10 @@ RSpec.describe Issue2140ResetLdapConfig, type: :db_migration do context 'when LDAP config is broken' do let(:config) do { 'wizardData' => - { 'backend_user_attributes' => - { 'foo' => "\u0001\u0001\u0004€" }, - 'user_attributes' => - { 'baz' => 'qux' } } }.with_indifferent_access + { 'backend_user_attributes' => + { 'foo' => "\u0001\u0001\u0004€" }, + 'user_attributes' => + { 'baz' => 'qux' } } }.with_indifferent_access end it 'removes the offending backend_user_attributes sub-hash' do diff --git a/spec/factories/channel.rb b/spec/factories/channel.rb index 0d991ebf7..9166b4c2f 100644 --- a/spec/factories/channel.rb +++ b/spec/factories/channel.rb @@ -17,33 +17,33 @@ FactoryBot.define do options do { adapter: 'twitter', - auth: { - consumer_key: 'some', - consumer_secret: 'some', - oauth_token: 'key', + auth: { + consumer_key: 'some', + consumer_secret: 'some', + oauth_token: 'key', oauth_token_secret: 'secret', }, - user: { - id: 'system_id', + user: { + id: 'system_id', screen_name: 'system_login', }, - sync: { + sync: { import_older_tweets: true, - track_retweets: true, - search: [ + track_retweets: true, + search: [ { - term: 'zammad', + term: 'zammad', group_id: Group.first.id }, { - term: 'hash_tag1', + term: 'hash_tag1', group_id: Group.first.id } ], - mentions: { + mentions: { group_id: Group.first.id }, - direct_messages: { + direct_messages: { group_id: Group.first.id } } diff --git a/spec/factories/job.rb b/spec/factories/job.rb index df3808fce..caaa3ca1a 100644 --- a/spec/factories/job.rb +++ b/spec/factories/job.rb @@ -7,32 +7,32 @@ FactoryBot.define do created_by_id 1 updated_by_id 1 timeplan do - { 'days' => { 'Mon' => true, 'Tue' => false, 'Wed' => false, 'Thu' => false, 'Fri' => false, 'Sat' => false, 'Sun' => false }, - 'hours' => - { '0' => true, - '1' => false, - '2' => false, - '3' => false, - '4' => false, - '5' => false, - '6' => false, - '7' => false, - '8' => false, - '9' => false, - '10' => false, - '11' => false, - '12' => false, - '13' => false, - '14' => false, - '15' => false, - '16' => false, - '17' => false, - '18' => false, - '19' => false, - '20' => false, - '21' => false, - '22' => false, - '23' => false }, + { 'days' => { 'Mon' => true, 'Tue' => false, 'Wed' => false, 'Thu' => false, 'Fri' => false, 'Sat' => false, 'Sun' => false }, + 'hours' => + { '0' => true, + '1' => false, + '2' => false, + '3' => false, + '4' => false, + '5' => false, + '6' => false, + '7' => false, + '8' => false, + '9' => false, + '10' => false, + '11' => false, + '12' => false, + '13' => false, + '14' => false, + '15' => false, + '16' => false, + '17' => false, + '18' => false, + '19' => false, + '20' => false, + '21' => false, + '22' => false, + '23' => false }, 'minutes' => { '0' => true, '10' => false, '20' => false, '30' => false, '40' => false, '50' => false } } end end diff --git a/spec/factories/object_manager_attribute.rb b/spec/factories/object_manager_attribute.rb index 3673adfd9..9ec41443b 100644 --- a/spec/factories/object_manager_attribute.rb +++ b/spec/factories/object_manager_attribute.rb @@ -26,7 +26,7 @@ FactoryBot.define do 'null' => false } }, - 'edit' => {} + 'edit' => {} } end add_attribute(:to_create) { true } @@ -57,9 +57,9 @@ FactoryBot.define do data_type 'integer' data_option do { - 'default' => 0, - 'min' => 0, - 'max' => 9999, + 'default' => 0, + 'min' => 0, + 'max' => 9999, } end end @@ -70,9 +70,9 @@ FactoryBot.define do data_option do { 'future' => true, - 'past' => true, - 'diff' => 24, - 'null' => true, + 'past' => true, + 'diff' => 24, + 'null' => true, } end end @@ -83,9 +83,9 @@ FactoryBot.define do data_option do { 'future' => true, - 'past' => true, - 'diff' => 24, - 'null' => true, + 'past' => true, + 'diff' => 24, + 'null' => true, } end end @@ -94,13 +94,13 @@ FactoryBot.define do data_type 'select' data_option do { - 'default' => '', - 'options' => { + 'default' => '', + 'options' => { 'key_1' => 'value_1', 'key_2' => 'value_2', 'key_3' => 'value_3', }, - 'relation' => '', + 'relation' => '', 'nulloption' => true, 'multiple' => false, 'null' => true, @@ -114,7 +114,7 @@ FactoryBot.define do data_type 'tree_select' data_option do { - 'options' => [ + 'options' => [ { 'name' => 'Incident', 'value' => 'Incident', @@ -146,7 +146,7 @@ FactoryBot.define do 'value' => 'Incident::Softwareproblem::CRM' }, { - 'name' => 'EDI', + 'name' => 'EDI', 'value' => 'Incident::Softwareproblem::EDI' }, { diff --git a/spec/factories/overview.rb b/spec/factories/overview.rb index 551559d9e..61aa1ff63 100644 --- a/spec/factories/overview.rb +++ b/spec/factories/overview.rb @@ -15,21 +15,21 @@ FactoryBot.define do { 'ticket.state_id' => { operator: 'is', - value: [ Ticket::State.lookup(name: 'new').id, Ticket::State.lookup(name: 'open').id ], + value: [ Ticket::State.lookup(name: 'new').id, Ticket::State.lookup(name: 'open').id ], }, } end order do { - by: 'created_at', + by: 'created_at', direction: 'DESC', } end view do { - d: %w[title customer state created_at], - s: %w[number title state created_at], - m: %w[number title state created_at], + d: %w[title customer state created_at], + s: %w[number title state created_at], + m: %w[number title state created_at], view_mode_default: 's', } end diff --git a/spec/factories/ticket.rb b/spec/factories/ticket.rb index 917784ae7..1cdf14155 100644 --- a/spec/factories/ticket.rb +++ b/spec/factories/ticket.rb @@ -15,7 +15,7 @@ FactoryBot.define do preferences do { - channel_id: channel.id, + channel_id: channel.id, channel_screen_name: channel.options[:user][:screen_name] } end diff --git a/spec/lib/import/otrs/article_spec.rb b/spec/lib/import/otrs/article_spec.rb index 2ee26d638..e0d644842 100644 --- a/spec/lib/import/otrs/article_spec.rb +++ b/spec/lib/import/otrs/article_spec.rb @@ -105,21 +105,21 @@ RSpec.describe Import::OTRS::Article do { created_by_id: '1', updated_by_id: 1, - ticket_id: '999', - id: '999', - body: "Welcome!\n\nThank you for installing OTRS.\n\nYou will find updates and patches at http://www.otrs.com/open-source/.\nOnline documentation is available at http://doc.otrs.org/.\nYou can also use our mailing lists http://lists.otrs.org/\nor our forums at http://forums.otrs.org/\n\nRegards,\n\nThe OTRS Project\n", - from: 'OTRS Feedback ', - to: 'Your OTRS System ', - cc: nil, - subject: 'Welcome to OTRS!', - in_reply_to: nil, - message_id: '<007@localhost>', - references: nil, - updated_at: '2014-06-24 09:32:14', - created_at: '2010-08-02 14:00:00', - type_id: 1, - internal: false, - sender_id: 2 + ticket_id: '999', + id: '999', + body: "Welcome!\n\nThank you for installing OTRS.\n\nYou will find updates and patches at http://www.otrs.com/open-source/.\nOnline documentation is available at http://doc.otrs.org/.\nYou can also use our mailing lists http://lists.otrs.org/\nor our forums at http://forums.otrs.org/\n\nRegards,\n\nThe OTRS Project\n", + from: 'OTRS Feedback ', + to: 'Your OTRS System ', + cc: nil, + subject: 'Welcome to OTRS!', + in_reply_to: nil, + message_id: '<007@localhost>', + references: nil, + updated_at: '2014-06-24 09:32:14', + created_at: '2010-08-02 14:00:00', + type_id: 1, + internal: false, + sender_id: 2 } end diff --git a/spec/lib/import/otrs/dynamic_field/checkbox_spec.rb b/spec/lib/import/otrs/dynamic_field/checkbox_spec.rb index 000ecc5a1..4c68a2afa 100644 --- a/spec/lib/import/otrs/dynamic_field/checkbox_spec.rb +++ b/spec/lib/import/otrs/dynamic_field/checkbox_spec.rb @@ -7,29 +7,29 @@ RSpec.describe Import::OTRS::DynamicField::Checkbox do it 'imports an OTRS Checkbox DynamicField' do zammad_structure = { - object: 'Ticket', - name: 'checkbox_example', - display: 'Checkbox Example', - screens: { + object: 'Ticket', + name: 'checkbox_example', + display: 'Checkbox Example', + screens: { view: { '-all-' => { shown: true } } }, - active: true, - editable: true, - position: '26', + active: true, + editable: true, + position: '26', created_by_id: 1, updated_by_id: 1, - data_type: 'boolean', - data_option: { - default: true, - options: { - true => 'Yes', + data_type: 'boolean', + data_option: { + default: true, + options: { + true => 'Yes', false => 'No' }, - null: true, + null: true, translate: true } } diff --git a/spec/lib/import/otrs/dynamic_field/date_spec.rb b/spec/lib/import/otrs/dynamic_field/date_spec.rb index 0de5e4cb4..032af08d0 100644 --- a/spec/lib/import/otrs/dynamic_field/date_spec.rb +++ b/spec/lib/import/otrs/dynamic_field/date_spec.rb @@ -13,10 +13,10 @@ RSpec.describe Import::OTRS::DynamicField::Date do it 'imports an OTRS Date DynamicField' do zammad_structure = { - object: 'Ticket', - name: 'date_example', - display: 'Date Example', - screens: { + object: 'Ticket', + name: 'date_example', + display: 'Date Example', + screens: { view: { '-all-' => { shown: true diff --git a/spec/lib/import/otrs/dynamic_field/date_time_spec.rb b/spec/lib/import/otrs/dynamic_field/date_time_spec.rb index b2ac81093..56004350b 100644 --- a/spec/lib/import/otrs/dynamic_field/date_time_spec.rb +++ b/spec/lib/import/otrs/dynamic_field/date_time_spec.rb @@ -13,10 +13,10 @@ RSpec.describe Import::OTRS::DynamicField::DateTime do it 'imports an OTRS DateTime DynamicField' do zammad_structure = { - object: 'Ticket', - name: 'date_time_example', - display: 'DateTime Example', - screens: { + object: 'Ticket', + name: 'date_time_example', + display: 'DateTime Example', + screens: { view: { '-all-' => { shown: true @@ -31,9 +31,9 @@ RSpec.describe Import::OTRS::DynamicField::DateTime do data_type: 'datetime', data_option: { future: true, - past: true, - diff: 72, - null: true + past: true, + diff: 72, + null: true } } diff --git a/spec/lib/import/otrs/dynamic_field/dropdown_spec.rb b/spec/lib/import/otrs/dynamic_field/dropdown_spec.rb index 5cc0f1365..3e08cab0a 100644 --- a/spec/lib/import/otrs/dynamic_field/dropdown_spec.rb +++ b/spec/lib/import/otrs/dynamic_field/dropdown_spec.rb @@ -7,10 +7,10 @@ RSpec.describe Import::OTRS::DynamicField::Dropdown do it 'imports an OTRS Dropdown DynamicField' do zammad_structure = { - object: 'Ticket', - name: 'dropdown_example', - display: 'Dropdown Example', - screens: { + object: 'Ticket', + name: 'dropdown_example', + display: 'Dropdown Example', + screens: { view: { '-all-' => { shown: true @@ -24,9 +24,9 @@ RSpec.describe Import::OTRS::DynamicField::Dropdown do updated_by_id: 1, data_type: 'select', data_option: { - default: '', - multiple: false, - options: { + default: '', + multiple: false, + options: { 'Hamburg' => 'Hamburg', 'München' => 'München', 'Köln' => 'Köln', diff --git a/spec/lib/import/otrs/dynamic_field/multiselect_spec.rb b/spec/lib/import/otrs/dynamic_field/multiselect_spec.rb index be8ca129b..95fe926d5 100644 --- a/spec/lib/import/otrs/dynamic_field/multiselect_spec.rb +++ b/spec/lib/import/otrs/dynamic_field/multiselect_spec.rb @@ -7,10 +7,10 @@ RSpec.describe Import::OTRS::DynamicField::Multiselect do it 'imports an OTRS Multiselect DynamicField' do zammad_structure = { - object: 'Ticket', - name: 'multiselect_example', - display: 'Multiselec tExample', - screens: { + object: 'Ticket', + name: 'multiselect_example', + display: 'Multiselec tExample', + screens: { view: { '-all-' => { shown: true @@ -24,9 +24,9 @@ RSpec.describe Import::OTRS::DynamicField::Multiselect do updated_by_id: 1, data_type: 'select', data_option: { - default: '', - multiple: true, - options: { + default: '', + multiple: true, + options: { 'Hamburg' => 'Hamburg', 'München' => 'München', 'Köln' => 'Köln', diff --git a/spec/lib/import/otrs/dynamic_field/text_area_spec.rb b/spec/lib/import/otrs/dynamic_field/text_area_spec.rb index 18199a7ca..f47bd0fe2 100644 --- a/spec/lib/import/otrs/dynamic_field/text_area_spec.rb +++ b/spec/lib/import/otrs/dynamic_field/text_area_spec.rb @@ -7,10 +7,10 @@ RSpec.describe Import::OTRS::DynamicField::TextArea do it 'imports an OTRS TextArea DynamicField' do zammad_structure = { - object: 'Ticket', - name: 'text_area_example', - display: 'TextArea Example', - screens: { + object: 'Ticket', + name: 'text_area_example', + display: 'TextArea Example', + screens: { view: { '-all-' => { shown: true diff --git a/spec/lib/import/otrs/dynamic_field/text_spec.rb b/spec/lib/import/otrs/dynamic_field/text_spec.rb index 1b0919958..a549e2759 100644 --- a/spec/lib/import/otrs/dynamic_field/text_spec.rb +++ b/spec/lib/import/otrs/dynamic_field/text_spec.rb @@ -7,23 +7,23 @@ RSpec.describe Import::OTRS::DynamicField::Text do it 'imports an OTRS Text DynamicField' do zammad_structure = { - object: 'Ticket', - name: 'text_example', - display: 'Text Example', - screens: { + object: 'Ticket', + name: 'text_example', + display: 'Text Example', + screens: { view: { '-all-' => { shown: true } } }, - active: true, - editable: true, - position: '8', + active: true, + editable: true, + position: '8', created_by_id: 1, updated_by_id: 1, - data_type: 'input', - data_option: { + data_type: 'input', + data_option: { default: '', type: 'text', maxlength: 255, diff --git a/spec/lib/import/otrs/priority_spec.rb b/spec/lib/import/otrs/priority_spec.rb index e4b1361ec..91f5e0d3f 100644 --- a/spec/lib/import/otrs/priority_spec.rb +++ b/spec/lib/import/otrs/priority_spec.rb @@ -31,11 +31,11 @@ RSpec.describe Import::OTRS::Priority do { created_by_id: '1', updated_by_id: '1', - active: true, - updated_at: '2014-04-28 10:53:18', - created_at: '2014-04-28 10:53:18', - name: '4 high', - id: '4' + active: true, + updated_at: '2014-04-28 10:53:18', + created_at: '2014-04-28 10:53:18', + name: '4 high', + id: '4' } end diff --git a/spec/lib/import/otrs/queue_spec.rb b/spec/lib/import/otrs/queue_spec.rb index e7f20f54b..b873a9d67 100644 --- a/spec/lib/import/otrs/queue_spec.rb +++ b/spec/lib/import/otrs/queue_spec.rb @@ -31,12 +31,12 @@ RSpec.describe Import::OTRS::Queue do { created_by_id: 1, updated_by_id: 1, - active: false, - updated_at: '2014-05-13 10:54:11', - created_at: '2014-05-13 10:54:11', - name: 'UnitTestQueue45699', - id: '11', - note: 'Some comment' + active: false, + updated_at: '2014-05-13 10:54:11', + created_at: '2014-05-13 10:54:11', + name: 'UnitTestQueue45699', + id: '11', + note: 'Some comment' } end diff --git a/spec/lib/import/otrs/state_spec.rb b/spec/lib/import/otrs/state_spec.rb index f5c1a35bd..1cd62546d 100644 --- a/spec/lib/import/otrs/state_spec.rb +++ b/spec/lib/import/otrs/state_spec.rb @@ -32,13 +32,13 @@ RSpec.describe Import::OTRS::State do { created_by_id: 1, updated_by_id: 1, - active: '1', + active: '1', state_type_id: 5, - updated_at: '2014-04-28 10:53:18', - created_at: '2014-04-28 10:53:18', - name: 'closed successful', - id: '2', - note: 'Ticket is closed successful.' + updated_at: '2014-04-28 10:53:18', + created_at: '2014-04-28 10:53:18', + name: 'closed successful', + id: '2', + note: 'Ticket is closed successful.' } end diff --git a/spec/lib/import/otrs/ticket_spec.rb b/spec/lib/import/otrs/ticket_spec.rb index 3a42795b9..991c9fda5 100644 --- a/spec/lib/import/otrs/ticket_spec.rb +++ b/spec/lib/import/otrs/ticket_spec.rb @@ -71,19 +71,19 @@ RSpec.describe Import::OTRS::Ticket do let(:object_structure) { load_ticket_json('no_title') } let(:zammad_structure) do { - title: '**EMPTY**', - owner_id: 1, - customer_id: 1, + title: '**EMPTY**', + owner_id: 1, + customer_id: 1, created_by_id: '3', updated_by_id: 1, - updated_at: '2014-11-21 00:21:08', - created_at: '2014-11-21 00:17:40', - number: '20141121305000012', - group_id: '1', - state_id: '2', - priority_id: '3', - id: '730', - close_at: '2014-11-21 00:21:08' + updated_at: '2014-11-21 00:21:08', + created_at: '2014-11-21 00:17:40', + number: '20141121305000012', + group_id: '1', + state_id: '2', + priority_id: '3', + id: '730', + close_at: '2014-11-21 00:21:08' } end @@ -103,18 +103,18 @@ RSpec.describe Import::OTRS::Ticket do let(:object_structure) { load_ticket_json('unknown_customer') } let(:zammad_structure) do { - owner_id: 1, - customer_id: 1337, + owner_id: 1, + customer_id: 1337, created_by_id: 1337, updated_by_id: 1, - updated_at: '2014-07-17 14:29:44', - created_at: '2014-07-17 14:29:43', - number: '2014071754002471', - group_id: '2', - state_id: '1', - priority_id: '3', - title: 'Ask me about performance', - id: '540' + updated_at: '2014-07-17 14:29:44', + created_at: '2014-07-17 14:29:43', + number: '2014071754002471', + group_id: '2', + state_id: '1', + priority_id: '3', + title: 'Ask me about performance', + id: '540' } end diff --git a/spec/lib/import/otrs/user_spec.rb b/spec/lib/import/otrs/user_spec.rb index 5c590578d..e56bc53e2 100644 --- a/spec/lib/import/otrs/user_spec.rb +++ b/spec/lib/import/otrs/user_spec.rb @@ -75,18 +75,18 @@ RSpec.describe Import::OTRS::User do { created_by_id: 1, updated_by_id: 1, - active: true, - source: 'OTRS Import', - role_ids: [2, 1], - group_ids: ['1'], - password: '{sha2}9faaba2ab242a99bbb6992e9424386375f6757c17e6484ae570f39d9cad9f28ea', - updated_at: '2014-04-28 10:53:18', - created_at: '2014-04-28 10:53:18', - id: '1', - email: 'root@localhost', - firstname: 'Admin', - lastname: 'OTRS', - login: 'root@localhost' + active: true, + source: 'OTRS Import', + role_ids: [2, 1], + group_ids: ['1'], + password: '{sha2}9faaba2ab242a99bbb6992e9424386375f6757c17e6484ae570f39d9cad9f28ea', + updated_at: '2014-04-28 10:53:18', + created_at: '2014-04-28 10:53:18', + id: '1', + email: 'root@localhost', + firstname: 'Admin', + lastname: 'OTRS', + login: 'root@localhost' } end @@ -108,18 +108,18 @@ RSpec.describe Import::OTRS::User do { created_by_id: 1, updated_by_id: 1, - active: true, - source: 'OTRS Import', - role_ids: [2, 1], - group_ids: [], - password: '{sha2}9edb001ad7900daea0622d89225c9ca729749fd12ae5ea044f072d1b7c56c8cc', - updated_at: '2014-11-14 00:53:20', - created_at: '2014-11-14 00:53:20', - id: '6', - email: 'agent-2-for-role-2@example.com', - firstname: 'agent-2-for-role-2', - lastname: 'agent-2-for-role-2', - login: 'agent-2-for-role-2' + active: true, + source: 'OTRS Import', + role_ids: [2, 1], + group_ids: [], + password: '{sha2}9edb001ad7900daea0622d89225c9ca729749fd12ae5ea044f072d1b7c56c8cc', + updated_at: '2014-11-14 00:53:20', + created_at: '2014-11-14 00:53:20', + id: '6', + email: 'agent-2-for-role-2@example.com', + firstname: 'agent-2-for-role-2', + lastname: 'agent-2-for-role-2', + login: 'agent-2-for-role-2' } end @@ -141,18 +141,18 @@ RSpec.describe Import::OTRS::User do { created_by_id: 1, updated_by_id: 1, - active: true, - source: 'OTRS Import', - role_ids: [2, 1], - group_ids: ['1'], - password: '{sha2}9faaba2ab242a99bbb6992e9424386375f6757c17e6484ae570f39d9cad9f28ea', - updated_at: '2014-04-28 10:53:18', - created_at: '2014-04-28 10:53:18', - id: '1', - email: 'root@localhost', - firstname: 'Admin', - lastname: 'OTRS', - login: 'root@localhost' + active: true, + source: 'OTRS Import', + role_ids: [2, 1], + group_ids: ['1'], + password: '{sha2}9faaba2ab242a99bbb6992e9424386375f6757c17e6484ae570f39d9cad9f28ea', + updated_at: '2014-04-28 10:53:18', + created_at: '2014-04-28 10:53:18', + id: '1', + email: 'root@localhost', + firstname: 'Admin', + lastname: 'OTRS', + login: 'root@localhost' } end @@ -174,18 +174,18 @@ RSpec.describe Import::OTRS::User do { created_by_id: 1, updated_by_id: 1, - active: true, - source: 'OTRS Import', - role_ids: [2, 1], - group_ids: ['1'], - password: '{sha2}9faaba2ab242a99bbb6992e9424386375f6757c17e6484ae570f39d9cad9f28ea', - updated_at: '2014-04-28 10:53:18', - created_at: '2014-04-28 10:53:18', - id: '1', - email: 'root@localhost', - firstname: 'Admin', - lastname: 'OTRS', - login: 'root@localhost' + active: true, + source: 'OTRS Import', + role_ids: [2, 1], + group_ids: ['1'], + password: '{sha2}9faaba2ab242a99bbb6992e9424386375f6757c17e6484ae570f39d9cad9f28ea', + updated_at: '2014-04-28 10:53:18', + created_at: '2014-04-28 10:53:18', + id: '1', + email: 'root@localhost', + firstname: 'Admin', + lastname: 'OTRS', + login: 'root@localhost' } end diff --git a/spec/lib/import/zendesk/object_attribute/checkbox_spec.rb b/spec/lib/import/zendesk/object_attribute/checkbox_spec.rb index 4592557ba..744938598 100644 --- a/spec/lib/import/zendesk/object_attribute/checkbox_spec.rb +++ b/spec/lib/import/zendesk/object_attribute/checkbox_spec.rb @@ -19,11 +19,11 @@ RSpec.describe Import::Zendesk::ObjectAttribute::Checkbox do ) expected_structure = { - object: 'Ticket', - name: 'example_field', - display: 'Example attribute', - data_type: 'boolean', - data_option: { + object: 'Ticket', + name: 'example_field', + display: 'Example attribute', + data_type: 'boolean', + data_option: { null: false, note: 'Example attribute description', default: false, @@ -32,15 +32,15 @@ RSpec.describe Import::Zendesk::ObjectAttribute::Checkbox do false => 'no' } }, - editable: true, - active: true, - screens: { + editable: true, + active: true, + screens: { edit: { Customer: { shown: true, - null: false + null: false }, - view: { + view: { '-all-' => { shown: true } diff --git a/spec/lib/import/zendesk/object_attribute/date_spec.rb b/spec/lib/import/zendesk/object_attribute/date_spec.rb index 8aaba3854..5a57623b0 100644 --- a/spec/lib/import/zendesk/object_attribute/date_spec.rb +++ b/spec/lib/import/zendesk/object_attribute/date_spec.rb @@ -22,26 +22,26 @@ RSpec.describe Import::Zendesk::ObjectAttribute::Date do ) expected_structure = { - object: 'Ticket', - name: 'example_field', - display: 'Example attribute', - data_type: 'date', - data_option: { + object: 'Ticket', + name: 'example_field', + display: 'Example attribute', + data_type: 'date', + data_option: { null: false, note: 'Example attribute description', future: true, past: true, diff: 0, }, - editable: true, - active: true, - screens: { + editable: true, + active: true, + screens: { edit: { Customer: { shown: true, - null: false + null: false }, - view: { + view: { '-all-' => { shown: true } diff --git a/spec/lib/import/zendesk/object_attribute/decimal_spec.rb b/spec/lib/import/zendesk/object_attribute/decimal_spec.rb index e289e1bc4..1cfa084b3 100644 --- a/spec/lib/import/zendesk/object_attribute/decimal_spec.rb +++ b/spec/lib/import/zendesk/object_attribute/decimal_spec.rb @@ -19,25 +19,25 @@ RSpec.describe Import::Zendesk::ObjectAttribute::Decimal do ) expected_structure = { - object: 'Ticket', - name: 'example_field', - display: 'Example attribute', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'example_field', + display: 'Example attribute', + data_type: 'input', + data_option: { null: false, note: 'Example attribute description', type: 'text', maxlength: 255, }, - editable: true, - active: true, - screens: { + editable: true, + active: true, + screens: { edit: { Customer: { shown: true, - null: false + null: false }, - view: { + view: { '-all-' => { shown: true } diff --git a/spec/lib/import/zendesk/object_attribute/dropdown_spec.rb b/spec/lib/import/zendesk/object_attribute/dropdown_spec.rb index 03ca51b1d..f03781bba 100644 --- a/spec/lib/import/zendesk/object_attribute/dropdown_spec.rb +++ b/spec/lib/import/zendesk/object_attribute/dropdown_spec.rb @@ -31,28 +31,28 @@ RSpec.describe Import::Zendesk::ObjectAttribute::Dropdown do ) expected_structure = { - object: 'Ticket', - name: 'example_field', - display: 'Example attribute', - data_type: 'select', - data_option: { - null: false, - note: 'Example attribute description', + object: 'Ticket', + name: 'example_field', + display: 'Example attribute', + data_type: 'select', + data_option: { + null: false, + note: 'Example attribute description', default: '', options: { 'Key 1' => 'Value 1', 'Key 2' => 'Value 2' }, }, - editable: true, - active: true, - screens: { + editable: true, + active: true, + screens: { edit: { Customer: { shown: true, - null: false + null: false }, - view: { + view: { '-all-' => { shown: true } diff --git a/spec/lib/import/zendesk/object_attribute/integer_spec.rb b/spec/lib/import/zendesk/object_attribute/integer_spec.rb index 4e60f0d0a..0460c215b 100644 --- a/spec/lib/import/zendesk/object_attribute/integer_spec.rb +++ b/spec/lib/import/zendesk/object_attribute/integer_spec.rb @@ -22,25 +22,25 @@ RSpec.describe Import::Zendesk::ObjectAttribute::Integer do ) expected_structure = { - object: 'Ticket', - name: 'example_field', - display: 'Example attribute', - data_type: 'integer', - data_option: { + object: 'Ticket', + name: 'example_field', + display: 'Example attribute', + data_type: 'integer', + data_option: { null: false, note: 'Example attribute description', min: 0, max: 999_999_999, }, - editable: true, - active: true, - screens: { + editable: true, + active: true, + screens: { edit: { Customer: { shown: true, - null: false + null: false }, - view: { + view: { '-all-' => { shown: true } diff --git a/spec/lib/import/zendesk/object_attribute/regexp_spec.rb b/spec/lib/import/zendesk/object_attribute/regexp_spec.rb index 14aae8d86..b0d8fafaf 100644 --- a/spec/lib/import/zendesk/object_attribute/regexp_spec.rb +++ b/spec/lib/import/zendesk/object_attribute/regexp_spec.rb @@ -24,26 +24,26 @@ RSpec.describe Import::Zendesk::ObjectAttribute::Regexp do ) expected_structure = { - object: 'Ticket', - name: 'example_field', - display: 'Example attribute', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'example_field', + display: 'Example attribute', + data_type: 'input', + data_option: { null: false, note: 'Example attribute description', type: 'text', maxlength: 255, regex: regex, }, - editable: true, - active: true, - screens: { + editable: true, + active: true, + screens: { edit: { Customer: { shown: true, - null: false + null: false }, - view: { + view: { '-all-' => { shown: true } diff --git a/spec/lib/import/zendesk/object_attribute/tagger_spec.rb b/spec/lib/import/zendesk/object_attribute/tagger_spec.rb index be40f3fa9..fa06188ee 100644 --- a/spec/lib/import/zendesk/object_attribute/tagger_spec.rb +++ b/spec/lib/import/zendesk/object_attribute/tagger_spec.rb @@ -31,28 +31,28 @@ RSpec.describe Import::Zendesk::ObjectAttribute::Tagger do ) expected_structure = { - object: 'Ticket', - name: 'example_field', - display: 'Example attribute', - data_type: 'select', - data_option: { - null: false, - note: 'Example attribute description', + object: 'Ticket', + name: 'example_field', + display: 'Example attribute', + data_type: 'select', + data_option: { + null: false, + note: 'Example attribute description', default: '', options: { 'Key 1' => 'Value 1', 'Key 2' => 'Value 2' }, }, - editable: true, - active: true, - screens: { + editable: true, + active: true, + screens: { edit: { Customer: { shown: true, - null: false + null: false }, - view: { + view: { '-all-' => { shown: true } diff --git a/spec/lib/import/zendesk/object_attribute/text_spec.rb b/spec/lib/import/zendesk/object_attribute/text_spec.rb index 6841c9eaa..e0b3bf6b7 100644 --- a/spec/lib/import/zendesk/object_attribute/text_spec.rb +++ b/spec/lib/import/zendesk/object_attribute/text_spec.rb @@ -19,25 +19,25 @@ RSpec.describe Import::Zendesk::ObjectAttribute::Text do ) expected_structure = { - object: 'Ticket', - name: 'example_field', - display: 'Example attribute', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'example_field', + display: 'Example attribute', + data_type: 'input', + data_option: { null: false, note: 'Example attribute description', type: 'text', maxlength: 255, }, - editable: true, - active: true, - screens: { + editable: true, + active: true, + screens: { edit: { Customer: { shown: true, - null: false + null: false }, - view: { + view: { '-all-' => { shown: true } diff --git a/spec/lib/import/zendesk/object_attribute/textarea_spec.rb b/spec/lib/import/zendesk/object_attribute/textarea_spec.rb index 351523216..f4ed38e38 100644 --- a/spec/lib/import/zendesk/object_attribute/textarea_spec.rb +++ b/spec/lib/import/zendesk/object_attribute/textarea_spec.rb @@ -19,25 +19,25 @@ RSpec.describe Import::Zendesk::ObjectAttribute::Textarea do ) expected_structure = { - object: 'Ticket', - name: 'example_field', - display: 'Example attribute', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'example_field', + display: 'Example attribute', + data_type: 'input', + data_option: { null: false, note: 'Example attribute description', type: 'textarea', maxlength: 255, }, - editable: true, - active: true, - screens: { + editable: true, + active: true, + screens: { edit: { Customer: { shown: true, - null: false + null: false }, - view: { + view: { '-all-' => { shown: true } diff --git a/spec/lib/ldap_spec.rb b/spec/lib/ldap_spec.rb index a7d719804..79666a30b 100644 --- a/spec/lib/ldap_spec.rb +++ b/spec/lib/ldap_spec.rb @@ -245,8 +245,8 @@ RSpec.describe Ldap do scope = Net::LDAP::SearchScope_BaseObject additional = { - base: base, - scope: scope, + base: base, + scope: scope, } expected = { diff --git a/spec/lib/notification_factory/renderer_spec.rb b/spec/lib/notification_factory/renderer_spec.rb index 0d8eb3256..d84217bec 100644 --- a/spec/lib/notification_factory/renderer_spec.rb +++ b/spec/lib/notification_factory/renderer_spec.rb @@ -16,7 +16,7 @@ RSpec.describe NotificationFactory::Renderer do user = User.where(firstname: 'Nicole').first ticket = create :ticket, customer: user renderer = build :notification_factory_renderer, - objects: { ticket: ticket }, + objects: { ticket: ticket }, template: '#{ticket.customer.firstname.downcase}' expect(renderer.render).to eq 'nicole' ticket.destroy @@ -25,7 +25,7 @@ RSpec.describe NotificationFactory::Renderer do it 'correctly renders multiple value calls' do ticket = create :ticket, customer: @user renderer = build :notification_factory_renderer, - objects: { ticket: ticket }, + objects: { ticket: ticket }, template: '#{ticket.created_at.value.value.value.value.to_s.first}' expect(renderer.render).to eq '2' ticket.destroy @@ -38,7 +38,7 @@ RSpec.describe NotificationFactory::Renderer do ticket = create :ticket, customer: @user, select: 'key_1' renderer = build :notification_factory_renderer, - objects: { ticket: ticket }, + objects: { ticket: ticket }, template: '#{ticket.select} _SEPERATOR_ #{ticket.select.value}' expect(renderer.render).to eq 'key_1 _SEPERATOR_ value_1' @@ -46,7 +46,7 @@ RSpec.describe NotificationFactory::Renderer do ObjectManager::Attribute.remove( object: 'Ticket', - name: 'select', + name: 'select', ) ObjectManager::Attribute.migration_execute end @@ -54,7 +54,7 @@ RSpec.describe NotificationFactory::Renderer do it 'correctly renders select attributes on chained user object' do attribute = create :object_manager_attribute_select, object_lookup_id: ObjectLookup.by_name('User'), - name: 'select' + name: 'select' ObjectManager::Attribute.migration_execute user = User.where(firstname: 'Nicole').first @@ -63,7 +63,7 @@ RSpec.describe NotificationFactory::Renderer do ticket = create :ticket, customer: user renderer = build :notification_factory_renderer, - objects: { ticket: ticket }, + objects: { ticket: ticket }, template: '#{ticket.customer.select} _SEPERATOR_ #{ticket.customer.select.value}' expect(renderer.render).to eq 'key_2 _SEPERATOR_ value_2' @@ -71,7 +71,7 @@ RSpec.describe NotificationFactory::Renderer do ObjectManager::Attribute.remove( object: 'User', - name: 'select', + name: 'select', ) ObjectManager::Attribute.migration_execute end @@ -79,7 +79,7 @@ RSpec.describe NotificationFactory::Renderer do it 'correctly renders select attributes on chained group object' do attribute = create :object_manager_attribute_select, object_lookup_id: ObjectLookup.by_name('Group'), - name: 'select' + name: 'select' ObjectManager::Attribute.migration_execute ticket = create :ticket, customer: @user @@ -88,7 +88,7 @@ RSpec.describe NotificationFactory::Renderer do group.save renderer = build :notification_factory_renderer, - objects: { ticket: ticket }, + objects: { ticket: ticket }, template: '#{ticket.group.select} _SEPERATOR_ #{ticket.group.select.value}' expect(renderer.render).to eq 'key_3 _SEPERATOR_ value_3' @@ -96,7 +96,7 @@ RSpec.describe NotificationFactory::Renderer do ObjectManager::Attribute.remove( object: 'Group', - name: 'select', + name: 'select', ) ObjectManager::Attribute.migration_execute end @@ -104,7 +104,7 @@ RSpec.describe NotificationFactory::Renderer do it 'correctly renders select attributes on chained organization object' do attribute = create :object_manager_attribute_select, object_lookup_id: ObjectLookup.by_name('Organization'), - name: 'select' + name: 'select' ObjectManager::Attribute.migration_execute @user.organization.select = 'key_2' @@ -112,7 +112,7 @@ RSpec.describe NotificationFactory::Renderer do ticket = create :ticket, customer: @user renderer = build :notification_factory_renderer, - objects: { ticket: ticket }, + objects: { ticket: ticket }, template: '#{ticket.customer.organization.select} _SEPERATOR_ #{ticket.customer.organization.select.value}' expect(renderer.render).to eq 'key_2 _SEPERATOR_ value_2' @@ -120,7 +120,7 @@ RSpec.describe NotificationFactory::Renderer do ObjectManager::Attribute.remove( object: 'Organization', - name: 'select', + name: 'select', ) ObjectManager::Attribute.migration_execute end @@ -132,7 +132,7 @@ RSpec.describe NotificationFactory::Renderer do ticket = create :ticket, customer: @user, tree_select: 'Incident::Hardware::Laptop' renderer = build :notification_factory_renderer, - objects: { ticket: ticket }, + objects: { ticket: ticket }, template: '#{ticket.tree_select} _SEPERATOR_ #{ticket.tree_select.value}' expect(renderer.render).to eq 'Incident::Hardware::Laptop _SEPERATOR_ Incident::Hardware::Laptop' @@ -140,7 +140,7 @@ RSpec.describe NotificationFactory::Renderer do ObjectManager::Attribute.remove( object: 'Ticket', - name: 'tree_select', + name: 'tree_select', ) ObjectManager::Attribute.migration_execute end diff --git a/spec/lib/sequencer/sequence/import/ldap/users_spec.rb b/spec/lib/sequencer/sequence/import/ldap/users_spec.rb index 949545f84..4ac5b1912 100644 --- a/spec/lib/sequencer/sequence/import/ldap/users_spec.rb +++ b/spec/lib/sequencer/sequence/import/ldap/users_spec.rb @@ -18,11 +18,11 @@ RSpec.describe ::Sequencer::Sequence::Import::Ldap::Users, sequencer: :sequence payload = { ldap_config: { - user_filter: 'user=filter', - group_role_map: { + user_filter: 'user=filter', + group_role_map: { group_entry.dn => [1, 2] }, - user_attributes: { + user_attributes: { 'first_name' => 'firstname', }, user_uid: 'objectguid', @@ -113,14 +113,14 @@ RSpec.describe ::Sequencer::Sequence::Import::Ldap::Users, sequencer: :sequence payload = { ldap_config: { - user_filter: 'user=filter', - group_role_map: { + user_filter: 'user=filter', + group_role_map: { group_entry.dn => agent_admin_role_ids }, user_attributes: { 'first_name' => 'firstname', }, - user_uid: 'objectguid', + user_uid: 'objectguid', } } diff --git a/spec/lib/sequencer/unit/import/zendesk/sub_sequence/base_examples.rb b/spec/lib/sequencer/unit/import/zendesk/sub_sequence/base_examples.rb index 3949caafc..c0fca3918 100644 --- a/spec/lib/sequencer/unit/import/zendesk/sub_sequence/base_examples.rb +++ b/spec/lib/sequencer/unit/import/zendesk/sub_sequence/base_examples.rb @@ -7,13 +7,13 @@ RSpec.shared_examples 'Sequencer::Unit::Import::Zendesk::SubSequence::Base' do let(:params) do { - dry_run: false, - import_job: instance_double(ImportJob), - client: double('ZendeskAPI'), - group_map: {}, # required by Tickets + dry_run: false, + import_job: instance_double(ImportJob), + client: double('ZendeskAPI'), + group_map: {}, # required by Tickets organization_map: {}, # required by Tickets ticket_field_map: {}, # required by Tickets - user_map: {}, # required by Tickets + user_map: {}, # required by Tickets } end diff --git a/spec/models/channel/driver/sms/massenversand_spec.rb b/spec/models/channel/driver/sms/massenversand_spec.rb index 6a251cf2f..311bd1b4f 100644 --- a/spec/models/channel/driver/sms/massenversand_spec.rb +++ b/spec/models/channel/driver/sms/massenversand_spec.rb @@ -25,11 +25,11 @@ RSpec.describe Channel::Driver::Sms::Massenversand do def create_channel FactoryBot.create(:channel, - options: { + options: { adapter: 'sms/massenversand', gateway: gateway, - sender: sender_number, - token: token + sender: sender_number, + token: token }, created_by_id: 1, updated_by_id: 1) @@ -38,11 +38,11 @@ RSpec.describe Channel::Driver::Sms::Massenversand do def url_to_mock params = { authToken: token, - getID: 1, - msg: message_body, - msgtype: 'c', - receiver: receiver_number, - sender: sender_number + getID: 1, + msg: message_body, + msgtype: 'c', + receiver: receiver_number, + sender: sender_number } gateway + '?' + URI.encode_www_form(params) diff --git a/spec/models/channel/driver/sms/twilio_spec.rb b/spec/models/channel/driver/sms/twilio_spec.rb index 9078c4d94..ebcb9d81b 100644 --- a/spec/models/channel/driver/sms/twilio_spec.rb +++ b/spec/models/channel/driver/sms/twilio_spec.rb @@ -27,11 +27,11 @@ RSpec.describe Channel::Driver::Sms::Twilio do def create_channel FactoryBot.create(:channel, - options: { + options: { account_id: account_id, - adapter: 'sms/twilio', - sender: sender_number, - token: token + adapter: 'sms/twilio', + sender: sender_number, + token: token }, created_by_id: 1, updated_by_id: 1) diff --git a/spec/models/channel_spec.rb b/spec/models/channel_spec.rb index 986dbb434..740d68819 100644 --- a/spec/models/channel_spec.rb +++ b/spec/models/channel_spec.rb @@ -54,7 +54,7 @@ RSpec.describe Channel do expect(Ticket.last.attributes).to include( 'title' => 'Wir haben unsere DMs deaktiviert. ' \ 'Leider können wir dank der neuen Twitter API k...', - 'preferences' => { 'channel_id' => twitter_channel.id, + 'preferences' => { 'channel_id' => twitter_channel.id, 'channel_screen_name' => twitter_channel.options[:user][:screen_name] }, 'customer_id' => User.find_by(firstname: 'Ccc', lastname: 'Event Logistics').id ) diff --git a/spec/models/recent_view_spec.rb b/spec/models/recent_view_spec.rb index e94cd5b2b..62bbd8343 100644 --- a/spec/models/recent_view_spec.rb +++ b/spec/models/recent_view_spec.rb @@ -145,8 +145,8 @@ RSpec.describe RecentView, type: :model do let(:owner) { agent } it 'does not create RecentView for records the given user cannot read' do - ticket.update(owner: User.first, # read access may come from ticket ownership, - customer: User.first, # customer status, + ticket.update(owner: User.first, # read access may come from ticket ownership, + customer: User.first, # customer status, organization: nil) # organization's 'shared' status, agent.update(groups: []) # and membership in the Ticket's group diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index 4a8b9464f..454a12ae8 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -9,8 +9,8 @@ RSpec.describe Tag do def tag_rename Tag::Item.rename( - id: Tag::Item.lookup(name: 'test1').id, - name: 'test1_renamed', + id: Tag::Item.lookup(name: 'test1').id, + name: 'test1_renamed', updated_by_id: 1, ) end diff --git a/spec/models/taskbar_spec.rb b/spec/models/taskbar_spec.rb index 6ef634700..c696742da 100644 --- a/spec/models/taskbar_spec.rb +++ b/spec/models/taskbar_spec.rb @@ -85,27 +85,27 @@ RSpec.describe Taskbar do UserInfo.current_user_id = 1 taskbar1 = Taskbar.create( client_id: 123, - key: 'Ticket-1234', - callback: 'TicketZoom', - params: { + key: 'Ticket-1234', + callback: 'TicketZoom', + params: { id: 1234, }, - state: {}, - prio: 1, - notify: false, + state: {}, + prio: 1, + notify: false, ) UserInfo.current_user_id = 2 taskbar2 = Taskbar.create( client_id: 123, - key: 'Ticket-1234', - callback: 'TicketZoom', - params: { + key: 'Ticket-1234', + callback: 'TicketZoom', + params: { id: 1234, }, - state: {}, - prio: 2, - notify: false, + state: {}, + prio: 2, + notify: false, ) taskbar1.reload @@ -124,14 +124,14 @@ RSpec.describe Taskbar do taskbar3 = Taskbar.create( client_id: 123, - key: 'Ticket-4444', - callback: 'TicketZoom', - params: { + key: 'Ticket-4444', + callback: 'TicketZoom', + params: { id: 4444, }, - state: {}, - prio: 2, - notify: false, + state: {}, + prio: 2, + notify: false, ) taskbar1.reload @@ -158,14 +158,14 @@ RSpec.describe Taskbar do taskbar4 = Taskbar.create( client_id: 123, - key: 'Ticket-1234', - callback: 'TicketZoom', - params: { + key: 'Ticket-1234', + callback: 'TicketZoom', + params: { id: 1234, }, - state: {}, - prio: 4, - notify: false, + state: {}, + prio: 4, + notify: false, ) taskbar1.reload diff --git a/spec/models/ticket/article_spec.rb b/spec/models/ticket/article_spec.rb index 20a1319e6..54f20b943 100644 --- a/spec/models/ticket/article_spec.rb +++ b/spec/models/ticket/article_spec.rb @@ -77,10 +77,10 @@ RSpec.describe Ticket::Article do expect(&run_bg_jobs) .to change { channel.reload.attributes } .to hash_including( - 'status_in' => nil, - 'last_log_in' => nil, - 'status_out' => 'ok', - 'last_log_out' => '' + 'status_in' => nil, + 'last_log_in' => nil, + 'status_out' => 'ok', + 'last_log_out' => '' ) end diff --git a/spec/models/ticket/overviews_spec.rb b/spec/models/ticket/overviews_spec.rb index f8ae6119c..92cbc062f 100644 --- a/spec/models/ticket/overviews_spec.rb +++ b/spec/models/ticket/overviews_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Ticket::Overviews do condition = { 'article.from' => { operator: 'contains', - value: 'blubselector.de', + value: 'blubselector.de', }, } overview = create(:overview, condition: condition) diff --git a/spec/models/ticket_spec.rb b/spec/models/ticket_spec.rb index be362ccba..8c175e359 100644 --- a/spec/models/ticket_spec.rb +++ b/spec/models/ticket_spec.rb @@ -24,7 +24,7 @@ RSpec.describe Ticket do ) links = Link.list( - link_object: 'Ticket', + link_object: 'Ticket', link_object_value: target_ticket.id, ) @@ -95,29 +95,29 @@ RSpec.describe Ticket do # get before destroy activities = ActivityStream.where( activity_stream_object_id: ObjectLookup.by_name('Ticket'), - o_id: source_ticket.id, + o_id: source_ticket.id, ) links = Link.list( - link_object: 'Ticket', + link_object: 'Ticket', link_object_value: source_ticket.id ) articles = Ticket::Article.where(ticket_id: source_ticket.id) history = History.list('Ticket', source_ticket.id, nil, true) karma_log = Karma::ActivityLog.where( object_lookup_id: ObjectLookup.by_name('Ticket'), - o_id: source_ticket.id, + o_id: source_ticket.id, ) online_notifications = OnlineNotification.where( object_lookup_id: ObjectLookup.by_name('Ticket'), - o_id: source_ticket.id, + o_id: source_ticket.id, ) recent_views = OnlineNotification.where( object_lookup_id: ObjectLookup.by_name('Ticket'), - o_id: source_ticket.id, + o_id: source_ticket.id, ) tags = Tag.tag_list( object: 'Ticket', - o_id: source_ticket.id, + o_id: source_ticket.id, ) # check before destroy @@ -136,29 +136,29 @@ RSpec.describe Ticket do # get after destroy activities = ActivityStream.where( activity_stream_object_id: ObjectLookup.by_name('Ticket'), - o_id: source_ticket.id, + o_id: source_ticket.id, ) links = Link.list( - link_object: 'Ticket', + link_object: 'Ticket', link_object_value: source_ticket.id ) articles = Ticket::Article.where(ticket_id: source_ticket.id) history = History.list('Ticket', source_ticket.id, nil, true) karma_log = Karma::ActivityLog.where( object_lookup_id: ObjectLookup.by_name('Ticket'), - o_id: source_ticket.id, + o_id: source_ticket.id, ) online_notifications = OnlineNotification.where( object_lookup_id: ObjectLookup.by_name('Ticket'), - o_id: source_ticket.id, + o_id: source_ticket.id, ) recent_views = OnlineNotification.where( object_lookup_id: ObjectLookup.by_name('Ticket'), - o_id: source_ticket.id, + o_id: source_ticket.id, ) tags = Tag.tag_list( object: 'Ticket', - o_id: source_ticket.id, + o_id: source_ticket.id, ) # check after destroy @@ -195,7 +195,7 @@ RSpec.describe Ticket do changes = { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s }, - 'ticket.action' => { 'value' => 'delete' }, + 'ticket.action' => { 'value' => 'delete' }, } source_ticket.perform_changes(changes, 'trigger', source_ticket, User.find(1)) @@ -208,9 +208,9 @@ RSpec.describe Ticket do trigger = Trigger.new( perform: { 'notification.email' => { - body: "Hello \#{ticket.customer.firstname} \#{ticket.customer.lastname},", + body: "Hello \#{ticket.customer.firstname} \#{ticket.customer.lastname},", recipient: %w[article_last_sender ticket_owner ticket_customer ticket_agents], - subject: "Autoclose (\#{ticket.title})" + subject: "Autoclose (\#{ticket.title})" } } ) @@ -239,9 +239,9 @@ RSpec.describe Ticket do trigger = Trigger.new( perform: { 'notification.email' => { - body: '', + body: '', recipient: 'ticket_customer', - subject: '' + subject: '' } } ) @@ -279,7 +279,7 @@ RSpec.describe Ticket do condition = { 'article.from' => { operator: 'contains', - value: 'blubselector.de', + value: 'blubselector.de', }, } diff --git a/spec/models/translation_spec.rb b/spec/models/translation_spec.rb index c40aee37c..94e2be0cd 100644 --- a/spec/models/translation_spec.rb +++ b/spec/models/translation_spec.rb @@ -39,10 +39,10 @@ RSpec.describe Translation do expect( Translation.remote_translation_need_update?( { - 'source' => translation.source, - 'format' => translation.format, - 'locale' => translation.locale, - 'target' => translation.target, + 'source' => translation.source, + 'format' => translation.format, + 'locale' => translation.locale, + 'target' => translation.target, 'target_initial' => translation.target_initial, }, translations ) @@ -57,10 +57,10 @@ RSpec.describe Translation do expect( Translation.remote_translation_need_update?( { - 'source' => translation.source, - 'format' => translation.format, - 'locale' => translation.locale, - 'target' => translation.target, + 'source' => translation.source, + 'format' => translation.format, + 'locale' => translation.locale, + 'target' => translation.target, 'target_initial' => translation.target_initial, }, translations ) @@ -72,10 +72,10 @@ RSpec.describe Translation do translations = Translation.where(locale: 'de-de').pluck(:id, :locale, :source, :format, :target, :target_initial).to_a (result, translation_result) = Translation.remote_translation_need_update?( { - 'source' => translation.source, - 'format' => translation.format, - 'locale' => translation.locale, - 'target' => 'some new translation by remote', + 'source' => translation.source, + 'format' => translation.format, + 'locale' => translation.locale, + 'target' => 'some new translation by remote', 'target_initial' => 'some new translation by remote', }, translations ) @@ -91,10 +91,10 @@ RSpec.describe Translation do expect( Translation.remote_translation_need_update?( { - 'source' => translation.source, - 'format' => translation.format, - 'locale' => translation.locale, - 'target' => 'some new translation by remote', + 'source' => translation.source, + 'format' => translation.format, + 'locale' => translation.locale, + 'target' => 'some new translation by remote', 'target_initial' => 'some new translation by remote', }, translations ) diff --git a/spec/models/trigger/sms_spec.rb b/spec/models/trigger/sms_spec.rb index 74defa3ae..c099b08d5 100644 --- a/spec/models/trigger/sms_spec.rb +++ b/spec/models/trigger/sms_spec.rb @@ -13,7 +13,7 @@ RSpec.describe Trigger do channel = create(:channel, area: 'Sms::Notification') trigger = create(:trigger, disable_notification: false, - perform: { + perform: { 'notification.sms': { recipient: 'ticket_agents', body: 'space between #{ticket.title}', # rubocop:disable Lint/InterpolationCheck diff --git a/spec/requests/api_auth_on_behalf_of_spec.rb b/spec/requests/api_auth_on_behalf_of_spec.rb index b56289876..7e3ffccfe 100644 --- a/spec/requests/api_auth_on_behalf_of_spec.rb +++ b/spec/requests/api_auth_on_behalf_of_spec.rb @@ -16,12 +16,12 @@ RSpec.describe 'Api Auth On Behalf Of', type: :request do it 'does X-On-Behalf-Of auth - ticket create admin for customer by id' do params = { - title: 'a new ticket #3', - group: 'Users', - priority: '2 normal', - state: 'new', + title: 'a new ticket #3', + group: 'Users', + priority: '2 normal', + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } @@ -36,12 +36,12 @@ RSpec.describe 'Api Auth On Behalf Of', type: :request do ActivityStream.cleanup(1.year) params = { - title: 'a new ticket #3', - group: 'Users', - priority: '2 normal', - state: 'new', + title: 'a new ticket #3', + group: 'Users', + priority: '2 normal', + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } @@ -90,12 +90,12 @@ RSpec.describe 'Api Auth On Behalf Of', type: :request do it 'does X-On-Behalf-Of auth - ticket create admin for customer by email' do params = { - title: 'a new ticket #3', - group: 'Users', - priority: '2 normal', - state: 'new', + title: 'a new ticket #3', + group: 'Users', + priority: '2 normal', + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } @@ -108,12 +108,12 @@ RSpec.describe 'Api Auth On Behalf Of', type: :request do it 'does X-On-Behalf-Of auth - ticket create admin for unknown' do params = { - title: 'a new ticket #3', - group: 'Users', - priority: '2 normal', - state: 'new', + title: 'a new ticket #3', + group: 'Users', + priority: '2 normal', + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } @@ -127,12 +127,12 @@ RSpec.describe 'Api Auth On Behalf Of', type: :request do it 'does X-On-Behalf-Of auth - ticket create customer for admin' do params = { - title: 'a new ticket #3', - group: 'Users', - priority: '2 normal', - state: 'new', + title: 'a new ticket #3', + group: 'Users', + priority: '2 normal', + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } @@ -146,12 +146,12 @@ RSpec.describe 'Api Auth On Behalf Of', type: :request do it 'does X-On-Behalf-Of auth - ticket create admin for customer by email but no permitted action' do params = { - title: 'a new ticket #3', - group: 'secret1234', - priority: '2 normal', - state: 'new', + title: 'a new ticket #3', + group: 'secret1234', + priority: '2 normal', + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } diff --git a/spec/requests/form_spec.rb b/spec/requests/form_spec.rb index feda0f2ed..891dcf000 100644 --- a/spec/requests/form_spec.rb +++ b/spec/requests/form_spec.rb @@ -207,11 +207,11 @@ RSpec.describe 'Form', type: :request, searchindex: true do token = json_response['token'] params = { fingerprint: fingerprint, - token: token, - name: 'Bob Smith', - email: 'discard@znuny.com', - title: 'test', - body: 'hello' + token: token, + name: 'Bob Smith', + email: 'discard@znuny.com', + title: 'test', + body: 'hello' } post '/api/v1/form_submit', params: params, as: :json diff --git a/spec/requests/integration/check_mk_spec.rb b/spec/requests/integration/check_mk_spec.rb index ae29e08bb..0d9dad66e 100644 --- a/spec/requests/integration/check_mk_spec.rb +++ b/spec/requests/integration/check_mk_spec.rb @@ -25,9 +25,9 @@ RSpec.describe 'Integration Check MK', type: :request do it 'does create and close a ticket' do params = { event_id: '123', - state: 'down', - host: 'some host', - service: 'some service', + state: 'down', + host: 'some host', + service: 'some service', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -43,9 +43,9 @@ RSpec.describe 'Integration Check MK', type: :request do params = { event_id: '123', - state: 'up', - host: 'some host', - service: 'some service', + state: 'up', + host: 'some host', + service: 'some service', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -62,9 +62,9 @@ RSpec.describe 'Integration Check MK', type: :request do it 'does double create and auto close' do params = { event_id: '123', - state: 'down', - host: 'some host', - service: 'some service', + state: 'down', + host: 'some host', + service: 'some service', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -80,9 +80,9 @@ RSpec.describe 'Integration Check MK', type: :request do params = { event_id: '123', - state: 'down', - host: 'some host', - service: 'some service', + state: 'down', + host: 'some host', + service: 'some service', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -97,9 +97,9 @@ RSpec.describe 'Integration Check MK', type: :request do params = { event_id: '123', - state: 'up', - host: 'some host', - service: 'some service', + state: 'up', + host: 'some host', + service: 'some service', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -116,9 +116,9 @@ RSpec.describe 'Integration Check MK', type: :request do it 'does ticket close which get ignored' do params = { event_id: '123', - state: 'up', - host: 'some host', - service: 'some service', + state: 'up', + host: 'some host', + service: 'some service', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -131,9 +131,9 @@ RSpec.describe 'Integration Check MK', type: :request do Setting.set('check_mk_auto_close', false) params = { event_id: '123', - state: 'down', - host: 'some host', - service: 'some service', + state: 'down', + host: 'some host', + service: 'some service', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -149,9 +149,9 @@ RSpec.describe 'Integration Check MK', type: :request do params = { event_id: '123', - state: 'down', - host: 'some host', - service: 'some service', + state: 'down', + host: 'some host', + service: 'some service', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -166,9 +166,9 @@ RSpec.describe 'Integration Check MK', type: :request do params = { event_id: '123', - state: 'up', - host: 'some host', - service: 'some service', + state: 'up', + host: 'some host', + service: 'some service', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -185,8 +185,8 @@ RSpec.describe 'Integration Check MK', type: :request do it 'does double create and auto close - host only' do params = { event_id: '123', - state: 'down', - host: 'some host', + state: 'down', + host: 'some host', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -202,8 +202,8 @@ RSpec.describe 'Integration Check MK', type: :request do params = { event_id: '123', - state: 'down', - host: 'some host', + state: 'down', + host: 'some host', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) @@ -218,8 +218,8 @@ RSpec.describe 'Integration Check MK', type: :request do params = { event_id: '123', - state: 'up', - host: 'some host', + state: 'up', + host: 'some host', } post "/api/v1/integration/check_mk/#{Setting.get('check_mk_token')}", params: params expect(response).to have_http_status(200) diff --git a/spec/requests/integration/cti_spec.rb b/spec/requests/integration/cti_spec.rb index 54a8a8193..f8c12f234 100644 --- a/spec/requests/integration/cti_spec.rb +++ b/spec/requests/integration/cti_spec.rb @@ -8,31 +8,31 @@ RSpec.describe 'Integration CTI', type: :request do let!(:customer_user1) do create( :customer_user, - login: 'ticket-caller_id_cti-customer1@example.com', + login: 'ticket-caller_id_cti-customer1@example.com', firstname: 'CallerId', - lastname: 'Customer1', - phone: '+49 99999 222222', - fax: '+49 99999 222223', - mobile: '+4912347114711', - note: 'Phone at home: +49 99999 222224', + lastname: 'Customer1', + phone: '+49 99999 222222', + fax: '+49 99999 222223', + mobile: '+4912347114711', + note: 'Phone at home: +49 99999 222224', ) end let!(:customer_user2) do create( :customer_user, - login: 'ticket-caller_id_cti-customer2@example.com', + login: 'ticket-caller_id_cti-customer2@example.com', firstname: 'CallerId', - lastname: 'Customer2', - phone: '+49 99999 222222 2', + lastname: 'Customer2', + phone: '+49 99999 222222 2', ) end let!(:customer_user3) do create( :customer_user, - login: 'ticket-caller_id_cti-customer3@example.com', + login: 'ticket-caller_id_cti-customer3@example.com', firstname: 'CallerId', - lastname: 'Customer3', - phone: '+49 99999 222222 2', + lastname: 'Customer3', + phone: '+49 99999 222222 2', ) end @@ -42,26 +42,26 @@ RSpec.describe 'Integration CTI', type: :request do Setting.set('cti_integration', true) Setting.set('cti_config', { outbound: { - routing_table: [ + routing_table: [ { - dest: '41*', + dest: '41*', caller_id: '41715880339000', }, { - dest: '491714000000', + dest: '491714000000', caller_id: '41715880339000', }, ], default_caller_id: '4930777000000', }, - inbound: { + inbound: { block_caller_ids: [ { caller_id: '491715000000', - note: 'some note', + note: 'some note', } ], - notify_user_ids: { + notify_user_ids: { 2 => true, 4 => false, }, diff --git a/spec/requests/integration/idoit_spec.rb b/spec/requests/integration/idoit_spec.rb index 9eac4c3fc..f7854fc01 100644 --- a/spec/requests/integration/idoit_spec.rb +++ b/spec/requests/integration/idoit_spec.rb @@ -22,7 +22,7 @@ RSpec.describe 'Idoit', type: :request do Setting.set('idoit_integration', true) Setting.set('idoit_config', { api_token: token, - endpoint: endpoint, + endpoint: endpoint, client_id: '', }) end @@ -33,7 +33,7 @@ RSpec.describe 'Idoit', type: :request do params = { api_token: token, - endpoint: endpoint, + endpoint: endpoint, client_id: '', } authenticated_as(agent_user) @@ -49,7 +49,7 @@ RSpec.describe 'Idoit', type: :request do params = { api_token: token, - endpoint: endpoint, + endpoint: endpoint, client_id: '', } authenticated_as(admin_user) @@ -64,7 +64,7 @@ RSpec.describe 'Idoit', type: :request do params = { api_token: token, - endpoint: " #{endpoint}/", + endpoint: " #{endpoint}/", client_id: '', } post '/api/v1/integration/idoit/verify', params: params, as: :json diff --git a/spec/requests/integration/monitoring_spec.rb b/spec/requests/integration/monitoring_spec.rb index 1d997d853..ef24bb0c5 100644 --- a/spec/requests/integration/monitoring_spec.rb +++ b/spec/requests/integration/monitoring_spec.rb @@ -115,10 +115,10 @@ RSpec.describe 'Monitoring', type: :request do end Store.add( - object: 'User', - o_id: 1, - data: string, - filename: 'filename.txt', + object: 'User', + o_id: 1, + data: string, + filename: 'filename.txt', created_by_id: 1, ) @@ -157,10 +157,10 @@ RSpec.describe 'Monitoring', type: :request do # save same file again Store.add( - object: 'User', - o_id: 1, - data: string, - filename: 'filename.txt', + object: 'User', + o_id: 1, + data: string, + filename: 'filename.txt', created_by_id: 1, ) @@ -188,10 +188,10 @@ RSpec.describe 'Monitoring', type: :request do end Store.add( - object: 'User', - o_id: 1, - data: string + '123', - filename: 'filename2.txt', + object: 'User', + o_id: 1, + data: string + '123', + filename: 'filename2.txt', created_by_id: 1, ) @@ -537,37 +537,37 @@ RSpec.describe 'Monitoring', type: :request do # parameters for updating params = { - 'name': 'test4', - 'object': 'Ticket', - 'display': 'Test 4', - 'active': true, - 'data_type': 'input', + 'name': 'test4', + 'object': 'Ticket', + 'display': 'Test 4', + 'active': true, + 'data_type': 'input', 'data_option': { - 'default': 'test', - 'type': 'text', + 'default': 'test', + 'type': 'text', 'maxlength': 120 }, - 'screens': { + 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } }, - 'id': 'c-196' + 'id': 'c-196' } # update the object diff --git a/spec/requests/integration/object_manager_attributes_spec.rb b/spec/requests/integration/object_manager_attributes_spec.rb index 3f1d47a63..6d8542136 100644 --- a/spec/requests/integration/object_manager_attributes_spec.rb +++ b/spec/requests/integration/object_manager_attributes_spec.rb @@ -15,37 +15,37 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # token based on headers params = { - 'name': 'test1', - 'object': 'Ticket', - 'display': 'Test 1', - 'active': true, - 'data_type': 'input', + 'name': 'test1', + 'object': 'Ticket', + 'display': 'Test 1', + 'active': true, + 'data_type': 'input', 'data_option': { - 'default': 'test', - 'type': 'text', + 'default': 'test', + 'type': 'text', 'maxlength': 120 }, - 'screens': { + 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } }, - 'id': 'c-196' + 'id': 'c-196' } post '/api/v1/object_manager_attributes', params: params, as: :json @@ -63,36 +63,36 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # token based on headers params = { - 'name': 'test2', - 'object': 'Ticket', - 'display': 'Test 2', - 'active': true, - 'data_type': 'input', + 'name': 'test2', + 'object': 'Ticket', + 'display': 'Test 2', + 'active': true, + 'data_type': 'input', 'data_option': { - 'type': 'text', + 'type': 'text', 'maxlength': 120 }, - 'screens': { + 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } }, - 'id': 'c-196' + 'id': 'c-196' } post '/api/v1/object_manager_attributes', params: params, as: :json @@ -117,37 +117,37 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # parameters for updating params = { - 'name': 'test4', - 'object': 'Ticket', - 'display': 'Test 4', - 'active': true, - 'data_type': 'input', + 'name': 'test4', + 'object': 'Ticket', + 'display': 'Test 4', + 'active': true, + 'data_type': 'input', 'data_option': { - 'default': 'test', - 'type': 'text', + 'default': 'test', + 'type': 'text', 'maxlength': 120 }, - 'screens': { + 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } }, - 'id': 'c-196' + 'id': 'c-196' } # update the object @@ -166,31 +166,31 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # token based on headers params = { - 'active': true, + 'active': true, 'data_option': { 'options': { 'false': 'no', - 'true': 'yes' + 'true': 'yes' } }, - 'data_type': 'boolean', - 'display': 'Boolean 2', - 'id': 'c-200', - 'name': 'bool2', - 'object': 'Ticket', - 'screens': { + 'data_type': 'boolean', + 'display': 'Boolean 2', + 'id': 'c-200', + 'name': 'bool2', + 'object': 'Ticket', + 'screens': { 'create_middle': { - 'ticket.agent' => { + 'ticket.agent' => { 'item_class': 'column', - 'shown': true + 'shown': true }, 'ticket.customer' => { 'item_class': 'column', - 'shown': true + 'shown': true } }, - 'edit': { - 'ticket.agent' => { + 'edit': { + 'ticket.agent' => { 'shown': true }, 'ticket.customer' => { @@ -215,42 +215,42 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # token based on headers params = { - 'active': true, + 'active': true, 'data_option': { 'options': { 'key1': 'foo' } }, - 'data_type': 'select', - 'display': 'Test 5', - 'id': 'c-204', - 'name': 'test5', - 'object': 'User', - 'screens': { + 'data_type': 'select', + 'display': 'Test 5', + 'id': 'c-204', + 'name': 'test5', + 'object': 'User', + 'screens': { 'create': { - 'admin.user' => { + 'admin.user' => { 'shown': true }, - 'ticket.agent' => { + 'ticket.agent' => { 'shown': true }, 'ticket.customer' => { 'shown': true } }, - 'edit': { - 'admin.user' => { + 'edit': { + 'admin.user' => { 'shown': true }, 'ticket.agent' => { 'shown': true } }, - 'view': { - 'admin.user' => { + 'view': { + 'admin.user' => { 'shown': true }, - 'ticket.agent' => { + 'ticket.agent' => { 'shown': true }, 'ticket.customer' => { @@ -281,43 +281,43 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # parameters for updating params = { - active: true, + active: true, data_option: { options: { key1: 'foo', key2: 'bar' } }, - data_type: 'select', - display: 'Test 7', - id: 'c-204', - name: 'test7', - object: 'User', - screens: { + data_type: 'select', + display: 'Test 7', + id: 'c-204', + name: 'test7', + object: 'User', + screens: { create: { - 'admin.user' => { + 'admin.user' => { shown: true }, - 'ticket.agent' => { + 'ticket.agent' => { shown: true }, 'ticket.customer' => { shown: true } }, - edit: { - 'admin.user' => { + edit: { + 'admin.user' => { shown: true }, 'ticket.agent' => { shown: true } }, - view: { - 'admin.user' => { + view: { + 'admin.user' => { shown: true }, - 'ticket.agent' => { + 'ticket.agent' => { shown: true }, 'ticket.customer' => { @@ -339,39 +339,39 @@ RSpec.describe 'ObjectManager Attributes', type: :request do it 'does converts string to boolean for default value for boolean data type with true (01)', db_strategy: :reset do params = { - 'name': "customerdescription#{rand(999_999_999)}", - 'object': 'Ticket', - 'display': "custom description#{rand(999_999_999)}", - 'active': true, - 'data_type': 'boolean', + 'name': "customerdescription#{rand(999_999_999)}", + 'object': 'Ticket', + 'display': "custom description#{rand(999_999_999)}", + 'active': true, + 'data_type': 'boolean', 'data_option': { 'options': { - 'true': '', + 'true': '', 'false': '', }, 'default': 'true', 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } } }, - 'id': 'c-201' + 'id': 'c-201' } authenticated_as(admin_user) @@ -390,33 +390,33 @@ RSpec.describe 'ObjectManager Attributes', type: :request do it 'does converts string to boolean for default value for boolean data type with false (02)', db_strategy: :reset do params = { - 'name': "customerdescription_#{rand(999_999_999)}", - 'object': 'Ticket', - 'display': "custom description #{rand(999_999_999)}", - 'active': true, - 'data_type': 'boolean', + 'name': "customerdescription_#{rand(999_999_999)}", + 'object': 'Ticket', + 'display': "custom description #{rand(999_999_999)}", + 'active': true, + 'data_type': 'boolean', 'data_option': { 'options': { - 'true': '', + 'true': '', 'false': '', }, 'default': 'false', 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } @@ -444,35 +444,35 @@ RSpec.describe 'ObjectManager Attributes', type: :request do migration = ObjectManager::Attribute.migration_execute params = { - 'name': 'test_attribute_referenced_by_an_overview', - 'object': 'Ticket', - 'display': 'Test Attribute', - 'active': true, - 'data_type': 'input', + 'name': 'test_attribute_referenced_by_an_overview', + 'object': 'Ticket', + 'display': 'Test Attribute', + 'active': true, + 'data_type': 'input', 'data_option': { - 'default': '', - 'type': 'text', + 'default': '', + 'type': 'text', 'maxlength': 120, - 'null': true, - 'options': {}, - 'relation': '' + 'null': true, + 'options': {}, + 'relation': '' }, - 'screens': { + 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } @@ -487,29 +487,29 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # 2. create an overview that uses the attribute params = { - name: 'test_overview', - roles: Role.where(name: 'Agent').pluck(:name), + name: 'test_overview', + roles: Role.where(name: 'Agent').pluck(:name), condition: { - 'ticket.state_id': { + 'ticket.state_id': { 'operator': 'is', - 'value': Ticket::State.all.pluck(:id), + 'value': Ticket::State.all.pluck(:id), }, 'ticket.test_attribute_referenced_by_an_overview': { 'operator': 'contains', - 'value': 'DUMMY' + 'value': 'DUMMY' }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, - user_ids: [ '1' ], + user_ids: [ '1' ], } if Overview.where('name like ?', '%test%').empty? @@ -539,35 +539,35 @@ RSpec.describe 'ObjectManager Attributes', type: :request do migration = ObjectManager::Attribute.migration_execute params = { - 'name': 'test_attribute_referenced_by_a_trigger', - 'object': 'Ticket', - 'display': 'Test Attribute', - 'active': true, - 'data_type': 'input', + 'name': 'test_attribute_referenced_by_a_trigger', + 'object': 'Ticket', + 'display': 'Test Attribute', + 'active': true, + 'data_type': 'input', 'data_option': { - 'default': '', - 'type': 'text', + 'default': '', + 'type': 'text', 'maxlength': 120, - 'null': true, - 'options': {}, - 'relation': '' + 'null': true, + 'options': {}, + 'relation': '' }, - 'screens': { + 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } @@ -582,11 +582,11 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # 2. create an trigger that uses the attribute params = { - name: 'test_trigger', + name: 'test_trigger', condition: { 'ticket.test_attribute_referenced_by_a_trigger': { 'operator': 'contains', - 'value': 'DUMMY' + 'value': 'DUMMY' } }, 'perform': { @@ -594,8 +594,8 @@ RSpec.describe 'ObjectManager Attributes', type: :request do 'value': '2' } }, - 'active': true, - 'id': 'c-3' + 'active': true, + 'id': 'c-3' } if Trigger.where('name like ?', '%test%').empty? @@ -625,35 +625,35 @@ RSpec.describe 'ObjectManager Attributes', type: :request do migration = ObjectManager::Attribute.migration_execute params = { - 'name': 'test_attribute_referenced_by_a_scheduler', - 'object': 'Ticket', - 'display': 'Test Attribute', - 'active': true, - 'data_type': 'input', + 'name': 'test_attribute_referenced_by_a_scheduler', + 'object': 'Ticket', + 'display': 'Test Attribute', + 'active': true, + 'data_type': 'input', 'data_option': { - 'default': '', - 'type': 'text', + 'default': '', + 'type': 'text', 'maxlength': 120, - 'null': true, - 'options': {}, - 'relation': '' + 'null': true, + 'options': {}, + 'relation': '' }, - 'screens': { + 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } @@ -668,9 +668,9 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # 2. create a scheduler that uses the attribute params = { - name: 'test_scheduler', - 'timeplan': { - 'days': { + name: 'test_scheduler', + 'timeplan': { + 'days': { 'Mon': true, 'Tue': false, 'Wed': false, @@ -679,17 +679,17 @@ RSpec.describe 'ObjectManager Attributes', type: :request do 'Sat': false, 'Sun': false }, - 'hours': { - '0': true, - '1': false, - '2': false, - '3': false, - '4': false, - '5': false, - '6': false, - '7': false, - '8': false, - '9': false, + 'hours': { + '0': true, + '1': false, + '2': false, + '3': false, + '4': false, + '5': false, + '6': false, + '7': false, + '8': false, + '9': false, '10': false, '11': false, '12': false, @@ -706,7 +706,7 @@ RSpec.describe 'ObjectManager Attributes', type: :request do '23': false }, 'minutes': { - '0': true, + '0': true, '10': false, '20': false, '30': false, @@ -714,21 +714,21 @@ RSpec.describe 'ObjectManager Attributes', type: :request do '50': false } }, - 'condition': { + 'condition': { 'ticket.test_attribute_referenced_by_a_scheduler': { 'operator': 'contains', - 'value': 'DUMMY' + 'value': 'DUMMY' } }, - 'perform': { + 'perform': { 'ticket.state_id': { 'value': '2' } }, 'disable_notification': true, - 'note': '', - 'active': true, - 'id': 'c-0' + 'note': '', + 'active': true, + 'id': 'c-0' } if Job.where('name like ?', '%test%').empty? @@ -758,35 +758,35 @@ RSpec.describe 'ObjectManager Attributes', type: :request do migration = ObjectManager::Attribute.migration_execute params = { - 'name': 'test_attribute_referenced_by_an_overview', - 'object': 'Ticket', - 'display': 'Test Attribute', - 'active': true, - 'data_type': 'input', + 'name': 'test_attribute_referenced_by_an_overview', + 'object': 'Ticket', + 'display': 'Test Attribute', + 'active': true, + 'data_type': 'input', 'data_option': { - 'default': '', - 'type': 'text', + 'default': '', + 'type': 'text', 'maxlength': 120, - 'null': true, - 'options': {}, - 'relation': '' + 'null': true, + 'options': {}, + 'relation': '' }, - 'screens': { + 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } @@ -797,35 +797,35 @@ RSpec.describe 'ObjectManager Attributes', type: :request do post '/api/v1/object_manager_attributes', params: params, as: :json params = { - 'name': 'test_attribute_referenced_by_an_overview', - 'object': 'User', - 'display': 'Test Attribute', - 'active': true, - 'data_type': 'input', + 'name': 'test_attribute_referenced_by_an_overview', + 'object': 'User', + 'display': 'Test Attribute', + 'active': true, + 'data_type': 'input', 'data_option': { - 'default': '', - 'type': 'text', + 'default': '', + 'type': 'text', 'maxlength': 120, - 'null': true, - 'options': {}, - 'relation': '' + 'null': true, + 'options': {}, + 'relation': '' }, - 'screens': { + 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } @@ -839,29 +839,29 @@ RSpec.describe 'ObjectManager Attributes', type: :request do # 2. create an overview that uses the attribute params = { - name: 'test_overview', - roles: Role.where(name: 'Agent').pluck(:name), + name: 'test_overview', + roles: Role.where(name: 'Agent').pluck(:name), condition: { - 'ticket.state_id': { + 'ticket.state_id': { 'operator': 'is', - 'value': Ticket::State.all.pluck(:id), + 'value': Ticket::State.all.pluck(:id), }, 'ticket.test_attribute_referenced_by_an_overview': { 'operator': 'contains', - 'value': 'DUMMY' + 'value': 'DUMMY' }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, - user_ids: [ '1' ], + user_ids: [ '1' ], } if Overview.where('name like ?', '%test%').empty? @@ -900,33 +900,33 @@ RSpec.describe 'ObjectManager Attributes', type: :request do it 'does verify if attribute type can not be changed (07)', db_strategy: :reset do params = { - 'name': "customerdescription_#{rand(999_999_999)}", - 'object': 'Ticket', - 'display': "custom description #{rand(999_999_999)}", - 'active': true, - 'data_type': 'boolean', + 'name': "customerdescription_#{rand(999_999_999)}", + 'object': 'Ticket', + 'display': "custom description #{rand(999_999_999)}", + 'active': true, + 'data_type': 'boolean', 'data_option': { 'options': { - 'true': '', + 'true': '', 'false': '', }, 'default': 'false', 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } } @@ -949,8 +949,8 @@ RSpec.describe 'ObjectManager Attributes', type: :request do params['data_type'] = 'input' params['data_option'] = { - 'default': 'test', - 'type': 'text', + 'default': 'test', + 'type': 'text', 'maxlength': 120 } @@ -964,32 +964,32 @@ RSpec.describe 'ObjectManager Attributes', type: :request do it 'does verify if attribute type can be changed (08)', db_strategy: :reset do params = { - 'name': "customerdescription_#{rand(999_999_999)}", - 'object': 'Ticket', - 'display': "custom description #{rand(999_999_999)}", - 'active': true, - 'data_type': 'input', + 'name': "customerdescription_#{rand(999_999_999)}", + 'object': 'Ticket', + 'display': "custom description #{rand(999_999_999)}", + 'active': true, + 'data_type': 'input', 'data_option': { - 'default': 'test', - 'type': 'text', + 'default': 'test', + 'type': 'text', 'maxlength': 120, }, - 'screens': { + 'screens': { 'create_middle': { 'ticket.customer': { - 'shown': true, + 'shown': true, 'item_class': 'column' }, - 'ticket.agent': { - 'shown': true, + 'ticket.agent': { + 'shown': true, 'item_class': 'column' } }, - 'edit': { + 'edit': { 'ticket.customer': { 'shown': true }, - 'ticket.agent': { + 'ticket.agent': { 'shown': true } }, diff --git a/spec/requests/integration/placetel_spec.rb b/spec/requests/integration/placetel_spec.rb index 3b392a668..e7f531402 100644 --- a/spec/requests/integration/placetel_spec.rb +++ b/spec/requests/integration/placetel_spec.rb @@ -8,31 +8,31 @@ RSpec.describe 'Integration Placetel', type: :request do let!(:customer_user1) do create( :customer_user, - login: 'ticket-caller_id_cti-customer1@example.com', + login: 'ticket-caller_id_cti-customer1@example.com', firstname: 'CallerId', - lastname: 'Customer1', - phone: '+49 99999 222222', - fax: '+49 99999 222223', - mobile: '+01114100300', - note: 'Phone at home: +49 99999 222224', + lastname: 'Customer1', + phone: '+49 99999 222222', + fax: '+49 99999 222223', + mobile: '+01114100300', + note: 'Phone at home: +49 99999 222224', ) end let!(:customer_user2) do create( :customer_user, - login: 'ticket-caller_id_cti-customer2@example.com', + login: 'ticket-caller_id_cti-customer2@example.com', firstname: 'CallerId', - lastname: 'Customer2', - phone: '+49 99999 222222 2', + lastname: 'Customer2', + phone: '+49 99999 222222 2', ) end let!(:customer_user3) do create( :customer_user, - login: 'ticket-caller_id_cti-customer3@example.com', + login: 'ticket-caller_id_cti-customer3@example.com', firstname: 'CallerId', - lastname: 'Customer3', - phone: '+49 99999 222222 2', + lastname: 'Customer3', + phone: '+49 99999 222222 2', ) end @@ -42,26 +42,26 @@ RSpec.describe 'Integration Placetel', type: :request do Setting.set('placetel_integration', true) Setting.set('placetel_config', { outbound: { - routing_table: [ + routing_table: [ { - dest: '41*', + dest: '41*', caller_id: '41715880339000', }, { - dest: '491714000000', + dest: '491714000000', caller_id: '41715880339000', }, ], default_caller_id: '4930777000000', }, - inbound: { + inbound: { block_caller_ids: [ { caller_id: '491715000000', - note: 'some note', + note: 'some note', } ], - notify_user_ids: { + notify_user_ids: { 2 => true, 4 => false, }, diff --git a/spec/requests/integration/sipgate_spec.rb b/spec/requests/integration/sipgate_spec.rb index bee8673ee..472a55270 100644 --- a/spec/requests/integration/sipgate_spec.rb +++ b/spec/requests/integration/sipgate_spec.rb @@ -8,31 +8,31 @@ RSpec.describe 'Integration Sipgate', type: :request do let!(:customer_user1) do create( :customer_user, - login: 'ticket-caller_id_cti-customer1@example.com', + login: 'ticket-caller_id_cti-customer1@example.com', firstname: 'CallerId', - lastname: 'Customer1', - phone: '+49 99999 222222', - fax: '+49 99999 222223', - mobile: '+4912347114711', - note: 'Phone at home: +49 99999 222224', + lastname: 'Customer1', + phone: '+49 99999 222222', + fax: '+49 99999 222223', + mobile: '+4912347114711', + note: 'Phone at home: +49 99999 222224', ) end let!(:customer_user2) do create( :customer_user, - login: 'ticket-caller_id_cti-customer2@example.com', + login: 'ticket-caller_id_cti-customer2@example.com', firstname: 'CallerId', - lastname: 'Customer2', - phone: '+49 99999 222222 2', + lastname: 'Customer2', + phone: '+49 99999 222222 2', ) end let!(:customer_user3) do create( :customer_user, - login: 'ticket-caller_id_cti-customer3@example.com', + login: 'ticket-caller_id_cti-customer3@example.com', firstname: 'CallerId', - lastname: 'Customer3', - phone: '+49 99999 222222 2', + lastname: 'Customer3', + phone: '+49 99999 222222 2', ) end @@ -42,26 +42,26 @@ RSpec.describe 'Integration Sipgate', type: :request do Setting.set('sipgate_integration', true) Setting.set('sipgate_config', { outbound: { - routing_table: [ + routing_table: [ { - dest: '41*', + dest: '41*', caller_id: '41715880339000', }, { - dest: '491714000000', + dest: '491714000000', caller_id: '41715880339000', }, ], default_caller_id: '4930777000000', }, - inbound: { + inbound: { block_caller_ids: [ { caller_id: '491715000000', - note: 'some note', + note: 'some note', } ], - notify_user_ids: { + notify_user_ids: { 2 => true, 4 => false, }, diff --git a/spec/requests/integration/twilio_sms_spec.rb b/spec/requests/integration/twilio_sms_spec.rb index 7d89c0cd5..14b21eaea 100644 --- a/spec/requests/integration/twilio_sms_spec.rb +++ b/spec/requests/integration/twilio_sms_spec.rb @@ -17,13 +17,13 @@ RSpec.describe 'Twilio SMS', type: :request do UserInfo.current_user_id = 1 channel = create( :channel, - area: 'Sms::Account', - options: { - adapter: 'sms/twilio', + area: 'Sms::Account', + options: { + adapter: 'sms/twilio', webhook_token: 'f409460e50f76d331fdac8ba7b7963b6', - account_id: '111', - token: '223', - sender: '333', + account_id: '111', + token: '223', + sender: '333', }, group_id: nil, ) @@ -129,8 +129,8 @@ RSpec.describe 'Twilio SMS', type: :request do # reply by agent params = { ticket_id: ticket.id, - body: 'some test', - type: 'sms', + body: 'some test', + type: 'sms', } authenticated_as(agent_user) post '/api/v1/ticket_articles', params: params, as: :json @@ -144,16 +144,16 @@ RSpec.describe 'Twilio SMS', type: :request do stub_request(:post, 'https://api.twilio.com/2010-04-01/Accounts/111/Messages.json') .with( - body: { + body: { 'Body' => 'some test', 'From' => '333', - 'To' => nil, + 'To' => nil, }, headers: { - 'Accept' => 'application/json', + 'Accept' => 'application/json', 'Accept-Charset' => 'utf-8', - 'Authorization' => 'Basic MTExOjIyMw==', - 'Content-Type' => 'application/x-www-form-urlencoded', + 'Authorization' => 'Basic MTExOjIyMw==', + 'Content-Type' => 'application/x-www-form-urlencoded', } ).to_return(status: 200, body: '', headers: {}) @@ -173,7 +173,7 @@ RSpec.describe 'Twilio SMS', type: :request do customer = create( :customer_user, - email: 'me@example.com', + email: 'me@example.com', mobile: '01710000000', ) Observer::Transaction.commit @@ -185,13 +185,13 @@ RSpec.describe 'Twilio SMS', type: :request do UserInfo.current_user_id = 1 channel = create( :channel, - area: 'Sms::Account', + area: 'Sms::Account', options: { - adapter: 'sms/twilio', + adapter: 'sms/twilio', webhook_token: 'f409460e50f76d331fdac8ba7b7963b6', - account_id: '111', - token: '223', - sender: '333', + account_id: '111', + token: '223', + sender: '333', }, ) diff --git a/spec/requests/integration/twitter_webhook_spec.rb b/spec/requests/integration/twitter_webhook_spec.rb index e02cf7a7d..65bcde478 100644 --- a/spec/requests/integration/twitter_webhook_spec.rb +++ b/spec/requests/integration/twitter_webhook_spec.rb @@ -40,20 +40,20 @@ RSpec.describe 'Twitter Webhook Integration', type: :request do custom_options: { auth: { external_credential_id: external_credential.id, - oauth_token: 'AAA', - oauth_token_secret: 'BBB', - consumer_key: 'CCC', - consumer_secret: 'DDD', + oauth_token: 'AAA', + oauth_token_secret: 'BBB', + consumer_key: 'CCC', + consumer_secret: 'DDD', }, user: { - id: 123, - name: 'Zammad HQ', + id: 123, + name: 'Zammad HQ', screen_name: 'zammadhq', }, sync: { - limit: 20, - track_retweets: false, - search: [ + limit: 20, + track_retweets: false, + search: [ { term: '#zammad', group_id: Group.first.id.to_s }, diff --git a/spec/requests/integration/user_device_spec.rb b/spec/requests/integration/user_device_spec.rb index 7bed010ea..b1c7f9927 100644 --- a/spec/requests/integration/user_device_spec.rb +++ b/spec/requests/integration/user_device_spec.rb @@ -195,7 +195,7 @@ RSpec.describe 'User Device', type: :request, sends_notification_emails: true do create( :user_device, - user_id: admin_user.id, + user_id: admin_user.id, fingerprint: 'fingerprintI', ) diff --git a/spec/requests/organization_spec.rb b/spec/requests/organization_spec.rb index 405a3c8d4..1809c3a8f 100644 --- a/spec/requests/organization_spec.rb +++ b/spec/requests/organization_spec.rb @@ -14,24 +14,24 @@ RSpec.describe 'Organization', type: :request, searchindex: true do let!(:organization) do create( :organization, - name: 'Rest Org #1', - note: 'Rest Org #1', + name: 'Rest Org #1', + note: 'Rest Org #1', created_at: '2017-09-05 10:00:00', ) end let!(:organization2) do create( :organization, - name: 'Rest Org #2', - note: 'Rest Org #2', + name: 'Rest Org #2', + note: 'Rest Org #2', created_at: '2017-09-05 11:00:00', ) end let!(:organization3) do create( :organization, - name: 'Rest Org #3', - note: 'Rest Org #3', + name: 'Rest Org #3', + note: 'Rest Org #3', created_at: '2017-09-05 12:00:00', ) end @@ -219,8 +219,8 @@ RSpec.describe 'Organization', type: :request, searchindex: true do it 'does organization show and response format' do organization = create( :organization, - name: 'Rest Org NEW', - members: [customer_user], + name: 'Rest Org NEW', + members: [customer_user], updated_by_id: admin_user.id, created_by_id: admin_user.id, ) @@ -283,8 +283,8 @@ RSpec.describe 'Organization', type: :request, searchindex: true do it 'does organization index and response format' do organization = create( :organization, - name: 'Rest Org NEW', - members: [customer_user], + name: 'Rest Org NEW', + members: [customer_user], updated_by_id: admin_user.id, created_by_id: admin_user.id, ) @@ -352,7 +352,7 @@ RSpec.describe 'Organization', type: :request, searchindex: true do it 'does ticket create and response format' do params = { - name: 'Rest Org NEW', + name: 'Rest Org NEW', members: [customer_user.login], } @@ -399,8 +399,8 @@ RSpec.describe 'Organization', type: :request, searchindex: true do it 'does ticket update and response formats' do organization = create( :organization, - name: 'Rest Org NEW', - members: [customer_user], + name: 'Rest Org NEW', + members: [customer_user], updated_by_id: admin_user.id, created_by_id: admin_user.id, ) @@ -482,21 +482,21 @@ RSpec.describe 'Organization', type: :request, searchindex: true do UserInfo.current_user_id = 1 customer1 = create( :customer_user, - login: 'customer1-members@example.com', + login: 'customer1-members@example.com', firstname: 'Member', - lastname: 'Customer', - email: 'customer1-members@example.com', - password: 'customerpw', - active: true, + lastname: 'Customer', + email: 'customer1-members@example.com', + password: 'customerpw', + active: true, ) customer2 = create( :customer_user, - login: 'customer2-members@example.com', + login: 'customer2-members@example.com', firstname: 'Member', - lastname: 'Customer', - email: 'customer2-members@example.com', - password: 'customerpw', - active: true, + lastname: 'Customer', + email: 'customer2-members@example.com', + password: 'customerpw', + active: true, ) UserInfo.current_user_id = nil diff --git a/spec/requests/overview_spec.rb b/spec/requests/overview_spec.rb index a46ada2f4..6bc88debf 100644 --- a/spec/requests/overview_spec.rb +++ b/spec/requests/overview_spec.rb @@ -10,23 +10,23 @@ RSpec.describe 'Overviews', type: :request do it 'does return no permissions' do params = { - name: 'Overview2', - link: 'my_overview', - roles: Role.where(name: 'Agent').pluck(:name), + name: 'Overview2', + link: 'my_overview', + roles: Role.where(name: 'Agent').pluck(:name), condition: { 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3], + value: [1, 2, 3], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, } @@ -42,23 +42,23 @@ RSpec.describe 'Overviews', type: :request do it 'does create overviews' do params = { - name: 'Overview2', - link: 'my_overview', - roles: Role.where(name: 'Agent').pluck(:name), + name: 'Overview2', + link: 'my_overview', + roles: Role.where(name: 'Agent').pluck(:name), condition: { 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3], + value: [1, 2, 3], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, } @@ -80,50 +80,50 @@ RSpec.describe 'Overviews', type: :request do it 'does set mass prio' do roles = Role.where(name: 'Agent') overview1 = Overview.create!( - name: 'Overview1', - link: 'my_overview', - roles: roles, - condition: { + name: 'Overview1', + link: 'my_overview', + roles: roles, + condition: { 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3], + value: [1, 2, 3], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, - prio: 1, + prio: 1, updated_by_id: 1, created_by_id: 1, ) overview2 = Overview.create!( - name: 'Overview2', - link: 'my_overview', - roles: roles, - condition: { + name: 'Overview2', + link: 'my_overview', + roles: roles, + condition: { 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3], + value: [1, 2, 3], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, - prio: 2, + prio: 2, updated_by_id: 1, created_by_id: 1, ) @@ -150,25 +150,25 @@ RSpec.describe 'Overviews', type: :request do it 'does create an overview with group_by direction' do params = { - name: 'Overview2', - link: 'my_overview', - roles: Role.where(name: 'Agent').pluck(:name), - condition: { + name: 'Overview2', + link: 'my_overview', + roles: Role.where(name: 'Agent').pluck(:name), + condition: { 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3], + value: [1, 2, 3], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - group_by: 'priority', + group_by: 'priority', group_direction: 'ASC', - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, } diff --git a/spec/requests/settings_spec.rb b/spec/requests/settings_spec.rb index e396592a9..b17d7dafd 100644 --- a/spec/requests/settings_spec.rb +++ b/spec/requests/settings_spec.rb @@ -72,10 +72,10 @@ RSpec.describe 'Settings', type: :request do # update setting = Setting.find_by(name: 'product_name') params = { - id: setting.id, - name: 'some_new_name', + id: setting.id, + name: 'some_new_name', preferences: { - permission: ['admin.branding', 'admin.some_new_permission'], + permission: ['admin.branding', 'admin.some_new_permission'], some_new_key: true, } } @@ -90,10 +90,10 @@ RSpec.describe 'Settings', type: :request do # update setting = Setting.find_by(name: 'api_token_access') params = { - id: setting.id, - name: 'some_new_name', + id: setting.id, + name: 'some_new_name', preferences: { - permission: ['admin.branding', 'admin.some_new_permission'], + permission: ['admin.branding', 'admin.some_new_permission'], some_new_key: true, } } @@ -148,10 +148,10 @@ RSpec.describe 'Settings', type: :request do # update setting = Setting.find_by(name: 'product_name') params = { - id: setting.id, - name: 'some_new_name', + id: setting.id, + name: 'some_new_name', preferences: { - permission: ['admin.branding', 'admin.some_new_permission'], + permission: ['admin.branding', 'admin.some_new_permission'], some_new_key: true, } } @@ -162,10 +162,10 @@ RSpec.describe 'Settings', type: :request do # update setting = Setting.find_by(name: 'api_token_access') params = { - id: setting.id, - name: 'some_new_name', + id: setting.id, + name: 'some_new_name', preferences: { - permission: ['admin.branding', 'admin.some_new_permission'], + permission: ['admin.branding', 'admin.some_new_permission'], some_new_key: true, } } diff --git a/spec/requests/taskbar_spec.rb b/spec/requests/taskbar_spec.rb index bf7f67a7c..f13801c23 100644 --- a/spec/requests/taskbar_spec.rb +++ b/spec/requests/taskbar_spec.rb @@ -13,23 +13,23 @@ RSpec.describe 'Taskbars', type: :request do it 'does task ownership' do params = { - user_id: customer_user.id, + user_id: customer_user.id, client_id: '123', - key: 'Ticket-5', - callback: 'TicketZoom', - state: { - ticket: { + key: 'Ticket-5', + callback: 'TicketZoom', + state: { + ticket: { owner_id: agent_user.id, }, article: {}, }, - params: { + params: { ticket_id: 5, - shown: true, + shown: true, }, - prio: 3, - notify: false, - active: false, + prio: 3, + notify: false, + active: false, } authenticated_as(agent_user) @@ -45,7 +45,7 @@ RSpec.describe 'Taskbars', type: :request do params[:user_id] = customer_user.id params[:params] = { ticket_id: 5, - shown: false, + shown: false, } put "/api/v1/taskbar/#{taskbar_id}", params: params, as: :json expect(response).to have_http_status(200) diff --git a/spec/requests/ticket/article_attachments_spec.rb b/spec/requests/ticket/article_attachments_spec.rb index bfbdaec32..c908eb2c3 100644 --- a/spec/requests/ticket/article_attachments_spec.rb +++ b/spec/requests/ticket/article_attachments_spec.rb @@ -13,11 +13,11 @@ RSpec.describe 'Ticket Article Attachments', type: :request do article1 = create(:ticket_article, ticket_id: ticket1.id) store1 = Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: 'some content', - filename: 'some_file.txt', - preferences: { + object: 'Ticket::Article', + o_id: article1.id, + data: 'some content', + filename: 'some_file.txt', + preferences: { 'Content-Type' => 'text/plain', }, created_by_id: 1, diff --git a/spec/requests/ticket/article_spec.rb b/spec/requests/ticket/article_spec.rb index 23beff28e..9d45e2684 100644 --- a/spec/requests/ticket/article_spec.rb +++ b/spec/requests/ticket/article_spec.rb @@ -16,10 +16,10 @@ RSpec.describe 'Ticket Article', type: :request do it 'does ticket create with agent and articles' do params = { - title: 'a new ticket #1', - group: 'Users', + title: 'a new ticket #1', + group: 'Users', customer_id: customer_user.id, - article: { + article: { body: 'some body', } } @@ -28,10 +28,10 @@ RSpec.describe 'Ticket Article', type: :request do expect(response).to have_http_status(201) params = { - ticket_id: json_response['id'], + ticket_id: json_response['id'], content_type: 'text/plain', # or text/html - body: 'some body', - type: 'note', + body: 'some body', + type: 'note', } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -48,12 +48,12 @@ RSpec.describe 'Ticket Article', type: :request do expect(ticket.articles[1].attachments.count).to eq(0) params = { - ticket_id: json_response['ticket_id'], + ticket_id: json_response['ticket_id'], content_type: 'text/html', # or text/html - body: 'some body Red dot', - type: 'note', + type: 'note', } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -77,13 +77,13 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO expect(ticket.articles[2].attachments[0]['preferences']['Content-ID']).to match(/@zammad.example.com/) params = { - ticket_id: json_response['ticket_id'], + ticket_id: json_response['ticket_id'], content_type: 'text/html', # or text/html - body: 'some body', - type: 'note', - attachments: [ - 'filename' => 'some_file.txt', - 'data' => 'dGVzdCAxMjM=', + body: 'some body', + type: 'note', + attachments: [ + 'filename' => 'some_file.txt', + 'data' => 'dGVzdCAxMjM=', 'mime-type' => 'text/plain', ], } @@ -112,11 +112,11 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO expect(json_response['attachments'][0]['preferences']['Mime-Type']).to eq('text/plain') params = { - ticket_id: json_response['ticket_id'], + ticket_id: json_response['ticket_id'], content_type: 'text/plain', - body: 'some body', - type: 'note', - preferences: { + body: 'some body', + type: 'note', + preferences: { some_key1: 123, }, } @@ -132,7 +132,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO expect(ticket.articles.count).to eq(5) params = { - body: 'some body 2', + body: 'some body 2', preferences: { some_key2: 'abc', }, @@ -152,8 +152,8 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO it 'does ticket create with customer and articles' do params = { - title: 'a new ticket #2', - group: 'Users', + title: 'a new ticket #2', + group: 'Users', article: { body: 'some body', } @@ -163,10 +163,10 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO expect(response).to have_http_status(201) params = { - ticket_id: json_response['id'], + ticket_id: json_response['id'], content_type: 'text/plain', # or text/html - body: 'some body', - type: 'note', + body: 'some body', + type: 'note', } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -184,11 +184,11 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO expect(ticket.articles[1].attachments.count).to eq(0) params = { - ticket_id: json_response['ticket_id'], + ticket_id: json_response['ticket_id'], content_type: 'text/plain', # or text/html - body: 'some body', - sender: 'Agent', - type: 'note', + body: 'some body', + sender: 'Agent', + type: 'note', } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -208,12 +208,12 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO expect(ticket.articles[2].attachments.count).to eq(0) params = { - ticket_id: json_response['ticket_id'], + ticket_id: json_response['ticket_id'], content_type: 'text/plain', # or text/html - body: 'some body 2', - sender: 'Agent', - type: 'note', - internal: true, + body: 'some body 2', + sender: 'Agent', + type: 'note', + internal: true, } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -237,9 +237,9 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO article = create( :ticket_article, ticket_id: ticket.id, - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) expect(ticket.articles.count).to eq(5) expect(ticket.articles[4].sender.name).to eq('Agent') @@ -265,13 +265,13 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO it 'does create phone ticket for customer and expected origin_by_id' do params = { - title: 'a new ticket #1', - group: 'Users', + title: 'a new ticket #1', + group: 'Users', customer_id: customer_user.id, - article: { - body: 'some body', + article: { + body: 'some body', sender: 'Customer', - type: 'phone', + type: 'phone', } } authenticated_as(agent_user) @@ -287,13 +287,13 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO it 'does create phone ticket by customer and manipulate origin_by_id' do params = { - title: 'a new ticket #1', - group: 'Users', + title: 'a new ticket #1', + group: 'Users', customer_id: customer_user.id, - article: { - body: 'some body', - sender: 'Customer', - type: 'phone', + article: { + body: 'some body', + sender: 'Customer', + type: 'phone', origin_by_id: 1, } } @@ -310,18 +310,18 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO ticket = create(:ticket) article = create( :ticket_article, - ticket_id: ticket.id, - type: Ticket::Article::Type.lookup(name: 'note'), - sender: Ticket::Article::Sender.lookup(name: 'Customer'), - body: 'test test ', + ticket_id: ticket.id, + type: Ticket::Article::Type.lookup(name: 'note'), + sender: Ticket::Article::Sender.lookup(name: 'Customer'), + body: 'test test ', content_type: 'text/html', ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file1_normally_should_be_an_image', - filename: 'some_file1.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file1_normally_should_be_an_image', + filename: 'some_file1.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938@zammad.example.com', @@ -330,11 +330,11 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file2_normally_should_be_an_image', - filename: 'some_file2.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file2_normally_should_be_an_image', + filename: 'some_file2.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938.2@zammad.example.com', @@ -343,35 +343,35 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file3_normally_should_be_an_image', - filename: 'some_file3.jpg', - preferences: { - 'Content-Type' => 'image/jpeg', - 'Mime-Type' => 'image/jpeg', - 'Content-ID' => '15.274327094.140938.3@zammad.example.com', + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file3_normally_should_be_an_image', + filename: 'some_file3.jpg', + preferences: { + 'Content-Type' => 'image/jpeg', + 'Mime-Type' => 'image/jpeg', + 'Content-ID' => '15.274327094.140938.3@zammad.example.com', }, created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file4_normally_should_be_an_image', - filename: 'some_file4.jpg', - preferences: { - 'Content-Type' => 'image/jpeg', - 'Mime-Type' => 'image/jpeg', - 'Content-ID' => '15.274327094.140938.4@zammad.example.com', + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file4_normally_should_be_an_image', + filename: 'some_file4.jpg', + preferences: { + 'Content-Type' => 'image/jpeg', + 'Mime-Type' => 'image/jpeg', + 'Content-ID' => '15.274327094.140938.4@zammad.example.com', }, created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file1_normally_should_be_an_pdf', - filename: 'Rechnung_RE-2018-200.pdf', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file1_normally_should_be_an_pdf', + filename: 'Rechnung_RE-2018-200.pdf', + preferences: { 'Content-Type' => 'application/octet-stream; name="Rechnung_RE-2018-200.pdf"', 'Mime-Type' => 'application/octet-stream', 'Content-ID' => '8AB0BEC88984EE4EBEF643C79C8E0346@zammad.example.com', @@ -406,20 +406,20 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO ) article = create( :ticket_article, - ticket_id: ticket.id, - type: Ticket::Article::Type.lookup(name: 'note'), - sender: Ticket::Article::Sender.lookup(name: 'Customer'), - body: 'test ', - content_type: 'text/plain', + ticket_id: ticket.id, + type: Ticket::Article::Type.lookup(name: 'note'), + sender: Ticket::Article::Sender.lookup(name: 'Customer'), + body: 'test ', + content_type: 'text/plain', updated_by_id: 1, created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file1_normally_should_be_an_image', - filename: 'some_file1.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file1_normally_should_be_an_image', + filename: 'some_file1.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938@zammad.example.com', @@ -428,11 +428,11 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file1_normally_should_be_an_image', - filename: 'some_file2.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file1_normally_should_be_an_image', + filename: 'some_file2.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938.2@zammad.example.com', @@ -441,11 +441,11 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file1_normally_should_be_an_pdf', - filename: 'Rechnung_RE-2018-200.pdf', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file1_normally_should_be_an_pdf', + filename: 'Rechnung_RE-2018-200.pdf', + preferences: { 'Content-Type' => 'application/octet-stream; name="Rechnung_RE-2018-200.pdf"', 'Mime-Type' => 'application/octet-stream', 'Content-ID' => '8AB0BEC88984EE4EBEF643C79C8E0346@zammad.example.com', diff --git a/spec/requests/ticket/escalation_spec.rb b/spec/requests/ticket/escalation_spec.rb index 428dde87f..eb000c242 100644 --- a/spec/requests/ticket/escalation_spec.rb +++ b/spec/requests/ticket/escalation_spec.rb @@ -11,56 +11,56 @@ RSpec.describe 'Ticket Escalation', type: :request do let!(:calendar) do create( :calendar, - name: 'Escalation Test', - timezone: 'Europe/Berlin', + name: 'Escalation Test', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, tue: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, wed: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, thu: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, fri: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, sat: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, sun: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, }, - default: true, - ical_url: nil, + default: true, + ical_url: nil, ) end let!(:sla) do create( :sla, - name: 'test sla 1', - condition: { + name: 'test sla 1', + condition: { 'ticket.title' => { operator: 'contains', - value: 'some value 123', + value: 'some value 123', }, }, first_response_time: 60, - update_time: 180, - solution_time: 240, - calendar: calendar, + update_time: 180, + solution_time: 240, + calendar: calendar, ) end let!(:mail_group) do @@ -71,8 +71,8 @@ RSpec.describe 'Ticket Escalation', type: :request do it 'does escalate by ticket created via web' do params = { - title: 'some value 123', - group: mail_group.name, + title: 'some value 123', + group: mail_group.name, article: { body: 'some test 123', }, @@ -121,11 +121,11 @@ Some Text" travel 3.hours params = { - title: 'some value 123 - update', + title: 'some value 123 - update', article: { body: 'some test 123', type: 'email', - to: 'customer@example.com', + to: 'customer@example.com', }, } authenticated_as(agent_user) diff --git a/spec/requests/ticket_spec.rb b/spec/requests/ticket_spec.rb index 5b4851ab4..aba6c348a 100644 --- a/spec/requests/ticket_spec.rb +++ b/spec/requests/ticket_spec.rb @@ -14,10 +14,10 @@ RSpec.describe 'Ticket', type: :request do let!(:customer_user) do create( :customer_user, - login: 'tickets-customer1@example.com', + login: 'tickets-customer1@example.com', firstname: 'Tickets', - lastname: 'Customer1', - email: 'tickets-customer1@example.com', + lastname: 'Customer1', + email: 'tickets-customer1@example.com', ) end @@ -25,12 +25,12 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - missing group (01.01)' do params = { - title: 'a new ticket #1', + title: 'a new ticket #1', article: { content_type: 'text/plain', # or text/html - body: 'some body', - sender: 'Customer', - type: 'note', + body: 'some body', + sender: 'Customer', + type: 'note', }, } authenticated_as(agent_user) @@ -42,13 +42,13 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - wrong group (01.02)' do params = { - title: 'a new ticket #2', - group: 'not_existing', + title: 'a new ticket #2', + group: 'not_existing', article: { content_type: 'text/plain', # or text/html - body: 'some body', - sender: 'Customer', - type: 'note', + body: 'some body', + sender: 'Customer', + type: 'note', }, } authenticated_as(agent_user) @@ -60,12 +60,12 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - missing article.body (01.03)' do params = { - title: 'a new ticket #3', - group: ticket_group.name, - priority: '2 normal', - state: 'new', + title: 'a new ticket #3', + group: ticket_group.name, + priority: '2 normal', + state: 'new', customer_id: customer_user.id, - article: {}, + article: {}, } authenticated_as(agent_user) post '/api/v1/tickets', params: params, as: :json @@ -76,12 +76,12 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article (01.03)' do params = { - title: 'a new ticket #3', - group: ticket_group.name, - priority: '2 normal', - state: 'new', + title: 'a new ticket #3', + group: ticket_group.name, + priority: '2 normal', + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } @@ -98,12 +98,12 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article and customer.email (01.04)' do params = { - title: 'a new ticket #3', - group: ticket_group.name, + title: 'a new ticket #3', + group: ticket_group.name, priority: '2 normal', - state: 'new', + state: 'new', customer: customer_user.email, - article: { + article: { body: 'some test 123', }, } @@ -120,13 +120,13 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - wrong owner_id - 0 (01.05)' do params = { - title: 'a new ticket #4', - group: ticket_group.name, - priority: '2 normal', - owner_id: 0, - state: 'new', + title: 'a new ticket #4', + group: ticket_group.name, + priority: '2 normal', + owner_id: 0, + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } @@ -139,13 +139,13 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - wrong owner_id - "" (01.06)' do params = { - title: 'a new ticket #5', - group: ticket_group.name, - priority: '2 normal', - owner_id: '', - state: 'new', + title: 'a new ticket #5', + group: ticket_group.name, + priority: '2 normal', + owner_id: '', + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } @@ -162,13 +162,13 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - wrong owner_id - 99999 (01.07)' do params = { - title: 'a new ticket #6', - group: ticket_group.name, - priority: '2 normal', - owner_id: 99_999, - state: 'new', + title: 'a new ticket #6', + group: ticket_group.name, + priority: '2 normal', + owner_id: 99_999, + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } @@ -181,13 +181,13 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - wrong owner_id - nil (01.08)' do params = { - title: 'a new ticket #7', - group: ticket_group.name, - priority: '2 normal', - owner_id: nil, - state: 'new', + title: 'a new ticket #7', + group: ticket_group.name, + priority: '2 normal', + owner_id: nil, + state: 'new', customer_id: customer_user.id, - article: { + article: { body: 'some test 123', }, } @@ -204,12 +204,12 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article with guess customer (01.09)' do params = { - title: 'a new ticket #9', - group: ticket_group.name, - priority: '2 normal', - state: 'new', + title: 'a new ticket #9', + group: ticket_group.name, + priority: '2 normal', + state: 'new', customer_id: 'guess:some_new_customer@example.com', - article: { + article: { body: 'some test 123', }, } @@ -226,10 +226,10 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article with guess customer (01.10)' do params = { - title: 'a new ticket #10', - group: ticket_group.name, + title: 'a new ticket #10', + group: ticket_group.name, customer_id: 'guess:some_new_customer@example.com', - article: { + article: { body: 'some test 123', }, } @@ -246,14 +246,14 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article with customer hash (01.11)' do params = { - title: 'a new ticket #11', - group: ticket_group.name, + title: 'a new ticket #11', + group: ticket_group.name, customer: { firstname: 'some firstname', - lastname: 'some lastname', - email: 'some_new_customer@example.com', + lastname: 'some lastname', + email: 'some_new_customer@example.com', }, - article: { + article: { body: 'some test 123', }, } @@ -270,15 +270,15 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article with customer hash with article.origin_by (01.11)' do params = { - title: 'a new ticket #11.1', - group: ticket_group.name, + title: 'a new ticket #11.1', + group: ticket_group.name, customer: { firstname: 'some firstname', - lastname: 'some lastname', - email: 'some_new_customer@example.com', + lastname: 'some lastname', + email: 'some_new_customer@example.com', }, - article: { - body: 'some test 123', + article: { + body: 'some test 123', origin_by: 'some_new_customer@example.com', }, } @@ -303,16 +303,16 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article with customer hash with article.origin_by (01.11)' do params = { - title: 'a new ticket #11.2', - group: ticket_group.name, + title: 'a new ticket #11.2', + group: ticket_group.name, customer: { firstname: 'some firstname', - lastname: 'some lastname', - email: 'some_new_customer@example.com', + lastname: 'some lastname', + email: 'some_new_customer@example.com', }, - article: { - sender: 'Customer', - body: 'some test 123', + article: { + sender: 'Customer', + body: 'some test 123', origin_by: 'some_new_customer@example.com', }, } @@ -337,17 +337,17 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article with customer hash with article.origin_by (01.11)' do params = { - title: 'a new ticket #11.3', - group: ticket_group.name, + title: 'a new ticket #11.3', + group: ticket_group.name, customer: { firstname: 'some firstname', - lastname: 'some lastname', - email: 'some_new_customer@example.com', + lastname: 'some lastname', + email: 'some_new_customer@example.com', }, - article: { - sender: 'Agent', - from: 'somebody', - body: 'some test 123', + article: { + sender: 'Agent', + from: 'somebody', + body: 'some test 123', origin_by: 'some_new_customer@example.com', }, } @@ -372,16 +372,16 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article with customer hash with article.origin_by (01.11)' do params = { - title: 'a new ticket #11.4', - group: ticket_group.name, + title: 'a new ticket #11.4', + group: ticket_group.name, customer: { firstname: 'some firstname', - lastname: 'some lastname', - email: 'some_new_customer@example.com', + lastname: 'some lastname', + email: 'some_new_customer@example.com', }, - article: { - sender: 'Customer', - body: 'some test 123', + article: { + sender: 'Customer', + body: 'some test 123', origin_by: customer_user.login, }, } @@ -406,10 +406,10 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article with missing body - with customer.id (01.12)' do params = { - title: 'a new ticket #12', - group: ticket_group.name, + title: 'a new ticket #12', + group: ticket_group.name, customer_id: customer_user.id, - article: { + article: { subject: 'some test 123', }, } @@ -422,15 +422,15 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article and attachment with customer (01.13)' do params = { - title: 'a new ticket #13', - group: ticket_group.name, + title: 'a new ticket #13', + group: ticket_group.name, customer_id: customer_user.id, - article: { - subject: 'some test 123', - body: 'some test 123', + article: { + subject: 'some test 123', + body: 'some test 123', attachments: [ - 'filename' => 'some_file.txt', - 'data' => 'dGVzdCAxMjM=', + 'filename' => 'some_file.txt', + 'data' => 'dGVzdCAxMjM=', 'mime-type' => 'text/plain', ], }, @@ -457,21 +457,21 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article and attachment with customer (01.14)' do params = { - title: 'a new ticket #14', - group: ticket_group.name, + title: 'a new ticket #14', + group: ticket_group.name, customer_id: customer_user.id, - article: { - subject: 'some test 123', - body: 'some test 123', + article: { + subject: 'some test 123', + body: 'some test 123', attachments: [ { - 'filename' => 'some_file1.txt', - 'data' => 'dGVzdCAxMjM=', + 'filename' => 'some_file1.txt', + 'data' => 'dGVzdCAxMjM=', 'mime-type' => 'text/plain', }, { - 'filename' => 'some_file2.txt', - 'data' => 'w6TDtsO8w58=', + 'filename' => 'some_file2.txt', + 'data' => 'w6TDtsO8w58=', 'mime-type' => 'text/plain', }, ], @@ -499,15 +499,15 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article and simple invalid base64 attachment with customer (01.15)' do params = { - title: 'a new ticket #15', - group: ticket_group.name, + title: 'a new ticket #15', + group: ticket_group.name, customer_id: customer_user.id, - article: { - subject: 'some test 123', - body: 'some test 123', + article: { + subject: 'some test 123', + body: 'some test 123', attachments: [ - 'filename' => 'some_file.txt', - 'data' => 'ABC_INVALID_BASE64', + 'filename' => 'some_file.txt', + 'data' => 'ABC_INVALID_BASE64', 'mime-type' => 'text/plain', ], }, @@ -521,15 +521,15 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article and large invalid base64 attachment with customer (01.15a)' do params = { - title: 'a new ticket #15a', - group: ticket_group.name, + title: 'a new ticket #15a', + group: ticket_group.name, customer_id: customer_user.id, - article: { - subject: 'some test 123', - body: 'some test 123', + article: { + subject: 'some test 123', + body: 'some test 123', attachments: [ - 'filename' => 'some_file.txt', - 'data' => "LARGE_INVALID_BASE64_#{'#' * 20_000_000}", + 'filename' => 'some_file.txt', + 'data' => "LARGE_INVALID_BASE64_#{'#' * 20_000_000}", 'mime-type' => 'text/plain', ], }, @@ -543,15 +543,15 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article and valid multiline base64 with linebreaks attachment with customer (01.15b)' do params = { - title: 'a new ticket #15b', - group: ticket_group.name, + title: 'a new ticket #15b', + group: ticket_group.name, customer_id: customer_user.id, - article: { - subject: 'some test 123', - body: 'some test 123', + article: { + subject: 'some test 123', + body: 'some test 123', attachments: [ - 'filename' => 'some_file.txt', - 'data' => Base64.encode64('a' * 1_000), + 'filename' => 'some_file.txt', + 'data' => Base64.encode64('a' * 1_000), 'mime-type' => 'text/plain', ], }, @@ -569,15 +569,15 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article and valid multiline base64 without linebreaks attachment with customer (01.15c)' do params = { - title: 'a new ticket #15c', - group: ticket_group.name, + title: 'a new ticket #15c', + group: ticket_group.name, customer_id: customer_user.id, - article: { - subject: 'some test 123', - body: 'some test 123', + article: { + subject: 'some test 123', + body: 'some test 123', attachments: [ - 'filename' => 'some_file.txt', - 'data' => Base64.strict_encode64('a' * 1_000), + 'filename' => 'some_file.txt', + 'data' => Base64.strict_encode64('a' * 1_000), 'mime-type' => 'text/plain', ], }, @@ -595,15 +595,15 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article and attachment invalid base64 with customer (01.16)' do params = { - title: 'a new ticket #16', - group: ticket_group.name, + title: 'a new ticket #16', + group: ticket_group.name, customer_id: customer_user.id, - article: { - subject: 'some test 123', - body: 'some test 123', + article: { + subject: 'some test 123', + body: 'some test 123', attachments: [ 'filename' => 'some_file.txt', - 'data' => 'dGVzdCAxMjM=', + 'data' => 'dGVzdCAxMjM=', ], }, } @@ -616,13 +616,13 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article and inline attachments with customer (01.17)' do params = { - title: 'a new ticket #17', - group: ticket_group.name, + title: 'a new ticket #17', + group: ticket_group.name, customer_id: customer_user.id, - article: { + article: { content_type: 'text/html', - subject: 'some test 123', - body: 'some test 123 Red dot ', }, @@ -656,17 +656,17 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article and inline attachments with customer (01.18)' do params = { - title: 'a new ticket #18', - group: ticket_group.name, + title: 'a new ticket #18', + group: ticket_group.name, customer_id: customer_user.id, - article: { + article: { content_type: 'text/html', - subject: 'some test 123', - body: 'some test 123 ', - attachments: [ - 'filename' => 'some_file.txt', - 'data' => 'dGVzdCAxMjM=', + attachments: [ + 'filename' => 'some_file.txt', + 'data' => 'dGVzdCAxMjM=', 'mime-type' => 'text/plain', ], }, @@ -699,16 +699,16 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent (02.02)' do params = { - title: 'a new ticket #1', - state: 'new', + title: 'a new ticket #1', + state: 'new', priority: '2 normal', - group: ticket_group.name, + group: ticket_group.name, customer: 'tickets-customer1@example.com', - article: { + article: { content_type: 'text/plain', # or text/html - body: 'some body', + body: 'some body', }, - links: { + links: { Ticket: { parent: [1], } @@ -723,7 +723,7 @@ RSpec.describe 'Ticket', type: :request do expect(json_response['updated_by_id']).to eq(agent_user.id) expect(json_response['created_by_id']).to eq(agent_user.id) links = Link.list( - link_object: 'Ticket', + link_object: 'Ticket', link_object_value: json_response['id'], ) expect(links[0]['link_type']).to eq('child') @@ -735,8 +735,8 @@ RSpec.describe 'Ticket', type: :request do group = create(:group) ticket = create( :ticket, - title: 'ticket with wrong ticket id', - group_id: group.id, + title: 'ticket with wrong ticket id', + group_id: group.id, customer_id: customer_user.id, ) authenticated_as(agent_user) @@ -763,8 +763,8 @@ RSpec.describe 'Ticket', type: :request do title = "ticket with corret ticket id testagent#{rand(999_999_999)}" ticket = create( :ticket, - title: title, - group: ticket_group, + title: title, + group: ticket_group, customer_id: customer_user.id, preferences: { some_key1: 123, @@ -782,7 +782,7 @@ RSpec.describe 'Ticket', type: :request do expect(json_response['preferences']['some_key1']).to eq(123) params = { - title: "#{title} - 2", + title: "#{title} - 2", customer_id: agent_user.id, preferences: { some_key2: 'abc', @@ -801,8 +801,8 @@ RSpec.describe 'Ticket', type: :request do params = { ticket_id: ticket.id, - subject: 'some subject', - body: 'some body', + subject: 'some subject', + body: 'some body', } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -829,7 +829,7 @@ RSpec.describe 'Ticket', type: :request do condition: { 'ticket.title' => { operator: 'contains', - value: title, + value: title, }, }, } @@ -843,12 +843,12 @@ RSpec.describe 'Ticket', type: :request do expect(response).to have_http_status(200) params = { - from: 'something which should not be changed on server side', + from: 'something which should not be changed on server side', ticket_id: ticket.id, - subject: 'some subject', - body: 'some body', - type: 'email', - internal: true, + subject: 'some subject', + body: 'some body', + type: 'email', + internal: true, } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -893,8 +893,8 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket with correct ticket id (02.05)' do ticket = create( :ticket, - title: 'ticket with corret ticket id', - group: ticket_group, + title: 'ticket with corret ticket id', + group: ticket_group, customer_id: customer_user.id, ) authenticated_as(admin_user) @@ -908,7 +908,7 @@ RSpec.describe 'Ticket', type: :request do expect(json_response['created_by_id']).to eq(1) params = { - title: 'ticket with corret ticket id - 2', + title: 'ticket with corret ticket id - 2', customer_id: agent_user.id, } put "/api/v1/tickets/#{ticket.id}", params: params, as: :json @@ -921,10 +921,10 @@ RSpec.describe 'Ticket', type: :request do expect(json_response['created_by_id']).to eq(1) params = { - from: 'something which should not be changed on server side', + from: 'something which should not be changed on server side', ticket_id: ticket.id, - subject: 'some subject', - body: 'some body', + subject: 'some subject', + body: 'some body', } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -940,7 +940,7 @@ RSpec.describe 'Ticket', type: :request do expect(json_response['type_id']).to eq(Ticket::Article::Type.lookup(name: 'note').id) params = { - subject: 'new subject', + subject: 'new subject', internal: true, } put "/api/v1/ticket_articles/#{json_response['id']}", params: params, as: :json @@ -961,9 +961,9 @@ RSpec.describe 'Ticket', type: :request do params = { ticket_id: ticket.id, - subject: 'some subject', - body: 'some body', - type: 'email', + subject: 'some subject', + body: 'some body', + type: 'email', } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -991,14 +991,14 @@ RSpec.describe 'Ticket', type: :request do (1..20).each do |count| ticket = create( :ticket, - title: "#{title} - #{count}", - group: ticket_group, + title: "#{title} - #{count}", + group: ticket_group, customer_id: customer_user.id, ) create( :ticket_article, - type: Ticket::Article::Type.lookup(name: 'note'), - sender: Ticket::Article::Sender.lookup(name: 'Customer'), + type: Ticket::Article::Type.lookup(name: 'note'), + sender: Ticket::Article::Sender.lookup(name: 'Customer'), ticket_id: ticket.id, ) tickets.push ticket @@ -1054,11 +1054,11 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with customer minimal (03.01)' do params = { - title: 'a new ticket #c1', - state: 'new', + title: 'a new ticket #c1', + state: 'new', priority: '2 normal', - group: ticket_group.name, - article: { + group: ticket_group.name, + article: { body: 'some body', }, } @@ -1075,15 +1075,15 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with customer with wrong customer (03.02)' do params = { - title: 'a new ticket #c2', - state: 'new', - priority: '2 normal', - group: ticket_group.name, + title: 'a new ticket #c2', + state: 'new', + priority: '2 normal', + group: ticket_group.name, customer_id: agent_user.id, - article: { + article: { content_type: 'text/plain', # or text/html - body: 'some body', - sender: 'System', + body: 'some body', + sender: 'System', }, } authenticated_as(customer_user) @@ -1099,19 +1099,19 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with customer with wrong customer hash (03.03)' do params = { - title: 'a new ticket #c2', - state: 'new', + title: 'a new ticket #c2', + state: 'new', priority: '2 normal', - group: ticket_group.name, + group: ticket_group.name, customer: { firstname: agent_user.firstname, - lastname: agent_user.lastname, - email: agent_user.email, + lastname: agent_user.lastname, + email: agent_user.email, }, - article: { + article: { content_type: 'text/plain', # or text/html - body: 'some body', - sender: 'System', + body: 'some body', + sender: 'System', }, } authenticated_as(customer_user) @@ -1128,8 +1128,8 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket with wrong ticket id (03.04)' do ticket = create( :ticket, - title: 'ticket with wrong ticket id', - group: ticket_group, + title: 'ticket with wrong ticket id', + group: ticket_group, customer_id: agent_user.id, ) authenticated_as(customer_user) @@ -1156,8 +1156,8 @@ RSpec.describe 'Ticket', type: :request do title = "ticket with corret ticket id testme#{rand(999_999_999)}" ticket = create( :ticket, - title: title, - group: ticket_group, + title: title, + group: ticket_group, customer_id: customer_user.id, ) authenticated_as(customer_user) @@ -1171,7 +1171,7 @@ RSpec.describe 'Ticket', type: :request do expect(json_response['created_by_id']).to eq(1) params = { - title: "#{title} - 2", + title: "#{title} - 2", customer_id: agent_user.id, } put "/api/v1/tickets/#{ticket.id}", params: params, as: :json @@ -1185,8 +1185,8 @@ RSpec.describe 'Ticket', type: :request do params = { ticket_id: ticket.id, - subject: 'some subject', - body: 'some body', + subject: 'some subject', + body: 'some body', } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -1212,7 +1212,7 @@ RSpec.describe 'Ticket', type: :request do condition: { 'ticket.title' => { operator: 'contains', - value: title, + value: title, }, }, } @@ -1229,10 +1229,10 @@ RSpec.describe 'Ticket', type: :request do params = { ticket_id: ticket.id, - subject: 'some subject', - body: 'some body', - type: 'email', - sender: 'Agent', + subject: 'some subject', + body: 'some body', + type: 'email', + sender: 'Agent', } post '/api/v1/ticket_articles', params: params, as: :json expect(response).to have_http_status(201) @@ -1252,13 +1252,13 @@ RSpec.describe 'Ticket', type: :request do expect(json_response['error']).to eq('Not authorized (admin permission required)!') params = { - from: 'something which should not be changed on server side', + from: 'something which should not be changed on server side', ticket_id: ticket.id, - subject: 'some subject', - body: 'some body', - type: 'web', - sender: 'Agent', - internal: true, + subject: 'some subject', + body: 'some body', + type: 'web', + sender: 'Agent', + internal: true, } post '/api/v1/ticket_articles', params: params, as: :json @@ -1291,15 +1291,15 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article with customer hash with article.origin_by (03.6)' do authenticated_as(customer_user) params = { - title: 'a new ticket #3.6', - group: ticket_group.name, + title: 'a new ticket #3.6', + group: ticket_group.name, customer: { firstname: 'some firstname', - lastname: 'some lastname', - email: 'some_new_customer@example.com', + lastname: 'some lastname', + email: 'some_new_customer@example.com', }, - article: { - body: 'some test 123', + article: { + body: 'some test 123', origin_by: agent_user.login, }, } @@ -1325,16 +1325,16 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create with agent - minimal article with customer hash with article.origin_by (03.6)' do authenticated_as(customer_user) params = { - title: 'a new ticket #3.6.1', - group: ticket_group.name, + title: 'a new ticket #3.6.1', + group: ticket_group.name, customer: { firstname: 'some firstname', - lastname: 'some lastname', - email: 'some_new_customer@example.com', + lastname: 'some lastname', + email: 'some_new_customer@example.com', }, - article: { - sender: 'Agent', - body: 'some test 123', + article: { + sender: 'Agent', + body: 'some test 123', origin_by_id: agent_user.id, }, } @@ -1361,9 +1361,9 @@ RSpec.describe 'Ticket', type: :request do title = "ticket testagent#{rand(999_999_999)}" ticket = create( :ticket, - title: title, - group: ticket_group, - customer_id: customer_user.id, + title: title, + group: ticket_group, + customer_id: customer_user.id, updated_by_id: agent_user.id, created_by_id: agent_user.id, ) @@ -1445,9 +1445,9 @@ RSpec.describe 'Ticket', type: :request do title = "ticket testagent#{rand(999_999_999)}" ticket = create( :ticket, - title: title, - group: ticket_group, - customer_id: customer_user.id, + title: title, + group: ticket_group, + customer_id: customer_user.id, updated_by_id: agent_user.id, created_by_id: agent_user.id, ) @@ -1539,12 +1539,12 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket create and response format (04.03)' do title = "ticket testagent#{rand(999_999_999)}" params = { - title: title, - group: ticket_group.name, + title: title, + group: ticket_group.name, customer_id: customer_user.id, - state: 'new', - priority: '2 normal', - article: { + state: 'new', + priority: '2 normal', + article: { body: 'some test 123', }, } @@ -1611,9 +1611,9 @@ RSpec.describe 'Ticket', type: :request do title = "ticket testagent#{rand(999_999_999)}" ticket = create( :ticket, - title: title, - group: ticket_group, - customer_id: customer_user.id, + title: title, + group: ticket_group, + customer_id: customer_user.id, updated_by_id: agent_user.id, created_by_id: agent_user.id, ) @@ -1689,26 +1689,26 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket split with html - check attachments (05.01)' do ticket = create( :ticket, - title: 'some title', - group: ticket_group, - customer_id: customer_user.id, + title: 'some title', + group: ticket_group, + customer_id: customer_user.id, updated_by_id: agent_user.id, created_by_id: agent_user.id, ) article = create( :ticket_article, - type: Ticket::Article::Type.lookup(name: 'note'), - sender: Ticket::Article::Sender.lookup(name: 'Customer'), - body: 'test test ', + type: Ticket::Article::Type.lookup(name: 'note'), + sender: Ticket::Article::Sender.lookup(name: 'Customer'), + body: 'test test ', content_type: 'text/html', - ticket_id: ticket.id, + ticket_id: ticket.id, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file1_normally_should_be_an_image', - filename: 'some_file1.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file1_normally_should_be_an_image', + filename: 'some_file1.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938@zammad.example.com', @@ -1717,11 +1717,11 @@ RSpec.describe 'Ticket', type: :request do created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file2_normally_should_be_an_image', - filename: 'some_file2.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file2_normally_should_be_an_image', + filename: 'some_file2.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938.2@zammad.example.com', @@ -1730,35 +1730,35 @@ RSpec.describe 'Ticket', type: :request do created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file3_normally_should_be_an_image', - filename: 'some_file3.jpg', - preferences: { - 'Content-Type' => 'image/jpeg', - 'Mime-Type' => 'image/jpeg', - 'Content-ID' => '15.274327094.140938.3@zammad.example.com', + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file3_normally_should_be_an_image', + filename: 'some_file3.jpg', + preferences: { + 'Content-Type' => 'image/jpeg', + 'Mime-Type' => 'image/jpeg', + 'Content-ID' => '15.274327094.140938.3@zammad.example.com', }, created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file4_normally_should_be_an_image', - filename: 'some_file4.jpg', - preferences: { - 'Content-Type' => 'image/jpeg', - 'Mime-Type' => 'image/jpeg', - 'Content-ID' => '15.274327094.140938.4@zammad.example.com', + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file4_normally_should_be_an_image', + filename: 'some_file4.jpg', + preferences: { + 'Content-Type' => 'image/jpeg', + 'Mime-Type' => 'image/jpeg', + 'Content-ID' => '15.274327094.140938.4@zammad.example.com', }, created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file1_normally_should_be_an_pdf', - filename: 'Rechnung_RE-2018-200.pdf', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file1_normally_should_be_an_pdf', + filename: 'Rechnung_RE-2018-200.pdf', + preferences: { 'Content-Type' => 'application/octet-stream; name="Rechnung_RE-2018-200.pdf"', 'Mime-Type' => 'application/octet-stream', 'Content-ID' => '8AB0BEC88984EE4EBEF643C79C8E0346@zammad.example.com', @@ -1794,26 +1794,26 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket split with plain - check attachments (05.02)' do ticket = create( :ticket, - title: 'some title', - group: ticket_group, - customer_id: customer_user.id, + title: 'some title', + group: ticket_group, + customer_id: customer_user.id, updated_by_id: agent_user.id, created_by_id: agent_user.id, ) article = create( :ticket_article, - type: Ticket::Article::Type.lookup(name: 'note'), - sender: Ticket::Article::Sender.lookup(name: 'Customer'), - body: 'test ', + type: Ticket::Article::Type.lookup(name: 'note'), + sender: Ticket::Article::Sender.lookup(name: 'Customer'), + body: 'test ', content_type: 'text/plain', - ticket_id: ticket.id, + ticket_id: ticket.id, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file1_normally_should_be_an_image', - filename: 'some_file1.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file1_normally_should_be_an_image', + filename: 'some_file1.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938@zammad.example.com', @@ -1822,11 +1822,11 @@ RSpec.describe 'Ticket', type: :request do created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file1_normally_should_be_an_image', - filename: 'some_file2.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file1_normally_should_be_an_image', + filename: 'some_file2.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938.2@zammad.example.com', @@ -1835,11 +1835,11 @@ RSpec.describe 'Ticket', type: :request do created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article.id, - data: 'content_file1_normally_should_be_an_pdf', - filename: 'Rechnung_RE-2018-200.pdf', - preferences: { + object: 'Ticket::Article', + o_id: article.id, + data: 'content_file1_normally_should_be_an_pdf', + filename: 'Rechnung_RE-2018-200.pdf', + preferences: { 'Content-Type' => 'application/octet-stream; name="Rechnung_RE-2018-200.pdf"', 'Mime-Type' => 'application/octet-stream', 'Content-ID' => '8AB0BEC88984EE4EBEF643C79C8E0346@zammad.example.com', @@ -1880,10 +1880,10 @@ RSpec.describe 'Ticket', type: :request do ticket = create( :ticket, - title: 'ticket with wrong ticket id', - group_id: group.id, + title: 'ticket with wrong ticket id', + group_id: group.id, customer_id: customer_user.id, - state: Ticket::State.lookup(name: 'closed'), # set the ticket to closed + state: Ticket::State.lookup(name: 'closed'), # set the ticket to closed ) state = Ticket::State.find_by(name: 'open') # try to open a ticket from a closed state @@ -1901,10 +1901,10 @@ RSpec.describe 'Ticket', type: :request do ticket = create( :ticket, - title: 'ticket with wrong ticket id', - group_id: group.id, + title: 'ticket with wrong ticket id', + group_id: group.id, customer_id: customer_user.id, - state: Ticket::State.lookup(name: 'closed'), # set the ticket to closed + state: Ticket::State.lookup(name: 'closed'), # set the ticket to closed ) authenticated_as(admin_user) @@ -1915,10 +1915,10 @@ RSpec.describe 'Ticket', type: :request do ticket = create( :ticket, - title: 'ticket with wrong ticket id', - group_id: group.id, + title: 'ticket with wrong ticket id', + group_id: group.id, customer_id: customer_user.id, - state: Ticket::State.lookup(name: 'closed'), # set the ticket to closed + state: Ticket::State.lookup(name: 'closed'), # set the ticket to closed ) # agent @@ -1933,20 +1933,20 @@ RSpec.describe 'Ticket', type: :request do group_no_permission = create(:group) ticket1 = create( :ticket, - title: 'ticket merge1', - group: ticket_group, + title: 'ticket merge1', + group: ticket_group, customer_id: customer_user.id, ) ticket2 = create( :ticket, - title: 'ticket merge2', - group: ticket_group, + title: 'ticket merge2', + group: ticket_group, customer_id: customer_user.id, ) ticket3 = create( :ticket, - title: 'ticket merge2', - group: group_no_permission, + title: 'ticket merge2', + group: group_no_permission, customer_id: customer_user.id, ) @@ -1978,21 +1978,21 @@ RSpec.describe 'Ticket', type: :request do it 'does ticket merge - change permission (07.02)' do group_change_permission = Group.create!( - name: 'GroupWithChangePermission', - active: true, + name: 'GroupWithChangePermission', + active: true, updated_by_id: 1, created_by_id: 1, ) ticket1 = create( :ticket, - title: 'ticket merge1', - group: group_change_permission, + title: 'ticket merge1', + group: group_change_permission, customer_id: customer_user.id, ) ticket2 = create( :ticket, - title: 'ticket merge2', - group: group_change_permission, + title: 'ticket merge2', + group: group_change_permission, customer_id: customer_user.id, ) @@ -2012,33 +2012,33 @@ RSpec.describe 'Ticket', type: :request do ticket1 = create( :ticket, - title: "#{title} A", - group: ticket_group, + title: "#{title} A", + group: ticket_group, customer_id: customer_user.id, - created_at: '2018-02-05 17:42:00', - updated_at: '2018-02-05 20:42:00', + created_at: '2018-02-05 17:42:00', + updated_at: '2018-02-05 20:42:00', ) create( :ticket_article, - type: Ticket::Article::Type.lookup(name: 'note'), - sender: Ticket::Article::Sender.lookup(name: 'Customer'), + type: Ticket::Article::Type.lookup(name: 'note'), + sender: Ticket::Article::Sender.lookup(name: 'Customer'), ticket_id: ticket1.id, ) ticket2 = create( :ticket, - title: "#{title} B", - group: ticket_group, + title: "#{title} B", + group: ticket_group, customer_id: customer_user.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '3 hoch'), - created_at: '2018-02-05 19:42:00', - updated_at: '2018-02-05 19:42:00', + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '3 hoch'), + created_at: '2018-02-05 19:42:00', + updated_at: '2018-02-05 19:42:00', ) create( :ticket_article, - type: Ticket::Article::Type.lookup(name: 'note'), - sender: Ticket::Article::Sender.lookup(name: 'Customer'), + type: Ticket::Article::Type.lookup(name: 'note'), + sender: Ticket::Article::Sender.lookup(name: 'Customer'), ticket_id: ticket2.id, ) diff --git a/spec/requests/user_spec.rb b/spec/requests/user_spec.rb index cf89f7d6e..8137afeb6 100644 --- a/spec/requests/user_spec.rb +++ b/spec/requests/user_spec.rb @@ -5,41 +5,41 @@ RSpec.describe 'User', type: :request, searchindex: true do let!(:admin_user) do create( :admin_user, - groups: Group.all, - login: 'rest-admin', + groups: Group.all, + login: 'rest-admin', firstname: 'Rest', - lastname: 'Agent', - email: 'rest-admin@example.com', + lastname: 'Agent', + email: 'rest-admin@example.com', ) end let!(:admin_user_pw) do create( :admin_user, - groups: Group.all, - login: 'rest-admin-pw', + groups: Group.all, + login: 'rest-admin-pw', firstname: 'Rest', - lastname: 'Agent', - email: 'rest-admin-pw@example.com', - password: 'adminpw', + lastname: 'Agent', + email: 'rest-admin-pw@example.com', + password: 'adminpw', ) end let!(:agent_user) do create( :agent_user, - groups: Group.all, - login: 'rest-agent@example.com', + groups: Group.all, + login: 'rest-agent@example.com', firstname: 'Rest', - lastname: 'Agent', - email: 'rest-agent@example.com', + lastname: 'Agent', + email: 'rest-agent@example.com', ) end let!(:customer_user) do create( :customer_user, - login: 'rest-customer1@example.com', + login: 'rest-customer1@example.com', firstname: 'Rest', - lastname: 'Customer1', - email: 'rest-customer1@example.com', + lastname: 'Customer1', + email: 'rest-customer1@example.com', ) end let!(:organization) do @@ -55,10 +55,10 @@ RSpec.describe 'User', type: :request, searchindex: true do create( :customer_user, organization: organization, - login: 'rest-customer2@example.com', - firstname: 'Rest', - lastname: 'Customer2', - email: 'rest-customer2@example.com', + login: 'rest-customer2@example.com', + firstname: 'Rest', + lastname: 'Customer2', + email: 'rest-customer2@example.com', ) end @@ -552,13 +552,13 @@ RSpec.describe 'User', type: :request, searchindex: true do it 'does users show and response format (04.01)' do user = create( :customer_user, - login: 'rest-customer3@example.com', - firstname: 'Rest', - lastname: 'Customer3', - email: 'rest-customer3@example.com', - password: 'customer3pw', - active: true, - organization: organization, + login: 'rest-customer3@example.com', + firstname: 'Rest', + lastname: 'Customer3', + email: 'rest-customer3@example.com', + password: 'customer3pw', + active: true, + organization: organization, updated_by_id: admin_user.id, created_by_id: admin_user.id, ) @@ -629,13 +629,13 @@ RSpec.describe 'User', type: :request, searchindex: true do it 'does user index and response format (04.02)' do user = create( :customer_user, - login: 'rest-customer3@example.com', - firstname: 'Rest', - lastname: 'Customer3', - email: 'rest-customer3@example.com', - password: 'customer3pw', - active: true, - organization: organization, + login: 'rest-customer3@example.com', + firstname: 'Rest', + lastname: 'Customer3', + email: 'rest-customer3@example.com', + password: 'customer3pw', + active: true, + organization: organization, updated_by_id: admin_user.id, created_by_id: admin_user.id, ) @@ -711,8 +711,8 @@ RSpec.describe 'User', type: :request, searchindex: true do it 'does ticket create and response format (04.03)' do organization = Organization.first params = { - firstname: 'newfirstname123', - note: 'some note', + firstname: 'newfirstname123', + note: 'some note', organization: organization.name, } @@ -765,13 +765,13 @@ RSpec.describe 'User', type: :request, searchindex: true do it 'does ticket update and response formats (04.04)' do user = create( :customer_user, - login: 'rest-customer3@example.com', - firstname: 'Rest', - lastname: 'Customer3', - email: 'rest-customer3@example.com', - password: 'customer3pw', - active: true, - organization: organization, + login: 'rest-customer3@example.com', + firstname: 'Rest', + lastname: 'Customer3', + email: 'rest-customer3@example.com', + password: 'customer3pw', + active: true, + organization: organization, updated_by_id: admin_user.id, created_by_id: admin_user.id, ) @@ -924,30 +924,30 @@ RSpec.describe 'User', type: :request, searchindex: true do user1 = create( :customer_user, - login: 'rest-user_search_sortableA@example.com', - firstname: "#{firstname} A", - lastname: 'user_search_sortableA', - email: 'rest-user_search_sortableA@example.com', - password: 'user_search_sortableA', - active: true, + login: 'rest-user_search_sortableA@example.com', + firstname: "#{firstname} A", + lastname: 'user_search_sortableA', + email: 'rest-user_search_sortableA@example.com', + password: 'user_search_sortableA', + active: true, organization_id: organization.id, - out_of_office: false, - created_at: '2016-02-05 17:42:00', + out_of_office: false, + created_at: '2016-02-05 17:42:00', ) user2 = create( :customer_user, - login: 'rest-user_search_sortableB@example.com', - firstname: "#{firstname} B", - lastname: 'user_search_sortableB', - email: 'rest-user_search_sortableB@example.com', - password: 'user_search_sortableB', - active: true, - organization_id: organization.id, - out_of_office_start_at: '2016-02-06 19:42:00', - out_of_office_end_at: '2016-02-07 19:42:00', + login: 'rest-user_search_sortableB@example.com', + firstname: "#{firstname} B", + lastname: 'user_search_sortableB', + email: 'rest-user_search_sortableB@example.com', + password: 'user_search_sortableB', + active: true, + organization_id: organization.id, + out_of_office_start_at: '2016-02-06 19:42:00', + out_of_office_end_at: '2016-02-07 19:42:00', out_of_office_replacement_id: 1, - out_of_office: true, - created_at: '2016-02-05 19:42:00', + out_of_office: true, + created_at: '2016-02-05 19:42:00', ) Scheduler.worker(true) sleep 2 # let es time to come ready diff --git a/test/browser/aaa_getting_started_test.rb b/test/browser/aaa_getting_started_test.rb index e912b73a5..65016a543 100644 --- a/test/browser/aaa_getting_started_test.rb +++ b/test/browser/aaa_getting_started_test.rb @@ -13,62 +13,62 @@ class AaaGettingStartedTest < TestCase @browser = browser_instance location(url: browser_url) watch_for( - css: '.setup.wizard', + css: '.setup.wizard', value: 'setup new system', ) click(css: '.js-start .btn--primary') watch_for( - css: '.setup.wizard', + css: '.setup.wizard', value: 'admin', ) set( - css: '.js-admin input[name="firstname"]', + css: '.js-admin input[name="firstname"]', value: 'Test Master', ) set( - css: '.js-admin input[name="lastname"]', + css: '.js-admin input[name="lastname"]', value: 'Agent', ) set( - css: '.js-admin input[name="email"]', + css: '.js-admin input[name="email"]', value: 'master@example.com', ) set( - css: '.js-admin input[name="firstname"]', + css: '.js-admin input[name="firstname"]', value: 'Test Master', ) set( - css: '.js-admin input[name="password"]', + css: '.js-admin input[name="password"]', value: 'test1234äöüß', ) set( - css: '.js-admin input[name="password_confirm"]', + css: '.js-admin input[name="password_confirm"]', value: 'test1234äöüß', ) click(css: '.js-admin .btn--success') # getting started - base watch_for( - css: '.js-base h2', + css: '.js-base h2', value: 'Organization', ) set( - css: '.js-base input[name="organization"]', + css: '.js-base input[name="organization"]', value: 'Some Organization', ) set( - css: '.js-base input[name="url"]', + css: '.js-base input[name="url"]', value: 'some host', ) click( css: '.js-base .btn--primary', ) watch_for( - css: 'body', + css: 'body', value: 'A URL looks like', ) set( - css: '.js-base input[name="url"]', + css: '.js-base input[name="url"]', value: browser_url, ) click( @@ -77,7 +77,7 @@ class AaaGettingStartedTest < TestCase # getting started - email notification watch_for( - css: '.js-outbound h2', + css: '.js-outbound h2', value: 'Email Notification', ) location_check( @@ -89,7 +89,7 @@ class AaaGettingStartedTest < TestCase # getting started - create email account watch_for( - css: '.js-channel h2', + css: '.js-channel h2', value: 'Connect Channels', ) location_check( @@ -99,28 +99,28 @@ class AaaGettingStartedTest < TestCase css: '.js-channel .email .provider_name', ) set( - css: '.js-intro input[name="realname"]', + css: '.js-intro input[name="realname"]', value: 'Some Realname', ) set( - css: '.js-intro input[name="email"]', + css: '.js-intro input[name="email"]', value: mailbox_user, ) set( - css: '.js-intro input[name="password"]', + css: '.js-intro input[name="password"]', value: mailbox_password, ) click( css: '.js-intro .btn--primary', ) watch_for( - css: 'body', - value: 'verify', + css: 'body', + value: 'verify', timeout: 20, ) watch_for( - css: 'body', - value: 'invite', + css: 'body', + value: 'invite', timeout: 100, ) @@ -132,15 +132,15 @@ class AaaGettingStartedTest < TestCase css: '.js-agent input[name="firstname"]', ) set( - css: '.js-agent input[name="firstname"]', + css: '.js-agent input[name="firstname"]', value: 'Agent 1', ) set( - css: '.js-agent input[name="lastname"]', + css: '.js-agent input[name="lastname"]', value: 'Test', ) set( - css: '.js-agent input[name="email"]', + css: '.js-agent input[name="email"]', value: 'agent1@example.com', ) # not needed since we hide group selections if only one group exists @@ -151,7 +151,7 @@ class AaaGettingStartedTest < TestCase css: '.js-agent .btn--success', ) watch_for( - css: 'body', + css: 'body', value: 'Invitation sent', ) location_check( @@ -161,7 +161,7 @@ class AaaGettingStartedTest < TestCase css: '.js-agent .btn--primary', ) watch_for( - css: 'body', + css: 'body', value: 'My Stats', ) location_check( @@ -181,7 +181,7 @@ class AaaGettingStartedTest < TestCase ) match( - css: '.content.active input[name="organization"]', + css: '.content.active input[name="organization"]', value: 'Some Organization', ) click( @@ -195,7 +195,7 @@ class AaaGettingStartedTest < TestCase raise "Unable to get fqdn based on #{browser_url}" if !fqdn match( - css: '.content.active input[name="fqdn"]', + css: '.content.active input[name="fqdn"]', value: fqdn, ) end @@ -210,7 +210,7 @@ class AaaGettingStartedTest < TestCase mailbox_password = ENV["MAILBOX_AUTO#{count}"].split(':')[1] account = { realname: 'auto account', - email: mailbox_user, + email: mailbox_user, password: mailbox_password, } accounts.push account @@ -224,7 +224,7 @@ class AaaGettingStartedTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) accounts.each do |account| @@ -234,28 +234,28 @@ class AaaGettingStartedTest < TestCase css: '.js-channel .email .provider_name', ) set( - css: '.js-intro input[name="realname"]', + css: '.js-intro input[name="realname"]', value: account[:realname], ) set( - css: '.js-intro input[name="email"]', + css: '.js-intro input[name="email"]', value: account[:email], ) set( - css: '.js-intro input[name="password"]', + css: '.js-intro input[name="password"]', value: account[:password], ) click( css: '.js-intro .btn--primary', ) watch_for( - css: 'body', - value: 'verify', + css: 'body', + value: 'verify', timeout: 20, ) watch_for( - css: 'body', - value: 'invite', + css: 'body', + value: 'invite', timeout: 100, ) location_check( @@ -276,9 +276,9 @@ class AaaGettingStartedTest < TestCase mailbox_outbound = ENV["MAILBOX_MANUAL#{count}"].split(':')[3] account = { realname: 'manual account', - email: mailbox_user, + email: mailbox_user, password: mailbox_password, - inbound: { + inbound: { 'options::host' => mailbox_inbound, }, outbound: { @@ -297,7 +297,7 @@ class AaaGettingStartedTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) accounts.each do |account| @@ -308,58 +308,58 @@ class AaaGettingStartedTest < TestCase css: '.js-channel .email .provider_name', ) set( - css: '.js-intro input[name="realname"]', + css: '.js-intro input[name="realname"]', value: account[:realname], ) set( - css: '.js-intro input[name="email"]', + css: '.js-intro input[name="email"]', value: account[:email], ) set( - css: '.js-intro input[name="password"]', + css: '.js-intro input[name="password"]', value: account[:password], ) click( css: '.js-intro .btn--primary', ) watch_for( - css: '.js-inbound h2', - value: 'inbound', + css: '.js-inbound h2', + value: 'inbound', timeout: 220, ) watch_for( - css: '.js-inbound', + css: '.js-inbound', value: 'manual', ) set( - css: '.js-inbound input[name="options::host"]', + css: '.js-inbound input[name="options::host"]', value: account[:inbound]['options::host'], ) click( css: '.js-inbound .btn--primary', ) watch_for( - css: '.js-outbound h2', + css: '.js-outbound h2', value: 'outbound', ) select( - css: '.js-outbound select[name="adapter"]', + css: '.js-outbound select[name="adapter"]', value: 'SMTP - configure your own outgoing SMTP settings', ) set( - css: '.js-outbound input[name="options::host"]', + css: '.js-outbound input[name="options::host"]', value: account[:outbound]['options::host'], ) click( css: '.js-outbound .btn--primary', ) watch_for( - css: 'body', + css: 'body', value: 'verify', ) watch_for( - css: 'body', - value: 'invite', + css: 'body', + value: 'invite', timeout: 190, ) location_check( diff --git a/test/browser/aab_unit_test.rb b/test/browser/aab_unit_test.rb index 5ddd104e8..1dc714455 100644 --- a/test/browser/aab_unit_test.rb +++ b/test/browser/aab_unit_test.rb @@ -6,12 +6,12 @@ class AAbUnitTest < TestCase location(url: browser_url + '/tests_core') sleep 5 watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 4, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) end @@ -20,57 +20,57 @@ class AAbUnitTest < TestCase @browser = browser_instance location(url: browser_url + '/tests_ui') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_model') sleep 5 watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 3, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_model_binding') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_model_ui') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_ticket_selector') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) end @@ -80,100 +80,100 @@ class AAbUnitTest < TestCase location(url: browser_url + '/tests_form') sleep 5 watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 2, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_form_trim') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_form_find') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_form_timer') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_form_extended') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_form_searchable_select') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_form_tree_select') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_form_column_select') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_form_validation') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) end @@ -182,46 +182,46 @@ class AAbUnitTest < TestCase @browser = browser_instance location(url: browser_url + '/tests_table') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_table_extended') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_html_utils') watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 8, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) location(url: browser_url + '/tests_taskbar') sleep 5 watch_for( - css: '.result', - value: 'Tests completed', + css: '.result', + value: 'Tests completed', timeout: 3, ) match( - css: '.result .failed', + css: '.result .failed', value: '0', ) end diff --git a/test/browser/aac_basic_richtext_test.rb b/test/browser/aac_basic_richtext_test.rb index 9dc4a2441..a6001d4b9 100644 --- a/test/browser/aac_basic_richtext_test.rb +++ b/test/browser/aac_basic_richtext_test.rb @@ -6,7 +6,7 @@ class AACBasicRichtextTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#current_user"]') @@ -16,9 +16,9 @@ class AACBasicRichtextTest < TestCase # richtext single line set( - css: '#content .text-1', + css: '#content .text-1', value: 'some test for browser ', - slow: true, + slow: true, ) sleep 1 sendkey(value: :enter) @@ -26,15 +26,15 @@ class AACBasicRichtextTest < TestCase sleep 1 match( - css: '#content .text-1', + css: '#content .text-1', value: 'some test for browser and some other for browser', ) # text multi line set( - css: '#content .text-3', + css: '#content .text-3', value: 'some test for browser ', - slow: true, + slow: true, ) sleep 1 sendkey(value: :enter) @@ -42,16 +42,16 @@ class AACBasicRichtextTest < TestCase sleep 1 match( - css: '#content .text-3', - value: "some test for browser\nand some other for browser", + css: '#content .text-3', + value: "some test for browser\nand some other for browser", cleanup: true, ) # richtext multi line set( - css: '#content .text-5', + css: '#content .text-5', value: 'some test for browser ', - slow: true, + slow: true, ) sleep 1 sendkey(value: :enter) @@ -59,8 +59,8 @@ class AACBasicRichtextTest < TestCase sleep 1 match( - css: '#content .text-5', - value: "some test for browser\nand some other for browser2", + css: '#content .text-5', + value: "some test for browser\nand some other for browser2", cleanup: true, ) end diff --git a/test/browser/abb_one_group_test.rb b/test/browser/abb_one_group_test.rb index 35a4c9034..92d7c702f 100644 --- a/test/browser/abb_one_group_test.rb +++ b/test/browser/abb_one_group_test.rb @@ -9,7 +9,7 @@ class AgentTicketActionLevel0Test < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -17,9 +17,9 @@ class AgentTicketActionLevel0Test < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: '-NONE-', - title: 'some subject 123äöü - one group 1', - body: 'some body 123äöü - one group 1', + group: '-NONE-', + title: 'some subject 123äöü - one group 1', + body: 'some body 123äöü - one group 1', }, ) sleep 1 @@ -29,7 +29,7 @@ class AgentTicketActionLevel0Test < TestCase data: { state: 'closed', group: '-NONE-', - body: 'some body 1234 äöüß - one group 1 - update', + body: 'some body 1234 äöüß - one group 1 - update', }, ) @@ -45,26 +45,26 @@ class AgentTicketActionLevel0Test < TestCase click(css: '.active.content .js-inviteAgent') modal_ready() set( - css: '.modal [name="firstname"]', + css: '.modal [name="firstname"]', value: 'Bob', ) set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'Smith', ) set( - css: '.modal [name="email"]', + css: '.modal [name="email"]', value: "#{agent}@example.com", ) exists( displayed: false, - css: '.modal .js-groupList', + css: '.modal .js-groupList', ) exists( css: '.modal .js-groupListItem[value=full]:checked', ) click( - css: '.modal button.btn.btn--primary', + css: '.modal button.btn.btn--primary', fast: true, ) watch_for( @@ -85,15 +85,15 @@ class AgentTicketActionLevel0Test < TestCase click(css: '.active.content .js-inviteAgent') modal_ready() set( - css: '.modal [name="firstname"]', + css: '.modal [name="firstname"]', value: 'Bob2', ) set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'Smith2', ) set( - css: '.modal [name="email"]', + css: '.modal [name="email"]', value: "#{agent}2@example.com", ) @@ -104,7 +104,7 @@ class AgentTicketActionLevel0Test < TestCase exists( displayed: false, - css: '.modal .js-groupList', + css: '.modal .js-groupList', ) exists_not( css: '.modal .js-groupListItem[value=full]:checked', @@ -117,14 +117,14 @@ class AgentTicketActionLevel0Test < TestCase exists( displayed: false, - css: '.modal .js-groupList', + css: '.modal .js-groupList', ) exists( css: '.modal .js-groupListItem[value=full]:checked', ) click( - css: '.modal button.btn.btn--primary', + css: '.modal button.btn.btn--primary', fast: true, ) watch_for( @@ -146,7 +146,7 @@ class AgentTicketActionLevel0Test < TestCase login( username: 'nicole.braun@zammad.org', password: 'test', - url: browser_url, + url: browser_url, ) # customer ticket create @@ -154,17 +154,17 @@ class AgentTicketActionLevel0Test < TestCase click(css: 'a[href="#customer_ticket_new"]') watch_for( - css: '.newTicket', + css: '.newTicket', value: 'New Ticket', ) exists_not(css: '.newTicket select[name="group_id"]') set( - css: '.newTicket input[name="title"]', + css: '.newTicket input[name="title"]', value: 'one group', ) set( - css: '.newTicket [data-name="body"]', + css: '.newTicket [data-name="body"]', value: 'one group body', ) click(css: '.newTicket button.js-submit', wait: 5) @@ -173,15 +173,15 @@ class AgentTicketActionLevel0Test < TestCase location_check(url: '#ticket/zoom/') match( - css: '.active div.ticket-article', - value: 'one group body', + css: '.active div.ticket-article', + value: 'one group body', no_quote: true, ) # update ticket set( - css: '.active [data-name="body"]', - value: 'one group - some body 1234 äöüß', + css: '.active [data-name="body"]', + value: 'one group - some body 1234 äöüß', no_click: true, ) @@ -192,7 +192,7 @@ class AgentTicketActionLevel0Test < TestCase click(css: '.active .js-submit') watch_for( - css: '.active div.ticket-article', + css: '.active div.ticket-article', value: 'one group - some body 1234 äöüß', ) @@ -206,7 +206,7 @@ class AgentTicketActionLevel0Test < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -215,11 +215,11 @@ class AgentTicketActionLevel0Test < TestCase name: "some group #{rand(999_999_999)}", member: [ { - login: 'master@example.com', + login: 'master@example.com', access: 'full', }, { - login: 'agent1@example.com', + login: 'agent1@example.com', access: 'full', }, ], @@ -233,9 +233,9 @@ class AgentTicketActionLevel0Test < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü - one group 2', - body: 'some body 123äöü - one group 2', + group: 'Users', + title: 'some subject 123äöü - one group 2', + body: 'some body 123äöü - one group 2', }, ) sleep 1 @@ -243,7 +243,7 @@ class AgentTicketActionLevel0Test < TestCase # update ticket ticket_update( data: { - body: 'some body 1234 äöüß - one group 2 - update', + body: 'some body 1234 äöüß - one group 2 - update', group: 'Users', }, ) diff --git a/test/browser/admin_calendar_sla_test.rb b/test/browser/admin_calendar_sla_test.rb index dde3c36bd..472fa6b58 100644 --- a/test/browser/admin_calendar_sla_test.rb +++ b/test/browser/admin_calendar_sla_test.rb @@ -6,7 +6,7 @@ class AdminCalendarSlaTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -25,8 +25,8 @@ class AdminCalendarSlaTest < TestCase click(css: '[href="#manage"]') click(css: '[href="#system/maintenance"]') watch_for( - css: '.content.active', - value: 'Enable or disable the maintenance mode', + css: '.content.active', + value: 'Enable or disable the maintenance mode', timeout: 4, ) @@ -34,8 +34,8 @@ class AdminCalendarSlaTest < TestCase click(css: '[href="#manage"]') click(css: '[href="#manage/calendars"]') watch_for( - css: '.content.active', - value: calendar_name, + css: '.content.active', + value: calendar_name, timeout: 4, ) @@ -50,8 +50,8 @@ class AdminCalendarSlaTest < TestCase click(css: '[href="#manage"]') click(css: '[href="#manage/calendars"]') watch_for( - css: '.content.active', - value: calendar_name, + css: '.content.active', + value: calendar_name, timeout: 4, ) @@ -60,21 +60,21 @@ class AdminCalendarSlaTest < TestCase modal_ready(browser: @browser) watch_for( - css: '.content.active .modal input[name=name]', - value: calendar_name, + css: '.content.active .modal input[name=name]', + value: calendar_name, timeout: 4, ) watch_for( - css: '.content.active .modal input.js-input', - value: timezone_verify, + css: '.content.active .modal input.js-input', + value: timezone_verify, timeout: 4, ) modal_close() sla_create( data: { - name: sla_name, - calendar: "#{calendar_name} - #{timezone}", + name: sla_name, + calendar: "#{calendar_name} - #{timezone}", first_response_time_in_text: 61 }, ) diff --git a/test/browser/admin_channel_email_test.rb b/test/browser/admin_channel_email_test.rb index e463d0415..a153b663d 100644 --- a/test/browser/admin_channel_email_test.rb +++ b/test/browser/admin_channel_email_test.rb @@ -15,7 +15,7 @@ class AdminChannelEmailTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -25,14 +25,14 @@ class AdminChannelEmailTest < TestCase # check if postmaster filter are shown click(css: '.content.active a[href="#c-filter"]') match( - css: '.content.active #c-filter .overview', + css: '.content.active #c-filter .overview', value: 'No Entries', ) # check if signatures are shown click(css: '.content.active a[href="#c-signature"]') match( - css: '.content.active #c-signature .overview', + css: '.content.active #c-signature .overview', value: 'default', ) @@ -41,15 +41,15 @@ class AdminChannelEmailTest < TestCase modal_ready() set( - css: '.modal input[name="realname"]', + css: '.modal input[name="realname"]', value: 'My System', ) set( - css: '.modal input[name="email"]', + css: '.modal input[name="email"]', value: mailbox_user, ) set( - css: '.modal input[name="password"]', + css: '.modal input[name="password"]', value: mailbox_password, ) select( @@ -60,7 +60,7 @@ class AdminChannelEmailTest < TestCase sleep 4 watch_for( - css: '.modal', + css: '.modal', value: '(already exists|unknown mailbox)', ) @@ -82,15 +82,15 @@ class AdminChannelEmailTest < TestCase modal_ready() set( - css: '.modal input[name="realname"]', + css: '.modal input[name="realname"]', value: 'My System', ) set( - css: '.modal input[name="email"]', + css: '.modal input[name="email"]', value: mailbox_user, ) set( - css: '.modal input[name="password"]', + css: '.modal input[name="password"]', value: mailbox_password, ) select( @@ -101,7 +101,7 @@ class AdminChannelEmailTest < TestCase modal_disappear(timeout: 20) watch_for( - css: '.content.active', + css: '.content.active', value: mailbox_user, ) @@ -111,12 +111,12 @@ class AdminChannelEmailTest < TestCase modal_ready() set( - css: '.modal input[name="options::folder"]', + css: '.modal input[name="options::folder"]', value: 'not_existing_folder', ) click(css: '.modal .js-inbound button.js-submit') watch_for( - css: '.modal', + css: '.modal', value: 'Mailbox doesn\'t exist', ) @@ -131,7 +131,7 @@ class AdminChannelEmailTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -145,18 +145,18 @@ class AdminChannelEmailTest < TestCase modal_ready() set( - css: '.modal input[name="name"]', + css: '.modal input[name="name"]', value: filter_name, ) set( - css: '.modal input[name="match::from::value"]', + css: '.modal input[name="match::from::value"]', value: 'target', ) click(css: '.modal .js-submit') modal_disappear() watch_for( - css: '.content.active .table', + css: '.content.active .table', value: filter_name, ) @@ -170,7 +170,7 @@ class AdminChannelEmailTest < TestCase # confirm the clone exists in the table watch_for( - css: '.content.active .table', + css: '.content.active .table', value: "Clone: #{filter_name}", ) end diff --git a/test/browser/admin_drag_drop_to_new_group_test.rb b/test/browser/admin_drag_drop_to_new_group_test.rb index e4a1c007b..dfc83e295 100644 --- a/test/browser/admin_drag_drop_to_new_group_test.rb +++ b/test/browser/admin_drag_drop_to_new_group_test.rb @@ -6,7 +6,7 @@ class AdminDragDropToNewGroupTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) new_group_name = add_group @@ -23,7 +23,7 @@ class AdminDragDropToNewGroupTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) new_group_name = add_group diff --git a/test/browser/admin_object_manager_test.rb b/test/browser/admin_object_manager_test.rb index d4b131cfe..e7aaad0cd 100644 --- a/test/browser/admin_object_manager_test.rb +++ b/test/browser/admin_object_manager_test.rb @@ -8,15 +8,15 @@ class AdminObjectManagerTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() # already existing object_manager_attribute_create( - data: { - name: 'customer_id', - display: 'Customer Should Not Creatable', + data: { + name: 'customer_id', + display: 'Customer Should Not Creatable', data_type: 'Text', }, error: 'already exists' @@ -24,9 +24,9 @@ class AdminObjectManagerTest < TestCase # invalid name object_manager_attribute_create( - data: { - name: 'some_other_id', - display: 'Should Not Creatable', + data: { + name: 'some_other_id', + display: 'Should Not Creatable', data_type: 'Text', }, error: 'are not allowed' @@ -34,9 +34,9 @@ class AdminObjectManagerTest < TestCase # invalid name object_manager_attribute_create( - data: { - name: 'some_other_ids', - display: 'Should Not Creatable', + data: { + name: 'some_other_ids', + display: 'Should Not Creatable', data_type: 'Text', }, error: 'are not allowed' @@ -44,9 +44,9 @@ class AdminObjectManagerTest < TestCase # invalid name object_manager_attribute_create( - data: { - name: 'some spaces', - display: 'Should Not Creatable', + data: { + name: 'some spaces', + display: 'Should Not Creatable', data_type: 'Text', }, error: 'are not allowed' @@ -55,19 +55,19 @@ class AdminObjectManagerTest < TestCase # valid name object_manager_attribute_create( data: { - name: 'browser_test1', - display: 'Browser Test 1', + name: 'browser_test1', + display: 'Browser Test 1', data_type: 'Text', }, ) watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'restart', ) watch_for_disappear( @@ -81,7 +81,7 @@ class AdminObjectManagerTest < TestCase # create new ticket ticket = ticket_create( - data: { + data: { customer: 'nico', group: 'Users', priority: '2 normal', @@ -92,7 +92,7 @@ class AdminObjectManagerTest < TestCase #custom_data_select: { # key1: 'some value', #}, - custom_data_input: { + custom_data_input: { browser_test1: 'some value öäüß', }, disable_group_check: true, @@ -100,7 +100,7 @@ class AdminObjectManagerTest < TestCase # update ticket ticket_update( - data: {}, + data: {}, #custom_data_select: { # key1: 'some value', #}, @@ -113,11 +113,11 @@ class AdminObjectManagerTest < TestCase click(css: 'a[href="#manage"]') click(css: 'a[href="#system/object_manager"]') watch_for( - css: '.content.active table', + css: '.content.active table', value: 'browser_test1', ) match_not( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) object_manager_attribute_delete( @@ -126,16 +126,16 @@ class AdminObjectManagerTest < TestCase }, ) watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) watch_for( - css: '.content.active table', + css: '.content.active table', value: 'browser_test1', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'restart', ) watch_for_disappear( @@ -147,11 +147,11 @@ class AdminObjectManagerTest < TestCase css: '.content.active', ) match_not( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) match_not( - css: '.content.active table', + css: '.content.active table', value: 'browser_test1', ) end @@ -161,15 +161,15 @@ class AdminObjectManagerTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() object_manager_attribute_create( data: { - name: 'browser_test2', - display: 'Browser Test 2', - data_type: 'Select', + name: 'browser_test2', + display: 'Browser Test 2', + data_type: 'Select', data_option: { options: { 'aa' => 'AA', @@ -185,8 +185,8 @@ class AdminObjectManagerTest < TestCase object_manager_attribute_create( data: { - name: 'browser_test2', - display: 'Browser Test 2', + name: 'browser_test2', + display: 'Browser Test 2', data_type: 'Text', #data_option: { # default: 'xxx', @@ -195,9 +195,9 @@ class AdminObjectManagerTest < TestCase ) object_manager_attribute_create( data: { - name: 'browser_test3', - display: 'Browser Test 3', - data_type: 'Select', + name: 'browser_test3', + display: 'Browser Test 3', + data_type: 'Select', data_option: { options: { 'aa' => 'AA', @@ -210,8 +210,8 @@ class AdminObjectManagerTest < TestCase object_manager_attribute_create( data: { - name: 'browser_test4', - display: 'Browser Test 4', + name: 'browser_test4', + display: 'Browser Test 4', data_type: 'Integer', #data_option: { # default: 'xxx', @@ -223,8 +223,8 @@ class AdminObjectManagerTest < TestCase object_manager_attribute_create( data: { - name: 'browser_test5', - display: 'Browser Test 5', + name: 'browser_test5', + display: 'Browser Test 5', data_type: 'Datetime', #data_option: { # future: true, @@ -236,8 +236,8 @@ class AdminObjectManagerTest < TestCase object_manager_attribute_create( data: { - name: 'browser_test6', - display: 'Browser Test 6', + name: 'browser_test6', + display: 'Browser Test 6', data_type: 'Date', #data_option: { # future: true, @@ -250,12 +250,12 @@ class AdminObjectManagerTest < TestCase # rubocop:disable Lint/BooleanSymbol object_manager_attribute_create( data: { - name: 'browser_test7', - display: 'Browser Test 7', - data_type: 'Boolean', + name: 'browser_test7', + display: 'Browser Test 7', + data_type: 'Boolean', data_option: { options: { - true: 'YES', + true: 'YES', false: 'NO', }, # default: true, @@ -265,12 +265,12 @@ class AdminObjectManagerTest < TestCase # rubocop:enable Lint/BooleanSymbol watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'restart', ) watch_for_disappear( @@ -284,7 +284,7 @@ class AdminObjectManagerTest < TestCase # create new ticket ticket = ticket_create( - data: { + data: { customer: 'nico', group: 'Users', priority: '2 normal', @@ -292,11 +292,11 @@ class AdminObjectManagerTest < TestCase title: 'ticket attribute test all #1', body: 'ticket attribute test all #1', }, - custom_data_select: { + custom_data_select: { browser_test3: 'CC', browser_test7: 'NO', }, - custom_data_input: { + custom_data_input: { browser_test2: 'some value öäüß', browser_test4: '25', }, @@ -305,12 +305,12 @@ class AdminObjectManagerTest < TestCase ticket_verify( data: { - title: 'ticket attribute test all #1', + title: 'ticket attribute test all #1', custom_data_select: { browser_test3: 'CC', browser_test7: 'NO', }, - custom_data_input: { + custom_data_input: { browser_test2: 'some value öäüß', browser_test4: '25', }, @@ -351,31 +351,31 @@ class AdminObjectManagerTest < TestCase object_manager_attribute_migrate match_not( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) match_not( - css: '.content.active table', + css: '.content.active table', value: 'browser_test2', ) match_not( - css: '.content.active table', + css: '.content.active table', value: 'browser_test3', ) match_not( - css: '.content.active table', + css: '.content.active table', value: 'browser_test4', ) match_not( - css: '.content.active table', + css: '.content.active table', value: 'browser_test5', ) match_not( - css: '.content.active table', + css: '.content.active table', value: 'browser_test6', ) match_not( - css: '.content.active table', + css: '.content.active table', value: 'browser_test7', ) end @@ -385,26 +385,26 @@ class AdminObjectManagerTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() # valid name object_manager_attribute_create( data: { - name: 'browser_update_test1', - display: 'Browser Update Test 1', + name: 'browser_update_test1', + display: 'Browser Update Test 1', data_type: 'Text', }, ) watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'restart', ) watch_for_disappear( @@ -416,26 +416,26 @@ class AdminObjectManagerTest < TestCase css: '.content.active', ) match_not( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) # valid name object_manager_attribute_update( data: { - name: 'browser_update_test1', - display: 'Browser Update Test 2', + name: 'browser_update_test1', + display: 'Browser Update Test 2', data_type: 'Text', }, ) watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'configuration of Zammad has changed', ) click(css: '.modal .js-submit') @@ -448,7 +448,7 @@ class AdminObjectManagerTest < TestCase css: '.content.active', ) match_not( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) @@ -458,16 +458,16 @@ class AdminObjectManagerTest < TestCase }, ) watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) watch_for( - css: '.content.active table', + css: '.content.active table', value: 'browser_update_test1', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'restart', ) watch_for_disappear( @@ -479,11 +479,11 @@ class AdminObjectManagerTest < TestCase css: '.content.active', ) match_not( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) match_not( - css: '.content.active table', + css: '.content.active table', value: 'browser_update_test1', ) @@ -494,7 +494,7 @@ class AdminObjectManagerTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -502,27 +502,27 @@ class AdminObjectManagerTest < TestCase # create two new attributes object_manager_attribute_create( data: { - name: 'deletable_attribute', - display: 'Deletable Attribute', + name: 'deletable_attribute', + display: 'Deletable Attribute', data_type: 'Text', }, ) object_manager_attribute_create( data: { - name: 'undeletable_attribute', - display: 'Undeletable Attribute', + name: 'undeletable_attribute', + display: 'Undeletable Attribute', data_type: 'Text', }, ) watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'restart', ) watch_for_disappear( @@ -534,14 +534,14 @@ class AdminObjectManagerTest < TestCase css: '.content.active', ) match_not( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) # create a new overview that references the undeletable_attribute overview_create( browser: instance, - data: { + data: { name: 'test_overview', roles: ['Agent'], selector: { @@ -552,13 +552,13 @@ class AdminObjectManagerTest < TestCase } ) click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#system/object_manager"]', + browser: instance, + css: '.content.active a[href="#system/object_manager"]', mute_log: true, ) @@ -591,7 +591,7 @@ class AdminObjectManagerTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -601,9 +601,9 @@ class AdminObjectManagerTest < TestCase object_manager_attribute_create( data: { - name: 'select_attributes_sorting_test', - display: 'Select Attributes Sorting Test', - data_type: 'Select', + name: 'select_attributes_sorting_test', + display: 'Select Attributes Sorting Test', + data_type: 'Select', data_option: { options: options_hash }, }, ) @@ -625,17 +625,17 @@ class AdminObjectManagerTest < TestCase click(css: '.modal button.js-submit') watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) watch_for( - css: '.content.active table', + css: '.content.active table', value: 'select_attributes_sorting_test', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'restart', ) watch_for_disappear( @@ -649,7 +649,7 @@ class AdminObjectManagerTest < TestCase # create a new ticket and check whether the select attributes are correctly sorted or not click( - css: 'a[href="#ticket/create"]', + css: 'a[href="#ticket/create"]', mute_log: true, ) @@ -675,7 +675,7 @@ class AdminObjectManagerTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) options = Hash[ %w[äöü cat delete dog ß].map { |x| [x, "#{x.capitalize} Display"] } ] @@ -686,9 +686,9 @@ class AdminObjectManagerTest < TestCase object_manager_attribute_create( data: { - name: 'select_attributes_delete_test', - display: 'Select Attributes Delete Test', - data_type: 'Select', + name: 'select_attributes_delete_test', + display: 'Select Attributes Delete Test', + data_type: 'Select', data_option: { options: options, }, @@ -697,13 +697,13 @@ class AdminObjectManagerTest < TestCase object_manager_attribute_migrate ticket = ticket_create( - data: { + data: { customer: 'nico', group: 'Users', title: 'select_attributes_delete_test', body: 'select_attributes_delete_test', }, - custom_data_select: { + custom_data_select: { select_attributes_delete_test: 'Delete Display', }, disable_group_check: true, @@ -727,7 +727,7 @@ class AdminObjectManagerTest < TestCase object_manager_attribute_update( data: { - name: 'select_attributes_delete_test', + name: 'select_attributes_delete_test', data_option: { options: options_no_dog_no_delete, }, @@ -753,7 +753,7 @@ class AdminObjectManagerTest < TestCase # create a new ticket and check that the deleted options no longer appear click( - css: 'a[href="#ticket/create"]', + css: 'a[href="#ticket/create"]', mute_log: true, ) @@ -782,20 +782,20 @@ class AdminObjectManagerTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() object_manager_attribute_create( data: { - object: 'Organization', - name: 'bool_test', - display: 'bool_test', - data_type: 'Boolean', + object: 'Organization', + name: 'bool_test', + display: 'bool_test', + data_type: 'Boolean', data_option: { options: { # rubocop:disable Lint/BooleanSymbol - true: 'YES', + true: 'YES', false: 'NO', # rubocop:enable Lint/BooleanSymbol } @@ -804,9 +804,9 @@ class AdminObjectManagerTest < TestCase ) object_manager_attribute_create( data: { - object: 'Organization', - name: 'text_test', - display: 'text_test', + object: 'Organization', + name: 'text_test', + display: 'text_test', data_type: 'Text', }, ) @@ -824,28 +824,28 @@ class AdminObjectManagerTest < TestCase modal_disappear watch_for( - css: '.content.active .sidebar[data-tab="organization"] .sidebar-content', + css: '.content.active .sidebar[data-tab="organization"] .sidebar-content', value: 'bool_test', ) match_not( - css: '.content.active .sidebar[data-tab="organization"] .sidebar-content', + css: '.content.active .sidebar[data-tab="organization"] .sidebar-content', value: 'text_test', ) match( - css: '.content.active .sidebar[data-tab="organization"] .sidebar-content', + css: '.content.active .sidebar[data-tab="organization"] .sidebar-content', value: 'note', ) object_manager_attribute_delete( data: { object: 'Organization', - name: 'bool_test', + name: 'bool_test', }, ) object_manager_attribute_delete( data: { object: 'Organization', - name: 'text_test', + name: 'text_test', }, ) object_manager_attribute_migrate @@ -858,20 +858,20 @@ class AdminObjectManagerTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() object_manager_attribute_create( data: { - object: 'User', - name: 'bool_test', - display: 'bool_test', - data_type: 'Boolean', + object: 'User', + name: 'bool_test', + display: 'bool_test', + data_type: 'Boolean', data_option: { options: { # rubocop:disable Lint/BooleanSymbol - true: 'YES', + true: 'YES', false: 'NO', # rubocop:enable Lint/BooleanSymbol } @@ -880,9 +880,9 @@ class AdminObjectManagerTest < TestCase ) object_manager_attribute_create( data: { - object: 'User', - name: 'text_test', - display: 'text_test', + object: 'User', + name: 'text_test', + display: 'text_test', data_type: 'Text', }, ) @@ -900,28 +900,28 @@ class AdminObjectManagerTest < TestCase modal_disappear watch_for( - css: '.content.active .sidebar[data-tab="customer"] .sidebar-content', + css: '.content.active .sidebar[data-tab="customer"] .sidebar-content', value: 'bool_test', ) match_not( - css: '.content.active .sidebar[data-tab="customer"] .sidebar-content', + css: '.content.active .sidebar[data-tab="customer"] .sidebar-content', value: 'text_test', ) match( - css: '.content.active .sidebar[data-tab="customer"] .sidebar-content', + css: '.content.active .sidebar[data-tab="customer"] .sidebar-content', value: 'note', ) object_manager_attribute_delete( data: { object: 'User', - name: 'bool_test', + name: 'bool_test', }, ) object_manager_attribute_delete( data: { object: 'User', - name: 'text_test', + name: 'text_test', }, ) object_manager_attribute_migrate diff --git a/test/browser/admin_object_manager_tree_select_test.rb b/test/browser/admin_object_manager_tree_select_test.rb index df708e871..b9b5dda5a 100644 --- a/test/browser/admin_object_manager_tree_select_test.rb +++ b/test/browser/admin_object_manager_tree_select_test.rb @@ -8,27 +8,27 @@ class AdminObjectManagerTreeSelectTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() object_manager_attribute_create( data: { - name: 'browser_test_tree_select1', - display: 'Browser Test TreeSelect1', - data_type: 'Tree Select', + name: 'browser_test_tree_select1', + display: 'Browser Test TreeSelect1', + data_type: 'Tree Select', data_option: { options: { - 'Incident' => { - 'Hardware' => { + 'Incident' => { + 'Hardware' => { 'Monitor' => {}, 'Mouse' => {}, 'Keyboard' => {}, }, 'Softwareproblem' => { - 'CRM' => {}, - 'EDI' => {}, - 'SAP' => { + 'CRM' => {}, + 'EDI' => {}, + 'SAP' => { 'Authentication' => {}, 'Not reachable' => {}, }, @@ -45,19 +45,19 @@ class AdminObjectManagerTreeSelectTest < TestCase 'New hardware' => {}, 'Consulting' => {}, }, - 'Change request' => {}, + 'Change request' => {}, }, }, }, ) watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'restart', ) watch_for_disappear( @@ -73,11 +73,11 @@ class AdminObjectManagerTreeSelectTest < TestCase click(css: 'a[href="#manage"]') click(css: 'a[href="#system/object_manager"]') watch_for( - css: '.content.active table', + css: '.content.active table', value: 'browser_test_tree_select1', ) match_not( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) object_manager_attribute_delete( @@ -86,16 +86,16 @@ class AdminObjectManagerTreeSelectTest < TestCase }, ) watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) watch_for( - css: '.content.active table', + css: '.content.active table', value: 'browser_test_tree_select1', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'restart', ) watch_for_disappear( @@ -107,11 +107,11 @@ class AdminObjectManagerTreeSelectTest < TestCase css: '.content.active', ) match_not( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) match_not( - css: '.content.active table', + css: '.content.active table', value: 'browser_test_tree_select1', ) end @@ -122,28 +122,28 @@ class AdminObjectManagerTreeSelectTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() object_manager_attribute_create( data: { - name: 'browser_test_tree_select2', - display: 'Browser Test TreeSelect2', - data_type: 'Tree Select', + name: 'browser_test_tree_select2', + display: 'Browser Test TreeSelect2', + data_type: 'Tree Select', data_option: { options: { - 'Incident' => { + 'Incident' => { 'Hardware' => { - 'Monitor' => {}, - 'Mouse' => {}, + 'Monitor' => {}, + 'Mouse' => {}, }, }, 'Service request' => { 'New software requirement' => {}, 'New hardware' => {}, }, - 'Change request' => {}, + 'Change request' => {}, }, }, }, @@ -152,8 +152,8 @@ class AdminObjectManagerTreeSelectTest < TestCase # open the newly created tree_select and add some new options object_manager_attribute_update( - data: { - name: 'browser_test_tree_select2', + data: { + name: 'browser_test_tree_select2', }, do_not_submit: true, ) @@ -176,18 +176,18 @@ class AdminObjectManagerTreeSelectTest < TestCase # open the tree select again and check that the newly added options are there watch_for( - css: '.content.active table', + css: '.content.active table', value: 'browser_test_tree_select2', ) object_manager_attribute_update( - data: { - name: 'browser_test_tree_select2', + data: { + name: 'browser_test_tree_select2', }, do_not_submit: true, ) 2.times do |i| exists( - css: '.modal .js-treeTable', + css: '.modal .js-treeTable', value: "new tree option #{i}", ) end @@ -202,7 +202,7 @@ class AdminObjectManagerTreeSelectTest < TestCase object_manager_attribute_migrate match_not( - css: '.content.active table', + css: '.content.active table', value: 'browser_test_tree_select2', ) end diff --git a/test/browser/admin_overview_test.rb b/test/browser/admin_overview_test.rb index 9f2c8d584..67681b1a1 100644 --- a/test/browser/admin_overview_test.rb +++ b/test/browser/admin_overview_test.rb @@ -8,7 +8,7 @@ class AdminOverviewTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -45,16 +45,16 @@ class AdminOverviewTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'Priority 1 ticket', - body: 'some body 123äöü', + group: 'Users', + title: 'Priority 1 ticket', + body: 'some body 123äöü', priority: '1 low', }, ) @@ -62,9 +62,9 @@ class AdminOverviewTest < TestCase ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'Priority 2 ticket', - body: 'some body 123äöü', + group: 'Users', + title: 'Priority 2 ticket', + body: 'some body 123äöü', priority: '2 normal', }, ) @@ -72,9 +72,9 @@ class AdminOverviewTest < TestCase ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'Priority 3 ticket', - body: 'some body 123äöü', + group: 'Users', + title: 'Priority 3 ticket', + body: 'some body 123äöü', priority: '3 high', }, ) @@ -102,7 +102,7 @@ class AdminOverviewTest < TestCase # Update overview to sort groups from low to high overview_update( data: { - name: name, + name: name, group_direction: 'up', } ) @@ -131,7 +131,7 @@ class AdminOverviewTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -145,11 +145,11 @@ class AdminOverviewTest < TestCase click( css: first_overview_css ) modal_ready watch_for( - css: out_of_office_css, + css: out_of_office_css, value: 'no', ) select( - css: out_of_office_css, + css: out_of_office_css, value: 'yes', ) click( css: '.content.active .modal .js-submit' ) @@ -159,11 +159,11 @@ class AdminOverviewTest < TestCase click( css: first_overview_css ) modal_ready watch_for( - css: out_of_office_css, + css: out_of_office_css, value: 'yes', ) select( - css: out_of_office_css, + css: out_of_office_css, value: 'no', ) click( css: '.content.active .modal .js-submit' ) @@ -173,7 +173,7 @@ class AdminOverviewTest < TestCase click( css: first_overview_css ) modal_ready watch_for( - css: out_of_office_css, + css: out_of_office_css, value: 'no', ) click( css: '.content.active .modal .js-submit' ) diff --git a/test/browser/admin_permissions_granular_vs_full_test.rb b/test/browser/admin_permissions_granular_vs_full_test.rb index e846e2dc8..31374f1a2 100644 --- a/test/browser/admin_permissions_granular_vs_full_test.rb +++ b/test/browser/admin_permissions_granular_vs_full_test.rb @@ -7,7 +7,7 @@ class AdminPermissionsGranularVsFullTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() diff --git a/test/browser/admin_role_test.rb b/test/browser/admin_role_test.rb index 6bfda37be..232712fbf 100644 --- a/test/browser/admin_role_test.rb +++ b/test/browser/admin_role_test.rb @@ -8,7 +8,7 @@ class AdminRoleTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -21,11 +21,11 @@ class AdminRoleTest < TestCase user_create( data: { - login: login, + login: login, firstname: firstname, - lastname: lastname, - email: email, - password: password, + lastname: lastname, + email: email, + password: password, }, ) @@ -34,11 +34,11 @@ class AdminRoleTest < TestCase data: { name: name, default_at_signup: false, - permission: [ + permission: [ 'admin.group', 'user_preferences.device', ], - member: [login], + member: [login], } ) @@ -47,33 +47,33 @@ class AdminRoleTest < TestCase login( username: email, password: password, - url: browser_url, + url: browser_url, ) tasks_close_all() click(css: 'a[href="#current_user"]') click(css: 'a[href="#profile"]') match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Password', ) match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Language', ) match_not( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Notifications', ) match_not( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Calendar', ) match_not( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Token Access', ) match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Devices', ) @@ -81,7 +81,7 @@ class AdminRoleTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) role_edit( data: { @@ -94,33 +94,33 @@ class AdminRoleTest < TestCase login( username: email, password: password, - url: browser_url, + url: browser_url, ) tasks_close_all() click(css: 'a[href="#current_user"]') click(css: 'a[href="#profile"]') match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Password', ) match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Language', ) match_not( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Notifications', ) match_not( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Calendar', ) match_not( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Token Access', ) match_not( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Devices', ) end @@ -132,7 +132,7 @@ class AdminRoleTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) # check if admin exists @@ -143,19 +143,19 @@ class AdminRoleTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() role_edit( data: { - name: 'Agent', - active: true, + name: 'Agent', + active: true, permission: { - 'admin.user' => true, - 'chat.agent' => true, - 'cti.agent' => true, - 'ticket.agent' => true, + 'admin.user' => true, + 'chat.agent' => true, + 'cti.agent' => true, + 'ticket.agent' => true, 'user_preferences' => true, }, } @@ -166,7 +166,7 @@ class AdminRoleTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -187,9 +187,9 @@ class AdminRoleTest < TestCase ticket_create( data: { customer: user_email, - group: 'Users', - title: 'some changes', - body: 'some body 123äöü - admin.user', + group: 'Users', + title: 'some changes', + body: 'some body 123äöü - admin.user', }, ) @@ -198,19 +198,19 @@ class AdminRoleTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() role_edit( data: { - name: 'Agent', - active: true, + name: 'Agent', + active: true, permission: { - 'admin.user' => false, - 'chat.agent' => true, - 'cti.agent' => true, - 'ticket.agent' => true, + 'admin.user' => false, + 'chat.agent' => true, + 'cti.agent' => true, + 'ticket.agent' => true, 'user_preferences' => true, }, } @@ -220,7 +220,7 @@ class AdminRoleTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) # check if admin exists @@ -236,7 +236,7 @@ class AdminRoleTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() diff --git a/test/browser/agent_navigation_and_title_test.rb b/test/browser/agent_navigation_and_title_test.rb index 594cd8ab6..999abf482 100644 --- a/test/browser/agent_navigation_and_title_test.rb +++ b/test/browser/agent_navigation_and_title_test.rb @@ -6,7 +6,7 @@ class AgentNavigationAndTitleTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -29,7 +29,7 @@ class AgentNavigationAndTitleTest < TestCase # ticket create screen ticket_create( - data: { + data: { customer: 'nico', group: 'Users', title: 'ticket create #1', diff --git a/test/browser/agent_organization_profile_test.rb b/test/browser/agent_organization_profile_test.rb index e12807299..e77c64e73 100644 --- a/test/browser/agent_organization_profile_test.rb +++ b/test/browser/agent_organization_profile_test.rb @@ -10,7 +10,7 @@ class AgentOrganizationProfileTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -26,17 +26,17 @@ class AgentOrganizationProfileTest < TestCase ) watch_for( - css: '.active .profile-window', + css: '.active .profile-window', value: 'note', ) watch_for( - css: '.active .profile-window', + css: '.active .profile-window', value: 'member', ) # update note set( - css: '.active .profile [data-name="note"]', + css: '.active .profile [data-name="note"]', value: note, ) empty_search() @@ -48,23 +48,23 @@ class AgentOrganizationProfileTest < TestCase modal_ready() watch_for( - css: '.active .modal', + css: '.active .modal', value: note, ) set( - css: '.modal [name="name"]', + css: '.modal [name="name"]', value: 'Z2', ) set( - css: '.active .modal [data-name="note"]', + css: '.active .modal [data-name="note"]', value: 'some note abc', ) click(css: '.active .modal button.js-submit') modal_disappear() watch_for( - css: '.active .profile-window', + css: '.active .profile-window', value: 'some note abc', ) @@ -80,7 +80,7 @@ class AgentOrganizationProfileTest < TestCase modal_ready() set( - css: '.modal [name="name"]', + css: '.modal [name="name"]', value: 'Zammad Foundation', ) click(css: '.active .modal button.js-submit') @@ -96,9 +96,9 @@ class AgentOrganizationProfileTest < TestCase ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'org profile check ' + message, - body: 'org profile check ' + message, + group: 'Users', + title: 'org profile check ' + message, + body: 'org profile check ' + message, }, ) @@ -107,7 +107,7 @@ class AgentOrganizationProfileTest < TestCase value: 'Zammad Foundation', ) watch_for( - css: '.active .profile-window', + css: '.active .profile-window', value: 'org profile check ' + message, ) tasks_close_all() @@ -120,10 +120,10 @@ class AgentOrganizationProfileTest < TestCase browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all( browser: browser2, @@ -131,18 +131,18 @@ class AgentOrganizationProfileTest < TestCase organization_open_by_search( browser: browser1, - value: 'Zammad Foundation', + value: 'Zammad Foundation', ) organization_open_by_search( browser: browser2, - value: 'Zammad Foundation', + value: 'Zammad Foundation', ) # update note set( browser: browser1, - css: '.active .profile [data-name="note"]', - value: message, + css: '.active .profile [data-name="note"]', + value: message, ) empty_search( browser: browser1, @@ -151,8 +151,8 @@ class AgentOrganizationProfileTest < TestCase # verify watch_for( browser: browser2, - css: '.active .profile-window', - value: message, + css: '.active .profile-window', + value: message, ) end @@ -161,7 +161,7 @@ class AgentOrganizationProfileTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -171,7 +171,7 @@ class AgentOrganizationProfileTest < TestCase ) watch_for( - css: '.active .profile-window .userList-entry a.user-popover', + css: '.active .profile-window .userList-entry a.user-popover', value: 'Nicole Braun', ) @@ -192,7 +192,7 @@ class AgentOrganizationProfileTest < TestCase modal_ready() select( - css: '.active .modal select[name="active"]', + css: '.active .modal select[name="active"]', value: 'inactive' ) @@ -224,7 +224,7 @@ class AgentOrganizationProfileTest < TestCase modal_ready() select( - css: '.active .modal select[name="active"]', + css: '.active .modal select[name="active"]', value: 'active' ) diff --git a/test/browser/agent_ticket_attachment_test.rb b/test/browser/agent_ticket_attachment_test.rb index 6c2f496f2..9558e7a86 100644 --- a/test/browser/agent_ticket_attachment_test.rb +++ b/test/browser/agent_ticket_attachment_test.rb @@ -7,7 +7,7 @@ class AgentTicketAttachmentTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -17,11 +17,11 @@ class AgentTicketAttachmentTest < TestCase # create new ticket with no attachment, attachment check should pop up ticket_create( - data: { + data: { customer: 'nico', - group: 'Users', - title: 'test 6 - ticket 1', - body: 'test 6 - ticket 1 - with the word attachment, but not attachment atteched it should give an warning on submit', + group: 'Users', + title: 'test 6 - ticket 1', + body: 'test 6 - ticket 1 - with the word attachment, but not attachment atteched it should give an warning on submit', }, do_not_submit: true, ) @@ -67,11 +67,11 @@ class AgentTicketAttachmentTest < TestCase sleep 2 ticket_number = @browser.find_elements({ css: '.content.active .ticketZoom-header .ticket-number' })[0].text match( - css: '.content.active .ticket-article-item:nth-child(1) .attachments', + css: '.content.active .ticket-article-item:nth-child(1) .attachments', value: 'upload2.jpg', ) match( - css: '.content.active .ticket-article-item:nth-child(1) .attachments', + css: '.content.active .ticket-article-item:nth-child(1) .attachments', value: 'upload1.txt', ) @@ -81,7 +81,7 @@ class AgentTicketAttachmentTest < TestCase # update ticket with no attachment, attachment check should pop up ticket_update( - data: { + data: { body: 'test 6 - ticket 1-1 - with the word attachment, but not attachment atteched it should give an warning on submit', }, do_not_submit: true, @@ -118,8 +118,8 @@ class AgentTicketAttachmentTest < TestCase # discard changes should gone away watch_for_disappear( - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) ticket_verify( @@ -130,15 +130,15 @@ class AgentTicketAttachmentTest < TestCase # check content and edit screen in instance 1 watch_for( - css: '.content.active div.ticket-article', + css: '.content.active div.ticket-article', value: 'test 6 - ticket 1-1', ) match_not( - css: '.content.active .ticket-article-item:nth-child(3) .attachments', + css: '.content.active .ticket-article-item:nth-child(3) .attachments', value: 'upload2.jpg', ) match( - css: '.content.active .ticket-article-item:nth-child(3) .attachments', + css: '.content.active .ticket-article-item:nth-child(3) .attachments', value: 'upload1.txt', ) @@ -165,14 +165,14 @@ class AgentTicketAttachmentTest < TestCase # check warning modal_ready() match( - css: '.content.active .modal', + css: '.content.active .modal', value: 'missing', ) click(css: '.content.active .modal .js-cancel') modal_disappear() ticket_update( - data: { + data: { body: 'now submit should work', }, do_not_submit: true, @@ -184,8 +184,8 @@ class AgentTicketAttachmentTest < TestCase # discard changes should gone away watch_for_disappear( - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) ticket_verify( @@ -194,11 +194,11 @@ class AgentTicketAttachmentTest < TestCase }, ) match( - css: '.content.active .ticket-article-item:nth-child(4) .attachments', + css: '.content.active .ticket-article-item:nth-child(4) .attachments', value: 'upload2.jpg', ) match( - css: '.content.active .ticket-article-item:nth-child(4) .attachments', + css: '.content.active .ticket-article-item:nth-child(4) .attachments', value: 'upload1.txt', ) # @@ -210,10 +210,10 @@ class AgentTicketAttachmentTest < TestCase browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all( browser: browser2, @@ -222,22 +222,22 @@ class AgentTicketAttachmentTest < TestCase user_email = random + '@example.com' user_create( browser: browser2, - data: { + data: { firstname: 'Action6 Firstname' + random, - lastname: 'Action6 Lastname' + random, - email: user_email, - password: 'some-pass', + lastname: 'Action6 Lastname' + random, + email: user_email, + password: 'some-pass', }, ) # update customer, check if new customer is shown in side bar ticket_open_by_search( browser: browser2, - number: ticket_number, + number: ticket_number, ) ticket_update( - browser: browser2, - data: { + browser: browser2, + data: { customer: user_email, }, do_not_submit: true, @@ -247,8 +247,8 @@ class AgentTicketAttachmentTest < TestCase click(browser: browser1, css: '.content.active .tabsSidebar-tab[data-tab="customer"]') watch_for( browser: browser1, - css: '.content.active .tabsSidebar', - value: user_email, + css: '.content.active .tabsSidebar', + value: user_email, ) # @@ -267,8 +267,8 @@ class AgentTicketAttachmentTest < TestCase click(browser: browser2, css: '.content.active .tabsSidebar-tab[data-tab="customer"]') watch_for( browser: browser2, - css: '.content.active .sidebar[data-tab="customer"]', - value: 'some new address', + css: '.content.active .sidebar[data-tab="customer"]', + value: 'some new address', ) # @@ -291,8 +291,8 @@ class AgentTicketAttachmentTest < TestCase click(browser: browser2, css: '.content.active .tabsSidebar-tab[data-tab="organization"]') watch_for( browser: browser2, - css: '.content.active .sidebar[data-tab="organization"]', - value: 'Zammad Foundation', + css: '.content.active .sidebar[data-tab="organization"]', + value: 'Zammad Foundation', ) # @@ -311,24 +311,24 @@ class AgentTicketAttachmentTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() ticket1 = ticket_create( - data: { + data: { customer: 'Nico', - group: 'Users', - title: 'Ticket 1', - body: 'some body', + group: 'Users', + title: 'Ticket 1', + body: 'some body', }, do_not_submit: true, ) # First test the attachment uploading for new tickets file_upload( - css: '.content.active .attachmentPlaceholder-inputHolder input', - files: [large_file], + css: '.content.active .attachmentPlaceholder-inputHolder input', + files: [large_file], no_sleep: true, ) exists( @@ -348,14 +348,14 @@ class AgentTicketAttachmentTest < TestCase # Next test the attachment uploading for new articles ticket_update( - data: { + data: { body: 'added attachment', }, do_not_submit: true, ) file_upload( - css: '.content.active .attachmentPlaceholder-inputHolder input', - files: [large_file], + css: '.content.active .attachmentPlaceholder-inputHolder input', + files: [large_file], no_sleep: true, ) exists( diff --git a/test/browser/agent_ticket_auto_assignment_test.rb b/test/browser/agent_ticket_auto_assignment_test.rb index b29cd8d84..693b0887b 100644 --- a/test/browser/agent_ticket_auto_assignment_test.rb +++ b/test/browser/agent_ticket_auto_assignment_test.rb @@ -7,7 +7,7 @@ class AgentTicketAutoAssignmentTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -19,27 +19,27 @@ class AgentTicketAutoAssignmentTest < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'test_auto_assignment_1 - ticket 1', - body: 'test_auto_assignment_1 - ticket 1 - no auto assignment', + group: 'Users', + title: 'test_auto_assignment_1 - ticket 1', + body: 'test_auto_assignment_1 - ticket 1 - no auto assignment', }, ) ticket2 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'test_auto_assignment_2 - ticket 2', - body: 'test_auto_assignment_2 - ticket 2 - no auto assignment', + group: 'Users', + title: 'test_auto_assignment_2 - ticket 2', + body: 'test_auto_assignment_2 - ticket 2 - no auto assignment', }, ) ticket3 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'test_auto_assignment_3 - ticket 3', - body: 'test_auto_assignment_3 - ticket 3 - no auto assignment', + group: 'Users', + title: 'test_auto_assignment_3 - ticket 3', + body: 'test_auto_assignment_3 - ticket 3 - no auto assignment', }, ) @@ -50,7 +50,7 @@ class AgentTicketAutoAssignmentTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -61,7 +61,7 @@ class AgentTicketAutoAssignmentTest < TestCase # verify if owner is set match( - css: '.content.active .sidebar select[name="owner_id"]', + css: '.content.active .sidebar select[name="owner_id"]', value: '-', ) @@ -72,7 +72,7 @@ class AgentTicketAutoAssignmentTest < TestCase # verify if owner is set match( - css: '.content.active .sidebar select[name="owner_id"]', + css: '.content.active .sidebar select[name="owner_id"]', value: '-', ) @@ -83,7 +83,7 @@ class AgentTicketAutoAssignmentTest < TestCase click(css: '.content.active a[href="#settings/ticket"]') click(css: '.content.active a[href="#auto_assignment"]') switch( - css: '.content.active .js-ticketAutoAssignment', + css: '.content.active .js-ticketAutoAssignment', type: 'on', ) @@ -94,8 +94,8 @@ class AgentTicketAutoAssignmentTest < TestCase # verify if owner is set watch_for( - css: '.content.active .sidebar select[name="owner_id"]', - value: 'Test Master', + css: '.content.active .sidebar select[name="owner_id"]', + value: 'Test Master', timeout: 2, ) @@ -106,8 +106,8 @@ class AgentTicketAutoAssignmentTest < TestCase # verify if owner is set watch_for( - css: '.content.active .sidebar select[name="owner_id"]', - value: 'Test Master', + css: '.content.active .sidebar select[name="owner_id"]', + value: 'Test Master', timeout: 2, ) @@ -119,8 +119,8 @@ class AgentTicketAutoAssignmentTest < TestCase click(css: '.content.active .js-timeAccountingFilter') watch_for_disappear( - css: '.content.active .sidebar select[name="owner_id"]', - value: 'Test Master', + css: '.content.active .sidebar select[name="owner_id"]', + value: 'Test Master', timeout: 10, ) @@ -132,7 +132,7 @@ class AgentTicketAutoAssignmentTest < TestCase # verify if owner is not set sleep 6 match( - css: '.content.active .sidebar select[name="owner_id"]', + css: '.content.active .sidebar select[name="owner_id"]', value: '-', ) @@ -143,7 +143,7 @@ class AgentTicketAutoAssignmentTest < TestCase click(css: '.content.active a[href="#settings/ticket"]') click(css: '.content.active a[href="#auto_assignment"]') switch( - css: '.content.active .js-ticketAutoAssignment', + css: '.content.active .js-ticketAutoAssignment', type: 'off', ) diff --git a/test/browser/agent_ticket_create_attachment_missing_after_reload_test.rb b/test/browser/agent_ticket_create_attachment_missing_after_reload_test.rb index 874fcbe67..68543f068 100644 --- a/test/browser/agent_ticket_create_attachment_missing_after_reload_test.rb +++ b/test/browser/agent_ticket_create_attachment_missing_after_reload_test.rb @@ -9,7 +9,7 @@ class AgentticketCreateAttachmentMissingAfterReloadTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -19,11 +19,11 @@ class AgentticketCreateAttachmentMissingAfterReloadTest < TestCase # create new ticket with no attachment, attachment check should pop up ticket_create( - data: { + data: { customer: 'nico', - group: 'Users', - title: 'test 6 - ticket 1', - body: 'test 6 - ticket 1 body', + group: 'Users', + title: 'test 6 - ticket 1', + body: 'test 6 - ticket 1 body', }, do_not_submit: true, ) @@ -43,7 +43,7 @@ class AgentticketCreateAttachmentMissingAfterReloadTest < TestCase # check if attachment is shown match( - css: '.content.active .newTicket .attachments .attachment:nth-child(1) .attachment-name', + css: '.content.active .newTicket .attachments .attachment:nth-child(1) .attachment-name', value: 'upload1.txt' ) @@ -53,7 +53,7 @@ class AgentticketCreateAttachmentMissingAfterReloadTest < TestCase # check if attachment is shown match( - css: '.content.active .newTicket .attachments .attachment:nth-child(1) .attachment-name', + css: '.content.active .newTicket .attachments .attachment:nth-child(1) .attachment-name', value: 'upload1.txt' ) end diff --git a/test/browser/agent_ticket_create_available_types_test.rb b/test/browser/agent_ticket_create_available_types_test.rb index 1d496981c..0671a92d8 100644 --- a/test/browser/agent_ticket_create_available_types_test.rb +++ b/test/browser/agent_ticket_create_available_types_test.rb @@ -9,7 +9,7 @@ class AgentTicketCreateAvailableTypesTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -27,7 +27,7 @@ class AgentTicketCreateAvailableTypesTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() diff --git a/test/browser/agent_ticket_create_cc_tokenizer_test.rb b/test/browser/agent_ticket_create_cc_tokenizer_test.rb index 70c511758..283928292 100644 --- a/test/browser/agent_ticket_create_cc_tokenizer_test.rb +++ b/test/browser/agent_ticket_create_cc_tokenizer_test.rb @@ -12,7 +12,7 @@ class AgentTicketCreateCcTokenizerTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() diff --git a/test/browser/agent_ticket_create_default_type_test.rb b/test/browser/agent_ticket_create_default_type_test.rb index 1cbad1142..08a9071c2 100644 --- a/test/browser/agent_ticket_create_default_type_test.rb +++ b/test/browser/agent_ticket_create_default_type_test.rb @@ -9,7 +9,7 @@ class AgentTicketCreateDefaultTypeTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -35,7 +35,7 @@ class AgentTicketCreateDefaultTypeTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -63,7 +63,7 @@ class AgentTicketCreateDefaultTypeTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() diff --git a/test/browser/agent_ticket_create_reset_customer_selection_test.rb b/test/browser/agent_ticket_create_reset_customer_selection_test.rb index 9e95d795a..774cb1a0c 100644 --- a/test/browser/agent_ticket_create_reset_customer_selection_test.rb +++ b/test/browser/agent_ticket_create_reset_customer_selection_test.rb @@ -6,7 +6,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -14,7 +14,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase click(css: 'a[href="#ticket/create"]') watch_for( - css: '.content.active .newTicket', + css: '.content.active .newTicket', timeout: 3, ) @@ -31,12 +31,12 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase @browser.execute_script( "$('.content.active .newTicket .js-recipientDropdown').addClass('open')" ) set( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: 'nicole', ) watch_for( - css: '.content.active .newTicket .js-recipientDropdown .recipientList.is-shown', - value: 'Nicole', + css: '.content.active .newTicket .js-recipientDropdown .recipientList.is-shown', + value: 'Nicole', timeout: 3, ) sendkey(value: :enter) @@ -50,7 +50,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase exists(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]') set( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: '', ) sendkey(value: :backspace) @@ -64,15 +64,15 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase exists_not(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]') set( - css: '.content.active .newTicket input[name="title"]', + css: '.content.active .newTicket input[name="title"]', value: 'some title', ) set( - css: '.content.active .newTicket div[data-name="body"]', + css: '.content.active .newTicket div[data-name="body"]', value: 'some body', ) select( - css: '.content.active .newTicket select[name="group_id"]', + css: '.content.active .newTicket select[name="group_id"]', value: 'Users', ) click(css: '.content.active .newTicket .js-submit') @@ -90,7 +90,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -111,12 +111,12 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase @browser.execute_script( "$('.content.active .newTicket .js-recipientDropdown').addClass('open')" ) set( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: 'nicole', ) watch_for( - css: '.content.active .newTicket .js-recipientDropdown .recipientList.is-shown', - value: 'Nicole', + css: '.content.active .newTicket .js-recipientDropdown .recipientList.is-shown', + value: 'Nicole', timeout: 3, ) sendkey(value: :enter) @@ -130,7 +130,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase exists(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]') set( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: '', ) sendkey(value: :backspace) @@ -144,32 +144,32 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase exists_not(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]') set( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: 'somecustomer_not_existing_right_now@example.com', ) set( - css: '.content.active .newTicket input[name="title"]', + css: '.content.active .newTicket input[name="title"]', value: 'some title', ) set( - css: '.content.active .newTicket div[data-name="body"]', + css: '.content.active .newTicket div[data-name="body"]', value: 'some body', ) select( - css: '.content.active .newTicket select[name="group_id"]', + css: '.content.active .newTicket select[name="group_id"]', value: 'Users', ) click(css: '.content.active .newTicket .js-submit') watch_for( - css: '.content.active .ticketZoom-header .ticket-number', + css: '.content.active .ticketZoom-header .ticket-number', value: '\d', ) click(css: '.content.active .tabsSidebar-tabs .tabsSidebar-tab[data-tab="customer"]') match( - css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', + css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', value: 'somecustomer_not_existing_right_now@example.com', ) @@ -189,7 +189,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase ) set( - css: '.content.active .modal input[name="customer_id_completion"]', + css: '.content.active .modal input[name="customer_id_completion"]', value: 'master', ) click(css: '.content.active .modal .js-submit') @@ -199,19 +199,19 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase ) set( - css: '.content.active .modal input[name="customer_id_completion"]', + css: '.content.active .modal input[name="customer_id_completion"]', value: 'master', ) watch_for( - css: '.content.active .modal .js-recipientDropdown .recipientList.is-shown', - value: 'Master', + css: '.content.active .modal .js-recipientDropdown .recipientList.is-shown', + value: 'Master', timeout: 3, ) sendkey(value: :enter) sleep 1 set( - css: '.content.active .modal input[name="customer_id_completion"]', + css: '.content.active .modal input[name="customer_id_completion"]', value: '', ) sendkey(value: :backspace) @@ -224,12 +224,12 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase ) set( - css: '.content.active .modal input[name="customer_id_completion"]', + css: '.content.active .modal input[name="customer_id_completion"]', value: 'master', ) watch_for( - css: '.content.active .modal .js-recipientDropdown .recipientList.is-shown', - value: 'Master', + css: '.content.active .modal .js-recipientDropdown .recipientList.is-shown', + value: 'Master', timeout: 3, ) sendkey(value: :enter) @@ -239,7 +239,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase #click(css: '.content.active .tabsSidebar-tabs .tabsSidebar-tab[data-tab="customer"]') watch_for( - css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', + css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', value: 'master@example.com', ) diff --git a/test/browser/agent_ticket_create_template_test.rb b/test/browser/agent_ticket_create_template_test.rb index b7787eae9..f518563a5 100644 --- a/test/browser/agent_ticket_create_template_test.rb +++ b/test/browser/agent_ticket_create_template_test.rb @@ -11,7 +11,7 @@ class AgentTicketCreateTemplateTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -19,21 +19,21 @@ class AgentTicketCreateTemplateTest < TestCase css: 'a[href="#ticket/create"]' ) watch_for( - css: '.active .templates-welcome', + css: '.active .templates-welcome', displayed: true ) set( - css: 'input[name="title"]', + css: 'input[name="title"]', value: 'my first ticket' ) click( css: '.active .templates-welcome .js-create' ) watch_for( - css: '.active .templates-manage', + css: '.active .templates-manage', displayed: true, - timeout: 3, + timeout: 3, ) exists_not( css: '.active .templates-manage select[name="id"] > option:not([value=""])' @@ -41,14 +41,14 @@ class AgentTicketCreateTemplateTest < TestCase # save new template set( - css: '.active .templates-manage .js-name', + css: '.active .templates-manage .js-name', value: 'test template' ) click( css: '.active .templates-manage .js-save' ) exists( - css: '.active .templates-manage select[name="id"] > option:not([value=""])', + css: '.active .templates-manage select[name="id"] > option:not([value=""])', displayed: true ) @@ -63,11 +63,11 @@ class AgentTicketCreateTemplateTest < TestCase css: '.navigation > .tasks > a.task' ) exists( - css: '.active .templates-manage', + css: '.active .templates-manage', displayed: true ) exists( - css: '.active .templates-manage select[name="id"] > option:not([value=""])', + css: '.active .templates-manage select[name="id"] > option:not([value=""])', displayed: true ) @@ -77,9 +77,9 @@ class AgentTicketCreateTemplateTest < TestCase css: 'a[href="#ticket/create"]' ) watch_for( - css: '.active .templates-manage', + css: '.active .templates-manage', displayed: true, - timeout: 3, + timeout: 3, ) select( css: '.active .templates-manage select[name="id"]', @@ -89,7 +89,7 @@ class AgentTicketCreateTemplateTest < TestCase css: '.active .templates-manage .js-apply' ) exists( - css: '.active .newTicket input[name="title"]', + css: '.active .newTicket input[name="title"]', value: 'my first ticket' ) end diff --git a/test/browser/agent_ticket_email_reply_keep_body_test.rb b/test/browser/agent_ticket_email_reply_keep_body_test.rb index ff601be19..14f61c90d 100644 --- a/test/browser/agent_ticket_email_reply_keep_body_test.rb +++ b/test/browser/agent_ticket_email_reply_keep_body_test.rb @@ -8,7 +8,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -16,16 +16,16 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü - reply test', - body: 'some body 123äöü - reply test', + group: 'Users', + title: 'some subject 123äöü - reply test', + body: 'some body 123äöü - reply test', }, ) sleep 1 # fill body ticket_update( - data: { + data: { body: 'keep me', }, do_not_submit: true, @@ -42,8 +42,8 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase # check body watch_for( - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) @@ -65,8 +65,8 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase # check body watch_for( - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) @@ -87,7 +87,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase click(css: '.content.active .js-settingContainer .js-setting') modal_ready() select( - css: params[:css], + css: params[:css], value: params[:value] ) click( @@ -102,7 +102,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -115,13 +115,13 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase # enable email full quote in the ticket zoom config page change_quote_config( - css: '.modal #ui_ticket_zoom_article_email_full_quote select[name="ui_ticket_zoom_article_email_full_quote"]', - value: 'yes', + css: '.modal #ui_ticket_zoom_article_email_full_quote select[name="ui_ticket_zoom_article_email_full_quote"]', + value: 'yes', submit_css: '.modal #ui_ticket_zoom_article_email_full_quote .btn[type="submit"]', ) change_quote_config( - css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]', - value: 'yes', + css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]', + value: 'yes', submit_css: '.modal #ui_ticket_zoom_article_email_full_quote_header .btn[type="submit"]', ) @@ -144,8 +144,8 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase title: 'Welcome to Zammad', ) change_quote_config( - css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]', - value: 'no', + css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]', + value: 'no', submit_css: '.modal #ui_ticket_zoom_article_email_full_quote_header .btn[type="submit"]', ) @@ -166,8 +166,8 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase title: 'Welcome to Zammad', ) change_quote_config( - css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]', - value: 'yes', + css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]', + value: 'yes', submit_css: '.modal #ui_ticket_zoom_article_email_full_quote_header .btn[type="submit"]', ) end @@ -178,7 +178,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -191,8 +191,8 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase # enable email full quote in the ticket zoom config page change_quote_config( - css: '.modal #ui_ticket_zoom_article_email_full_quote select[name="ui_ticket_zoom_article_email_full_quote"]', - value: 'yes', + css: '.modal #ui_ticket_zoom_article_email_full_quote select[name="ui_ticket_zoom_article_email_full_quote"]', + value: 'yes', submit_css: '.modal #ui_ticket_zoom_article_email_full_quote .btn[type="submit"]', ) diff --git a/test/browser/agent_ticket_email_signature_test.rb b/test/browser/agent_ticket_email_signature_test.rb index 74b61919a..393f4915f 100644 --- a/test/browser/agent_ticket_email_signature_test.rb +++ b/test/browser/agent_ticket_email_signature_test.rb @@ -16,7 +16,7 @@ class AgentTicketEmailSignatureTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -41,11 +41,11 @@ class AgentTicketEmailSignatureTest < TestCase # create groups group_create( data: { - name: group_name1, + name: group_name1, signature: signature_name1, - member: [ + member: [ { - login: 'master@example.com', + login: 'master@example.com', access: 'full', }, ], @@ -53,11 +53,11 @@ class AgentTicketEmailSignatureTest < TestCase ) group_create( data: { - name: group_name2, + name: group_name2, signature: signature_name2, - member: [ + member: [ { - login: 'master@example.com', + login: 'master@example.com', access: 'full', }, ], @@ -65,10 +65,10 @@ class AgentTicketEmailSignatureTest < TestCase ) group_create( data: { - name: group_name3, + name: group_name3, member: [ { - login: 'master@example.com', + login: 'master@example.com', access: 'full', }, ], @@ -85,36 +85,36 @@ class AgentTicketEmailSignatureTest < TestCase # create ticket ticket_create( - data: { + data: { customer: 'nicole', - group: 'Users', - title: 'some subject 5 - 123äöü', - body: 'some body 5 - 123äöü', + group: 'Users', + title: 'some subject 5 - 123äöü', + body: 'some body 5 - 123äöü', }, do_not_submit: true, ) # select group select( - css: '.active [name="group_id"]', + css: '.active [name="group_id"]', value: group_name1, ) # check content match( - css: '.active [data-name="body"]', + css: '.active [data-name="body"]', value: 'some body 5', ) # check signature match_not( - css: '.active [data-name="body"]', - value: signature_body1, + css: '.active [data-name="body"]', + value: signature_body1, no_quote: true, ) match_not( - css: '.active [data-name="body"]', - value: signature_body2, + css: '.active [data-name="body"]', + value: signature_body2, no_quote: true, ) @@ -127,91 +127,91 @@ class AgentTicketEmailSignatureTest < TestCase # check content match( - css: '.active [data-name="body"]', + css: '.active [data-name="body"]', value: 'some body 5', ) # check signature match( - css: '.active [data-name="body"]', - value: signature_body1, + css: '.active [data-name="body"]', + value: signature_body1, no_quote: true, ) match_not( - css: '.active [data-name="body"]', - value: signature_body2, + css: '.active [data-name="body"]', + value: signature_body2, no_quote: true, ) # select group select( - css: '.active [name="group_id"]', + css: '.active [name="group_id"]', value: group_name2, ) # check content match( - css: '.active [data-name="body"]', + css: '.active [data-name="body"]', value: 'some body 5', ) # check signature match_not( - css: '.active [data-name="body"]', - value: signature_body1, + css: '.active [data-name="body"]', + value: signature_body1, no_quote: true, ) match( - css: '.active [data-name="body"]', - value: signature_body2, + css: '.active [data-name="body"]', + value: signature_body2, no_quote: true, ) # select group select( - css: '.active [name="group_id"]', + css: '.active [name="group_id"]', value: group_name3, ) # check content match( - css: '.active [data-name="body"]', + css: '.active [data-name="body"]', value: 'some body 5', ) # check signature match_not( - css: '.active [data-name="body"]', - value: signature_body1, + css: '.active [data-name="body"]', + value: signature_body1, no_quote: true, ) match_not( - css: '.active [data-name="body"]', - value: signature_body2, + css: '.active [data-name="body"]', + value: signature_body2, no_quote: true, ) # select group select( - css: '.active [name="group_id"]', + css: '.active [name="group_id"]', value: group_name1, ) # check content match( - css: '.active [data-name="body"]', + css: '.active [data-name="body"]', value: 'some body 5', ) # check signature match( - css: '.active [data-name="body"]', - value: signature_body1, + css: '.active [data-name="body"]', + value: signature_body1, no_quote: true, ) match_not( - css: '.active [data-name="body"]', - value: signature_body2, + css: '.active [data-name="body"]', + value: signature_body2, no_quote: true, ) @@ -222,19 +222,19 @@ class AgentTicketEmailSignatureTest < TestCase # check content match( - css: '.active [data-name="body"]', + css: '.active [data-name="body"]', value: 'some body 5', ) # check signature match_not( - css: '.active [data-name="body"]', - value: signature_body1, + css: '.active [data-name="body"]', + value: signature_body1, no_quote: true, ) match_not( - css: '.active [data-name="body"]', - value: signature_body2, + css: '.active [data-name="body"]', + value: signature_body2, no_quote: true, ) @@ -244,9 +244,9 @@ class AgentTicketEmailSignatureTest < TestCase ticket_create( data: { customer: 'nicole', - group: group_name1, - title: 'some subject 5/2 - 123äöü', - body: 'some body 5/2 - 123äöü', + group: group_name1, + title: 'some subject 5/2 - 123äöü', + body: 'some body 5/2 - 123äöü', }, ) @@ -257,19 +257,19 @@ class AgentTicketEmailSignatureTest < TestCase # check if signature exists match( - css: '.active [data-name="body"]', - value: signature_body1, + css: '.active [data-name="body"]', + value: signature_body1, no_quote: true, ) match_not( - css: '.active [data-name="body"]', - value: signature_body2, + css: '.active [data-name="body"]', + value: signature_body2, no_quote: true, ) # update group2 select( - css: '.active [name="group_id"]', + css: '.active [name="group_id"]', value: group_name2, ) @@ -285,13 +285,13 @@ class AgentTicketEmailSignatureTest < TestCase # check if signature exists match_not( - css: '.active [data-name="body"]', - value: signature_body1, + css: '.active [data-name="body"]', + value: signature_body1, no_quote: true, ) match( - css: '.active [data-name="body"]', - value: signature_body2, + css: '.active [data-name="body"]', + value: signature_body2, no_quote: true, ) @@ -304,13 +304,13 @@ class AgentTicketEmailSignatureTest < TestCase # check if signature exists match_not( - css: '.active [data-name="body"]', - value: signature_body1, + css: '.active [data-name="body"]', + value: signature_body1, no_quote: true, ) match_not( - css: '.active [data-name="body"]', - value: signature_body2, + css: '.active [data-name="body"]', + value: signature_body2, no_quote: true, ) diff --git a/test/browser/agent_ticket_link_test.rb b/test/browser/agent_ticket_link_test.rb index b19f5a2e0..709fe7b4f 100644 --- a/test/browser/agent_ticket_link_test.rb +++ b/test/browser/agent_ticket_link_test.rb @@ -7,35 +7,35 @@ class AgentTicketLinkTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject - link#1', - body: 'some body - link#1', + group: 'Users', + title: 'some subject - link#1', + body: 'some body - link#1', }, ) ticket2 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject - link#2', - body: 'some body - link#2', + group: 'Users', + title: 'some subject - link#2', + body: 'some body - link#2', }, ) # verify changes in second browser browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) ticket_open_by_search( browser: browser2, @@ -49,11 +49,11 @@ class AgentTicketLinkTest < TestCase modal_ready() set( - css: '.content.active .modal-body [name="ticket_number"]', + css: '.content.active .modal-body [name="ticket_number"]', value: ticket1[:number], ) select( - css: '.content.active .modal-body [name="link_type"]', + css: '.content.active .modal-body [name="link_type"]', value: 'Normal', ) click( @@ -61,45 +61,45 @@ class AgentTicketLinkTest < TestCase ) watch_for( - css: '.content.active .ticketLinks', + css: '.content.active .ticketLinks', value: ticket1[:title], ) watch_for( browser: browser2, - css: '.content.active .ticketLinks', - value: ticket2[:title], + css: '.content.active .ticketLinks', + value: ticket2[:title], ) reload() watch_for( - css: '.content.active .ticketLinks', + css: '.content.active .ticketLinks', value: ticket1[:title], ) click( css: '.content.active .ticketLinks .js-delete' ) watch_for_disappear( - css: '.content.active .ticketLinks', + css: '.content.active .ticketLinks', value: ticket1[:title], ) watch_for_disappear( browser: browser2, - css: '.content.active .ticketLinks', - value: ticket2[:title], + css: '.content.active .ticketLinks', + value: ticket2[:title], ) reload() watch_for_disappear( - css: '.content.active .ticketLinks', + css: '.content.active .ticketLinks', value: ticket1[:title], ) watch_for_disappear( browser: browser2, - css: '.content.active .ticketLinks', - value: ticket2[:title], + css: '.content.active .ticketLinks', + value: ticket2[:title], ) end diff --git a/test/browser/agent_ticket_merge_test.rb b/test/browser/agent_ticket_merge_test.rb index 720f4278b..f01c696fc 100644 --- a/test/browser/agent_ticket_merge_test.rb +++ b/test/browser/agent_ticket_merge_test.rb @@ -8,7 +8,7 @@ class AgentTicketMergeTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -16,9 +16,9 @@ class AgentTicketMergeTest < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü - with closed tab', - body: 'some body 123äöü - with closed tab', + group: 'Users', + title: 'some subject 123äöü - with closed tab', + body: 'some body 123äöü - with closed tab', }, ) sleep 1 @@ -36,9 +36,9 @@ class AgentTicketMergeTest < TestCase ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'test to merge - with closed tab', - body: 'some body 123äöü 222 - test to merge - with closed tab', + group: 'Users', + title: 'test to merge - with closed tab', + body: 'some body 123äöü 222 - test to merge - with closed tab', }, ) @@ -50,7 +50,7 @@ class AgentTicketMergeTest < TestCase # check if task is shown match( - css: '.tasks', + css: '.tasks', value: 'test to merge - with closed tab', ) @@ -60,7 +60,7 @@ class AgentTicketMergeTest < TestCase modal_ready() set( - css: '.modal input[name="master_ticket_number"]', + css: '.modal input[name="master_ticket_number"]', value: ticket1[:number], ) @@ -68,21 +68,21 @@ class AgentTicketMergeTest < TestCase # check if merged to ticket is shown now watch_for( - css: '.active .ticketZoom-header .ticket-number', + css: '.active .ticketZoom-header .ticket-number', value: ticket1[:number], ) watch_for( - css: '.active .ticket-article', + css: '.active .ticket-article', value: 'test to merge - with closed tab', ) # check if task is now gone match_not( - css: '.tasks', + css: '.tasks', value: 'test to merge', ) match( - css: '.tasks', + css: '.tasks', value: 'some subject 123äöü - with closed tab', ) @@ -93,18 +93,18 @@ class AgentTicketMergeTest < TestCase ticket3 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü - with open tab', - body: 'some body 123äöü - with open tab', + group: 'Users', + title: 'some subject 123äöü - with open tab', + body: 'some body 123äöü - with open tab', }, ) ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'test to merge - with open tab', - body: 'some body 123äöü 222 - test to merge - with open tab', + group: 'Users', + title: 'test to merge - with open tab', + body: 'some body 123äöü 222 - test to merge - with open tab', }, ) @@ -114,28 +114,28 @@ class AgentTicketMergeTest < TestCase modal_ready() set( - css: '.modal input[name="master_ticket_number"]', + css: '.modal input[name="master_ticket_number"]', value: ticket3[:number], ) click( css: '.modal button[type="submit"]' ) # check if merged to ticket is shown now watch_for( - css: '.active .ticketZoom-header .ticket-number', + css: '.active .ticketZoom-header .ticket-number', value: ticket3[:number], ) watch_for( - css: '.active .ticket-article', + css: '.active .ticket-article', value: 'test to merge - with open tab', ) # check if task is now gone match_not( - css: '.tasks', + css: '.tasks', value: 'test to merge', ) match( - css: '.tasks', + css: '.tasks', value: 'some subject 123äöü - with open tab', ) diff --git a/test/browser/agent_ticket_online_notification_test.rb b/test/browser/agent_ticket_online_notification_test.rb index 084008ed8..54f9f1a12 100644 --- a/test/browser/agent_ticket_online_notification_test.rb +++ b/test/browser/agent_ticket_online_notification_test.rb @@ -8,7 +8,7 @@ class AgentTicketOnlineNotificationTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -16,28 +16,28 @@ class AgentTicketOnlineNotificationTest < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'online notification #1', - body: 'online notification #1', + group: 'Users', + title: 'online notification #1', + body: 'online notification #1', }, ) browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all(browser: browser2) click( browser: browser2, - css: '.js-toggleNotifications', + css: '.js-toggleNotifications', ) click( browser: browser2, - css: '.js-mark', + css: '.js-mark', ) sleep 2 @@ -48,71 +48,71 @@ class AgentTicketOnlineNotificationTest < TestCase exists_not( browser: browser2, - css: '.js-noNotifications.hide', + css: '.js-noNotifications.hide', ) match( browser: browser2, - css: '.js-noNotifications', - value: 'No unread Notifications', + css: '.js-noNotifications', + value: 'No unread Notifications', ) exists( browser: browser2, - css: '.js-mark.hide', + css: '.js-mark.hide', ) match_not( - browser: browser2, - css: '.js-notificationsCounter', - value: '\d', + browser: browser2, + css: '.js-notificationsCounter', + value: '\d', no_quote: true, ) ticket2 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'online notification #2', - body: 'online notification #2', + group: 'Users', + title: 'online notification #2', + body: 'online notification #2', }, ) watch_for( browser: browser2, - css: '.js-notificationsContainer .js-item', - value: 'online notification #2', + css: '.js-notificationsContainer .js-item', + value: 'online notification #2', timeout: 10, ) match( browser: browser2, - css: '.js-notificationsCounter', - value: '1', + css: '.js-notificationsCounter', + value: '1', ) exists_not( browser: browser2, - css: '.js-mark.hide', + css: '.js-mark.hide', ) ticket3 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'online notification #3', - body: 'online notification #3', + group: 'Users', + title: 'online notification #3', + body: 'online notification #3', }, ) watch_for( browser: browser2, - css: '.js-notificationsContainer .js-item', - value: 'online notification #3', + css: '.js-notificationsContainer .js-item', + value: 'online notification #3', timeout: 6, ) # flanky watch_for( browser: browser2, - css: '.js-notificationsCounter', - value: '2', + css: '.js-notificationsCounter', + value: '2', ) items = browser2.find_elements(css: '.js-notificationsContainer .js-item') @@ -123,13 +123,13 @@ class AgentTicketOnlineNotificationTest < TestCase click( browser: browser2, - css: '.js-toggleNotifications', + css: '.js-toggleNotifications', ) watch_for( browser: browser2, - css: '.js-notificationsCounter', - value: '1', + css: '.js-notificationsCounter', + value: '1', ) items = browser2.find_elements(css: '.js-notificationsContainer .js-item') @@ -141,16 +141,16 @@ class AgentTicketOnlineNotificationTest < TestCase ticket4 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'online notification #4', - body: 'online notification #4', + group: 'Users', + title: 'online notification #4', + body: 'online notification #4', }, ) watch_for( browser: browser2, - css: '.js-notificationsCounter', - value: '2', + css: '.js-notificationsCounter', + value: '2', ) items = browser2.find_elements(css: '.js-notificationsContainer .js-item') @@ -161,7 +161,7 @@ class AgentTicketOnlineNotificationTest < TestCase click( browser: browser2, - css: '.js-mark', + css: '.js-mark', ) sleep 3 @@ -173,25 +173,25 @@ class AgentTicketOnlineNotificationTest < TestCase assert_equal(3, items.count) match_not( - browser: browser2, - css: '.js-notificationsCounter', - value: '\d', + browser: browser2, + css: '.js-notificationsCounter', + value: '\d', no_quote: true, ) ticket5 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'online notification #5', - body: 'online notification #5', + group: 'Users', + title: 'online notification #5', + body: 'online notification #5', }, ) watch_for( browser: browser2, - css: '.js-notificationsCounter', - value: '1', + css: '.js-notificationsCounter', + value: '1', ) items = browser2.find_elements(css: '.js-notificationsContainer .js-item') @@ -210,22 +210,22 @@ class AgentTicketOnlineNotificationTest < TestCase watch_for( browser: browser2, - css: '.js-notificationsContainer .js-item', - value: 'online notification #5/5', + css: '.js-notificationsContainer .js-item', + value: 'online notification #5/5', timeout: 20, ) watch_for( browser: browser2, - css: '.js-notificationsContainer .js-item.is-inactive', - value: 'online notification #5/5', + css: '.js-notificationsContainer .js-item.is-inactive', + value: 'online notification #5/5', timeout: 20, ) match_not( - browser: browser2, - css: '.js-notificationsCounter', - value: '\d', + browser: browser2, + css: '.js-notificationsCounter', + value: '\d', no_quote: true, ) @@ -242,92 +242,92 @@ class AgentTicketOnlineNotificationTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all(browser: browser2) click( browser: browser2, - css: '.js-toggleNotifications', + css: '.js-toggleNotifications', ) online_notitifcation_close_all(browser: browser2) ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'online notification render #1', - body: 'online notification render #1', + group: 'Users', + title: 'online notification render #1', + body: 'online notification render #1', }, ) ticket2 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'online notification render #2', - body: 'online notification render #2', + group: 'Users', + title: 'online notification render #2', + body: 'online notification render #2', }, ) watch_for( browser: browser2, - css: '.js-notificationsCounter', - value: '2', + css: '.js-notificationsCounter', + value: '2', ) execute( browser: browser2, - js: '$(".js-notificationsContainer .js-items .js-item:nth-child(1) .activity-text").text("render test 2")', + js: '$(".js-notificationsContainer .js-items .js-item:nth-child(1) .activity-text").text("render test 2")', ) execute( browser: browser2, - js: '$(".js-notificationsContainer .js-items .js-item:nth-child(2) .activity-text").text("render test 1")', + js: '$(".js-notificationsContainer .js-items .js-item:nth-child(2) .activity-text").text("render test 1")', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .js-item:nth-child(1) .activity-text', - value: 'render test 2', + css: '.js-notificationsContainer .js-items .js-item:nth-child(1) .activity-text', + value: 'render test 2', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .js-item:nth-child(2) .activity-text', - value: 'render test 1', + css: '.js-notificationsContainer .js-items .js-item:nth-child(2) .activity-text', + value: 'render test 1', ) ticket3 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'online notification render #3', - body: 'online notification render #3', + group: 'Users', + title: 'online notification render #3', + body: 'online notification render #3', }, ) watch_for( browser: browser2, - css: '.js-notificationsCounter', - value: '3', + css: '.js-notificationsCounter', + value: '3', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .js-item:nth-child(1) .activity-text', - value: 'online notification render #3', + css: '.js-notificationsContainer .js-items .js-item:nth-child(1) .activity-text', + value: 'online notification render #3', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .js-item:nth-child(2) .activity-text', - value: 'render test 2', + css: '.js-notificationsContainer .js-items .js-item:nth-child(2) .activity-text', + value: 'render test 2', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .js-item:nth-child(3) .activity-text', - value: 'render test 1', + css: '.js-notificationsContainer .js-items .js-item:nth-child(3) .activity-text', + value: 'render test 1', ) ticket_update( @@ -337,57 +337,57 @@ class AgentTicketOnlineNotificationTest < TestCase ) watch_for( browser: browser2, - css: '.js-notificationsCounter', - value: '2', + css: '.js-notificationsCounter', + value: '2', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .is-inactive.js-item:nth-child(1) .activity-text', - value: 'online notification render #3', + css: '.js-notificationsContainer .js-items .is-inactive.js-item:nth-child(1) .activity-text', + value: 'online notification render #3', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .is-inactive.js-item:nth-child(2) .activity-text', - value: 'online notification render #3', + css: '.js-notificationsContainer .js-items .is-inactive.js-item:nth-child(2) .activity-text', + value: 'online notification render #3', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .js-item:nth-child(3) .activity-text', - value: 'render test 2', + css: '.js-notificationsContainer .js-items .js-item:nth-child(3) .activity-text', + value: 'render test 2', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .js-item:nth-child(4) .activity-text', - value: 'render test 1', + css: '.js-notificationsContainer .js-items .js-item:nth-child(4) .activity-text', + value: 'render test 1', ) execute( browser: browser2, - js: '$(".js-notificationsContainer .js-items .js-item:nth-child(2) .activity-text").text("render test 3")', + js: '$(".js-notificationsContainer .js-items .js-item:nth-child(2) .activity-text").text("render test 3")', ) close_online_notitifcation( browser: browser2, - data: { + data: { position: 3, }, ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .is-inactive.js-item:nth-child(1) .activity-text', - value: 'online notification render #3', + css: '.js-notificationsContainer .js-items .is-inactive.js-item:nth-child(1) .activity-text', + value: 'online notification render #3', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .js-item:nth-child(2) .activity-text', - value: 'render test 3', + css: '.js-notificationsContainer .js-items .js-item:nth-child(2) .activity-text', + value: 'render test 3', ) match( browser: browser2, - css: '.js-notificationsContainer .js-items .js-item:nth-child(3) .activity-text', - value: 'render test 1', + css: '.js-notificationsContainer .js-items .js-item:nth-child(3) .activity-text', + value: 'render test 1', ) end diff --git a/test/browser/agent_ticket_overview_group_by_organization_test.rb b/test/browser/agent_ticket_overview_group_by_organization_test.rb index b5583fa72..ce7ac64e0 100644 --- a/test/browser/agent_ticket_overview_group_by_organization_test.rb +++ b/test/browser/agent_ticket_overview_group_by_organization_test.rb @@ -16,7 +16,7 @@ class AgentTicketOverviewGroupByOrganizationTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -30,11 +30,11 @@ class AgentTicketOverviewGroupByOrganizationTest < TestCase # 2. Create a new user that belongs to the test organization user = user_create( data: { - login: 'test user', - firstname: 'Max', - lastname: 'Mustermann', - email: user_email, - password: 'some-pass', + login: 'test user', + firstname: 'Max', + lastname: 'Mustermann', + email: user_email, + password: 'some-pass', organization: 'äöüß & Test Organization', } ) @@ -52,8 +52,8 @@ class AgentTicketOverviewGroupByOrganizationTest < TestCase # 4. Create an overview grouping by organization overview = overview_create( data: { - name: overview_name, - roles: %w[Agent Admin Customer], + name: overview_name, + roles: %w[Agent Admin Customer], group_by: 'Organization', } ) diff --git a/test/browser/agent_ticket_overview_level0_test.rb b/test/browser/agent_ticket_overview_level0_test.rb index 455c62b2f..d23c784d5 100644 --- a/test/browser/agent_ticket_overview_level0_test.rb +++ b/test/browser/agent_ticket_overview_level0_test.rb @@ -6,7 +6,7 @@ class AgentTicketOverviewLevel0Test < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -16,17 +16,17 @@ class AgentTicketOverviewLevel0Test < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'overview count test #1', - body: 'overview count test #1', + group: 'Users', + title: 'overview count test #1', + body: 'overview count test #1', } ) ticket2 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'overview count test #2', - body: 'overview count test #2', + group: 'Users', + title: 'overview count test #2', + body: 'overview count test #2', } ) click(text: 'Overviews') @@ -38,13 +38,13 @@ class AgentTicketOverviewLevel0Test < TestCase click(text: 'Unassigned & Open') watch_for( - css: '.content.active', + css: '.content.active', value: 'overview count test #2', ) # select both via bulk action click( - css: '.content.active table tr td input[value="' + ticket1[:id] + '"] + .icon-checkbox.icon-unchecked', + css: '.content.active table tr td input[value="' + ticket1[:id] + '"] + .icon-checkbox.icon-unchecked', fast: true, ) @@ -54,7 +54,7 @@ class AgentTicketOverviewLevel0Test < TestCase css: '.content.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked', ) click( - css: '.content.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked', + css: '.content.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked', fast: true, ) @@ -67,7 +67,7 @@ class AgentTicketOverviewLevel0Test < TestCase # select close state & submit select( - css: '.content.active .bulkAction [name="state_id"]', + css: '.content.active .bulkAction [name="state_id"]', value: 'closed', ) click( @@ -120,15 +120,15 @@ class AgentTicketOverviewLevel0Test < TestCase # check if number and article count is shown match( - css: '.content.active table th:nth-child(3)', + css: '.content.active table th:nth-child(3)', value: '#', ) match( - css: '.content.active table th:nth-child(4)', + css: '.content.active table th:nth-child(4)', value: 'Title', ) match( - css: '.content.active table th:nth-child(7)', + css: '.content.active table th:nth-child(7)', value: 'Article#', ) @@ -138,15 +138,15 @@ class AgentTicketOverviewLevel0Test < TestCase # check if number and article count is shown match( - css: '.content.active table th:nth-child(3)', + css: '.content.active table th:nth-child(3)', value: '#', ) match( - css: '.content.active table th:nth-child(4)', + css: '.content.active table th:nth-child(4)', value: 'Title', ) match( - css: '.content.active table th:nth-child(7)', + css: '.content.active table th:nth-child(7)', value: 'Article#', ) @@ -166,11 +166,11 @@ class AgentTicketOverviewLevel0Test < TestCase # check if number and article count is gone match_not( - css: '.content.active table th:nth-child(3)', + css: '.content.active table th:nth-child(3)', value: '#', ) match( - css: '.content.active table th:nth-child(3)', + css: '.content.active table th:nth-child(3)', value: 'Title', ) exists_not( @@ -181,9 +181,9 @@ class AgentTicketOverviewLevel0Test < TestCase ticket3 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'overview count test #3', - body: 'overview count test #3', + group: 'Users', + title: 'overview count test #3', + body: 'overview count test #3', } ) sleep 6 @@ -219,7 +219,7 @@ class AgentTicketOverviewLevel0Test < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -229,17 +229,17 @@ class AgentTicketOverviewLevel0Test < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'overview count test #3', - body: 'overview count test #3', + group: 'Users', + title: 'overview count test #3', + body: 'overview count test #3', } ) ticket2 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'overview count test #4', - body: 'overview count test #4', + group: 'Users', + title: 'overview count test #4', + body: 'overview count test #4', } ) click(text: 'Overviews') @@ -251,8 +251,8 @@ class AgentTicketOverviewLevel0Test < TestCase click(text: 'Unassigned & Open') watch_for( - css: '.content.active', - value: 'overview count test #4', + css: '.content.active', + value: 'overview count test #4', timeout: 8, ) @@ -261,7 +261,7 @@ class AgentTicketOverviewLevel0Test < TestCase # select both via bulk action click( - css: '.content.active table tr td input[value="' + ticket1[:id] + '"] + .icon-checkbox.icon-unchecked', + css: '.content.active table tr td input[value="' + ticket1[:id] + '"] + .icon-checkbox.icon-unchecked', fast: true, ) @@ -271,7 +271,7 @@ class AgentTicketOverviewLevel0Test < TestCase css: '.content.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked', ) click( - css: '.content.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked', + css: '.content.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked', fast: true, ) @@ -284,31 +284,31 @@ class AgentTicketOverviewLevel0Test < TestCase exists( displayed: false, - css: '.content.active .bulkAction [data-name="pending_time"]', + css: '.content.active .bulkAction [data-name="pending_time"]', ) select( - css: '.content.active .bulkAction [name="state_id"]', + css: '.content.active .bulkAction [name="state_id"]', value: 'pending close', ) exists( displayed: true, - css: '.content.active .bulkAction [data-name="pending_time"]', + css: '.content.active .bulkAction [data-name="pending_time"]', ) set( - css: '.content.active .bulkAction [data-item="date"]', + css: '.content.active .bulkAction [data-item="date"]', value: '05/23/2037', ) select( - css: '.content.active .bulkAction [name="group_id"]', + css: '.content.active .bulkAction [name="group_id"]', value: 'Users', ) select( - css: '.content.active .bulkAction [name="owner_id"]', + css: '.content.active .bulkAction [name="owner_id"]', value: 'Test Master Agent', ) @@ -371,7 +371,7 @@ class AgentTicketOverviewLevel0Test < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -381,17 +381,17 @@ class AgentTicketOverviewLevel0Test < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'overview owner change test #1', - body: 'overview owner change #1', + group: 'Users', + title: 'overview owner change test #1', + body: 'overview owner change #1', } ) ticket2 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'overview owner change #2', - body: 'overview owner change #2', + group: 'Users', + title: 'overview owner change #2', + body: 'overview owner change #2', } ) @@ -400,8 +400,8 @@ class AgentTicketOverviewLevel0Test < TestCase ) watch_for( - css: '.content.active', - value: 'overview owner change #2', + css: '.content.active', + value: 'overview owner change #2', timeout: 8, ) @@ -410,7 +410,7 @@ class AgentTicketOverviewLevel0Test < TestCase # select both via bulk action click( - css: '.content.active table tr td input[value="' + ticket1[:id] + '"] + .icon-checkbox.icon-unchecked', + css: '.content.active table tr td input[value="' + ticket1[:id] + '"] + .icon-checkbox.icon-unchecked', fast: true, ) @@ -420,7 +420,7 @@ class AgentTicketOverviewLevel0Test < TestCase css: '.content.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked', ) click( - css: '.content.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked', + css: '.content.active table tr td input[value="' + ticket2[:id] + '"] + .icon-checkbox.icon-unchecked', fast: true, ) @@ -432,12 +432,12 @@ class AgentTicketOverviewLevel0Test < TestCase ) select( - css: '.content.active .bulkAction [name="owner_id"]', + css: '.content.active .bulkAction [name="owner_id"]', value: 'Test Master Agent', ) select( - css: '.content.active .bulkAction [name="state_id"]', + css: '.content.active .bulkAction [name="state_id"]', value: 'closed', ) @@ -474,7 +474,7 @@ class AgentTicketOverviewLevel0Test < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -487,7 +487,7 @@ class AgentTicketOverviewLevel0Test < TestCase role_edit( data: { - name: 'Agent', + name: 'Agent', group_permissions: { 2 => ['full'], 3 => ['full'], } }, @@ -517,17 +517,17 @@ class AgentTicketOverviewLevel0Test < TestCase can_change_ticket = ticket_create( data: { customer: 'nico', - group: 'some group2', - title: 'overview test #5', - body: 'overview test #5', + group: 'some group2', + title: 'overview test #5', + body: 'overview test #5', } ) cannot_change_ticket = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'overview test #6', - body: 'overview test #6', + group: 'Users', + title: 'overview test #6', + body: 'overview test #6', } ) @@ -535,7 +535,7 @@ class AgentTicketOverviewLevel0Test < TestCase login( username: 'agent2@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -555,8 +555,8 @@ class AgentTicketOverviewLevel0Test < TestCase ) watch_for( - css: '.content.active', - value: 'overview test #6', + css: '.content.active', + value: 'overview test #6', timeout: 8, ) @@ -568,7 +568,7 @@ class AgentTicketOverviewLevel0Test < TestCase # check that the bulk action form appears exists( displayed: true, - css: '.content.active .bulkAction', + css: '.content.active .bulkAction', ) # then select the ticket that we do not have change rights to @@ -583,31 +583,31 @@ class AgentTicketOverviewLevel0Test < TestCase # check that the bulk action form disappears exists( displayed: false, - css: '.content.active .bulkAction', + css: '.content.active .bulkAction', ) # de-select the ticket that we do not have change rights to uncheck( - css: '.content.active table tr td input[value="' + cannot_change_ticket[:id] + '"]', + css: '.content.active table tr td input[value="' + cannot_change_ticket[:id] + '"]', fast: true, ) # check that the bulk action form appears again exists( displayed: true, - css: '.content.active .bulkAction', + css: '.content.active .bulkAction', ) # de-select the ticket that we have change rights to uncheck( - css: '.content.active table tr td input[value="' + can_change_ticket[:id] + '"]', + css: '.content.active table tr td input[value="' + can_change_ticket[:id] + '"]', fast: true, ) # check that the bulk action form disappears again exists( displayed: false, - css: '.content.active .bulkAction', + css: '.content.active .bulkAction', ) # cleanup @@ -616,7 +616,7 @@ class AgentTicketOverviewLevel0Test < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() diff --git a/test/browser/agent_ticket_overview_level1_test.rb b/test/browser/agent_ticket_overview_level1_test.rb index 05c32d2cc..310c1a22a 100644 --- a/test/browser/agent_ticket_overview_level1_test.rb +++ b/test/browser/agent_ticket_overview_level1_test.rb @@ -7,26 +7,26 @@ class AgentTicketOverviewLevel1Test < TestCase browser1 = browser_instance login( - browser: browser1, + browser: browser1, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all(browser: browser1) browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all(browser: browser2) # create new overview overview_create( browser: browser1, - data: { + data: { name: name1, roles: ['Agent'], selector: { @@ -37,7 +37,7 @@ class AgentTicketOverviewLevel1Test < TestCase ) overview_create( browser: browser1, - data: { + data: { name: name2, roles: ['Agent'], selector: { @@ -50,97 +50,97 @@ class AgentTicketOverviewLevel1Test < TestCase # create tickets ticket1 = ticket_create( browser: browser1, - data: { + data: { customer: 'nico', priority: '1 low', - group: 'Users', - title: 'overview #1', - body: 'overview #1', + group: 'Users', + title: 'overview #1', + body: 'overview #1', } ) # keep connection alive click( browser: browser2, - css: '.search-holder', + css: '.search-holder', ) ticket2 = ticket_create( browser: browser1, - data: { + data: { customer: 'nico', priority: '1 low', - group: 'Users', - title: 'overview #2', - body: 'overview #2', + group: 'Users', + title: 'overview #2', + body: 'overview #2', } ) ticket3 = ticket_create( browser: browser1, - data: { + data: { customer: 'nico', priority: '1 low', - group: 'Users', - title: 'overview #3', - body: 'overview #3', + group: 'Users', + title: 'overview #3', + body: 'overview #3', } ) # click on #1 on overview ticket_open_by_overview( browser: browser2, - number: ticket3[:number], - link: "#ticket/view/#{name1}", + number: ticket3[:number], + link: "#ticket/view/#{name1}", ) # use overview navigation to got to #2 & #3 match( browser: browser2, - css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', - value: '1', + css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', + value: '1', ) match( browser: browser2, - css: '.active .ticketZoom-header .ticket-number', - value: ticket3[:number], + css: '.active .ticketZoom-header .ticket-number', + value: ticket3[:number], ) click( browser: browser2, - css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .next', + css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .next', ) match( browser: browser2, - css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', - value: '2', + css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', + value: '2', ) match( browser: browser2, - css: '.active .ticketZoom-header .ticket-number', - value: ticket2[:number], + css: '.active .ticketZoom-header .ticket-number', + value: ticket2[:number], ) click( browser: browser2, - css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .next', + css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .next', ) match( browser: browser2, - css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', - value: '3', + css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', + value: '3', ) match( browser: browser2, - css: '.active .ticketZoom-header .ticket-number', - value: ticket1[:number], + css: '.active .ticketZoom-header .ticket-number', + value: ticket1[:number], ) # close ticket sleep 2 # needed to selenium cache issues ticket_update( browser: browser2, - data: { + data: { state: 'closed', } ) @@ -148,55 +148,55 @@ class AgentTicketOverviewLevel1Test < TestCase match( browser: browser2, - css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', - value: '3', + css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', + value: '3', ) match( browser: browser2, - css: '.active .ticketZoom-header .ticket-number', - value: ticket1[:number], + css: '.active .ticketZoom-header .ticket-number', + value: ticket1[:number], ) click( browser: browser2, - css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .previous', + css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .previous', ) match( browser: browser2, - css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', - value: '2', + css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', + value: '2', ) match( browser: browser2, - css: '.active .ticketZoom-header .ticket-number', - value: ticket2[:number], + css: '.active .ticketZoom-header .ticket-number', + value: ticket2[:number], ) click( browser: browser2, - css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .next', + css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .next', ) match( browser: browser2, - css: '.active .ticketZoom-header .ticket-number', - value: ticket1[:number], + css: '.active .ticketZoom-header .ticket-number', + value: ticket1[:number], ) sleep 2 # needed to selenium cache issues ticket_update( browser: browser2, - data: { - state: 'closed', + data: { + state: 'closed', priority: '3 high', } ) watch_for_disappear( browser: browser2, - css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', + css: '.active .ticketZoom .ticketZoom-controls .overview-navigator .pagination-counter .pagination-item-current', ) match( browser: browser2, - css: '.active .ticketZoom-header .ticket-number', - value: ticket1[:number], + css: '.active .ticketZoom-header .ticket-number', + value: ticket1[:number], ) end diff --git a/test/browser/agent_ticket_overview_pending_til_test.rb b/test/browser/agent_ticket_overview_pending_til_test.rb index d2676cf3a..0b5e7efd8 100644 --- a/test/browser/agent_ticket_overview_pending_til_test.rb +++ b/test/browser/agent_ticket_overview_pending_til_test.rb @@ -10,7 +10,7 @@ class AgentTicketOverviewPendingTil < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -19,11 +19,11 @@ class AgentTicketOverviewPendingTil < TestCase 4.times do |i| ticket = ticket_create( data: { - customer: 'nico', - group: 'Users', - title: "pending til ticket #{i}", - body: 'test ticket', - state: i.odd? ? 'pending close' : 'open', + customer: 'nico', + group: 'Users', + title: "pending til ticket #{i}", + body: 'test ticket', + state: i.odd? ? 'pending close' : 'open', pending_date: '11/24/2018', pending_time: '08:00', } @@ -34,9 +34,9 @@ class AgentTicketOverviewPendingTil < TestCase # create and open new overview that has the Pending Til column overview_create( data: { - name: name, - roles: %w[Admin Agent], - selector: { + name: name, + roles: %w[Admin Agent], + selector: { 'State' => ['new', 'open', 'closed', 'merged', 'pending close', 'pending reminder'], }, attributes: { @@ -55,11 +55,11 @@ class AgentTicketOverviewPendingTil < TestCase # check if the first and second rows both correctly contain 'pending close' match( - css: '.content.active table .js-tableBody tr:nth-child(1)', + css: '.content.active table .js-tableBody tr:nth-child(1)', value: 'pending close', ) match( - css: '.content.active table .js-tableBody tr:nth-child(2)', + css: '.content.active table .js-tableBody tr:nth-child(2)', value: 'pending close', ) end diff --git a/test/browser/agent_ticket_overview_tab_test.rb b/test/browser/agent_ticket_overview_tab_test.rb index ca513c6ea..233891ec2 100644 --- a/test/browser/agent_ticket_overview_tab_test.rb +++ b/test/browser/agent_ticket_overview_tab_test.rb @@ -6,7 +6,7 @@ class AgentTicketOverviewTabTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -16,25 +16,25 @@ class AgentTicketOverviewTabTest < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: "overview tab test #1 - #{title}", - body: "overview tab test #1 - #{title}", + group: 'Users', + title: "overview tab test #1 - #{title}", + body: "overview tab test #1 - #{title}", } ) ticket2 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: "overview tab test #2 - #{title}", - body: "overview tab test #2 - #{title}", + group: 'Users', + title: "overview tab test #2 - #{title}", + body: "overview tab test #2 - #{title}", } ) ticket3 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: "overview tab test #3 - #{title}", - body: "overview tab test #3 - #{title}", + group: 'Users', + title: "overview tab test #3 - #{title}", + body: "overview tab test #3 - #{title}", } ) tasks_close_all() @@ -48,15 +48,15 @@ class AgentTicketOverviewTabTest < TestCase sleep 8 # till overview is rendered ticket_open_by_overview( - number: ticket1[:number], - title: "overview tab test #1 - #{title}", - link: '#ticket/view/all_unassigned', + number: ticket1[:number], + title: "overview tab test #1 - #{title}", + link: '#ticket/view/all_unassigned', ) assert_equal(1, @browser.find_elements(css: '.tasks .task').count) ticket_update( - data: { + data: { body: 'some body', state: 'closed', }, @@ -64,14 +64,14 @@ class AgentTicketOverviewTabTest < TestCase ) match( - css: '.tasks .task.is-active', + css: '.tasks .task.is-active', value: "overview tab test #2 - #{title}", ) assert_equal(1, @browser.find_elements(css: '.tasks .task').count) ticket_update( - data: { + data: { body: 'some body', state: 'closed', }, diff --git a/test/browser/agent_ticket_tag_test.rb b/test/browser/agent_ticket_tag_test.rb index 19eff1634..beee9cde9 100644 --- a/test/browser/agent_ticket_tag_test.rb +++ b/test/browser/agent_ticket_tag_test.rb @@ -6,23 +6,23 @@ class AgentTicketTagTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() # set tag (by tab) ticket1 = ticket_create( - data: { + data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü - tags 1', - body: 'some body 123äöü - tags 1', + group: 'Users', + title: 'some subject 123äöü - tags 1', + body: 'some body 123äöü - tags 1', }, do_not_submit: true, ) sleep 1 set( - css: '.active .ticket-form-bottom .token-input', + css: '.active .ticket-form-bottom .token-input', value: 'tag1, tag2', ) sendkey(value: :tab) @@ -52,17 +52,17 @@ class AgentTicketTagTest < TestCase # set tag (by blur) ticket2 = ticket_create( - data: { + data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü - tags 2', - body: 'some body 123äöü - tags 2', + group: 'Users', + title: 'some subject 123äöü - tags 2', + body: 'some body 123äöü - tags 2', }, do_not_submit: true, ) sleep 1 set( - css: '.active .ticket-form-bottom .token-input', + css: '.active .ticket-form-bottom .token-input', value: 'tag3, tag4', ) click(css: '#global-search') @@ -85,19 +85,19 @@ class AgentTicketTagTest < TestCase ticket3 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü - tags 3', - body: 'some body 123äöü - tags 3', + group: 'Users', + title: 'some subject 123äöü - tags 3', + body: 'some body 123äöü - tags 3', }, ) # verify changes in second browser browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) ticket_open_by_search( browser: browser2, @@ -109,7 +109,7 @@ class AgentTicketTagTest < TestCase css: '.content.active .js-newTagLabel', ) set( - css: '.content.active .js-newTagInput', + css: '.content.active .js-newTagInput', value: 'tag1', ) sleep 2 @@ -123,7 +123,7 @@ class AgentTicketTagTest < TestCase css: '.content.active .js-newTagLabel', ) set( - css: '.content.active .js-newTagInput', + css: '.content.active .js-newTagInput', value: 'tag 2', ) sendkey( @@ -136,7 +136,7 @@ class AgentTicketTagTest < TestCase css: '.content.active .js-newTagLabel', ) set( - css: '.content.active .js-newTagInput', + css: '.content.active .js-newTagInput', value: 'tag3, tag4', ) sendkey( @@ -149,7 +149,7 @@ class AgentTicketTagTest < TestCase css: '.content.active .js-newTagLabel', ) set( - css: '.content.active .js-newTagInput', + css: '.content.active .js-newTagInput', value: 'tag5', ) click( @@ -160,25 +160,25 @@ class AgentTicketTagTest < TestCase # verify tags tags_verify( tags: { - 'tag1' => true, + 'tag1' => true, 'tag 2' => true, - 'tag2' => false, - 'tag3' => true, - 'tag4' => true, - 'tag5' => true, + 'tag2' => false, + 'tag3' => true, + 'tag4' => true, + 'tag5' => true, } ) sleep 4 tags_verify( browser: browser2, - tags: { - 'tag1' => true, + tags: { + 'tag1' => true, 'tag 2' => true, - 'tag2' => false, - 'tag3' => true, - 'tag4' => true, - 'tag5' => true, + 'tag2' => false, + 'tag3' => true, + 'tag4' => true, + 'tag5' => true, } ) @@ -189,24 +189,24 @@ class AgentTicketTagTest < TestCase # verify tags tags_verify( tags: { - 'tag1' => true, + 'tag1' => true, 'tag 2' => true, - 'tag2' => false, - 'tag3' => true, - 'tag4' => true, - 'tag5' => true, + 'tag2' => false, + 'tag3' => true, + 'tag4' => true, + 'tag5' => true, } ) tags_verify( browser: browser2, - tags: { - 'tag1' => true, + tags: { + 'tag1' => true, 'tag 2' => true, - 'tag2' => false, - 'tag3' => true, - 'tag4' => true, - 'tag5' => true, + 'tag2' => false, + 'tag3' => true, + 'tag4' => true, + 'tag5' => true, } ) @@ -219,39 +219,39 @@ class AgentTicketTagTest < TestCase # verify tags tags_verify( tags: { - 'tag1' => false, + 'tag1' => false, 'tag 2' => true, - 'tag2' => false, - 'tag3' => true, - 'tag4' => true, - 'tag5' => true, + 'tag2' => false, + 'tag3' => true, + 'tag4' => true, + 'tag5' => true, } ) tags_verify( browser: browser2, - tags: { - 'tag1' => false, + tags: { + 'tag1' => false, 'tag 2' => true, - 'tag2' => false, - 'tag3' => true, - 'tag4' => true, - 'tag5' => true, + 'tag2' => false, + 'tag3' => true, + 'tag4' => true, + 'tag5' => true, } ) # verify changes via admin interface click( browser: browser2, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: browser2, - css: '.content.active a[href="#manage/tags"]', + css: '.content.active a[href="#manage/tags"]', ) sleep 3 execute( browser: browser2, - js: "$('.content.active .js-name:contains(\"tag3\")').click()", + js: "$('.content.active .js-name:contains(\"tag3\")').click()", ) modal_ready( @@ -260,12 +260,12 @@ class AgentTicketTagTest < TestCase set( browser: browser2, - css: '.modal [name="name"]', - value: 'TAGXX', + css: '.modal [name="name"]', + value: 'TAGXX', ) click( browser: browser2, - css: '.modal .js-submit', + css: '.modal .js-submit', ) modal_disappear(browser: browser2) ticket_open_by_search( @@ -276,40 +276,40 @@ class AgentTicketTagTest < TestCase # verify tags tags_verify( tags: { - 'tag1' => false, + 'tag1' => false, 'tag 2' => true, - 'tag2' => false, - 'tag3' => false, - 'tag4' => true, - 'tag5' => true, + 'tag2' => false, + 'tag3' => false, + 'tag4' => true, + 'tag5' => true, 'TAGXX' => true, } ) tags_verify( browser: browser2, - tags: { - 'tag1' => false, + tags: { + 'tag1' => false, 'tag 2' => true, - 'tag2' => false, - 'tag3' => false, - 'tag4' => true, - 'tag5' => true, + 'tag2' => false, + 'tag3' => false, + 'tag4' => true, + 'tag5' => true, 'TAGXX' => true, } ) click( browser: browser2, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: browser2, - css: '.content.active a[href="#manage/tags"]', + css: '.content.active a[href="#manage/tags"]', ) sleep 3 execute( browser: browser2, - js: "$('.content.active .js-name:contains(\"tag5\")').closest('tr').find('.js-delete').click()", + js: "$('.content.active .js-name:contains(\"tag5\")').closest('tr').find('.js-delete').click()", ) modal_ready( @@ -318,7 +318,7 @@ class AgentTicketTagTest < TestCase click( browser: browser2, - css: '.modal .js-submit', + css: '.modal .js-submit', ) modal_disappear(browser: browser2) ticket_open_by_search( @@ -329,24 +329,24 @@ class AgentTicketTagTest < TestCase # verify tags tags_verify( tags: { - 'tag1' => false, + 'tag1' => false, 'tag 2' => true, - 'tag2' => false, - 'tag3' => false, - 'tag4' => true, - 'tag5' => false, + 'tag2' => false, + 'tag3' => false, + 'tag4' => true, + 'tag5' => false, 'TAGXX' => true, } ) tags_verify( browser: browser2, - tags: { - 'tag1' => false, + tags: { + 'tag1' => false, 'tag 2' => true, - 'tag2' => false, - 'tag3' => false, - 'tag4' => true, - 'tag5' => false, + 'tag2' => false, + 'tag3' => false, + 'tag4' => true, + 'tag5' => false, 'TAGXX' => true, } ) @@ -359,7 +359,7 @@ class AgentTicketTagTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -371,60 +371,60 @@ class AgentTicketTagTest < TestCase ) set( - css: '.content.active .js-create input[name="name"]', + css: '.content.active .js-create input[name="name"]', value: tag_prefix + ' A', ) click(css: '.content.active .js-create .js-submit') set( - css: '.content.active .js-create input[name="name"]', + css: '.content.active .js-create input[name="name"]', value: tag_prefix + ' a', ) click(css: '.content.active .js-create .js-submit') set( - css: '.content.active .js-create input[name="name"]', + css: '.content.active .js-create input[name="name"]', value: tag_prefix + ' B', ) click(css: '.content.active .js-create .js-submit') set( - css: '.content.active .js-create input[name="name"]', + css: '.content.active .js-create input[name="name"]', value: tag_prefix + ' C', ) click(css: '.content.active .js-create .js-submit') # set tag (by tab) ticket1 = ticket_create( - data: { + data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü - tags no new 1', - body: 'some body 123äöü - tags no new 1', + group: 'Users', + title: 'some subject 123äöü - tags no new 1', + body: 'some body 123äöü - tags no new 1', }, do_not_submit: true, ) sleep 1 set( - css: '.active .ticket-form-bottom .token-input', + css: '.active .ticket-form-bottom .token-input', value: "#{tag_prefix} A", ) sleep 2 sendkey(value: :tab) sleep 1 set( - css: '.active .ticket-form-bottom .token-input', + css: '.active .ticket-form-bottom .token-input', value: "#{tag_prefix} a", ) sleep 2 sendkey(value: :tab) sleep 1 set( - css: '.active .ticket-form-bottom .token-input', + css: '.active .ticket-form-bottom .token-input', value: "#{tag_prefix} B", ) sleep 2 sendkey(value: :tab) sleep 1 set( - css: '.active .ticket-form-bottom .token-input', + css: '.active .ticket-form-bottom .token-input', value: 'NOT EXISTING', ) sleep 2 @@ -445,7 +445,7 @@ class AgentTicketTagTest < TestCase "#{tag_prefix} A" => true, "#{tag_prefix} a" => true, "#{tag_prefix} B" => true, - 'NOT EXISTING' => false, + 'NOT EXISTING' => false, } ) @@ -453,16 +453,16 @@ class AgentTicketTagTest < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü - tags no new 2', - body: 'some body 223äöü - tags no new 1', + group: 'Users', + title: 'some subject 123äöü - tags no new 2', + body: 'some body 223äöü - tags no new 1', }, ) sleep 2 click(css: '.active .sidebar .js-newTagLabel') set( - css: '.active .sidebar .js-newTagInput', + css: '.active .sidebar .js-newTagInput', value: "#{tag_prefix} A", ) sleep 2 @@ -470,7 +470,7 @@ class AgentTicketTagTest < TestCase sleep 1 click(css: '.active .sidebar .js-newTagLabel') set( - css: '.active .sidebar .js-newTagInput', + css: '.active .sidebar .js-newTagInput', value: "#{tag_prefix} a", ) sleep 2 @@ -478,7 +478,7 @@ class AgentTicketTagTest < TestCase sleep 1 click(css: '.active .sidebar .js-newTagLabel') set( - css: '.active .sidebar .js-newTagInput', + css: '.active .sidebar .js-newTagInput', value: "#{tag_prefix} B", ) sleep 2 @@ -486,7 +486,7 @@ class AgentTicketTagTest < TestCase sleep 1 click(css: '.active .sidebar .js-newTagLabel') set( - css: '.active .sidebar .js-newTagInput', + css: '.active .sidebar .js-newTagInput', value: 'NOT EXISTING', ) sleep 2 @@ -499,7 +499,7 @@ class AgentTicketTagTest < TestCase "#{tag_prefix} A" => true, "#{tag_prefix} a" => true, "#{tag_prefix} B" => true, - 'NOT EXISTING' => false, + 'NOT EXISTING' => false, } ) reload() @@ -511,7 +511,7 @@ class AgentTicketTagTest < TestCase "#{tag_prefix} A" => true, "#{tag_prefix} a" => true, "#{tag_prefix} B" => true, - 'NOT EXISTING' => false, + 'NOT EXISTING' => false, } ) diff --git a/test/browser/agent_ticket_task_changed_test.rb b/test/browser/agent_ticket_task_changed_test.rb index d5c00c770..c3dc25cea 100644 --- a/test/browser/agent_ticket_task_changed_test.rb +++ b/test/browser/agent_ticket_task_changed_test.rb @@ -8,23 +8,23 @@ class AgentTicketTaskChangedTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() ticket = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'test ticket', - body: 'some body 123äöü', + group: 'Users', + title: 'test ticket', + body: 'some body 123äöü', }, ) object_manager_attribute_create( data: { - name: 'text_test', - display: 'text_test', + name: 'text_test', + display: 'text_test', data_type: 'Text', }, ) diff --git a/test/browser/agent_ticket_text_module_test.rb b/test/browser/agent_ticket_text_module_test.rb index 3385a03c1..22572d84d 100644 --- a/test/browser/agent_ticket_text_module_test.rb +++ b/test/browser/agent_ticket_text_module_test.rb @@ -9,23 +9,23 @@ class AgentTicketTextModuleTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() # create new text modules text_module_create( data: { - name: 'some name' + random, + name: 'some name' + random, keywords: random, - content: 'some content' + random, + content: 'some content' + random, }, ) text_module_create( data: { - name: 'some name' + random2, + name: 'some name' + random2, keywords: random2, - content: 'some content' + random2, + content: 'some content' + random2, }, ) @@ -35,21 +35,21 @@ class AgentTicketTextModuleTest < TestCase sleep 2 set( - css: '.active div[data-name=body]', + css: '.active div[data-name=body]', value: 'test ::' + random, ) watch_for( - css: '.active .shortcut', + css: '.active .shortcut', value: random, ) sendkey( value: :arrow_down, - slow: true, + slow: true, ) click(css: '.active .shortcut > ul> li') watch_for( - css: '.active div[data-name=body]', + css: '.active div[data-name=body]', value: 'some content' + random, ) tasks_close_all() @@ -69,10 +69,10 @@ class AgentTicketTextModuleTest < TestCase browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all( browser: browser2, @@ -80,15 +80,15 @@ class AgentTicketTextModuleTest < TestCase # create new ticket ticket_create( - browser: browser2, - data: { + browser: browser2, + data: { title: 'A', }, do_not_submit: true, ) ticket_create( - browser: browser2, - data: { + browser: browser2, + data: { title: 'B', }, do_not_submit: true, @@ -97,172 +97,172 @@ class AgentTicketTextModuleTest < TestCase # create new text module text_module_create( browser: browser1, - data: { - name: 'some name' + random, + data: { + name: 'some name' + random, keywords: random, - content: "some content \#{ticket.customer.lastname}#{random}", + content: "some content \#{ticket.customer.lastname}#{random}", }, ) # create user to test placeholder user_create( browser: browser1, - data: { - login: login, + data: { + login: login, firstname: firstname, - lastname: lastname, - email: email, - password: password, + lastname: lastname, + email: email, + password: password, }, ) # check if text module exists in instance2, for ready to use set( browser: browser2, - css: '.active div[data-name=body]', - value: 'test ::' + random, + css: '.active div[data-name=body]', + value: 'test ::' + random, ) watch_for( browser: browser2, - css: '.active .shortcut', - value: random, + css: '.active .shortcut', + value: random, ) sendkey( browser: browser2, - value: :arrow_down, + value: :arrow_down, ) click( browser: browser2, - css: '.active .shortcut > ul> li', + css: '.active .shortcut > ul> li', ) watch_for( browser: browser2, - css: '.active div[data-name=body]', - value: 'some content -' + random, + css: '.active div[data-name=body]', + value: 'some content -' + random, ) ticket_customer_select( browser: browser2, - css: '.active .newTicket', + css: '.active .newTicket', customer: 'nicole', ) set( browser: browser2, - css: '.active div[data-name=body]', - value: '::' + random, + css: '.active div[data-name=body]', + value: '::' + random, ) sendkey( browser: browser2, - value: :arrow_down, - slow: true, + value: :arrow_down, + slow: true, ) click( browser: browser2, - css: '.active .shortcut > ul> li', + css: '.active .shortcut > ul> li', ) watch_for( browser: browser2, - css: '.active div[data-name=body]', - value: 'some content Braun' + random, + css: '.active div[data-name=body]', + value: 'some content Braun' + random, ) # verify zoom click( browser: browser1, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) # create ticket ticket_create( browser: browser2, - data: { + data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü', - body: 'some body 123äöü', + group: 'Users', + title: 'some subject 123äöü', + body: 'some body 123äöü', }, ) set( - browser: browser2, - css: '.active div[data-name=body]', - value: 'test', + browser: browser2, + css: '.active div[data-name=body]', + value: 'test', no_click: true, ) set( - browser: browser2, - css: '.active div[data-name=body]', - value: '::' + random, + browser: browser2, + css: '.active div[data-name=body]', + value: '::' + random, no_click: true, ) sendkey( browser: browser2, - value: :arrow_down, + value: :arrow_down, ) sleep 1 click( browser: browser2, - css: '.active .shortcut > ul> li', + css: '.active .shortcut > ul> li', ) watch_for( browser: browser2, - css: '.active div[data-name=body]', - value: 'some content Braun' + random, + css: '.active div[data-name=body]', + value: 'some content Braun' + random, ) # change customer click( browser: browser1, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: browser2, - css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down', + css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down', ) click( browser: browser2, - css: '.active div[data-tab="ticket"] .js-actions [data-type="customer-change"]', + css: '.active div[data-tab="ticket"] .js-actions [data-type="customer-change"]', ) modal_ready(browser: browser2) ticket_customer_select( browser: browser2, - css: '.modal', + css: '.modal', customer: firstname, ) click( browser: browser2, - css: '.modal-content .js-submit', + css: '.modal-content .js-submit', ) modal_disappear(browser: browser2) set( - browser: browser2, - css: '.active div[data-name=body]', - value: '::' + random, + browser: browser2, + css: '.active div[data-name=body]', + value: '::' + random, no_click: true, ) sendkey( browser: browser2, - value: :arrow_down, + value: :arrow_down, ) sendkey( browser: browser2, - value: :enter, + value: :enter, ) watch_for( browser: browser2, - css: '.active div[data-name=body]', - value: 'some content ' + lastname, + css: '.active div[data-name=body]', + value: 'some content ' + lastname, ) end end diff --git a/test/browser/agent_ticket_time_accounting_test.rb b/test/browser/agent_ticket_time_accounting_test.rb index d93ea99c1..a3ec7d7e8 100644 --- a/test/browser/agent_ticket_time_accounting_test.rb +++ b/test/browser/agent_ticket_time_accounting_test.rb @@ -6,7 +6,7 @@ class AgentTicketTimeAccountingTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -18,21 +18,21 @@ class AgentTicketTimeAccountingTest < TestCase css: '.content.active a[href="#manage/time_accounting"]', ) switch( - css: '.content.active .js-timeAccountingSetting', + css: '.content.active .js-timeAccountingSetting', type: 'on', ) ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject - time accounting#1', - body: 'some body - time accounting#1', + group: 'Users', + title: 'some subject - time accounting#1', + body: 'some body - time accounting#1', }, ) ticket_update( - data: { + data: { body: 'some note', }, do_not_submit: true, @@ -42,7 +42,7 @@ class AgentTicketTimeAccountingTest < TestCase ) modal_ready() set( - css: '.content.active .modal [name=time_unit]', + css: '.content.active .modal [name=time_unit]', value: '4', ) click( @@ -51,21 +51,21 @@ class AgentTicketTimeAccountingTest < TestCase modal_disappear() watch_for( - css: '.content.active .js-timeUnit', + css: '.content.active .js-timeUnit', value: '4', ) ticket2 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject - time accounting#2', - body: 'some body - time accounting#2', + group: 'Users', + title: 'some subject - time accounting#2', + body: 'some body - time accounting#2', }, ) ticket_update( - data: { + data: { body: 'some note', }, do_not_submit: true, @@ -75,7 +75,7 @@ class AgentTicketTimeAccountingTest < TestCase ) modal_ready() set( - css: '.content.active .modal [name=time_unit]', + css: '.content.active .modal [name=time_unit]', value: '4,6', ) click( @@ -84,12 +84,12 @@ class AgentTicketTimeAccountingTest < TestCase modal_disappear() watch_for( - css: '.content.active .js-timeUnit', + css: '.content.active .js-timeUnit', value: '4.6', ) ticket_update( - data: { + data: { body: 'some note2', }, do_not_submit: true, @@ -100,7 +100,7 @@ class AgentTicketTimeAccountingTest < TestCase modal_ready() set( - css: '.content.active .modal [name=time_unit]', + css: '.content.active .modal [name=time_unit]', value: '4abc', ) click( @@ -110,7 +110,7 @@ class AgentTicketTimeAccountingTest < TestCase css: '.content.active .modal [name=time_unit].has-error', ) set( - css: '.content.active .modal [name=time_unit]', + css: '.content.active .modal [name=time_unit]', value: '4 ', ) click( @@ -118,7 +118,7 @@ class AgentTicketTimeAccountingTest < TestCase ) modal_disappear() watch_for( - css: '.content.active .js-timeUnit', + css: '.content.active .js-timeUnit', value: '8.6', ) @@ -130,7 +130,7 @@ class AgentTicketTimeAccountingTest < TestCase css: '.content.active a[href="#manage/time_accounting"]', ) switch( - css: '.content.active .js-timeAccountingSetting', + css: '.content.active .js-timeAccountingSetting', type: 'off', ) @@ -145,7 +145,7 @@ class AgentTicketTimeAccountingTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -157,21 +157,21 @@ class AgentTicketTimeAccountingTest < TestCase css: '.content.active a[href="#manage/time_accounting"]', ) switch( - css: '.content.active .js-timeAccountingSetting', + css: '.content.active .js-timeAccountingSetting', type: 'on', ) ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject - time accounting#3', - body: 'some body - time accounting#3', + group: 'Users', + title: 'some subject - time accounting#3', + body: 'some body - time accounting#3', }, ) ticket_update( - data: { + data: { body: 'some note', }, do_not_submit: true, @@ -192,7 +192,7 @@ class AgentTicketTimeAccountingTest < TestCase ) modal_ready() set( - css: '.content.active .modal [name=time_unit]', + css: '.content.active .modal [name=time_unit]', value: '4', ) click( @@ -208,7 +208,7 @@ class AgentTicketTimeAccountingTest < TestCase css: '.content.active a[href="#manage/time_accounting"]', ) switch( - css: '.content.active .js-timeAccountingSetting', + css: '.content.active .js-timeAccountingSetting', type: 'off', ) diff --git a/test/browser/agent_ticket_update1_test.rb b/test/browser/agent_ticket_update1_test.rb index b88b89229..e81b1092b 100644 --- a/test/browser/agent_ticket_update1_test.rb +++ b/test/browser/agent_ticket_update1_test.rb @@ -6,22 +6,22 @@ class AgentTicketUpdate1Test < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() # confirm on create ticket_create( - data: { + data: { customer: 'nico', - group: 'Users', - title: 'some changes', - body: 'some body 123äöü - changes', + group: 'Users', + title: 'some changes', + body: 'some body 123äöü - changes', }, do_not_submit: true, ) close_task( - data: { + data: { title: 'some changes', }, discard_changes: true, @@ -32,19 +32,19 @@ class AgentTicketUpdate1Test < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some changes', - body: 'some body 123äöü - changes', + group: 'Users', + title: 'some changes', + body: 'some body 123äöü - changes', }, ) ticket_update( - data: { + data: { body: 'some note', }, do_not_submit: true, ) close_task( - data: { + data: { title: 'some changes', }, discard_changes: true, diff --git a/test/browser/agent_ticket_update2_test.rb b/test/browser/agent_ticket_update2_test.rb index 672c08c2c..1b7cda6c6 100644 --- a/test/browser/agent_ticket_update2_test.rb +++ b/test/browser/agent_ticket_update2_test.rb @@ -4,147 +4,147 @@ class AgentTicketUpdate2Test < TestCase def test_work_with_two_browser_on_same_ticket_edit browser1 = browser_instance login( - browser: browser1, + browser: browser1, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all(browser: browser1) browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all(browser: browser2) # create ticket ticket1 = ticket_create( browser: browser1, - data: { - group: 'Users', + data: { + group: 'Users', customer: 'nicole', - title: 'some level 3 subject 123äöü', - body: 'some level 3 body 123äöü', + title: 'some level 3 subject 123äöü', + body: 'some level 3 body 123äöü', } ) # open ticket in second browser ticket_open_by_search( browser: browser2, - number: ticket1[:number], + number: ticket1[:number], ) watch_for( browser: browser2, - css: '.active div.ticket-article', - value: 'some level 3 body 123äöü', + css: '.active div.ticket-article', + value: 'some level 3 body 123äöü', ) watch_for( browser: browser1, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'AT', # agent1 + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'AT', # agent1 ) watch_for( browser: browser2, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'TA', # master + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'TA', # master ) # change edit screen in instance 1 ticket_update( - browser: browser1, - data: { + browser: browser1, + data: { body: 'some level 3 body in instance 1', }, do_not_submit: true, ) watch_for( - browser: browser1, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser1, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) watch_for( browser: browser1, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'AT', # agent1 + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'AT', # agent1 ) watch_for( browser: browser2, - css: '.content.active .js-attributeBar .js-avatar .avatar--changed', - value: 'TA', # master + css: '.content.active .js-attributeBar .js-avatar .avatar--changed', + value: 'TA', # master ) # update ticket in instance 2 ticket_update( - browser: browser2, - data: { + browser: browser2, + data: { body: 'some level 3 body in instance 2', }, do_not_submit: true, ) watch_for( - browser: browser2, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) watch_for( browser: browser1, - css: '.content.active .js-attributeBar .js-avatar .avatar--changed', - value: 'AT', # agent1 + css: '.content.active .js-attributeBar .js-avatar .avatar--changed', + value: 'AT', # agent1 ) watch_for( browser: browser2, - css: '.content.active .js-attributeBar .js-avatar .avatar--changed', - value: 'TA', # master + css: '.content.active .js-attributeBar .js-avatar .avatar--changed', + value: 'TA', # master ) click( browser: browser2, - css: '.active .js-submit', + css: '.active .js-submit', ) # discard changes should gone away watch_for_disappear( - browser: browser2, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) ticket_verify( browser: browser2, - data: { + data: { body: '', }, ) watch_for( browser: browser1, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'AT', # agent1 + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'AT', # agent1 ) watch_for( browser: browser2, - css: '.content.active .js-attributeBar .js-avatar .avatar--changed', - value: 'TA', # master + css: '.content.active .js-attributeBar .js-avatar .avatar--changed', + value: 'TA', # master ) # check content and edit screen in instance 1 watch_for( browser: browser2, - css: '.active div.ticket-article', - value: 'some level 3 body in instance 2', + css: '.active div.ticket-article', + value: 'some level 3 body in instance 2', timeout: 1, ) ticket_verify( browser: browser1, - data: { + data: { body: 'some level 3 body in instance 1', }, ) @@ -152,76 +152,76 @@ class AgentTicketUpdate2Test < TestCase # update ticket in instance 1 click( browser: browser1, - css: '.active .js-submit', + css: '.active .js-submit', ) watch_for( browser: browser1, - css: '.active div.ticket-article', - value: 'some level 3 body in instance 2', + css: '.active div.ticket-article', + value: 'some level 3 body in instance 2', ) sleep 1 match_not( - browser: browser1, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser1, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) watch_for( browser: browser1, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'AT', # agent1 + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'AT', # agent1 ) watch_for( browser: browser2, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'TA', # master + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'TA', # master ) # check content in instance 2 watch_for( browser: browser2, - css: '.active div.ticket-article', - value: 'some level 3 body in instance 1', + css: '.active div.ticket-article', + value: 'some level 3 body in instance 1', ) # check content and edit screen in instance 1+2 ticket_verify( browser: browser1, - data: { + data: { body: '', }, ) match_not( - browser: browser1, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser1, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) ticket_verify( browser: browser2, - data: { + data: { body: '', }, ) match_not( - browser: browser2, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) watch_for( browser: browser1, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'AT', # agent1 + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'AT', # agent1 ) watch_for( browser: browser2, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'TA', # master + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'TA', # master ) # reload instances, verify again @@ -235,54 +235,54 @@ class AgentTicketUpdate2Test < TestCase # check content and edit screen in instance 1+2 ticket_verify( browser: browser1, - data: { + data: { body: '', }, ) match_not( - browser: browser1, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser1, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) ticket_verify( browser: browser2, - data: { + data: { body: '', }, ) match_not( - browser: browser2, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) watch_for( browser: browser1, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'AT', # agent1 + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'AT', # agent1 ) watch_for( browser: browser2, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'TA', # master + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'TA', # master ) # change form of ticket, reset, reload and verify in instance 2 ticket_update( - browser: browser2, - data: { + browser: browser2, + data: { body: '22 some level 3 body in instance 2', }, do_not_submit: true, ) watch_for( - browser: browser2, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) sleep 3 @@ -291,43 +291,43 @@ class AgentTicketUpdate2Test < TestCase ) sleep 3 click( - css: '.content.active .js-reset', + css: '.content.active .js-reset', browser: browser2, ) sleep 4 ticket_verify( browser: browser2, - data: { + data: { body: '', }, ) # change form of ticket in instance 2 ticket_update( - browser: browser2, - data: { + browser: browser2, + data: { body: '22 some level 3 body in instance 2', }, do_not_submit: true, ) watch_for( - browser: browser2, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) sleep 2 watch_for( browser: browser1, - css: '.content.active .js-attributeBar .js-avatar .avatar--changed', - value: 'AT', # agent1 + css: '.content.active .js-attributeBar .js-avatar .avatar--changed', + value: 'AT', # agent1 ) watch_for( browser: browser2, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'TA', # master + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'TA', # master ) reload( @@ -335,26 +335,26 @@ class AgentTicketUpdate2Test < TestCase ) ticket_verify( browser: browser2, - data: { + data: { body: '22 some level 3 body in instance 2', }, ) watch_for( - browser: browser2, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) watch_for( browser: browser1, - css: '.content.active .js-attributeBar .js-avatar .avatar--changed', - value: 'AT', # agent1 + css: '.content.active .js-attributeBar .js-avatar .avatar--changed', + value: 'AT', # agent1 ) watch_for( browser: browser2, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'TA', # master + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'TA', # master ) task_type( @@ -364,39 +364,39 @@ class AgentTicketUpdate2Test < TestCase click( browser: browser2, - css: '.active .js-submit', + css: '.active .js-submit', ) # discard changes should gone away watch_for_disappear( - browser: browser2, - css: '.content.active .js-reset', - value: '(Discard your unsaved changes.|Verwerfen der)', + browser: browser2, + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', no_quote: true, ) watch_for( browser: browser1, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'AT', # agent1 + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'AT', # agent1 ) watch_for( browser: browser2, - css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', - value: 'TA', # master + css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed', + value: 'TA', # master ) # check if new article is empty ticket_verify( browser: browser2, - data: { + data: { body: '', }, ) watch_for( browser: browser2, - css: '.active div.ticket-article', - value: '22 some level 3 body in instance 2', + css: '.active div.ticket-article', + value: '22 some level 3 body in instance 2', ) end end diff --git a/test/browser/agent_ticket_update3_test.rb b/test/browser/agent_ticket_update3_test.rb index e096a6971..61f603b4a 100644 --- a/test/browser/agent_ticket_update3_test.rb +++ b/test/browser/agent_ticket_update3_test.rb @@ -6,48 +6,48 @@ class AgentTicketUpdate3Test < TestCase # work on one ticket with two browsers browser1 = browser_instance login( - browser: browser1, + browser: browser1, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all(browser: browser1) browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all(browser: browser2) # create ticket ticket1 = ticket_create( browser: browser1, - data: { - group: 'Users', + data: { + group: 'Users', customer: 'nicole', - title: 'some level 2 subject 123äöü', - body: 'some level 2 body 123äöü', + title: 'some level 2 subject 123äöü', + body: 'some level 2 body 123äöü', } ) # open ticket in second browser ticket_open_by_search( browser: browser2, - number: ticket1[:number], + number: ticket1[:number], ) watch_for( browser: browser2, - css: '.active div.ticket-article', - value: 'some level 2 body 123äöü', + css: '.active div.ticket-article', + value: 'some level 2 body 123äöü', ) # set body in edit area in second ticket_update( - browser: browser2, - data: { + browser: browser2, + data: { body: 'some level 2 body in instance 2', }, do_not_submit: true, @@ -55,8 +55,8 @@ class AgentTicketUpdate3Test < TestCase # set body in edit area in first ticket_update( - browser: browser1, - data: { + browser: browser1, + data: { body: 'some level 2 body in instance 1', }, do_not_submit: true, @@ -64,8 +64,8 @@ class AgentTicketUpdate3Test < TestCase # change title in second browser ticket_update( - browser: browser2, - data: { + browser: browser2, + data: { title: 'TTTsome level 2 subject 123äöü', }, do_not_submit: true, @@ -75,18 +75,18 @@ class AgentTicketUpdate3Test < TestCase # verify title in second and first browser verify_title( browser: browser2, - value: 'TTTsome level 2 subject<\/b> 123äöü', + value: 'TTTsome level 2 subject<\/b> 123äöü', ) ticket_verify( browser: browser2, - data: { + data: { title: 'TTTsome level 2 subject<\/b> 123äöü', }, ) verify_task( browser: browser2, - data: { - title: 'TTTsome level 2 subject<\/b> 123äöü', + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', modified: false, } ) @@ -94,18 +94,18 @@ class AgentTicketUpdate3Test < TestCase sleep 4 verify_title( browser: browser1, - value: 'TTTsome level 2 subject<\/b> 123äöü', + value: 'TTTsome level 2 subject<\/b> 123äöü', ) ticket_verify( browser: browser1, - data: { + data: { title: 'TTTsome level 2 subject<\/b> 123äöü', }, ) verify_task( browser: browser1, - data: { - title: 'TTTsome level 2 subject<\/b> 123äöü', + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', modified: true, } ) @@ -113,13 +113,13 @@ class AgentTicketUpdate3Test < TestCase # verify text in input body, if still exists ticket_verify( browser: browser1, - data: { + data: { body: 'some level 2 body in instance 1', }, ) ticket_verify( browser: browser2, - data: { + data: { body: 'some level 2 body in instance 2', }, ) @@ -127,19 +127,19 @@ class AgentTicketUpdate3Test < TestCase # set body in edit area in second ticket_update( browser: browser1, - data: { + data: { body: 'some update 4711', }, ) watch_for( browser: browser1, - css: '.active div.ticket-article', - value: 'some update 4711', + css: '.active div.ticket-article', + value: 'some update 4711', ) verify_task( browser: browser1, - data: { - title: 'TTTsome level 2 subject<\/b> 123äöü', + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', modified: false, } ) @@ -147,7 +147,7 @@ class AgentTicketUpdate3Test < TestCase # verify if text in input body is now empty ticket_verify( browser: browser1, - data: { + data: { body: '', }, ) @@ -155,7 +155,7 @@ class AgentTicketUpdate3Test < TestCase # check if body is still in second browser ticket_verify( browser: browser2, - data: { + data: { body: 'some level 2 body in instance 2', }, ) @@ -163,8 +163,8 @@ class AgentTicketUpdate3Test < TestCase # verify task verify_task( browser: browser2, - data: { - title: 'TTTsome level 2 subject<\/b> 123äöü', + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', modified: true, } ) @@ -181,36 +181,36 @@ class AgentTicketUpdate3Test < TestCase sleep 8 verify_title( browser: browser2, - value: 'TTTsome level 2 subject<\/b> 123äöü', + value: 'TTTsome level 2 subject<\/b> 123äöü', ) ticket_verify( browser: browser2, - data: { + data: { title: 'TTTsome level 2 subject<\/b> 123äöü', }, ) verify_task( browser: browser2, - data: { - title: 'TTTsome level 2 subject<\/b> 123äöü', + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', modified: false, # modify was muted at reload ticket tab } ) verify_title( browser: browser1, - value: 'TTTsome level 2 subject<\/b> 123äöü', + value: 'TTTsome level 2 subject<\/b> 123äöü', ) ticket_verify( browser: browser1, - data: { + data: { title: 'TTTsome level 2 subject<\/b> 123äöü', }, ) verify_task( browser: browser1, - data: { - title: 'TTTsome level 2 subject<\/b> 123äöü', + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', modified: false, } ) @@ -218,19 +218,19 @@ class AgentTicketUpdate3Test < TestCase # verify if update is on ticket in each browser watch_for( browser: browser1, - css: '.active div.ticket-article', - value: 'some update 4711', + css: '.active div.ticket-article', + value: 'some update 4711', ) watch_for( browser: browser2, - css: '.active div.ticket-article', - value: 'some update 4711', + css: '.active div.ticket-article', + value: 'some update 4711', ) # verify if text in input body is now empty ticket_verify( browser: browser1, - data: { + data: { body: '', }, ) @@ -238,7 +238,7 @@ class AgentTicketUpdate3Test < TestCase # check if body is still in second browser ticket_verify( browser: browser2, - data: { + data: { body: 'some level 2 body in instance 2', }, ) @@ -246,27 +246,27 @@ class AgentTicketUpdate3Test < TestCase # modify ticket again and erase modified via mouse click on .active.content ticket_update( browser: browser1, - data: { + data: { body: 'some update 4711/2', }, ) sleep 4 verify_task( browser: browser2, - data: { - title: 'TTTsome level 2 subject<\/b> 123äöü', + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', modified: true, } ) click( browser: browser2, - css: '.active.content', + css: '.active.content', ) sleep 4 verify_task( browser: browser2, - data: { - title: 'TTTsome level 2 subject<\/b> 123äöü', + data: { + title: 'TTTsome level 2 subject<\/b> 123äöü', modified: false, } ) diff --git a/test/browser/agent_ticket_update4_test.rb b/test/browser/agent_ticket_update4_test.rb index a8161ad9a..0faa21a4c 100644 --- a/test/browser/agent_ticket_update4_test.rb +++ b/test/browser/agent_ticket_update4_test.rb @@ -8,27 +8,27 @@ class AgentTicketUpdate4Test < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() # date object object_manager_attribute_create( data: { - name: 'date1', - display: "Date-#{rand(999_999)}", + name: 'date1', + display: "Date-#{rand(999_999)}", data_type: 'Date', }, ) watch_for( - css: '.content.active', + css: '.content.active', value: 'Database Update required', ) click(css: '.content.active .tab-pane.active div.js-execute') watch_for( - css: '.modal', + css: '.modal', value: 'restart', ) watch_for_disappear( @@ -42,7 +42,7 @@ class AgentTicketUpdate4Test < TestCase # create new ticket ticket = ticket_create( - data: { + data: { customer: 'nico', group: 'Users', priority: '2 normal', @@ -50,7 +50,7 @@ class AgentTicketUpdate4Test < TestCase title: 'ticket attribute test #1', body: 'ticket attribute test #1', }, - custom_data_date: { + custom_data_date: { date1: '02/28/2018', }, disable_group_check: true, @@ -58,11 +58,11 @@ class AgentTicketUpdate4Test < TestCase ticket_open_by_search( browser: @browser, - number: ticket[:number], + number: ticket[:number], ) ticket_update( - data: {}, + data: {}, custom_data_date: { date1: '', }, @@ -70,7 +70,7 @@ class AgentTicketUpdate4Test < TestCase click(css: '.content.active .js-submit') match_not( - css: '.active .sidebar div[data-name="date1"] input[data-item="date"]', + css: '.active .sidebar div[data-name="date1"] input[data-item="date"]', value: '02/28/2018', ) end diff --git a/test/browser/agent_ticket_update5_test.rb b/test/browser/agent_ticket_update5_test.rb index 5a6ebc31b..5898f0f01 100644 --- a/test/browser/agent_ticket_update5_test.rb +++ b/test/browser/agent_ticket_update5_test.rb @@ -7,7 +7,7 @@ class AgentTicketUpdate5Test < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) # create ticket @@ -15,33 +15,33 @@ class AgentTicketUpdate5Test < TestCase ticket1 = ticket_create( data: { customer: 'Nico', - group: 'Users', - title: 'some changes', - body: 'some body 123äöü - changes', + group: 'Users', + title: 'some changes', + body: 'some body 123äöü - changes', } ) select( - css: '.content.active .sidebar select[name="owner_id"]', + css: '.content.active .sidebar select[name="owner_id"]', value: 'Agent 1 Test', ) click(css: '.content.active .js-attributeBar .js-submit', wait: 2) select( - css: '.content.active .sidebar select[name="group_id"]', + css: '.content.active .sidebar select[name="group_id"]', value: '-', ) select( - css: '.content.active .sidebar select[name="group_id"]', + css: '.content.active .sidebar select[name="group_id"]', value: 'Users', ) sleep 1 match( - css: '.content.active .sidebar select[name="owner_id"]', + css: '.content.active .sidebar select[name="owner_id"]', value: '-' ) diff --git a/test/browser/agent_ticket_update_and_reload_test.rb b/test/browser/agent_ticket_update_and_reload_test.rb index b4eef7dbe..578ccfcee 100644 --- a/test/browser/agent_ticket_update_and_reload_test.rb +++ b/test/browser/agent_ticket_update_and_reload_test.rb @@ -7,17 +7,17 @@ class AgentTicketUpdateAndReloadTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() # create ticket ticket_create( - data: { + data: { customer: 'nicole', - group: 'Users', - title: 'some subject 4 - 123äöü', - body: 'some body 4 - 123äöü', + group: 'Users', + title: 'some subject 4 - 123äöü', + body: 'some body 4 - 123äöü', }, do_not_submit: true, ) @@ -26,7 +26,7 @@ class AgentTicketUpdateAndReloadTest < TestCase # check if customer is shown in sidebar click(css: '.active .tabsSidebar-tab[data-tab="customer"]') match( - css: '.active .sidebar[data-tab="customer"]', + css: '.active .sidebar[data-tab="customer"]', value: 'nicole', ) @@ -48,7 +48,7 @@ class AgentTicketUpdateAndReloadTest < TestCase # check if customer is still shown in sidebar click(css: '.active .tabsSidebar-tab[data-tab="customer"]') watch_for( - css: '.active .sidebar[data-tab="customer"]', + css: '.active .sidebar[data-tab="customer"]', value: 'nicole', ) sleep 2 @@ -63,7 +63,7 @@ class AgentTicketUpdateAndReloadTest < TestCase # check ticket match( - css: '.active div.ticket-article', + css: '.active div.ticket-article', value: 'some body 4 - 123äöü', ) diff --git a/test/browser/agent_ticket_update_with_attachment_refresh_test.rb b/test/browser/agent_ticket_update_with_attachment_refresh_test.rb index af4f0ab1d..5b8f58e48 100644 --- a/test/browser/agent_ticket_update_with_attachment_refresh_test.rb +++ b/test/browser/agent_ticket_update_with_attachment_refresh_test.rb @@ -9,7 +9,7 @@ class AgentTicketUpdateWithAttachmentRefreshTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) # @@ -20,16 +20,16 @@ class AgentTicketUpdateWithAttachmentRefreshTest < TestCase ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'test 6 - ticket 1', - body: 'test 6 - ticket 1 body', + group: 'Users', + title: 'test 6 - ticket 1', + body: 'test 6 - ticket 1 body', }, ) sleep 1 # fill body ticket_update( - data: { + data: { body: 'keep me', }, do_not_submit: true, @@ -49,7 +49,7 @@ class AgentTicketUpdateWithAttachmentRefreshTest < TestCase # check if attachment is shown match( - css: '.content.active .ticketZoom .attachments .attachment:nth-child(1) .attachment-name', + css: '.content.active .ticketZoom .attachments .attachment:nth-child(1) .attachment-name', value: 'upload1.txt' ) @@ -59,7 +59,7 @@ class AgentTicketUpdateWithAttachmentRefreshTest < TestCase # check if attachment is shown match( - css: '.content.active .ticketZoom .attachments .attachment:nth-child(1) .attachment-name', + css: '.content.active .ticketZoom .attachments .attachment:nth-child(1) .attachment-name', value: 'upload1.txt' ) end diff --git a/test/browser/agent_ticket_zoom_hide_test.rb b/test/browser/agent_ticket_zoom_hide_test.rb index 2f1210124..06b17b355 100644 --- a/test/browser/agent_ticket_zoom_hide_test.rb +++ b/test/browser/agent_ticket_zoom_hide_test.rb @@ -17,25 +17,25 @@ class AgentTicketZoomHideTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) # create two tickets ticket1 = ticket_create( data: { customer: 'Nico', - group: 'Users', - title: 'Ticket 1', - body: 'some body 123äöü - changes', + group: 'Users', + title: 'Ticket 1', + body: 'some body 123äöü - changes', } ) ticket2 = ticket_create( data: { customer: 'Nico', - group: 'Users', - title: 'Ticket 2', - body: 'some body 123äöü - changes', + group: 'Users', + title: 'Ticket 2', + body: 'some body 123äöü - changes', } ) diff --git a/test/browser/agent_user_manage_test.rb b/test/browser/agent_user_manage_test.rb index ed9b5ef06..e7cba02fd 100644 --- a/test/browser/agent_user_manage_test.rb +++ b/test/browser/agent_user_manage_test.rb @@ -11,7 +11,7 @@ class AgentUserManageTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -20,7 +20,7 @@ class AgentUserManageTest < TestCase click(css: 'a[href="#ticket/create"]') watch_for( - css: '.content.active .newTicket', + css: '.content.active .newTicket', timeout: 1, ) @@ -36,15 +36,15 @@ class AgentUserManageTest < TestCase modal_ready() set( - css: '.content.active .modal input[name="firstname"]', + css: '.content.active .modal input[name="firstname"]', value: firstname, ) set( - css: '.content.active .modal input[name="lastname"]', + css: '.content.active .modal input[name="lastname"]', value: lastname, ) set( - css: '.content.active .modal input[name="email"]', + css: '.content.active .modal input[name="email"]', value: customer_user_email, ) @@ -55,24 +55,24 @@ class AgentUserManageTest < TestCase # check is used to check selected match( - css: '.content.active .newTicket input[name="customer_id"]', - value: '^\d+$', + css: '.content.active .newTicket input[name="customer_id"]', + value: '^\d+$', no_quote: true, ) match( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: firstname, ) match( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: lastname, ) match( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: customer_user_email, ) match( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: fullname, ) sleep 4 @@ -84,20 +84,20 @@ class AgentUserManageTest < TestCase click(css: 'a[href="#ticket/create"]') watch_for( - css: '.content.active .newTicket', + css: '.content.active .newTicket', timeout: 1, ) match( - css: '.content.active .newTicket input[name="customer_id"]', + css: '.content.active .newTicket input[name="customer_id"]', value: '', ) match( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: '', ) set( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: customer_user_email, ) sleep 3 @@ -107,24 +107,24 @@ class AgentUserManageTest < TestCase # check is used to check selected match( - css: '.content.active .newTicket input[name="customer_id"]', - value: '^\d+$', + css: '.content.active .newTicket input[name="customer_id"]', + value: '^\d+$', no_quote: true, ) match( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: firstname, ) match( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: lastname, ) match( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: customer_user_email, ) match( - css: '.content.active .newTicket input[name="customer_id_completion"]', + css: '.content.active .newTicket input[name="customer_id_completion"]', value: fullname, ) end @@ -139,28 +139,28 @@ class AgentUserManageTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some changes', - body: 'some body', + group: 'Users', + title: 'some changes', + body: 'some body', }, ) watch_for( - css: '.content.active .ticketZoom-header .ticket-number', + css: '.content.active .ticketZoom-header .ticket-number', value: '\d', ) click(css: '.content.active .tabsSidebar-tabs .tabsSidebar-tab[data-tab="customer"]') match( - css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', + css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', value: 'Nicole Braun', ) @@ -179,20 +179,20 @@ class AgentUserManageTest < TestCase click(css: '.content.active .modal .recipientList-entry.js-objectNew') watch_for( - css: '.content.active .modal input[name="firstname"]', + css: '.content.active .modal input[name="firstname"]', timeout: 1, ) set( - css: '.content.active .modal input[name="firstname"]', + css: '.content.active .modal input[name="firstname"]', value: firstname, ) set( - css: '.content.active .modal input[name="lastname"]', + css: '.content.active .modal input[name="lastname"]', value: lastname, ) set( - css: '.content.active .modal input[name="email"]', + css: '.content.active .modal input[name="email"]', value: customer_user_email, ) @@ -202,24 +202,24 @@ class AgentUserManageTest < TestCase # check is used to check selected watch_for( - css: '.content.active .modal input[name="customer_id"]', - value: '^\d+$', + css: '.content.active .modal input[name="customer_id"]', + value: '^\d+$', no_quote: true, ) match( - css: '.content.active .modal input[name="customer_id_completion"]', + css: '.content.active .modal input[name="customer_id_completion"]', value: firstname, ) match( - css: '.content.active .modal input[name="customer_id_completion"]', + css: '.content.active .modal input[name="customer_id_completion"]', value: lastname, ) match( - css: '.content.active .modal input[name="customer_id_completion"]', + css: '.content.active .modal input[name="customer_id_completion"]', value: customer_user_email, ) match( - css: '.content.active .modal input[name="customer_id_completion"]', + css: '.content.active .modal input[name="customer_id_completion"]', value: fullname, ) @@ -227,8 +227,8 @@ class AgentUserManageTest < TestCase modal_disappear() watch_for( - css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', - value: customer_user_email, + css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', + value: customer_user_email, timeout: 4, ) diff --git a/test/browser/agent_user_profile_test.rb b/test/browser/agent_user_profile_test.rb index c2bc46dc8..078557d7d 100644 --- a/test/browser/agent_user_profile_test.rb +++ b/test/browser/agent_user_profile_test.rb @@ -8,7 +8,7 @@ class AgentUserProfileTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -22,17 +22,17 @@ class AgentUserProfileTest < TestCase ) watch_for( - css: '.active .profile-window', + css: '.active .profile-window', value: 'note', ) watch_for( - css: '.active .profile-window', + css: '.active .profile-window', value: 'email', ) # update note set( - css: '.active [data-name="note"]', + css: '.active [data-name="note"]', value: 'some note 123', ) empty_search() @@ -44,23 +44,23 @@ class AgentUserProfileTest < TestCase modal_ready() watch_for( - css: '.active .modal', + css: '.active .modal', value: 'some note 123', ) set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'B2', ) set( - css: '.modal [data-name="note"]', + css: '.modal [data-name="note"]', value: 'some note abc', ) click(css: '.active .modal button.js-submit') modal_disappear() watch_for( - css: '.active .profile-window', + css: '.active .profile-window', value: 'some note abc', ) @@ -76,7 +76,7 @@ class AgentUserProfileTest < TestCase modal_ready() set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'Braun', ) click(css: '.active .modal button.js-submit') @@ -92,16 +92,16 @@ class AgentUserProfileTest < TestCase ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'user profile check ' + message, - body: 'user profile check ' + message, + group: 'Users', + title: 'user profile check ' + message, + body: 'user profile check ' + message, }, ) # switch to org tab, verify if ticket is shown user_open_by_search(value: 'Braun') watch_for( - css: '.active .profile-window', + css: '.active .profile-window', value: 'user profile check ' + message, ) tasks_close_all() @@ -114,10 +114,10 @@ class AgentUserProfileTest < TestCase browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all( browser: browser2, @@ -125,18 +125,18 @@ class AgentUserProfileTest < TestCase user_open_by_search( browser: browser1, - value: 'Braun', + value: 'Braun', ) user_open_by_search( browser: browser2, - value: 'Braun', + value: 'Braun', ) # update note set( browser: browser1, - css: '.active [data-name="note"]', - value: message, + css: '.active [data-name="note"]', + value: message, ) empty_search( browser: browser1, @@ -144,8 +144,8 @@ class AgentUserProfileTest < TestCase watch_for( browser: browser2, - css: '.active .profile-window', - value: message, + css: '.active .profile-window', + value: message, ) end diff --git a/test/browser/auth_test.rb b/test/browser/auth_test.rb index d61443bba..49fbbc270 100644 --- a/test/browser/auth_test.rb +++ b/test/browser/auth_test.rb @@ -5,14 +5,14 @@ class AuthTest < TestCase @browser = browser_instance location(url: browser_url) match( - css: '#login', + css: '#login', value: 'username', ) click(css: '#login button') sleep 4 match( - css: '#login', + css: '#login', value: 'username', ) @@ -28,14 +28,14 @@ class AuthTest < TestCase # check if cookie is temporarily watch_for( - css: 'body', + css: 'body', value: 'Overviews', ) # verify session cookie cookie( - name: '^_zammad.+?', - value: '.+?', + name: '^_zammad.+?', + value: '.+?', expires: '', ) end @@ -44,7 +44,7 @@ class AuthTest < TestCase @browser = browser_instance location(url: browser_url) match( - css: '#login', + css: '#login', value: 'username', ) end @@ -55,21 +55,21 @@ class AuthTest < TestCase # login with username/password login( - username: 'nicole.braun@zammad.org', - password: 'test', + username: 'nicole.braun@zammad.org', + password: 'test', remember_me: true, ) # check if cookie is temporarily watch_for( - css: 'body', + css: 'body', value: 'Overviews', ) # verify session cookie cookie( - name: '^_zammad.+?', - value: '.+?', + name: '^_zammad.+?', + value: '.+?', expires: '\d{4}-\d{1,2}-\d{1,2}.+?', ) @@ -78,8 +78,8 @@ class AuthTest < TestCase # verify session cookie sleep 2 cookie( - name: '^_zammad.+?', - value: '.+?', + name: '^_zammad.+?', + value: '.+?', expires: '', ) end diff --git a/test/browser/chat_test.rb b/test/browser/chat_test.rb index ead09eba3..d39d15d4d 100644 --- a/test/browser/chat_test.rb +++ b/test/browser/chat_test.rb @@ -6,10 +6,10 @@ class ChatTest < TestCase chat_url = "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}" agent = browser_instance login( - browser: agent, + browser: agent, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all( browser: agent, @@ -18,23 +18,23 @@ class ChatTest < TestCase # disable chat click( browser: agent, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: agent, - css: '.content.active a[href="#channels/chat"]', + css: '.content.active a[href="#channels/chat"]', ) switch( browser: agent, - css: '.content.active .js-chatSetting', - type: 'off', + css: '.content.active .js-chatSetting', + type: 'off', ) # nav bar shuld be gone sleep 2 exists_not( browser: agent, - css: 'a[href="#customer_chat"]', + css: 'a[href="#customer_chat"]', ) sleep 15 @@ -46,41 +46,41 @@ class ChatTest < TestCase sleep 4 exists_not( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', ) match( browser: customer, - css: '.settings', - value: '{"state":"chat_disabled"}', + css: '.settings', + value: '{"state":"chat_disabled"}', ) click( browser: agent, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: agent, - css: '.content.active a[href="#channels/chat"]', + css: '.content.active a[href="#channels/chat"]', ) switch( browser: agent, - css: '.content.active .js-chatSetting', - type: 'on', + css: '.content.active .js-chatSetting', + type: 'on', ) sleep 15 # wait for rerendering switch( browser: agent, - css: '#navigation .js-chatMenuItem .js-switch', - type: 'off', + css: '#navigation .js-chatMenuItem .js-switch', + type: 'off', ) click( browser: agent, - css: 'a[href="#customer_chat"]', - wait: 2, + css: 'a[href="#customer_chat"]', + wait: 2, ) match_not( browser: agent, - css: '.active.content', - value: 'disabled', + css: '.active.content', + value: 'disabled', ) reload( @@ -89,82 +89,82 @@ class ChatTest < TestCase sleep 4 exists_not( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', ) match_not( browser: customer, - css: '.settings', - value: '{"state":"chat_disabled"}', + css: '.settings', + value: '{"state":"chat_disabled"}', ) match( browser: customer, - css: '.settings', - value: '{"event":"chat_status_customer","data":{"state":"offline"}}', + css: '.settings', + value: '{"event":"chat_status_customer","data":{"state":"offline"}}', ) click( browser: agent, - css: 'a[href="#customer_chat"]', + css: 'a[href="#customer_chat"]', ) switch( browser: agent, - css: '#navigation .js-chatMenuItem .js-switch', - type: 'on', + css: '#navigation .js-chatMenuItem .js-switch', + type: 'on', ) reload( browser: customer, ) watch_for( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', timeout: 5, ) match_not( browser: customer, - css: '.settings', - value: '{"state":"chat_disabled"}', + css: '.settings', + value: '{"state":"chat_disabled"}', ) match_not( browser: customer, - css: '.settings', - value: '{"event":"chat_status_customer","data":{"state":"offline"}}', + css: '.settings', + value: '{"event":"chat_status_customer","data":{"state":"offline"}}', ) match( browser: customer, - css: '.settings', - value: '"data":{"state":"online"}', + css: '.settings', + value: '"data":{"state":"online"}', ) # init chat click( browser: customer, - css: '.zammad-chat .js-chat-open', + css: '.zammad-chat .js-chat-open', ) exists( browser: customer, - css: '.zammad-chat-is-shown', + css: '.zammad-chat-is-shown', ) watch_for( browser: customer, - css: '.zammad-chat', - value: '(waiting|warte)', + css: '.zammad-chat', + value: '(waiting|warte)', ) watch_for( browser: agent, - css: '.js-chatMenuItem .counter', - value: '1', + css: '.js-chatMenuItem .counter', + value: '1', ) click( browser: customer, - css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon', + css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon', ) watch_for_disappear( browser: customer, - css: '.zammad-chat', - value: '(waiting|warte)', + css: '.zammad-chat', + value: '(waiting|warte)', ) watch_for_disappear( browser: agent, - css: '.js-chatMenuItem .counter', + css: '.js-chatMenuItem .counter', ) end @@ -173,17 +173,17 @@ class ChatTest < TestCase chat_url = "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}" agent = browser_instance login( - browser: agent, + browser: agent, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all( browser: agent, ) click( browser: agent, - css: 'a[href="#customer_chat"]', + css: 'a[href="#customer_chat"]', ) agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click) agent.find_elements(css: '.active .chat-window .js-close').each(&:click) @@ -195,90 +195,90 @@ class ChatTest < TestCase ) watch_for( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', timeout: 5, ) click( browser: customer, - css: '.js-chat-open', + css: '.js-chat-open', ) exists( browser: customer, - css: '.zammad-chat-is-shown', + css: '.zammad-chat-is-shown', ) watch_for( browser: customer, - css: '.zammad-chat', - value: '(waiting|warte)', + css: '.zammad-chat', + value: '(waiting|warte)', ) click( browser: agent, - css: '.active .js-acceptChat', + css: '.active .js-acceptChat', ) sleep 2 exists_not( browser: agent, - css: '.active .chat-window .chat-status.is-modified', + css: '.active .chat-window .chat-status.is-modified', ) match( browser: agent, - css: '.active .chat-window .js-body', - value: chat_url, + css: '.active .chat-window .js-body', + value: chat_url, ) set( browser: agent, - css: '.active .chat-window .js-customerChatInput', - value: 'my name is me', + css: '.active .chat-window .js-customerChatInput', + value: 'my name is me', ) click( browser: agent, - css: '.active .chat-window .js-send', + css: '.active .chat-window .js-send', ) watch_for( browser: customer, - css: '.zammad-chat .zammad-chat-agent-status', - value: 'online', + css: '.zammad-chat .zammad-chat-agent-status', + value: 'online', ) watch_for( browser: customer, - css: '.zammad-chat', - value: 'my name is me', + css: '.zammad-chat', + value: 'my name is me', ) set( browser: customer, - css: '.zammad-chat .zammad-chat-input', - value: 'my name is customer', + css: '.zammad-chat .zammad-chat-input', + value: 'my name is customer', ) click( browser: customer, - css: '.zammad-chat .zammad-chat-send', + css: '.zammad-chat .zammad-chat-send', ) watch_for( browser: agent, - css: '.active .chat-window', - value: 'my name is customer', + css: '.active .chat-window', + value: 'my name is customer', ) exists( browser: agent, - css: '.active .chat-window .chat-status.is-modified', + css: '.active .chat-window .chat-status.is-modified', ) click( browser: agent, - css: '.active .chat-window .js-customerChatInput', + css: '.active .chat-window .js-customerChatInput', ) exists_not( browser: agent, - css: '.active .chat-window .chat-status.is-modified', + css: '.active .chat-window .chat-status.is-modified', ) click( browser: customer, - css: '.js-chat-toggle .zammad-chat-header-icon', + css: '.js-chat-toggle .zammad-chat-header-icon', ) watch_for( browser: agent, - css: '.active .chat-window', - value: 'closed the conversation', + css: '.active .chat-window', + value: 'closed the conversation', ) end @@ -286,17 +286,17 @@ class ChatTest < TestCase chat_url = "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}" agent = browser_instance login( - browser: agent, + browser: agent, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all( browser: agent, ) click( browser: agent, - css: 'a[href="#customer_chat"]', + css: 'a[href="#customer_chat"]', ) agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click) agent.find_elements(css: '.active .chat-window .js-close').each(&:click) @@ -308,132 +308,132 @@ class ChatTest < TestCase ) watch_for( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', timeout: 5, ) click( browser: customer, - css: '.js-chat-open', + css: '.js-chat-open', ) exists( browser: customer, - css: '.zammad-chat-is-shown', + css: '.zammad-chat-is-shown', ) watch_for( browser: customer, - css: '.zammad-chat', - value: '(waiting|warte)', + css: '.zammad-chat', + value: '(waiting|warte)', ) click( browser: agent, - css: '.active .js-acceptChat', + css: '.active .js-acceptChat', ) sleep 2 exists_not( browser: agent, - css: '.active .chat-window .chat-status.is-modified', + css: '.active .chat-window .chat-status.is-modified', ) # keep focus outside of chat window to check .chat-status.is-modified later click( browser: agent, - css: '#global-search', + css: '#global-search', ) watch_for( browser: customer, - css: '.zammad-chat .zammad-chat-agent-status', - value: 'online', + css: '.zammad-chat .zammad-chat-agent-status', + value: 'online', ) set( browser: customer, - css: '.zammad-chat .zammad-chat-input', - value: 'my name is customer', + css: '.zammad-chat .zammad-chat-input', + value: 'my name is customer', ) click( browser: customer, - css: '.zammad-chat .zammad-chat-send', + css: '.zammad-chat .zammad-chat-send', ) watch_for( browser: agent, - css: '.active .chat-window', - value: 'my name is customer', + css: '.active .chat-window', + value: 'my name is customer', ) exists( browser: agent, - css: '.active .chat-window .chat-status.is-modified', + css: '.active .chat-window .chat-status.is-modified', ) set( browser: agent, - css: '.active .chat-window .js-customerChatInput', - value: 'my name is me', + css: '.active .chat-window .js-customerChatInput', + value: 'my name is me', ) exists_not( browser: agent, - css: '.active .chat-window .chat-status.is-modified', + css: '.active .chat-window .chat-status.is-modified', ) click( browser: agent, - css: '.active .chat-window .js-send', + css: '.active .chat-window .js-send', ) watch_for( browser: customer, - css: '.zammad-chat', - value: 'my name is me', + css: '.zammad-chat', + value: 'my name is me', ) click( browser: agent, - css: '.active .chat-window .js-disconnect:not(.is-hidden)', + css: '.active .chat-window .js-disconnect:not(.is-hidden)', ) click( browser: agent, - css: '.active .chat-window .js-close', + css: '.active .chat-window .js-close', ) watch_for( browser: customer, - css: '.zammad-chat .zammad-chat-agent-status', - value: 'offline', + css: '.zammad-chat .zammad-chat-agent-status', + value: 'offline', ) watch_for( browser: customer, - css: '.zammad-chat', - value: '(Chat closed by|Chat beendet von)', + css: '.zammad-chat', + value: '(Chat closed by|Chat beendet von)', ) click( browser: customer, - css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon', + css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon', ) watch_for_disappear( browser: customer, - css: '.zammad-chat-is-open', + css: '.zammad-chat-is-open', ) agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click) agent.find_elements(css: '.active .chat-window .js-close').each(&:click) sleep 2 click( browser: customer, - css: '.zammad-chat .js-chat-open', + css: '.zammad-chat .js-chat-open', ) exists( browser: customer, - css: '.zammad-chat-is-shown', + css: '.zammad-chat-is-shown', ) watch_for( browser: customer, - css: '.zammad-chat', - value: '(waiting|warte)', + css: '.zammad-chat', + value: '(waiting|warte)', ) click( browser: agent, - css: '.active .js-acceptChat', + css: '.active .js-acceptChat', ) sleep 2 exists_not( browser: agent, - css: '.active .chat-window .chat-status.is-modified', + css: '.active .chat-window .chat-status.is-modified', ) exists( browser: agent, - css: '.active .chat-window .chat-status', + css: '.active .chat-window .chat-status', ) end @@ -441,17 +441,17 @@ class ChatTest < TestCase chat_url = "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}" agent = browser_instance login( - browser: agent, + browser: agent, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all( browser: agent, ) click( browser: agent, - css: 'a[href="#customer_chat"]', + css: 'a[href="#customer_chat"]', ) agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click) agent.find_elements(css: '.active .chat-window .js-close').each(&:click) @@ -459,18 +459,18 @@ class ChatTest < TestCase # set chat preferences click( browser: agent, - css: '.active .js-settings', + css: '.active .js-settings', ) modal_ready(browser: agent) set( browser: agent, - css: '.modal [name="chat::phrase::1"]', - value: 'Hi Stranger!;My Greeting', + css: '.modal [name="chat::phrase::1"]', + value: 'Hi Stranger!;My Greeting', ) click( browser: agent, - css: '.modal .js-submit', + css: '.modal .js-submit', ) modal_disappear(browser: agent) @@ -481,94 +481,94 @@ class ChatTest < TestCase ) watch_for( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', timeout: 5, ) click( browser: customer, - css: '.js-chat-open', + css: '.js-chat-open', ) exists( browser: customer, - css: '.zammad-chat-is-shown', + css: '.zammad-chat-is-shown', ) watch_for( browser: agent, - css: '.active .js-badgeWaitingCustomers', - value: '1', + css: '.active .js-badgeWaitingCustomers', + value: '1', ) click( browser: agent, - css: '.active .js-acceptChat', + css: '.active .js-acceptChat', ) watch_for( browser: customer, - css: '.zammad-chat', - value: 'Hi Stranger|My Greeting', + css: '.zammad-chat', + value: 'Hi Stranger|My Greeting', ) watch_for( browser: customer, - css: '.zammad-chat .zammad-chat-agent-status', - value: 'online', + css: '.zammad-chat .zammad-chat-agent-status', + value: 'online', ) match( browser: agent, - css: '.active .chat-window .js-body', - value: chat_url, + css: '.active .chat-window .js-body', + value: chat_url, ) set( browser: agent, - css: '.active .chat-window .js-customerChatInput', - value: 'my name is me', + css: '.active .chat-window .js-customerChatInput', + value: 'my name is me', ) click( browser: agent, - css: '.active .chat-window .js-send', + css: '.active .chat-window .js-send', ) watch_for( browser: customer, - css: '.zammad-chat', - value: 'my name is me', + css: '.zammad-chat', + value: 'my name is me', ) set( browser: customer, - css: '.zammad-chat .zammad-chat-input', - value: 'my name is customer', + css: '.zammad-chat .zammad-chat-input', + value: 'my name is customer', ) click( browser: customer, - css: '.zammad-chat .zammad-chat-send', + css: '.zammad-chat .zammad-chat-send', ) watch_for( browser: agent, - css: '.active .chat-window', - value: 'my name is customer', + css: '.active .chat-window', + value: 'my name is customer', ) click( browser: agent, - css: '.active .chat-window .js-customerChatInput', + css: '.active .chat-window .js-customerChatInput', ) reload( browser: customer, ) exists( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', ) watch_for( browser: customer, - css: '.zammad-chat', - value: 'Hi Stranger|My Greeting', + css: '.zammad-chat', + value: 'Hi Stranger|My Greeting', ) watch_for( browser: customer, - css: '.zammad-chat', - value: 'my name is me', + css: '.zammad-chat', + value: 'my name is me', ) watch_for( browser: customer, - css: '.zammad-chat', - value: 'my name is customer', + css: '.zammad-chat', + value: 'my name is customer', ) location( browser: customer, @@ -577,17 +577,17 @@ class ChatTest < TestCase sleep 2 match( browser: agent, - css: '.active .chat-window .js-body', - value: "#{chat_url}#new_hash", + css: '.active .chat-window .js-body', + value: "#{chat_url}#new_hash", ) click( browser: customer, - css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon', + css: '.zammad-chat .js-chat-toggle .zammad-chat-header-icon', ) watch_for( browser: agent, - css: '.active .chat-window', - value: 'closed the conversation', + css: '.active .chat-window', + value: 'closed the conversation', ) end @@ -595,24 +595,24 @@ class ChatTest < TestCase chat_url = "#{browser_url}/assets/chat/znuny.html?port=#{ENV['WS_PORT']}" agent = browser_instance login( - browser: agent, + browser: agent, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all( browser: agent, ) click( browser: agent, - css: 'a[href="#customer_chat"]', + css: 'a[href="#customer_chat"]', ) agent.find_elements(css: '.active .chat-window .js-disconnect:not(.is-hidden)').each(&:click) agent.find_elements(css: '.active .chat-window .js-close').each(&:click) exists( browser: agent, - css: '#navigation .js-chatMenuItem .js-switch input[checked]' + css: '#navigation .js-chatMenuItem .js-switch input[checked]' ) # no customer action, hide widget @@ -623,12 +623,12 @@ class ChatTest < TestCase ) watch_for( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', timeout: 5, ) watch_for_disappear( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', timeout: 95, ) @@ -638,34 +638,34 @@ class ChatTest < TestCase ) exists( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', ) click( browser: customer, - css: '.js-chat-open', + css: '.js-chat-open', ) watch_for( browser: customer, - css: '.zammad-chat', - value: '(waiting|warte)', + css: '.zammad-chat', + value: '(waiting|warte)', timeout: 35, ) watch_for( browser: customer, - css: '.zammad-chat', - value: '(takes longer|dauert länger)', + css: '.zammad-chat', + value: '(takes longer|dauert länger)', timeout: 120, ) # check if agent is offline, idle timeout, chat not answered exists_not( browser: agent, - css: '#navigation .js-chatMenuItem .js-switch input[checked]' + css: '#navigation .js-chatMenuItem .js-switch input[checked]' ) switch( browser: agent, - css: '#navigation .js-chatMenuItem .js-switch', - type: 'on', + css: '#navigation .js-chatMenuItem .js-switch', + type: 'on', ) # no customer action, show sorry screen @@ -674,40 +674,40 @@ class ChatTest < TestCase ) exists( browser: customer, - css: '.zammad-chat', + css: '.zammad-chat', ) click( browser: customer, - css: '.js-chat-open', + css: '.js-chat-open', ) watch_for( browser: agent, - css: '.js-chatMenuItem .counter', - value: '1', + css: '.js-chatMenuItem .counter', + value: '1', ) click( browser: agent, - css: '.active .js-acceptChat', + css: '.active .js-acceptChat', ) sleep 2 set( browser: agent, - css: '.active .chat-window .js-customerChatInput', - value: 'agent is asking', + css: '.active .chat-window .js-customerChatInput', + value: 'agent is asking', ) click( browser: agent, - css: '.active .chat-window .js-send', + css: '.active .chat-window .js-send', ) watch_for( browser: customer, - css: '.zammad-chat', - value: 'agent is asking', + css: '.zammad-chat', + value: 'agent is asking', ) watch_for( browser: customer, - css: '.zammad-chat', - value: '(Since you didn\'t respond|Da Sie in den letzten)', + css: '.zammad-chat', + value: '(Since you didn\'t respond|Da Sie in den letzten)', timeout: 150, ) @@ -715,49 +715,49 @@ class ChatTest < TestCase sleep 2 click( browser: customer, - css: '.js-restart', + css: '.js-restart', ) sleep 5 click( browser: customer, - css: '.js-chat-open', + css: '.js-chat-open', ) exists( browser: customer, - css: '.zammad-chat-is-shown', + css: '.zammad-chat-is-shown', ) watch_for( browser: customer, - css: '.zammad-chat', - value: '(waiting|warte)', + css: '.zammad-chat', + value: '(waiting|warte)', ) click( browser: agent, - css: '.active .js-acceptChat', + css: '.active .js-acceptChat', ) sleep 2 exists( browser: agent, - css: '.active .chat-window .chat-status', + css: '.active .chat-window .chat-status', ) set( browser: agent, - css: '.active .chat-window .js-customerChatInput', - value: 'my name is me', + css: '.active .chat-window .js-customerChatInput', + value: 'my name is me', ) click( browser: agent, - css: '.active .chat-window .js-send', + css: '.active .chat-window .js-send', ) watch_for( browser: customer, - css: '.zammad-chat .zammad-chat-agent-status', - value: 'online', + css: '.zammad-chat .zammad-chat-agent-status', + value: 'online', ) watch_for( browser: customer, - css: '.zammad-chat', - value: 'my name is me', + css: '.zammad-chat', + value: 'my name is me', ) end diff --git a/test/browser/customer_ticket_create_test.rb b/test/browser/customer_ticket_create_test.rb index 0c510c626..9e2bd82da 100644 --- a/test/browser/customer_ticket_create_test.rb +++ b/test/browser/customer_ticket_create_test.rb @@ -6,7 +6,7 @@ class CustomerTicketCreateTest < TestCase login( username: 'nicole.braun@zammad.org', password: 'test', - url: browser_url, + url: browser_url, ) # customer ticket create @@ -15,16 +15,16 @@ class CustomerTicketCreateTest < TestCase sleep 2 select( - css: '.newTicket select[name="group_id"]', + css: '.newTicket select[name="group_id"]', value: 'Users', ) set( - css: '.newTicket input[name="title"]', + css: '.newTicket input[name="title"]', value: 'some subject 123äöü', ) set( - css: '.newTicket [data-name="body"]', + css: '.newTicket [data-name="body"]', value: 'some body 123äöü', ) exists_not( @@ -41,21 +41,21 @@ class CustomerTicketCreateTest < TestCase location_check(url: '#ticket/zoom/') match( - css: '.active div.ticket-article', - value: 'some body 123äöü', + css: '.active div.ticket-article', + value: 'some body 123äöü', no_quote: true, ) # verify if the state has changed to open match( - css: '.content.active .sidebar [name="state_id"]', + css: '.content.active .sidebar [name="state_id"]', value: 'new', ) # update ticket set( - css: '.content.active [data-name="body"]', - value: 'some body 1234 äöüß', + css: '.content.active [data-name="body"]', + value: 'some body 1234 äöüß', no_click: true, ) @@ -66,13 +66,13 @@ class CustomerTicketCreateTest < TestCase click(css: '.content.active .js-submit') watch_for( - css: '.content.active div.ticket-article', + css: '.content.active div.ticket-article', value: 'some body 1234 äöüß', ) # check if the ticket state is new after update by customer match( - css: '.content.active .sidebar [name="state_id"]', + css: '.content.active .sidebar [name="state_id"]', value: 'new', ) @@ -83,38 +83,38 @@ class CustomerTicketCreateTest < TestCase # close the ticket select( - css: '.content.active [name="state_id"]', + css: '.content.active [name="state_id"]', value: 'closed', ) set( - css: '.content.active [data-name="body"]', - value: 'close #1', + css: '.content.active [data-name="body"]', + value: 'close #1', no_click: true, ) click(css: '.content.active .js-submit') watch_for( - css: '.content.active div.ticket-article', + css: '.content.active div.ticket-article', value: 'close #1', ) # check if the ticket is closed match( - css: '.content.active .sidebar [name="state_id"]', + css: '.content.active .sidebar [name="state_id"]', value: 'closed', ) # type in new content into rte to trigger the default follow up state set( - css: '.content.active [data-name="body"]', - value: 'some body blublub default followup for reopen check', + css: '.content.active [data-name="body"]', + value: 'some body blublub default followup for reopen check', no_click: true, ) # verify if the state has changed to open watch_for( - css: '.content.active .sidebar [name="state_id"]', + css: '.content.active .sidebar [name="state_id"]', value: 'open', ) @@ -125,27 +125,27 @@ class CustomerTicketCreateTest < TestCase # remove content from rte set( - css: '.content.active [data-name="body"]', - value: '', + css: '.content.active [data-name="body"]', + value: '', no_click: true, ) # check if state changed to closed again watch_for( - css: '.content.active .sidebar [name="state_id"]', + css: '.content.active .sidebar [name="state_id"]', value: 'closed', ) # type in new content into rte to trigger the default follow up state set( - css: '.content.active [data-name="body"]', - value: 'some body blublub default followup for reopen check', + css: '.content.active [data-name="body"]', + value: 'some body blublub default followup for reopen check', no_click: true, ) # verify if the state has changed to open watch_for( - css: '.content.active .sidebar [name="state_id"]', + css: '.content.active .sidebar [name="state_id"]', value: 'open', ) @@ -153,13 +153,13 @@ class CustomerTicketCreateTest < TestCase click(css: '.content.active .js-submit') watch_for( - css: '.content.active div.ticket-article', + css: '.content.active div.ticket-article', value: 'some body blublub default followup for reopen check', ) # verify if the state has changed to open match( - css: '.content.active .sidebar [name="state_id"]', + css: '.content.active .sidebar [name="state_id"]', value: 'open', ) end @@ -169,7 +169,7 @@ class CustomerTicketCreateTest < TestCase login( username: 'nicole.braun@zammad.org', password: 'test', - url: browser_url, + url: browser_url, ) # customer ticket create @@ -178,16 +178,16 @@ class CustomerTicketCreateTest < TestCase sleep 2 select( - css: '.newTicket select[name="group_id"]', + css: '.newTicket select[name="group_id"]', value: 'Users', ) set( - css: '.newTicket input[name="title"]', + css: '.newTicket input[name="title"]', value: 'relogin - customer - agent - test 1', ) set( - css: '.newTicket [data-name="body"]', + css: '.newTicket [data-name="body"]', value: 'relogin - customer - agent - test 1', ) @@ -198,8 +198,8 @@ class CustomerTicketCreateTest < TestCase location_check(url: '#ticket/zoom/') match( - css: '.active div.ticket-article', - value: 'relogin - customer - agent - test 1', + css: '.active div.ticket-article', + value: 'relogin - customer - agent - test 1', no_quote: true, ) @@ -209,17 +209,17 @@ class CustomerTicketCreateTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'relogin - customer - agent - test 2', - body: 'relogin - customer - agent - test 2', - state: 'closed', + group: 'Users', + title: 'relogin - customer - agent - test 2', + body: 'relogin - customer - agent - test 2', + state: 'closed', }, ) end @@ -231,7 +231,7 @@ class CustomerTicketCreateTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#manage"]') @@ -249,7 +249,7 @@ class CustomerTicketCreateTest < TestCase login( username: 'nicole.braun@zammad.org', password: 'test', - url: browser_url, + url: browser_url, ) assert(exists_not(css: 'a[href="#customer_ticket_new"]')) @@ -261,7 +261,7 @@ class CustomerTicketCreateTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#manage"]') @@ -279,7 +279,7 @@ class CustomerTicketCreateTest < TestCase login( username: 'nicole.braun@zammad.org', password: 'test', - url: browser_url, + url: browser_url, ) assert(exists(css: 'a[href="#customer_ticket_new"]')) diff --git a/test/browser/first_steps_test.rb b/test/browser/first_steps_test.rb index 71d05cb3c..863484be8 100644 --- a/test/browser/first_steps_test.rb +++ b/test/browser/first_steps_test.rb @@ -10,7 +10,7 @@ class FirstStepsTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -26,20 +26,20 @@ class FirstStepsTest < TestCase modal_ready() set( - css: '.modal [name="firstname"]', + css: '.modal [name="firstname"]', value: 'Bob', ) set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'Smith', ) set( - css: '.modal [name="email"]', + css: '.modal [name="email"]', value: "#{agent}@example.com", ) check(css: '.modal .js-groupListItem[value=full]') click( - css: '.modal button.btn.btn--primary', + css: '.modal button.btn.btn--primary', fast: true, ) watch_for( @@ -56,23 +56,23 @@ class FirstStepsTest < TestCase click(css: '.active.content .js-inviteCustomer') modal_ready() set( - css: '.modal [name="firstname"]', + css: '.modal [name="firstname"]', value: 'Client', ) set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'Smith', ) set( - css: '.modal [name="email"]', + css: '.modal [name="email"]', value: "#{customer}@example.com", ) set( - css: '.modal [data-name="note"]', + css: '.modal [data-name="note"]', value: 'some note', ) click( - css: '.modal button.btn.btn--primary', + css: '.modal button.btn.btn--primary', fast: true, ) watch_for( @@ -87,7 +87,7 @@ class FirstStepsTest < TestCase # test ticket click( - css: '.active.content .js-testTicket', + css: '.active.content .js-testTicket', fast: true, ) modal_ready() @@ -96,7 +96,7 @@ class FirstStepsTest < TestCase value: 'A Test Ticket has been created', ) click( - css: '.modal .modal-body', + css: '.modal .modal-body', fast: true, ) watch_for_disappear( @@ -118,7 +118,7 @@ class FirstStepsTest < TestCase click(css: '.active.content a[href="#channels/form"]') sleep 2 switch( - css: '.content.active .js-formSetting', + css: '.content.active .js-formSetting', type: 'on', ) click(css: '#navigation a[href="#dashboard"]') diff --git a/test/browser/form_test.rb b/test/browser/form_test.rb index eb6435859..0e78a2601 100644 --- a/test/browser/form_test.rb +++ b/test/browser/form_test.rb @@ -5,10 +5,10 @@ class FormTest < TestCase def test_basic agent = browser_instance login( - browser: agent, + browser: agent, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all( browser: agent, @@ -17,78 +17,78 @@ class FormTest < TestCase # disable form click( browser: agent, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: agent, - css: '.content.active a[href="#channels/form"]', + css: '.content.active a[href="#channels/form"]', ) switch( browser: agent, - css: '.content.active .js-formSetting', - type: 'off', + css: '.content.active .js-formSetting', + type: 'off', ) # admin preview test sleep 1 click( browser: agent, - css: '.content.active .js-formBtn', + css: '.content.active .js-formBtn', ) sleep 10 set( browser: agent, - css: 'body div.zammad-form-modal [name="name"]', - value: 'some sender', + css: 'body div.zammad-form-modal [name="name"]', + value: 'some sender', ) set( browser: agent, - css: 'body div.zammad-form-modal [name="body"]', - value: '', + css: 'body div.zammad-form-modal [name="body"]', + value: '', ) click( browser: agent, - css: 'body div.zammad-form-modal button[type="submit"]', + css: 'body div.zammad-form-modal button[type="submit"]', ) watch_for( browser: agent, - css: 'body div.zammad-form-modal .has-error [name="body"]', + css: 'body div.zammad-form-modal .has-error [name="body"]', ) watch_for_disappear( browser: agent, - css: 'body div.zammad-form-modal button[type="submit"][disabled]', + css: 'body div.zammad-form-modal button[type="submit"][disabled]', ) set( browser: agent, - css: 'body div.zammad-form-modal [name="body"]', - value: 'new body', + css: 'body div.zammad-form-modal [name="body"]', + value: 'new body', ) set( browser: agent, - css: 'body div.zammad-form-modal [name="email"]', - value: 'somebody@notexistinginanydomainspacealsonothere.nowhere', + css: 'body div.zammad-form-modal [name="email"]', + value: 'somebody@notexistinginanydomainspacealsonothere.nowhere', ) click( browser: agent, - css: 'body div.zammad-form-modal button[type="submit"]', + css: 'body div.zammad-form-modal button[type="submit"]', ) watch_for( browser: agent, - css: 'body div.zammad-form-modal .has-error [name="email"]', + css: 'body div.zammad-form-modal .has-error [name="email"]', ) watch_for_disappear( browser: agent, - css: 'body div.zammad-form-modal button[type="submit"][disabled]', + css: 'body div.zammad-form-modal button[type="submit"][disabled]', ) set( browser: agent, - css: 'body div.zammad-form-modal [name="email"]', - value: 'discard@znuny.com', + css: 'body div.zammad-form-modal [name="email"]', + value: 'discard@znuny.com', ) click( browser: agent, - css: 'body div.zammad-form-modal button[type="submit"]', + css: 'body div.zammad-form-modal button[type="submit"]', ) watch_for( browser: agent, @@ -107,13 +107,13 @@ class FormTest < TestCase ) watch_for( browser: customer, - css: '.js-logDisplay', - value: 'Faild to load form config, feature is disabled', + css: '.js-logDisplay', + value: 'Faild to load form config, feature is disabled', ) switch( browser: agent, - css: '.content.active .js-formSetting', - type: 'on', + css: '.content.active .js-formSetting', + type: 'on', ) reload( @@ -122,44 +122,44 @@ class FormTest < TestCase sleep 4 match_not( browser: customer, - css: '.js-logDisplay', - value: 'Faild to load form config, feature is disabled', + css: '.js-logDisplay', + value: 'Faild to load form config, feature is disabled', ) exists_not( browser: customer, - css: 'body div.zammad-form-modal', + css: 'body div.zammad-form-modal', ) # modal dialog click( browser: customer, - css: '#feedback-form-modal', + css: '#feedback-form-modal', ) watch_for( browser: customer, - css: 'body div.zammad-form-modal', + css: 'body div.zammad-form-modal', ) # fill form valid data - but too fast set( browser: customer, - css: 'body div.zammad-form-modal [name="name"]', - value: 'some name', + css: 'body div.zammad-form-modal [name="name"]', + value: 'some name', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="email"]', - value: 'discard@znuny.com', + css: 'body div.zammad-form-modal [name="email"]', + value: 'discard@znuny.com', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="body"]', - value: "some text\nnew line", + css: 'body div.zammad-form-modal [name="body"]', + value: "some text\nnew line", ) click( browser: customer, - css: 'body div.zammad-form-modal button[type="submit"]', + css: 'body div.zammad-form-modal button[type="submit"]', ) # check warning @@ -170,38 +170,38 @@ class FormTest < TestCase # fill form invalid data - within correct time set( browser: customer, - css: 'body div.zammad-form-modal [name="name"]', - value: 'some name', + css: 'body div.zammad-form-modal [name="name"]', + value: 'some name', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="email"]', - value: 'invalid_email', + css: 'body div.zammad-form-modal [name="email"]', + value: 'invalid_email', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="body"]', - value: "some text\nnew line", + css: 'body div.zammad-form-modal [name="body"]', + value: "some text\nnew line", ) click( browser: customer, - css: 'body div.zammad-form-modal button[type="submit"]', + css: 'body div.zammad-form-modal button[type="submit"]', ) sleep 10 exists( browser: customer, - css: 'body div.zammad-form-modal', + css: 'body div.zammad-form-modal', ) # fill form valid data set( browser: customer, - css: 'body div.zammad-form-modal [name="email"]', - value: 'discard@znuny.com', + css: 'body div.zammad-form-modal [name="email"]', + value: 'discard@znuny.com', ) click( browser: customer, - css: 'body div.zammad-form-modal button[type="submit"]', + css: 'body div.zammad-form-modal button[type="submit"]', ) watch_for( browser: customer, @@ -217,94 +217,94 @@ class FormTest < TestCase sleep 1 exists_not( browser: customer, - css: 'body div.zammad-form-modal', + css: 'body div.zammad-form-modal', ) # fill form invalid data - within correct time click( browser: customer, - css: '#feedback-form-modal', + css: '#feedback-form-modal', ) sleep 10 set( browser: customer, - css: 'body div.zammad-form-modal [name="name"]', - value: '', + css: 'body div.zammad-form-modal [name="name"]', + value: '', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="email"]', - value: 'discard@znuny.com', + css: 'body div.zammad-form-modal [name="email"]', + value: 'discard@znuny.com', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="body"]', - value: "some text\nnew line", + css: 'body div.zammad-form-modal [name="body"]', + value: "some text\nnew line", ) click( browser: customer, - css: 'body div.zammad-form-modal button[type="submit"]', + css: 'body div.zammad-form-modal button[type="submit"]', ) watch_for( browser: customer, - css: 'body div.zammad-form-modal .has-error [name="name"]', + css: 'body div.zammad-form-modal .has-error [name="name"]', ) watch_for_disappear( browser: customer, - css: 'body div.zammad-form-modal button[type="submit"][disabled]', + css: 'body div.zammad-form-modal button[type="submit"][disabled]', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="name"]', - value: 'some sender', + css: 'body div.zammad-form-modal [name="name"]', + value: 'some sender', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="body"]', - value: '', + css: 'body div.zammad-form-modal [name="body"]', + value: '', ) click( browser: customer, - css: 'body div.zammad-form-modal button[type="submit"]', + css: 'body div.zammad-form-modal button[type="submit"]', ) watch_for( browser: customer, - css: 'body div.zammad-form-modal .has-error [name="body"]', + css: 'body div.zammad-form-modal .has-error [name="body"]', ) watch_for_disappear( browser: customer, - css: 'body div.zammad-form-modal button[type="submit"][disabled]', + css: 'body div.zammad-form-modal button[type="submit"][disabled]', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="body"]', - value: 'new body', + css: 'body div.zammad-form-modal [name="body"]', + value: 'new body', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="email"]', - value: 'somebody@notexistinginanydomainspacealsonothere.nowhere', + css: 'body div.zammad-form-modal [name="email"]', + value: 'somebody@notexistinginanydomainspacealsonothere.nowhere', ) click( browser: customer, - css: 'body div.zammad-form-modal button[type="submit"]', + css: 'body div.zammad-form-modal button[type="submit"]', ) watch_for( browser: customer, - css: 'body div.zammad-form-modal .has-error [name="email"]', + css: 'body div.zammad-form-modal .has-error [name="email"]', ) watch_for_disappear( browser: customer, - css: 'body div.zammad-form-modal button[type="submit"][disabled]', + css: 'body div.zammad-form-modal button[type="submit"][disabled]', ) set( browser: customer, - css: 'body div.zammad-form-modal [name="email"]', - value: 'discard@znuny.com', + css: 'body div.zammad-form-modal [name="email"]', + value: 'discard@znuny.com', ) click( browser: customer, - css: 'body div.zammad-form-modal button[type="submit"]', + css: 'body div.zammad-form-modal button[type="submit"]', ) watch_for( browser: customer, @@ -320,28 +320,28 @@ class FormTest < TestCase sleep 1 exists_not( browser: customer, - css: 'body div.zammad-form-modal', + css: 'body div.zammad-form-modal', ) # inline form set( browser: customer, - css: '.zammad-form [name="name"]', - value: 'Some Name', + css: '.zammad-form [name="name"]', + value: 'Some Name', ) set( browser: customer, - css: '.zammad-form [name="email"]', - value: 'discard@znuny.com', + css: '.zammad-form [name="email"]', + value: 'discard@znuny.com', ) set( browser: customer, - css: '.zammad-form [name="body"]', - value: 'some text', + css: '.zammad-form [name="body"]', + value: 'some text', ) click( browser: customer, - css: '.zammad-form button[type="submit"]', + css: '.zammad-form button[type="submit"]', ) watch_for( browser: customer, diff --git a/test/browser/integration_cti_test.rb b/test/browser/integration_cti_test.rb index f12c33199..67f26a584 100644 --- a/test/browser/integration_cti_test.rb +++ b/test/browser/integration_cti_test.rb @@ -16,7 +16,7 @@ class IntegrationCtiTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#manage"]') @@ -24,12 +24,12 @@ class IntegrationCtiTest < TestCase click(css: 'a[href="#system/integration/cti"]') switch( - css: '.content.active .js-switch', + css: '.content.active .js-switch', type: 'on' ) watch_for( - css: 'a[href="#cti"]', + css: 'a[href="#cti"]', timeout: 4, ) @@ -42,24 +42,24 @@ class IntegrationCtiTest < TestCase url = URI.join(browser_url, "api/v1/cti/#{ENV['CTI_TOKEN']}") params = { direction: 'in', - from: '491715000002', - to: '4930600000000', - callId: "4991155921769858278-#{id}", - cause: 'busy' + from: '491715000002', + to: '4930600000000', + callId: "4991155921769858278-#{id}", + cause: 'busy' } Net::HTTP.post_form(url, params.merge(event: 'newCall')) Net::HTTP.post_form(url, params.merge(event: 'hangup')) watch_for( - css: '.js-phoneMenuItem .counter', - value: (call_counter + 1).to_s, + css: '.js-phoneMenuItem .counter', + value: (call_counter + 1).to_s, timeout: 4, ) check(css: '.content.active .table-checkbox input') watch_for_disappear( - css: '.js-phoneMenuItem .counter', + css: '.js-phoneMenuItem .counter', timeout: 6, ) @@ -68,7 +68,7 @@ class IntegrationCtiTest < TestCase click(css: 'a[href="#system/integration/cti"]') switch( - css: '.content.active .js-switch', + css: '.content.active .js-switch', type: 'off' ) end @@ -81,7 +81,7 @@ class IntegrationCtiTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#manage"]') @@ -89,7 +89,7 @@ class IntegrationCtiTest < TestCase click(css: 'a[href="#system/integration/cti"]') switch( - css: '.content.active .js-switch', + css: '.content.active .js-switch', type: 'on' ) @@ -105,10 +105,10 @@ class IntegrationCtiTest < TestCase # ...for private network number params = { direction: 'in', - from: '007', - to: '008', - callId: "4991155921769858278-#{id}", - cause: 'busy' + from: '007', + to: '008', + callId: "4991155921769858278-#{id}", + cause: 'busy' } Net::HTTP.post_form(url, params.merge(event: 'newCall')) Net::HTTP.post_form(url, params.merge(event: 'hangup')) @@ -116,10 +116,10 @@ class IntegrationCtiTest < TestCase # ...for e164 number params = { direction: 'in', - from: '4930609854180', - to: '4930609811111', - callId: "4991155921769858278-#{id.next}", - cause: 'busy' + from: '4930609854180', + to: '4930609811111', + callId: "4991155921769858278-#{id.next}", + cause: 'busy' } Net::HTTP.post_form(url, params.merge(event: 'newCall')) Net::HTTP.post_form(url, params.merge(event: 'hangup')) @@ -129,24 +129,24 @@ class IntegrationCtiTest < TestCase # assertion: private network numbers appear verbatim watch_for( - css: '.content.active .js-callerLog', - value: '007', + css: '.content.active .js-callerLog', + value: '007', timeout: 3, ) match( - css: '.content.active .js-callerLog', + css: '.content.active .js-callerLog', value: '008', ) # assertion: E164 numbers appear prettified match( - css: '.content.active .js-callerLog', + css: '.content.active .js-callerLog', value: '+49 30 609854180', ) match( - css: '.content.active .js-callerLog', + css: '.content.active .js-callerLog', value: '+49 30 609811111', ) end @@ -159,7 +159,7 @@ class IntegrationCtiTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) # create inactive user with phone number (via API) @@ -179,7 +179,7 @@ class IntegrationCtiTest < TestCase click(css: 'a[href="#system/integration/cti"]') switch( - css: '.content.active .js-switch', + css: '.content.active .js-switch', type: 'on' ) @@ -193,10 +193,10 @@ class IntegrationCtiTest < TestCase url = URI.join(browser_url, "api/v1/cti/#{ENV['CTI_TOKEN']}") params = { direction: 'in', - from: '1234567890', - to: '1234567890', - callId: "4991155921769858278-#{id}", - cause: 'busy' + from: '1234567890', + to: '1234567890', + callId: "4991155921769858278-#{id}", + cause: 'busy' } Net::HTTP.post_form(url, params.merge(event: 'newCall')) Net::HTTP.post_form(url, params.merge(event: 'hangup')) @@ -206,7 +206,7 @@ class IntegrationCtiTest < TestCase # assertion: names appear in strikethrough match( - css: 'span.is-inactive', + css: 'span.is-inactive', value: 'John Doe', ) end @@ -219,7 +219,7 @@ class IntegrationCtiTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) # create user with organization (via API) @@ -239,7 +239,7 @@ class IntegrationCtiTest < TestCase click(css: 'a[href="#system/integration/cti"]') switch( - css: '.content.active .js-switch', + css: '.content.active .js-switch', type: 'on' ) @@ -254,20 +254,20 @@ class IntegrationCtiTest < TestCase url = URI.join(browser_url, "api/v1/cti/#{ENV['CTI_TOKEN']}") params = { direction: 'out', - from: '1234567890', - to: '1234567890', - callId: "4991155921769858278-#{id}", - cause: 'busy' + from: '1234567890', + to: '1234567890', + callId: "4991155921769858278-#{id}", + cause: 'busy' } Net::HTTP.post_form(url, params.merge(event: 'newCall')) Net::HTTP.post_form(url, params.merge(event: 'hangup')) params = { direction: 'in', - from: '1234567890', - to: '1234567890', - callId: "4991155921769858278-#{id.next}", - cause: 'busy' + from: '1234567890', + to: '1234567890', + callId: "4991155921769858278-#{id.next}", + cause: 'busy' } Net::HTTP.post_form(url, params.merge(event: 'newCall')) Net::HTTP.post_form(url, params.merge(event: 'hangup')) @@ -278,12 +278,12 @@ class IntegrationCtiTest < TestCase # assertions: Caller ID includes user organization match( - css: '.js-callerLog tr:first-of-type span.user-popover', + css: '.js-callerLog tr:first-of-type span.user-popover', value: 'John Doe (Zammad Foundation)', ) match( - css: '.js-callerLog tr:last-of-type span.user-popover', + css: '.js-callerLog tr:last-of-type span.user-popover', value: 'John Doe (Zammad Foundation)', ) end diff --git a/test/browser/integration_sipgate_test.rb b/test/browser/integration_sipgate_test.rb index bc17675cc..3c776d403 100644 --- a/test/browser/integration_sipgate_test.rb +++ b/test/browser/integration_sipgate_test.rb @@ -9,7 +9,7 @@ class IntegrationSipgateTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#manage"]') @@ -17,12 +17,12 @@ class IntegrationSipgateTest < TestCase click(css: 'a[href="#system/integration/sipgate"]') switch( - css: '.content.active .js-switch', + css: '.content.active .js-switch', type: 'on' ) watch_for( - css: 'a[href="#cti"]', + css: 'a[href="#cti"]', timeout: 4, ) @@ -35,24 +35,24 @@ class IntegrationSipgateTest < TestCase url = URI.join(browser_url, 'api/v1/sipgate/in') params = { direction: 'in', - from: '491715000003', - to: '4930600000004', - callId: "4991155921769858279-#{id}", - cause: 'busy' + from: '491715000003', + to: '4930600000004', + callId: "4991155921769858279-#{id}", + cause: 'busy' } Net::HTTP.post_form(url, params.merge(event: 'newCall')) Net::HTTP.post_form(url, params.merge(event: 'hangup')) watch_for( - css: '.js-phoneMenuItem .counter', - value: (call_counter + 1).to_s, + css: '.js-phoneMenuItem .counter', + value: (call_counter + 1).to_s, timeout: 4, ) check(css: '.content.active .table-checkbox input') watch_for_disappear( - css: '.js-phoneMenuItem .counter', + css: '.js-phoneMenuItem .counter', timeout: 6, ) @@ -61,7 +61,7 @@ class IntegrationSipgateTest < TestCase click(css: 'a[href="#system/integration/sipgate"]') switch( - css: '.content.active .js-switch', + css: '.content.active .js-switch', type: 'off' ) end diff --git a/test/browser/integration_test.rb b/test/browser/integration_test.rb index fd480ff4d..754cbebda 100644 --- a/test/browser/integration_test.rb +++ b/test/browser/integration_test.rb @@ -7,7 +7,7 @@ class IntegrationTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -17,15 +17,15 @@ class IntegrationTest < TestCase click(css: 'a[href="#system/integration/sipgate"]') sleep 2 switch( - css: '.content.active .main .js-switch', + css: '.content.active .main .js-switch', type: 'on', ) set( - css: '.content.active .main .js-inboundBlockCallerId input[name=caller_id]', + css: '.content.active .main .js-inboundBlockCallerId input[name=caller_id]', value: '041 1234567', ) set( - css: '.content.active .main .js-inboundBlockCallerId input[name=note]', + css: '.content.active .main .js-inboundBlockCallerId input[name=note]', value: 'block spam caller id', ) click(css: '.content.active .main .js-inboundBlockCallerId .js-add') @@ -61,7 +61,7 @@ class IntegrationTest < TestCase click(css: '.content.active .main .js-submit') sleep 6 switch( - css: '.content.active .main .js-switch', + css: '.content.active .main .js-switch', type: 'off', ) @@ -79,7 +79,7 @@ class IntegrationTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -89,35 +89,35 @@ class IntegrationTest < TestCase click(css: 'a[href="#system/integration/slack"]') sleep 2 switch( - css: '.content.active .main .js-switch', + css: '.content.active .main .js-switch', type: 'on', ) click(css: '.content.active .main .checkbox-replacement') select( - css: '.content.active .main select[name="group_ids"]', + css: '.content.active .main select[name="group_ids"]', value: 'Users', ) set( - css: '.content.active .main input[name="webhook"]', + css: '.content.active .main input[name="webhook"]', value: 'http://some_url/webhook/123', ) set( - css: '.content.active .main input[name="username"]', + css: '.content.active .main input[name="username"]', value: 'someuser', ) click(css: '.content.active .main .js-submit') match( - css: '.content.active .main select[name="group_ids"]', + css: '.content.active .main select[name="group_ids"]', value: 'Users', ) match( - css: '.content.active .main input[name="webhook"]', + css: '.content.active .main input[name="webhook"]', value: 'http://some_url/webhook/123', ) match( - css: '.content.active .main input[name="username"]', + css: '.content.active .main input[name="username"]', value: 'someuser', ) @@ -127,35 +127,35 @@ class IntegrationTest < TestCase click(css: 'a[href="#system/integration/slack"]') match( - css: '.content.active .main select[name="group_ids"]', + css: '.content.active .main select[name="group_ids"]', value: 'Users', ) match( - css: '.content.active .main input[name="webhook"]', + css: '.content.active .main input[name="webhook"]', value: 'http://some_url/webhook/123', ) match( - css: '.content.active .main input[name="username"]', + css: '.content.active .main input[name="username"]', value: 'someuser', ) reload() match( - css: '.content.active .main select[name="group_ids"]', + css: '.content.active .main select[name="group_ids"]', value: 'Users', ) match( - css: '.content.active .main input[name="webhook"]', + css: '.content.active .main input[name="webhook"]', value: 'http://some_url/webhook/123', ) match( - css: '.content.active .main input[name="username"]', + css: '.content.active .main input[name="username"]', value: 'someuser', ) switch( - css: '.content.active .main .js-switch', + css: '.content.active .main .js-switch', type: 'off', ) end @@ -165,7 +165,7 @@ class IntegrationTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -175,19 +175,19 @@ class IntegrationTest < TestCase click(css: 'a[href="#system/integration/clearbit"]') sleep 2 switch( - css: '.content.active .main .js-switch', + css: '.content.active .main .js-switch', type: 'on', ) set( - css: '.content.active .main input[name="api_key"]', + css: '.content.active .main input[name="api_key"]', value: 'some_api_key', ) set( - css: '.content.active .main .js-userSync .js-new [name="source"]', + css: '.content.active .main .js-userSync .js-new [name="source"]', value: 'source1', ) set( - css: '.content.active .main .js-userSync .js-new [name="destination"]', + css: '.content.active .main .js-userSync .js-new [name="destination"]', value: 'destination1', ) click(css: '.content.active .main .js-userSync .js-add') @@ -199,7 +199,7 @@ class IntegrationTest < TestCase click(css: 'a[href="#system/integration/clearbit"]') match( - css: '.content.active .main input[name="api_key"]', + css: '.content.active .main input[name="api_key"]', value: 'some_api_key', ) exists( @@ -212,7 +212,7 @@ class IntegrationTest < TestCase reload() match( - css: '.content.active .main input[name="api_key"]', + css: '.content.active .main input[name="api_key"]', value: 'some_api_key', ) exists( @@ -223,23 +223,23 @@ class IntegrationTest < TestCase ) switch( - css: '.content.active .main .js-switch', + css: '.content.active .main .js-switch', type: 'off', ) set( - css: '.content.active .main input[name="api_key"]', + css: '.content.active .main input[name="api_key"]', value: '-empty-', ) click(css: '.content.active .main .js-submit') reload() match_not( - css: '.content.active .main input[name="api_key"]', + css: '.content.active .main input[name="api_key"]', value: 'some_api_key', ) match( - css: '.content.active .main input[name="api_key"]', + css: '.content.active .main input[name="api_key"]', value: '-empty-', ) exists( @@ -255,7 +255,7 @@ class IntegrationTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -265,25 +265,25 @@ class IntegrationTest < TestCase click(css: 'a[href="#system/integration/icinga"]') sleep 2 switch( - css: '.content.active .main .js-switch', + css: '.content.active .main .js-switch', type: 'on', ) set( - css: '.content.active .main input[name="icinga_sender"]', + css: '.content.active .main input[name="icinga_sender"]', value: 'some@othersender.com', ) select( - css: '.content.active .main select[name="icinga_auto_close"]', + css: '.content.active .main select[name="icinga_auto_close"]', value: 'no', ) click(css: '.content.active .main .js-submit') match( - css: '.content.active .main input[name="icinga_sender"]', + css: '.content.active .main input[name="icinga_sender"]', value: 'some@othersender.com', ) match( - css: '.content.active .main select[name="icinga_auto_close"]', + css: '.content.active .main select[name="icinga_auto_close"]', value: 'no', ) @@ -293,45 +293,45 @@ class IntegrationTest < TestCase click(css: 'a[href="#system/integration/icinga"]') match( - css: '.content.active .main input[name="icinga_sender"]', + css: '.content.active .main input[name="icinga_sender"]', value: 'some@othersender.com', ) match( - css: '.content.active .main select[name="icinga_auto_close"]', + css: '.content.active .main select[name="icinga_auto_close"]', value: 'no', ) reload() match( - css: '.content.active .main input[name="icinga_sender"]', + css: '.content.active .main input[name="icinga_sender"]', value: 'some@othersender.com', ) match( - css: '.content.active .main select[name="icinga_auto_close"]', + css: '.content.active .main select[name="icinga_auto_close"]', value: 'no', ) switch( - css: '.content.active .main .js-switch', + css: '.content.active .main .js-switch', type: 'off', ) set( - css: '.content.active .main input[name="icinga_sender"]', + css: '.content.active .main input[name="icinga_sender"]', value: 'icinga@monitoring.example.com', ) select( - css: '.content.active .main select[name="icinga_auto_close"]', + css: '.content.active .main select[name="icinga_auto_close"]', value: 'yes', ) click(css: '.content.active .main .js-submit') match( - css: '.content.active .main input[name="icinga_sender"]', + css: '.content.active .main input[name="icinga_sender"]', value: 'icinga@monitoring.example.com', ) match( - css: '.content.active .main select[name="icinga_auto_close"]', + css: '.content.active .main select[name="icinga_auto_close"]', value: 'yes', ) end diff --git a/test/browser/keyboard_shortcuts_test.rb b/test/browser/keyboard_shortcuts_test.rb index 365a649ea..21cac9db9 100644 --- a/test/browser/keyboard_shortcuts_test.rb +++ b/test/browser/keyboard_shortcuts_test.rb @@ -6,7 +6,7 @@ class KeyboardShortcutsTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() sleep 2 @@ -99,9 +99,9 @@ class KeyboardShortcutsTest < TestCase ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'Test Ticket for Shortcuts - ABC123', - body: 'Test Ticket Body for Shortcuts - ABC123', + group: 'Users', + title: 'Test Ticket for Shortcuts - ABC123', + body: 'Test Ticket Body for Shortcuts - ABC123', }, ) sleep 5 @@ -190,15 +190,15 @@ class KeyboardShortcutsTest < TestCase browser: @browser_agent, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) ticket2 = ticket_create( - browser: @browser_agent, - data: { + browser: @browser_agent, + data: { customer: 'nico', - group: 'Users', - title: 'Test Ticket for Shortcuts II - ABC123', - body: 'Test Ticket Body for Shortcuts II - ABC123', + group: 'Users', + title: 'Test Ticket for Shortcuts II - ABC123', + body: 'Test Ticket Body for Shortcuts II - ABC123', }, ) sleep 5 diff --git a/test/browser/maintenance_app_version_test.rb b/test/browser/maintenance_app_version_test.rb index 1cf5f703d..4dfd5e5ac 100644 --- a/test/browser/maintenance_app_version_test.rb +++ b/test/browser/maintenance_app_version_test.rb @@ -7,7 +7,7 @@ class MaintenanceAppVersionTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) sleep 8 @@ -18,7 +18,7 @@ class MaintenanceAppVersionTest < TestCase sleep 8 match_not( - css: 'body', + css: 'body', value: 'new version', ) @@ -28,7 +28,7 @@ class MaintenanceAppVersionTest < TestCase sleep 5 match( - css: 'body', + css: 'body', value: 'new version', ) end diff --git a/test/browser/maintenance_login_message_test.rb b/test/browser/maintenance_login_message_test.rb index ea7d8e1f3..e5906f250 100644 --- a/test/browser/maintenance_login_message_test.rb +++ b/test/browser/maintenance_login_message_test.rb @@ -5,31 +5,31 @@ class MaintenanceLoginMessageTest < TestCase def test_login_message browser1 = browser_instance login( - browser: browser1, + browser: browser1, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click( browser: browser1, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: browser1, - css: 'a[href="#system/maintenance"]', + css: 'a[href="#system/maintenance"]', ) string = rand(99_999_999_999_999_999).to_s message = "test #{string}" set( browser: browser1, - css: '.content.active .js-loginPreview [data-name="message"]', - value: message, + css: '.content.active .js-loginPreview [data-name="message"]', + value: message, ) click( browser: browser1, - css: '#global-search', + css: '#global-search', ) browser2 = browser_instance @@ -39,30 +39,30 @@ class MaintenanceLoginMessageTest < TestCase ) exists_not( browser: browser2, - css: '.js-maintenanceLogin', + css: '.js-maintenanceLogin', ) switch( browser: browser1, - css: '.content.active .js-loginSetting', - type: 'on', + css: '.content.active .js-loginSetting', + type: 'on', ) watch_for( browser: browser2, - css: '.js-maintenanceLogin', - value: message + css: '.js-maintenanceLogin', + value: message ) switch( browser: browser1, - css: '.content.active .js-loginSetting', - type: 'off', + css: '.content.active .js-loginSetting', + type: 'off', ) watch_for_disappear( browser: browser2, - css: '.js-maintenanceLogin', + css: '.js-maintenanceLogin', timeout: 30, ) end diff --git a/test/browser/maintenance_mode_test.rb b/test/browser/maintenance_mode_test.rb index 597b0a1e7..01b406b7f 100644 --- a/test/browser/maintenance_mode_test.rb +++ b/test/browser/maintenance_mode_test.rb @@ -5,10 +5,10 @@ class MaintenanceModeTest < TestCase def test_mode browser1 = browser_instance login( - browser: browser1, + browser: browser1, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) browser2 = browser_instance @@ -18,16 +18,16 @@ class MaintenanceModeTest < TestCase ) click( browser: browser1, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: browser1, - css: 'a[href="#system/maintenance"]', + css: 'a[href="#system/maintenance"]', ) exists_not( browser: browser2, - css: '.js-maintenanceMode', + css: '.js-maintenanceMode', ) switch( @@ -41,29 +41,29 @@ class MaintenanceModeTest < TestCase modal_ready(browser: browser1) click( browser: browser1, - css: '.content.active .modal .js-submit', + css: '.content.active .modal .js-submit', ) modal_disappear(browser: browser1) watch_for( browser: browser2, - css: '.js-maintenanceMode', + css: '.js-maintenanceMode', ) # try to logon with normal agent, should not work login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, - success: false, + url: browser_url, + success: false, ) login( - browser: browser2, + browser: browser2, username: 'nicole.braun@zammad.org', password: 'test', - url: browser_url, - success: false, + url: browser_url, + success: false, ) # logout with admin and logon again @@ -72,47 +72,47 @@ class MaintenanceModeTest < TestCase ) sleep 4 login( - browser: browser1, + browser: browser1, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click( browser: browser1, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: browser1, - css: 'a[href="#system/maintenance"]', + css: 'a[href="#system/maintenance"]', ) switch( browser: browser1, - css: '.content.active .js-modeSetting', - type: 'off', + css: '.content.active .js-modeSetting', + type: 'off', ) watch_for_disappear( browser: browser2, - css: '.js-maintenanceMode', + css: '.js-maintenanceMode', ) # try to logon with normal agent, should work again login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) logout( browser: browser2, ) sleep 4 login( - browser: browser2, + browser: browser2, username: 'nicole.braun@zammad.org', password: 'test', - url: browser_url, + url: browser_url, ) switch( @@ -126,28 +126,28 @@ class MaintenanceModeTest < TestCase modal_ready(browser: browser1) click( browser: browser1, - css: '.content.active .modal .js-submit', + css: '.content.active .modal .js-submit', ) modal_disappear(browser: browser1) watch_for( browser: browser2, - css: '#login', + css: '#login', ) watch_for( browser: browser2, - css: '.js-maintenanceMode', + css: '.js-maintenanceMode', ) switch( browser: browser1, - css: '.content.active .js-modeSetting', - type: 'off', + css: '.content.active .js-modeSetting', + type: 'off', ) watch_for_disappear( browser: browser2, - css: '.js-maintenanceMode', + css: '.js-maintenanceMode', ) end diff --git a/test/browser/maintenance_session_message_test.rb b/test/browser/maintenance_session_message_test.rb index 3c31cec86..3464db478 100644 --- a/test/browser/maintenance_session_message_test.rb +++ b/test/browser/maintenance_session_message_test.rb @@ -11,168 +11,168 @@ class MaintenanceSessionMessageTest < TestCase # check #1 browser1 = browser_instance login( - browser: browser1, + browser: browser1, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click( browser: browser1, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: browser1, - css: 'a[href="#system/maintenance"]', + css: 'a[href="#system/maintenance"]', ) set( browser: browser1, - css: '.content.active .js-Message input[name="head"]', - value: title_html, + css: '.content.active .js-Message input[name="head"]', + value: title_html, ) set( browser: browser1, - css: '.content.active .js-Message .js-textarea[data-name="message"]', - value: message_html, + css: '.content.active .js-Message .js-textarea[data-name="message"]', + value: message_html, ) click( browser: browser1, - css: '.content.active .js-Message button.js-submit', + css: '.content.active .js-Message button.js-submit', ) modal_ready(browser: browser2) watch_for( browser: browser2, - css: '.modal', - value: title_text, + css: '.modal', + value: title_text, ) watch_for( browser: browser2, - css: '.modal', - value: message_text, + css: '.modal', + value: message_text, ) match_not( browser: browser1, - css: 'body', - value: message_text, + css: 'body', + value: message_text, ) click( browser: browser2, - css: 'div.modal-header .js-close', + css: 'div.modal-header .js-close', ) modal_disappear(browser: browser2) # check #2 click( browser: browser1, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: browser1, - css: 'a[href="#system/maintenance"]', + css: 'a[href="#system/maintenance"]', ) set( browser: browser1, - css: '.content.active .js-Message input[name="head"]', - value: title_html + ' #2', + css: '.content.active .js-Message input[name="head"]', + value: title_html + ' #2', ) set( browser: browser1, - css: '.content.active .js-Message .js-textarea[data-name="message"]', - value: message_html + ' #2', + css: '.content.active .js-Message .js-textarea[data-name="message"]', + value: message_html + ' #2', ) click( browser: browser1, - css: '.content.active .js-Message button.js-submit', + css: '.content.active .js-Message button.js-submit', ) modal_ready(browser: browser2) watch_for( browser: browser2, - css: '.modal', - value: title_text + ' #2', + css: '.modal', + value: title_text + ' #2', ) watch_for( browser: browser2, - css: '.modal', - value: message_text + ' #2', + css: '.modal', + value: message_text + ' #2', ) match_not( browser: browser1, - css: 'body', - value: message_text, + css: 'body', + value: message_text, ) click( browser: browser2, - css: 'div.modal-header .js-close', + css: 'div.modal-header .js-close', ) modal_disappear(browser: browser2) # check #3 click( browser: browser1, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: browser1, - css: 'a[href="#system/maintenance"]', + css: 'a[href="#system/maintenance"]', ) set( browser: browser1, - css: '.content.active .js-Message input[name="head"]', - value: title_html + ' #3', + css: '.content.active .js-Message input[name="head"]', + value: title_html + ' #3', ) set( browser: browser1, - css: '.content.active .js-Message .js-textarea[data-name="message"]', - value: message_html + ' #3', + css: '.content.active .js-Message .js-textarea[data-name="message"]', + value: message_html + ' #3', ) click( browser: browser1, - css: '.content.active .js-Message input[name="reload"] + .icon-checkbox.icon-unchecked', + css: '.content.active .js-Message input[name="reload"] + .icon-checkbox.icon-unchecked', ) click( browser: browser1, - css: '.content.active .js-Message button.js-submit', + css: '.content.active .js-Message button.js-submit', ) modal_ready(browser: browser2) watch_for( browser: browser2, - css: '.modal', - value: title_text + ' #3', + css: '.modal', + value: title_text + ' #3', ) watch_for( browser: browser2, - css: '.modal', - value: message_text + ' #3', + css: '.modal', + value: message_text + ' #3', ) watch_for( browser: browser2, - css: '.modal', - value: 'Continue session', + css: '.modal', + value: 'Continue session', ) match_not( browser: browser1, - css: 'body', - value: message_text, + css: 'body', + value: message_text, ) end diff --git a/test/browser/manage_test.rb b/test/browser/manage_test.rb index 75c82f3e5..8be1f0d3c 100644 --- a/test/browser/manage_test.rb +++ b/test/browser/manage_test.rb @@ -10,7 +10,7 @@ class ManageTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#manage"]') @@ -18,11 +18,11 @@ class ManageTest < TestCase user_create( data: { - login: "some login#{random}", + login: "some login#{random}", firstname: "Manage Firstname#{random}", - lastname: "Manage Lastname#{random}", - email: user_email, - password: 'some-pass', + lastname: "Manage Lastname#{random}", + email: user_email, + password: 'some-pass', } ) @@ -30,26 +30,26 @@ class ManageTest < TestCase modal_ready() set( - css: '.modal input[name="lastname"]', + css: '.modal input[name="lastname"]', value: "2Manage Lastname#{random}", ) click(css: '.modal button.js-submit') modal_disappear() watch_for( - css: 'body', + css: 'body', value: "2Manage Lastname#{random}", ) # sla sla_create( data: { - name: "some sla#{random}", + name: "some sla#{random}", first_response_time_in_text: '1:01' } ) watch_for( - css: 'body', + css: 'body', value: random, ) sleep 1 @@ -58,18 +58,18 @@ class ManageTest < TestCase modal_ready() set( - css: '.modal input[name=name]', + css: '.modal input[name=name]', value: "some sla update #{random}", ) set( - css: '.modal input[name="first_response_time_in_text"]', + css: '.modal input[name="first_response_time_in_text"]', value: '2:01', ) click(css: '.modal button.js-submit') modal_disappear() watch_for( - css: 'body', + css: 'body', value: "some sla update #{random}", ) sleep 4 @@ -80,7 +80,7 @@ class ManageTest < TestCase click(css: '.modal button.js-submit') sleep 4 match_not( - css: 'body', + css: 'body', value: "some sla update #{random}", ) @@ -88,7 +88,7 @@ class ManageTest < TestCase click(css: 'a[href="#manage/slas"]') sleep 2 match_not( - css: 'body', + css: 'body', value: "some sla update #{random}", ) @@ -99,7 +99,7 @@ class ManageTest < TestCase click(css: 'a[href="#manage/slas"]') sleep 2 match_not( - css: 'body', + css: 'body', value: "some sla update #{random}", ) end diff --git a/test/browser/monitoring_test.rb b/test/browser/monitoring_test.rb index 47cf9e80e..e346e05be 100644 --- a/test/browser/monitoring_test.rb +++ b/test/browser/monitoring_test.rb @@ -5,18 +5,18 @@ class MonitoringTest < TestCase def test_mode browser1 = browser_instance login( - browser: browser1, + browser: browser1, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click( browser: browser1, - css: 'a[href="#manage"]', + css: 'a[href="#manage"]', ) click( browser: browser1, - css: 'a[href="#system/monitoring"]', + css: 'a[href="#system/monitoring"]', ) token = browser1.find_elements(css: '.active.content .js-token')[0].attribute('value') @@ -26,7 +26,7 @@ class MonitoringTest < TestCase click( browser: browser1, - css: '.active.content .js-resetToken', + css: '.active.content .js-resetToken', ) sleep 3 diff --git a/test/browser/preferences_language_test.rb b/test/browser/preferences_language_test.rb index 8f836a8ed..9b85ebb0b 100644 --- a/test/browser/preferences_language_test.rb +++ b/test/browser/preferences_language_test.rb @@ -7,17 +7,17 @@ class PreferencesLanguageTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() # start ticket create ticket_create( - data: { + data: { customer: 'nicole', - group: 'Users', - title: 'preferences lang check #1', - body: 'preferences lang check #1', + group: 'Users', + title: 'preferences lang check #1', + body: 'preferences lang check #1', }, do_not_submit: true, ) @@ -26,9 +26,9 @@ class PreferencesLanguageTest < TestCase ticket_create( data: { customer: 'nicole', - group: 'Users', - title: 'preferences lang check #2', - body: 'preferences lang check #2', + group: 'Users', + title: 'preferences lang check #2', + body: 'preferences lang check #2', }, ) @@ -46,32 +46,32 @@ class PreferencesLanguageTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/language"]') select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'Deutsch', ) click(css: '.content.active button[type="submit"]') watch_for( - css: 'body', + css: 'body', value: 'Sprache', ) # check language in navbar watch_for( - css: '.js-menu', + css: '.js-menu', value: 'Übersicht' ) # check language in dashboard click(css: '.js-menu a[href="#dashboard"]') watch_for( - css: '.content.active', + css: '.content.active', value: 'Meine Statistik' ) # check language in overview click(css: '.js-menu a[href="#ticket/view"]') watch_for( - css: '.content.active', + css: '.content.active', value: 'Meine' ) verify_title( @@ -95,15 +95,15 @@ class PreferencesLanguageTest < TestCase } ) watch_for( - css: '.content.active', + css: '.content.active', value: 'kunde' ) watch_for( - css: '.content.active', + css: '.content.active', value: 'priorität' ) watch_for( - css: '.content.active [data-name="body"]', + css: '.content.active [data-name="body"]', value: 'preferences lang check #1' ) verify_title( @@ -117,11 +117,11 @@ class PreferencesLanguageTest < TestCase } ) watch_for( - css: '.content.active', + css: '.content.active', value: 'erstellt' ) watch_for( - css: '.content.active', + css: '.content.active', value: 'priorität' ) @@ -132,15 +132,15 @@ class PreferencesLanguageTest < TestCase } ) watch_for( - css: '.content.active', + css: '.content.active', value: 'notiz' ) watch_for( - css: '.content.active', + css: '.content.active', value: 'e-mail' ) watch_for( - css: '.content.active', + css: '.content.active', value: 'aktion' ) @@ -151,7 +151,7 @@ class PreferencesLanguageTest < TestCase } ) watch_for( - css: '.content.active', + css: '.content.active', value: 'notiz' ) @@ -159,33 +159,33 @@ class PreferencesLanguageTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/language"]') select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'English (United States)', ) click(css: '.content.active button[type="submit"]') sleep 2 watch_for( - css: 'body', + css: 'body', value: 'Language', ) # check language in navbar watch_for( - css: '.js-menu', + css: '.js-menu', value: 'Overview' ) # check language in dashboard click(css: '.js-menu a[href="#dashboard"]') watch_for( - css: '.content.active', + css: '.content.active', value: 'My Stats' ) # check language in overview click(css: '.js-menu a[href="#ticket/view"]') watch_for( - css: '.content.active', + css: '.content.active', value: 'My' ) verify_title( @@ -209,15 +209,15 @@ class PreferencesLanguageTest < TestCase } ) watch_for( - css: '.content.active', + css: '.content.active', value: 'customer' ) watch_for( - css: '.content.active', + css: '.content.active', value: 'priority' ) watch_for( - css: '.content.active [data-name="body"]', + css: '.content.active [data-name="body"]', value: 'preferences lang check #1' ) verify_title( @@ -231,11 +231,11 @@ class PreferencesLanguageTest < TestCase } ) watch_for( - css: '.content.active', + css: '.content.active', value: 'create' ) watch_for( - css: '.content.active', + css: '.content.active', value: 'priority' ) @@ -246,11 +246,11 @@ class PreferencesLanguageTest < TestCase } ) watch_for( - css: '.content.active', + css: '.content.active', value: 'note' ) watch_for( - css: '.content.active', + css: '.content.active', value: 'email' ) @@ -261,11 +261,11 @@ class PreferencesLanguageTest < TestCase } ) watch_for( - css: '.content.active', + css: '.content.active', value: 'note' ) watch_for( - css: '.content.active', + css: '.content.active', value: 'action' ) @@ -275,13 +275,13 @@ class PreferencesLanguageTest < TestCase click(css: 'a[href="#profile/language"]') sleep 4 select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'Deutsch', ) click(css: '.content.active button[type="submit"]') sleep 4 watch_for( - css: 'body', + css: 'body', value: 'Sprache', ) sleep 6 @@ -291,27 +291,27 @@ class PreferencesLanguageTest < TestCase sleep 2 watch_for( - css: 'body', + css: 'body', value: 'Sprache', ) # check language in navbar watch_for( - css: '.js-menu', + css: '.js-menu', value: 'Übersicht' ) # check language in dashboard click(css: '.js-menu a[href="#dashboard"]') watch_for( - css: '.content.active', + css: '.content.active', value: 'Meine Statistik' ) # check language in overview click(css: '.js-menu a[href="#ticket/view"]') watch_for( - css: '.content.active', + css: '.content.active', value: 'Meine' ) @@ -320,13 +320,13 @@ class PreferencesLanguageTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/language"]') select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'English (United States)', ) click(css: '.content.active button[type="submit"]') sleep 2 watch_for( - css: 'body', + css: 'body', value: 'Language', ) diff --git a/test/browser/preferences_permission_check_test.rb b/test/browser/preferences_permission_check_test.rb index 2e141ba4f..aada38143 100644 --- a/test/browser/preferences_permission_check_test.rb +++ b/test/browser/preferences_permission_check_test.rb @@ -7,28 +7,28 @@ class PreferencesPermissionCheckTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#current_user"]') click(css: 'a[href="#profile"]') match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Password', ) match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Language', ) match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Notifications', ) match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Calendar', ) match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Token Access', ) end @@ -38,28 +38,28 @@ class PreferencesPermissionCheckTest < TestCase login( username: 'nicole.braun@zammad.org', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#current_user"]') click(css: 'a[href="#profile"]') match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Password', ) match( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Language', ) match_not( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Notifications', ) match_not( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Calendar', ) match_not( - css: '.content .NavBarProfile', + css: '.content .NavBarProfile', value: 'Token Access', ) end diff --git a/test/browser/preferences_token_access_test.rb b/test/browser/preferences_token_access_test.rb index cc8640584..64b716e17 100644 --- a/test/browser/preferences_token_access_test.rb +++ b/test/browser/preferences_token_access_test.rb @@ -7,7 +7,7 @@ class PreferencesTokenAccessTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() click(css: 'a[href="#current_user"]') @@ -29,18 +29,18 @@ class PreferencesTokenAccessTest < TestCase click(css: '.content.active .modal input[value="ticket.agent"] ~ .label-text') click(css: '.content.active .modal .js-submit') watch_for( - css: '.modal .modal-title', + css: '.modal .modal-title', value: 'Your New Personal Access Token' ) click(css: '.modal .js-submit') modal_disappear() watch_for( - css: '.content.active .js-tokenList', + css: '.content.active .js-tokenList', value: 'Some App#1' ) watch_for( - css: '.content.active .js-tokenList', + css: '.content.active .js-tokenList', value: '05/15/2022' ) @@ -55,14 +55,14 @@ class PreferencesTokenAccessTest < TestCase click(css: '.content.active .modal .js-submit') watch_for( - css: '.modal .modal-title', + css: '.modal .modal-title', value: 'Your New Personal Access Token' ) click(css: '.modal .js-submit') modal_disappear() watch_for( - css: '.content.active .js-tokenList', + css: '.content.active .js-tokenList', value: 'Some App#2' ) @@ -70,7 +70,7 @@ class PreferencesTokenAccessTest < TestCase modal_ready() watch_for( - css: '.content.active .modal .modal-header', + css: '.content.active .modal .modal-header', value: 'confirm', ) click( @@ -78,7 +78,7 @@ class PreferencesTokenAccessTest < TestCase ) modal_disappear() watch_for_disappear( - css: '.content.active .js-tokenList', + css: '.content.active .js-tokenList', value: 'Some App#2' ) diff --git a/test/browser/reporting_test.rb b/test/browser/reporting_test.rb index a455718d2..3c9adf121 100644 --- a/test/browser/reporting_test.rb +++ b/test/browser/reporting_test.rb @@ -7,19 +7,19 @@ class ReportingTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() report_profile_create( data: { - name: 'active_report_profile', + name: 'active_report_profile', active: true, } ) report_profile_create( data: { - name: 'inactive_report_profile', + name: 'inactive_report_profile', active: false, } ) diff --git a/test/browser/setting_test.rb b/test/browser/setting_test.rb index f22aeaa66..6b710ed93 100644 --- a/test/browser/setting_test.rb +++ b/test/browser/setting_test.rb @@ -6,7 +6,7 @@ class SettingTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -15,7 +15,7 @@ class SettingTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/language"]') select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'English (United States)', ) click(css: '.content.active button[type="submit"]') @@ -27,53 +27,53 @@ class SettingTest < TestCase click(css: 'a[href="#third_party_auth"]') sleep 2 switch( - css: '.content.active .js-setting[data-name="auth_facebook"]', + css: '.content.active .js-setting[data-name="auth_facebook"]', type: 'off', ) browser2 = browser_instance location( browser: browser2, - url: browser_url, + url: browser_url, ) watch_for( browser: browser2, - css: 'body', - value: 'login', + css: 'body', + value: 'login', ) match_not( browser: browser2, - css: 'body', - value: 'facebook', + css: 'body', + value: 'facebook', ) # set yes switch( - css: '.content.active .js-setting[data-name="auth_facebook"]', + css: '.content.active .js-setting[data-name="auth_facebook"]', type: 'on', ) # set key and secret set( - css: '[data-name="auth_facebook_credentials"] input[name=app_id]', + css: '[data-name="auth_facebook_credentials"] input[name=app_id]', value: 'id_test1234äöüß', ) set( - css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', + css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', value: 'secret_test1234äöüß', ) click( css: '[data-name="auth_facebook_credentials"] button[type=submit]') watch_for( - css: '#notify', + css: '#notify', value: 'update successful', ) sleep 4 match( - css: '[data-name="auth_facebook_credentials"] input[name=app_id]', + css: '[data-name="auth_facebook_credentials"] input[name=app_id]', value: 'id_test1234äöüß', ) match( - css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', + css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', value: 'secret_test1234äöüß', ) @@ -81,31 +81,31 @@ class SettingTest < TestCase sleep 2 watch_for( browser: browser2, - css: 'body', - value: 'facebook', + css: 'body', + value: 'facebook', ) # set key and secret again set( - css: '[data-name="auth_facebook_credentials"] input[name=app_id]', + css: '[data-name="auth_facebook_credentials"] input[name=app_id]', value: '---', ) set( - css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', + css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', value: '---', ) click(css: '[data-name="auth_facebook_credentials"] button[type=submit]') watch_for( - css: '#notify', + css: '#notify', value: 'update successful', ) sleep 4 match( - css: '[data-name="auth_facebook_credentials"] input[name=app_id]', + css: '[data-name="auth_facebook_credentials"] input[name=app_id]', value: '---', ) match( - css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', + css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', value: '---', ) @@ -114,29 +114,29 @@ class SettingTest < TestCase click(css: 'a[href="#settings/security"]') click(css: 'a[href="#third_party_auth"]') watch_for( - css: '[data-name="auth_facebook_credentials"] input[name=app_id]', + css: '[data-name="auth_facebook_credentials"] input[name=app_id]', value: '---', ) watch_for( - css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', + css: '[data-name="auth_facebook_credentials"] input[name=app_secret]', value: '---', ) sleep 2 switch( - css: '.content.active .js-setting[data-name="auth_facebook"]', + css: '.content.active .js-setting[data-name="auth_facebook"]', type: 'off', ) sleep 2 watch_for( browser: browser2, - css: 'body', - value: 'login', + css: 'body', + value: 'login', ) match_not( browser: browser2, - css: 'body', - value: 'facebook', + css: 'body', + value: 'facebook', ) end @@ -145,7 +145,7 @@ class SettingTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -154,7 +154,7 @@ class SettingTest < TestCase click(css: 'a[href="#manage"]') click(css: '.content.active a[href="#settings/branding"]') set( - css: '.content.active [name="product_name"]', + css: '.content.active [name="product_name"]', value: 'ABC App', ) click(css: '.content.active #product_name button[type=submit]') @@ -162,7 +162,7 @@ class SettingTest < TestCase sleep 2 verify_title(value: 'ABC App') set( - css: '.content.active [name="product_name"]', + css: '.content.active [name="product_name"]', value: 'Zammad Test System', ) click(css: '.content.active #product_name button[type=submit]') diff --git a/test/browser/signup_password_change_and_reset_test.rb b/test/browser/signup_password_change_and_reset_test.rb index 8545d5def..dd2d316e7 100644 --- a/test/browser/signup_password_change_and_reset_test.rb +++ b/test/browser/signup_password_change_and_reset_test.rb @@ -10,42 +10,42 @@ class SignupPasswordChangeAndResetTest < TestCase # signup set( - css: 'input[name="firstname"]', + css: 'input[name="firstname"]', value: 'Signup Firstname', ) set( - css: 'input[name="lastname"]', + css: 'input[name="lastname"]', value: 'Signup Lastname', ) set( - css: 'input[name="email"]', + css: 'input[name="email"]', value: signup_user_email, ) set( - css: 'input[name="password"]', + css: 'input[name="password"]', value: 'some-pass', ) set( - css: 'input[name="password_confirm"]', + css: 'input[name="password_confirm"]', value: 'some-pass', ) click(css: 'button.js-submit') watch_for_disappear( - css: '.signup', + css: '.signup', timeout: 10, ) match( - css: '.user-menu .user a', - value: signup_user_email, + css: '.user-menu .user a', + value: signup_user_email, attribute: 'title', ) # check email verify location(url: "#{browser_url}#email_verify/not_existing") watch_for( - css: '#content', + css: '#content', value: 'Unable to verify email', ) logout() @@ -53,10 +53,10 @@ class SignupPasswordChangeAndResetTest < TestCase login( username: signup_user_email, password: 'some-pass', - url: "#{browser_url}#email_verify/not_existing2", + url: "#{browser_url}#email_verify/not_existing2", ) watch_for( - css: '#content', + css: '#content', value: 'Unable to verify email', ) execute( @@ -77,7 +77,7 @@ class SignupPasswordChangeAndResetTest < TestCase password: 'some-pass', ) watch_for( - css: '#content', + css: '#content', value: 'Your email address has been verified', ) modal_disappear() @@ -89,80 +89,80 @@ class SignupPasswordChangeAndResetTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/password"]') set( - css: 'input[name="password_old"]', + css: 'input[name="password_old"]', value: 'nonexisiting', ) set( - css: 'input[name="password_new"]', + css: 'input[name="password_new"]', value: 'some', ) set( - css: 'input[name="password_new_confirm"]', + css: 'input[name="password_new_confirm"]', value: 'some', ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'current password is wrong', ) set( - css: 'input[name="password_old"]', + css: 'input[name="password_old"]', value: 'some-pass', ) set( - css: 'input[name="password_new_confirm"]', + css: 'input[name="password_new_confirm"]', value: 'some2', ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'passwords do not match', ) set( - css: 'input[name="password_new"]', + css: 'input[name="password_new"]', value: 'some', ) set( - css: 'input[name="password_new_confirm"]', + css: 'input[name="password_new_confirm"]', value: 'some', ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'it must be at least', ) set( - css: 'input[name="password_new"]', + css: 'input[name="password_new"]', value: 'some-pass-new', ) set( - css: 'input[name="password_new_confirm"]', + css: 'input[name="password_new_confirm"]', value: 'some-pass-new', ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'must contain at least 1 digit', ) set( - css: 'input[name="password_new"]', + css: 'input[name="password_new"]', value: 'some-pass-new2', ) set( - css: 'input[name="password_new_confirm"]', + css: 'input[name="password_new_confirm"]', value: 'some-pass-new2', ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'Password changed successfully', ) logout() @@ -178,7 +178,7 @@ class SignupPasswordChangeAndResetTest < TestCase location(url: browser_url + '/#password_reset_verify/not_existing_token') watch_for( - css: 'body', + css: 'body', value: 'Token is invalid', ) @@ -186,14 +186,14 @@ class SignupPasswordChangeAndResetTest < TestCase login( username: signup_user_email, password: 'some-pass-new2', - url: browser_url, + url: browser_url, ) location(url: browser_url + '/#password_reset') sleep 1 match_not( - css: 'body', + css: 'body', value: 'password', ) logout() @@ -202,93 +202,93 @@ class SignupPasswordChangeAndResetTest < TestCase click(css: 'a[href="#password_reset"]') set( - css: 'input[name="username"]', + css: 'input[name="username"]', value: 'nonexisiting', ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'address invalid', ) set( - css: 'input[name="username"]', + css: 'input[name="username"]', value: signup_user_email, ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'sent password reset instructions', ) # redirect to "#password_reset_verify/#{token}" url by app, because of "developer_mode" watch_for( - css: 'body', + css: 'body', value: 'Choose your new password', ) # set new password set( - css: 'input[name="password"]', + css: 'input[name="password"]', value: 'some', ) set( - css: 'input[name="password_confirm"]', + css: 'input[name="password_confirm"]', value: 'some2', ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'passwords do not match', ) set( - css: 'input[name="password"]', + css: 'input[name="password"]', value: 'some', ) set( - css: 'input[name="password_confirm"]', + css: 'input[name="password_confirm"]', value: 'some', ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'it must be at least', ) set( - css: 'input[name="password"]', + css: 'input[name="password"]', value: 'some-pass-new', ) set( - css: 'input[name="password_confirm"]', + css: 'input[name="password_confirm"]', value: 'some-pass-new', ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'must contain at least 1 digit', ) set( - css: 'input[name="password"]', + css: 'input[name="password"]', value: 'some-pass-new2', ) set( - css: 'input[name="password_confirm"]', + css: 'input[name="password_confirm"]', value: 'some-pass-new2', ) click(css: '.content .btn--primary') watch_for( - css: 'body', + css: 'body', value: 'Your password has been changed', ) # check if user is logged in sleep 5 match( - css: '.user-menu .user a', - value: signup_user_email, + css: '.user-menu .user a', + value: signup_user_email, attribute: 'title', ) diff --git a/test/browser/switch_to_user_test.rb b/test/browser/switch_to_user_test.rb index 9f7e74bf6..e47792b06 100644 --- a/test/browser/switch_to_user_test.rb +++ b/test/browser/switch_to_user_test.rb @@ -28,11 +28,11 @@ class SwitchToUserTest < TestCase sleep 3 watch_for( - css: '.switchBackToUser', + css: '.switchBackToUser', value: 'zammad looks like', ) watch_for( - css: '.switchBackToUser', + css: '.switchBackToUser', value: 'Nicole', ) login = @browser.find_elements({ css: '.user-menu .user a' })[0].attribute('title') diff --git a/test/browser/taskbar_session_test.rb b/test/browser/taskbar_session_test.rb index 6a15df149..efecedff3 100644 --- a/test/browser/taskbar_session_test.rb +++ b/test/browser/taskbar_session_test.rb @@ -6,31 +6,31 @@ class TaskbarSessionTest < TestCase # check taken over session block screen with same user browser1 = browser_instance login( - browser: browser1, + browser: browser1, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) sleep 8 match( browser: browser1, - css: 'body', - value: 'Continue session', + css: 'body', + value: 'Continue session', ) match_not( browser: browser2, - css: 'body', - value: 'Continue session', + css: 'body', + value: 'Continue session', ) end @@ -40,31 +40,31 @@ class TaskbarSessionTest < TestCase # check taken over session block screen with same user browser1 = browser_instance login( - browser: browser1, + browser: browser1, username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) browser2 = browser_instance login( - browser: browser2, + browser: browser2, username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) sleep 8 match_not( browser: browser1, - css: 'body', - value: 'Continue session', + css: 'body', + value: 'Continue session', ) match_not( browser: browser2, - css: 'body', - value: 'Continue session', + css: 'body', + value: 'Continue session', ) end diff --git a/test/browser/taskbar_task_test.rb b/test/browser/taskbar_task_test.rb index 49da08cd4..225764983 100644 --- a/test/browser/taskbar_task_test.rb +++ b/test/browser/taskbar_task_test.rb @@ -6,7 +6,7 @@ class TaskbarTaskTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -14,7 +14,7 @@ class TaskbarTaskTest < TestCase click(css: 'a[href="#new"]', only_if_exists: true) click(css: 'a[href="#ticket/create"]', wait: 0.8) set( - css: '.active .newTicket input[name="title"]', + css: '.active .newTicket input[name="title"]', value: 'some test AAA', ) sleep 4 @@ -25,7 +25,7 @@ class TaskbarTaskTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) sleep 3 @@ -33,7 +33,7 @@ class TaskbarTaskTest < TestCase click(css: '.task', wait: 0.8) match( - css: '.active .newTicket input[name="title"]', + css: '.active .newTicket input[name="title"]', value: 'some test AAA', ) @@ -47,18 +47,18 @@ class TaskbarTaskTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() click(css: 'a[href="#new"]', only_if_exists: true) click(css: 'a[href="#ticket/create"]', wait: 0.8) set( - css: '.active .newTicket input[name="title"]', + css: '.active .newTicket input[name="title"]', value: 'INBOUND TEST#1', ) set( - css: '.active .newTicket [data-name="body"]', + css: '.active .newTicket [data-name="body"]', value: 'INBOUND BODY TEST#1', ) sleep 2 @@ -66,11 +66,11 @@ class TaskbarTaskTest < TestCase click(css: 'a[href="#new"]', only_if_exists: true) click(css: 'a[href="#ticket/create"]', wait: 0.8) set( - css: '.active .newTicket input[name="title"]', + css: '.active .newTicket input[name="title"]', value: 'OUTBOUND TEST#1', ) set( - css: '.active .newTicket [data-name="body"]', + css: '.active .newTicket [data-name="body"]', value: 'OUTBOUND BODY TEST#1', ) sleep 3 @@ -82,27 +82,27 @@ class TaskbarTaskTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) sleep 3 match_not( - css: 'body', + css: 'body', value: 'INBOUND TEST#1', ) match_not( - css: 'body', + css: 'body', value: 'OUTBOUND TEST#1', ) logout() sleep 2 match_not( - css: 'body', + css: 'body', value: 'INBOUND TEST#1', ) match_not( - css: 'body', + css: 'body', value: 'OUTBOUND TEST#1', ) @@ -110,16 +110,16 @@ class TaskbarTaskTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) sleep 3 match( - css: 'body', + css: 'body', value: 'INBOUND TEST#1', ) match( - css: 'body', + css: 'body', value: 'OUTBOUND TEST#1', ) end diff --git a/test/browser/translation_test.rb b/test/browser/translation_test.rb index 5a11bd0b2..543b7b36f 100644 --- a/test/browser/translation_test.rb +++ b/test/browser/translation_test.rb @@ -7,7 +7,7 @@ class TranslationTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -15,13 +15,13 @@ class TranslationTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/language"]') select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'English (United States)', ) click(css: '.content.active button[type="submit"]') sleep 2 watch_for( - css: 'body', + css: 'body', value: 'Language', ) @@ -29,7 +29,7 @@ class TranslationTest < TestCase click(css: 'a[href="#system/translation"]') watch_for( - css: '.content.active', + css: '.content.active', value: 'English is the source language, so we have nothing to translate', ) @@ -37,12 +37,12 @@ class TranslationTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/language"]') select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'Deutsch', ) click(css: '.content.active button[type="submit"]') watch_for( - css: 'body', + css: 'body', value: 'Sprache', ) @@ -51,7 +51,7 @@ class TranslationTest < TestCase notify_close(optional: true) # to be not in click area set( - css: '.content.active input.js-Item[data-source="Translations"]', + css: '.content.active input.js-Item[data-source="Translations"]', value: 'Übersetzung2', ) sleep 5 # wait until nofify is gone @@ -65,11 +65,11 @@ class TranslationTest < TestCase click(css: 'a[href="#system/translation"]') match( - css: '.content.active .sidebar', + css: '.content.active .sidebar', value: 'Übersetzung2', ) match( - css: '.content.active input.js-Item[data-source="Translations"]', + css: '.content.active input.js-Item[data-source="Translations"]', value: 'Übersetzung2', ) @@ -79,11 +79,11 @@ class TranslationTest < TestCase sleep 5 match( - css: '.content.active .sidebar', + css: '.content.active .sidebar', value: 'Übersetzung2', ) match_not( - css: '.content.active input.js-Item[data-source="Translations"]', + css: '.content.active input.js-Item[data-source="Translations"]', value: 'Übersetzung2', ) @@ -95,15 +95,15 @@ class TranslationTest < TestCase sleep 2 match_not( - css: '.content.active .sidebar', + css: '.content.active .sidebar', value: 'Übersetzung2', ) match_not( - css: '.content.active input.js-Item[data-source="Translations"]', + css: '.content.active input.js-Item[data-source="Translations"]', value: 'Übersetzung2', ) match_not( - css: '.content.active .sidebar', + css: '.content.active .sidebar', value: 'Übersetzung2', ) @@ -115,11 +115,11 @@ class TranslationTest < TestCase .perform watch_for( - css: 'span.translation[title="Overviews"]', + css: 'span.translation[title="Overviews"]', value: 'Übersichten', ) set( - css: 'span.translation[title="Overviews"]', + css: 'span.translation[title="Overviews"]', value: 'Übersichten123', ) sleep 1 @@ -138,7 +138,7 @@ class TranslationTest < TestCase css: 'span.translation[title="Overviews"]', ) match( - css: '.js-menu', + css: '.js-menu', value: 'Übersichten123', ) @@ -147,7 +147,7 @@ class TranslationTest < TestCase css: 'span.translation[title="Overviews"]', ) match( - css: '.js-menu', + css: '.js-menu', value: 'Übersichten123', ) @@ -156,7 +156,7 @@ class TranslationTest < TestCase sleep 4 match( - css: '.content.active input.js-Item[data-source="Overviews"]', + css: '.content.active input.js-Item[data-source="Overviews"]', value: 'Übersichten123', ) @@ -169,11 +169,11 @@ class TranslationTest < TestCase sleep 5 match_not( - css: '.js-menu', + css: '.js-menu', value: 'Übersichten123', ) match( - css: '.js-menu', + css: '.js-menu', value: 'Übersichten', ) @@ -181,13 +181,13 @@ class TranslationTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/language"]') select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'English (United States)', ) click(css: '.content.active button[type="submit"]') sleep 2 watch_for( - css: 'body', + css: 'body', value: 'Language', ) sleep 5 @@ -200,11 +200,11 @@ class TranslationTest < TestCase .perform watch_for( - css: 'span.translation[title="Overviews"]', + css: 'span.translation[title="Overviews"]', value: 'Overviews', ) set( - css: 'span.translation[title="Overviews"]', + css: 'span.translation[title="Overviews"]', value: 'Overviews123', ) sleep 1 @@ -223,7 +223,7 @@ class TranslationTest < TestCase css: 'span.translation[title="Overviews"]', ) match( - css: '.js-menu', + css: '.js-menu', value: 'Overviews123', ) @@ -232,11 +232,11 @@ class TranslationTest < TestCase sleep 4 match( - css: '.content.active input.js-Item[data-source="Overviews"]', + css: '.content.active input.js-Item[data-source="Overviews"]', value: 'Overviews123', ) match_not( - css: '.content.active', + css: '.content.active', value: 'English is the source language, so we have nothing to translate', ) @@ -245,7 +245,7 @@ class TranslationTest < TestCase ) watch_for( - css: '.content.active', + css: '.content.active', value: 'English is the source language, so we have nothing to translate', ) @@ -256,7 +256,7 @@ class TranslationTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -264,12 +264,12 @@ class TranslationTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/language"]') select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'Deutsch', ) click(css: '.content.active button[type="submit"]') watch_for( - css: 'body', + css: 'body', value: 'Sprache', ) @@ -277,7 +277,7 @@ class TranslationTest < TestCase click(css: 'a[href="#system/translation"]') watch_for( - css: '.content.active', + css: '.content.active', value: 'Inline Übersetzung', ) @@ -285,7 +285,7 @@ class TranslationTest < TestCase modal_ready() watch_for( - css: '.content.active .modal', + css: '.content.active .modal', value: 'Letzte Übersetzung laden', ) modal_disappear( @@ -296,12 +296,12 @@ class TranslationTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/language"]') select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'English (United States)', ) click(css: '.content.active button[type="submit"]') watch_for( - css: 'body', + css: 'body', value: 'Language', ) @@ -323,7 +323,7 @@ class TranslationTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -331,12 +331,12 @@ class TranslationTest < TestCase click(css: 'a[href="#profile"]') click(css: 'a[href="#profile/language"]') select( - css: '.language_item [name="locale"]', + css: '.language_item [name="locale"]', value: 'Deutsch', ) click(css: '.content.active button[type="submit"]') watch_for( - css: 'body', + css: 'body', value: 'Sprache', ) @@ -350,7 +350,7 @@ class TranslationTest < TestCase click(css: 'a[href="#system/translation"]') watch_for( - css: '.content.active', + css: '.content.active', value: 'Inline Übersetzung', ) @@ -362,8 +362,8 @@ class TranslationTest < TestCase click(css: 'a[href="#manage"]') watch_for( - css: %(td[title="#{new_ui_phrase}"]), - value: new_ui_phrase, + css: %(td[title="#{new_ui_phrase}"]), + value: new_ui_phrase, timeout: 3 ) diff --git a/test/browser/user_access_permissions_test.rb b/test/browser/user_access_permissions_test.rb index 605ca3177..f3c115048 100644 --- a/test/browser/user_access_permissions_test.rb +++ b/test/browser/user_access_permissions_test.rb @@ -6,7 +6,7 @@ class AgentProfilePermissionsTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -19,17 +19,17 @@ class AgentProfilePermissionsTest < TestCase ) watch_for( - css: '.content.active .profile-window', + css: '.content.active .profile-window', value: 'note', ) watch_for( - css: '.content.active .profile-window', + css: '.content.active .profile-window', value: 'email', ) set( - css: '.content.active [data-name="note"]', + css: '.content.active [data-name="note"]', value: 'some note 123', ) empty_search() @@ -40,23 +40,23 @@ class AgentProfilePermissionsTest < TestCase modal_ready() watch_for( - css: '.content.active .modal', + css: '.content.active .modal', value: 'some note 123', ) set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'B2', ) set( - css: '.modal [data-name="note"]', + css: '.modal [data-name="note"]', value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') modal_disappear() watch_for( - css: '.content.active .profile-window', + css: '.content.active .profile-window', value: 'some note abc', ) @@ -72,7 +72,7 @@ class AgentProfilePermissionsTest < TestCase modal_ready() set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'Braun', ) click(css: '.content.active .modal button.js-submit') @@ -90,7 +90,7 @@ class AgentProfilePermissionsTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -103,11 +103,11 @@ class AgentProfilePermissionsTest < TestCase ) watch_for( - css: '.content.active .profile-window', + css: '.content.active .profile-window', value: 'note', ) watch_for( - css: '.content.active .profile-window', + css: '.content.active .profile-window', value: 'email', ) @@ -123,7 +123,7 @@ class AgentProfilePermissionsTest < TestCase login( username: 'master@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -143,7 +143,7 @@ class AgentProfilePermissionsTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -152,7 +152,7 @@ class AgentProfilePermissionsTest < TestCase ) watch_for( - css: '.content.active .tabsSidebar-holder', + css: '.content.active .tabsSidebar-holder', value: ticket1[:title], ) @@ -167,7 +167,7 @@ class AgentProfilePermissionsTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -189,23 +189,23 @@ class AgentProfilePermissionsTest < TestCase modal_ready() set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'B2', ) set( - css: '.modal [data-name="note"]', + css: '.modal [data-name="note"]', value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') modal_disappear() watch_for( - css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]', + css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]', value: 'some note abc', ) watch_for( - css: '.content.active .sidebar[data-tab="customer"] .sidebar-block h3[title="Name"]', + css: '.content.active .sidebar[data-tab="customer"] .sidebar-block h3[title="Name"]', value: 'Nicole B2', ) @@ -215,23 +215,23 @@ class AgentProfilePermissionsTest < TestCase modal_ready() set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'Braun', ) set( - css: '.modal [data-name="note"]', + css: '.modal [data-name="note"]', value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') modal_disappear() watch_for( - css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]', + css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]', value: 'some note abc', ) watch_for( - css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [title="Name"]', + css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [title="Name"]', value: 'Nicole Braun', ) end @@ -242,7 +242,7 @@ class AgentProfilePermissionsTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() @@ -278,18 +278,18 @@ class AgentProfilePermissionsTest < TestCase modal_ready() set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'B2', ) set( - css: '.modal [data-name="note"]', + css: '.modal [data-name="note"]', value: 'some note abc', ) click(css: '.content.active .modal button.js-submit') modal_disappear() watch_for( - css: '.content.active .profile-window', + css: '.content.active .profile-window', value: 'some note abc', ) @@ -305,11 +305,11 @@ class AgentProfilePermissionsTest < TestCase modal_ready() set( - css: '.modal [name="lastname"]', + css: '.modal [name="lastname"]', value: 'Braun', ) set( - css: '.modal [data-name="note"]', + css: '.modal [data-name="note"]', value: 'note', ) click(css: '.content.active .modal button.js-submit') @@ -328,7 +328,7 @@ class AgentProfilePermissionsTest < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() diff --git a/test/browser/user_switch_cache_test.rb b/test/browser/user_switch_cache_test.rb index 6aaad5e37..759f3e1fe 100644 --- a/test/browser/user_switch_cache_test.rb +++ b/test/browser/user_switch_cache_test.rb @@ -8,15 +8,15 @@ class UserSwitchCache < TestCase login( username: 'agent1@example.com', password: 'test', - url: browser_url, + url: browser_url, ) tasks_close_all() ticket1 = ticket_create( data: { customer: 'nico', - group: 'Users', - title: 'some subject 123äöü - reply test', - body: 'some body 123äöü - reply test', + group: 'Users', + title: 'some subject 123äöü - reply test', + body: 'some body 123äöü - reply test', }, ) @@ -26,26 +26,26 @@ class UserSwitchCache < TestCase login( username: 'nicole.braun@zammad.org', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#new"]', only_if_exists: true) click(css: 'a[href="#customer_ticket_new"]') sleep 4 match( - css: '#content', - value: 'Priority', + css: '#content', + value: 'Priority', should_not_match: true, ) match( - css: '#content', - value: 'Owner', + css: '#content', + value: 'Owner', should_not_match: true, ) match( - css: '#content', + css: '#content', value: 'State', ) @@ -55,26 +55,26 @@ class UserSwitchCache < TestCase login( username: 'nicole.braun@zammad.org', password: 'test', - url: browser_url, + url: browser_url, ) click(css: 'a[href="#new"]', only_if_exists: true) click(css: 'a[href="#customer_ticket_new"]') sleep 4 match( - css: '#content', - value: 'Priority', + css: '#content', + value: 'Priority', should_not_match: true, ) match( - css: '#content', - value: 'Owner', + css: '#content', + value: 'Owner', should_not_match: true, ) match( - css: '#content', + css: '#content', value: 'State', ) diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 6adddda56..6cea4c82c 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -114,9 +114,9 @@ class TestCase < Test::Unit::TestCase local_browser = Selenium::WebDriver.for( :remote, - url: ENV['REMOTE_URL'], + url: ENV['REMOTE_URL'], desired_capabilities: caps, - http_client: http_client, + http_client: http_client, ) @browsers[local_browser.hash] = local_browser browser_instance_preferences(local_browser) @@ -214,7 +214,7 @@ class TestCase < Test::Unit::TestCase assert(true, 'auto wizard login ok') clues_close( - browser: instance, + browser: instance, optional: true, ) @@ -260,7 +260,7 @@ class TestCase < Test::Unit::TestCase end clues_close( - browser: instance, + browser: instance, optional: true, ) @@ -283,13 +283,13 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser click( - browser: instance, - css: 'a[href="#current_user"]', + browser: instance, + css: 'a[href="#current_user"]', mute_log: true, ) click( - browser: instance, - css: 'a[href="#logout"]', + browser: instance, + css: 'a[href="#logout"]', mute_log: true, ) @@ -1739,18 +1739,18 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/overviews"]', + browser: instance, + css: '.content.active a[href="#manage/overviews"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[data-type="new"]', + browser: instance, + css: '.content.active a[data-type="new"]', mute_log: true, ) modal_ready(browser: instance) @@ -1897,13 +1897,13 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/overviews"]', + browser: instance, + css: '.content.active a[href="#manage/overviews"]', mute_log: true, ) @@ -2054,14 +2054,14 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#new"]', - mute_log: true, + browser: instance, + css: 'a[href="#new"]', + mute_log: true, only_if_exists: true, ) click( - browser: instance, - css: 'a[href="#ticket/create"]', + browser: instance, + css: 'a[href="#ticket/create"]', mute_log: true, ) @@ -2222,8 +2222,8 @@ wait untill text in selector disabppears if data[:attachment] file_upload( browser: instance, - css: '.content.active .text-1', - value: 'some text', + css: '.content.active .text-1', + value: 'some text', ) end @@ -2234,8 +2234,8 @@ wait untill text in selector disabppears #instance.execute_script('$(".content.active .newTicket form").submit();') click( - browser: instance, - css: '.content.active .newTicket button.js-submit', + browser: instance, + css: '.content.active .newTicket button.js-submit', mute_log: true, ) screenshot(browser: instance, comment: 'ticket_create_after_submit_1') @@ -2254,9 +2254,9 @@ wait untill text in selector disabppears if element number = element.text ticket = { - id: id, + id: id, number: number, - title: data[:title], + title: data[:title], } sleep 2 # wait until notify is gone return ticket @@ -2350,8 +2350,8 @@ wait untill text in selector disabppears click(browser: instance, css: '.content.active div[data-tab="customer"] .js-actions [data-type="customer-change"]') watch_for( browser: instance, - css: '.modal', - value: 'change', + css: '.modal', + value: 'change', ) element = instance.find_elements(css: '.modal input[name="customer_id_completion"]')[0] @@ -2371,8 +2371,8 @@ wait untill text in selector disabppears watch_for( browser: instance, - css: '.content.active .tabsSidebar', - value: data[:customer], + css: '.content.active .tabsSidebar', + value: data[:customer], ) # select tab @@ -2630,7 +2630,7 @@ wait untill text in selector disabppears sleep 0.5 execute( browser: instance, - js: '$(".content.active .sidebar").css("display", "block")', + js: '$(".content.active .sidebar").css("display", "block")', ) link = if params[:link] @@ -2646,7 +2646,7 @@ wait untill text in selector disabppears sleep 0.5 execute( browser: instance, - js: '$(".content.active .sidebar").css("display", "none")', + js: '$(".content.active .sidebar").css("display", "none")', ) end @@ -2735,7 +2735,7 @@ wait untill text in selector disabppears instance.execute_script("$(\".js-global-search-result a:contains('#{params[:number]}') .nav-tab-icon\").first().click()") watch_for( browser: instance, - css: '.content.active .ticketZoom-header .ticket-number' + css: '.content.active .ticketZoom-header .ticket-number' ) number = instance.find_elements(css: '.content.active .ticketZoom-header .ticket-number')[0].text if !number.match?(/#{params[:number]}/) @@ -2803,7 +2803,7 @@ wait untill text in selector disabppears execute( browser: instance, - js: '$(".content.active .sidebar").css("display", "block")', + js: '$(".content.active .sidebar").css("display", "block")', ) #execute( # browser: instance, @@ -2859,7 +2859,7 @@ wait untill text in selector disabppears instance.execute_script("$(\".js-global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()") watch_for( browser: instance, - css: '.content.active h1' + css: '.content.active h1' ) name = instance.find_elements(css: '.content.active h1')[0].text if !name.match?(/#{params[:value]}/) @@ -2895,7 +2895,7 @@ wait untill text in selector disabppears instance.execute_script("$(\".js-global-search-result a:contains('#{params[:value]}') .nav-tab-icon\").click()") watch_for( browser: instance, - css: '.content.active h1' + css: '.content.active h1' ) name = instance.find_elements(css: '.content.active h1')[0].text if !name.match?(/#{params[:value]}/) @@ -2947,18 +2947,18 @@ wait untill text in selector disabppears raise 'user_create() requires either email or phone' if data[:email].blank? && data[:phone].blank? click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/users"]', + browser: instance, + css: '.content.active a[href="#manage/users"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[data-type="new"]', + browser: instance, + css: '.content.active a[data-type="new"]', mute_log: true, ) modal_ready(browser: instance) @@ -3071,8 +3071,8 @@ wait untill text in selector disabppears if (i % 10).zero? set( browser: instance, - css: '.content.active .js-search', - value: search_query, + css: '.content.active .js-search', + value: search_query, ) end sleep 1 @@ -3112,13 +3112,13 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/users"]', + browser: instance, + css: '.content.active a[href="#manage/users"]', mute_log: true, ) instance.find_elements(css: '.content.active .user-list td:first-child').each do |element| @@ -3244,18 +3244,18 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/organizations"]', + browser: instance, + css: '.content.active a[href="#manage/organizations"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[data-type="new"]', + browser: instance, + css: '.content.active a[data-type="new"]', mute_log: true, ) modal_ready(browser: instance) @@ -3270,8 +3270,8 @@ wait untill text in selector disabppears ) watch_for( browser: instance, - css: 'body', - value: data[:name], + css: 'body', + value: data[:name], ) end @@ -3295,19 +3295,19 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/calendars"]', + browser: instance, + css: '.content.active a[href="#manage/calendars"]', mute_log: true, ) sleep 4 click( - browser: instance, - css: '.content.active a.js-new', + browser: instance, + css: '.content.active a.js-new', mute_log: true, ) modal_ready(browser: instance) @@ -3355,18 +3355,18 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/slas"]', + browser: instance, + css: '.content.active a[href="#manage/slas"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a.js-new', + browser: instance, + css: '.content.active a.js-new', mute_log: true, ) modal_ready(browser: instance) @@ -3418,35 +3418,35 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/text_modules"]', + browser: instance, + css: '.content.active a[href="#manage/text_modules"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[data-type="new"]', + browser: instance, + css: '.content.active a[data-type="new"]', mute_log: true, ) modal_ready(browser: instance) set( - browser: instance, - css: '.modal input[name=name]', - value: data[:name], + browser: instance, + css: '.modal input[name=name]', + value: data[:name], ) set( - browser: instance, - css: '.modal input[name=keywords]', - value: data[:keywords], + browser: instance, + css: '.modal input[name=keywords]', + value: data[:keywords], ) set( - browser: instance, - css: '.modal [data-name=content]', - value: data[:content], + browser: instance, + css: '.modal [data-name=content]', + value: data[:content], ) instance.find_elements(css: '.modal button.js-submit')[0].click modal_disappear(browser: instance) @@ -3484,36 +3484,36 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#channels/email"]', + browser: instance, + css: '.content.active a[href="#channels/email"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#c-signature"]', + browser: instance, + css: '.content.active a[href="#c-signature"]', mute_log: true, ) sleep 4 click( - browser: instance, - css: '.content.active #c-signature a[data-type="new"]', + browser: instance, + css: '.content.active #c-signature a[data-type="new"]', mute_log: true, ) modal_ready(browser: instance) set( - browser: instance, - css: '.modal input[name=name]', - value: data[:name], + browser: instance, + css: '.modal input[name=name]', + value: data[:name], ) set( - browser: instance, - css: '.modal [data-name=body]', - value: data[:body], + browser: instance, + css: '.modal [data-name=body]', + value: data[:body], ) instance.find_elements(css: '.modal button.js-submit')[0].click modal_disappear(browser: instance) @@ -3557,18 +3557,18 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/groups"]', + browser: instance, + css: '.content.active a[href="#manage/groups"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[data-type="new"]', + browser: instance, + css: '.content.active a[data-type="new"]', mute_log: true, ) modal_ready(browser: instance) @@ -3642,14 +3642,14 @@ wait untill text in selector disabppears instance = params[:browser] || @browser click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.sidebar a[href="#manage/macros"]', + browser: instance, + css: '.sidebar a[href="#manage/macros"]', mute_log: true, ) @@ -3741,18 +3741,18 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/roles"]', + browser: instance, + css: '.content.active a[href="#manage/roles"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[data-type="new"]', + browser: instance, + css: '.content.active a[data-type="new"]', mute_log: true, ) modal_ready(browser: instance) @@ -3852,13 +3852,13 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/roles"]', + browser: instance, + css: '.content.active a[href="#manage/roles"]', mute_log: true, ) instance.execute_script('$(\'.content.active table tr td:contains(" ' + data[:name] + '")\').first().click()') @@ -3970,18 +3970,18 @@ wait untill text in selector disabppears data = params[:data] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#manage/report_profiles"]', + browser: instance, + css: '.content.active a[href="#manage/report_profiles"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a.btn.primary[data-type="new"]', + browser: instance, + css: '.content.active a.btn.primary[data-type="new"]', mute_log: true, ) set( @@ -3995,8 +3995,8 @@ wait untill text in selector disabppears end sleep 0.5 click( - browser: instance, - css: '.content.active .modal .js-submit', + browser: instance, + css: '.content.active .modal .js-submit', mute_log: true, ) modal_disappear @@ -4231,13 +4231,13 @@ wait untill text in selector disabppears raise 'invalid object parameter in object_manager_attribute_delete' if %w[Ticket User Organization Group].exclude? data[:object] click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#system/object_manager"]', + browser: instance, + css: '.content.active a[href="#system/object_manager"]', mute_log: true, ) watch_for( @@ -4269,13 +4269,13 @@ wait untill text in selector disabppears instance = params[:browser] || @browser click( - browser: instance, - css: 'a[href="#manage"]', + browser: instance, + css: 'a[href="#manage"]', mute_log: true, ) click( - browser: instance, - css: '.content.active a[href="#system/object_manager"]', + browser: instance, + css: '.content.active a[href="#system/object_manager"]', mute_log: true, ) sleep 4 @@ -4307,14 +4307,14 @@ wait untill text in selector disabppears instance = params[:browser] || @browser watch_for( - browser: instance, - css: '.content.active', - value: 'Database Update required', + browser: instance, + css: '.content.active', + value: 'Database Update required', mute_log: true, ) click( - browser: instance, - css: '.content.active .tab-pane.active div.js-execute', + browser: instance, + css: '.content.active .tab-pane.active div.js-execute', mute_log: true, ) modal_ready( @@ -4330,8 +4330,8 @@ wait untill text in selector disabppears elsif title_text == 'Config has changed' # in the simple case, just click the submit button click( - browser: instance, - css: '.modal .js-submit', + browser: instance, + css: '.modal .js-submit', mute_log: true, ) else @@ -4339,8 +4339,8 @@ wait untill text in selector disabppears end sleep 5 watch_for( - browser: instance, - css: '.content.active', + browser: instance, + css: '.content.active', mute_log: true, ) end @@ -4443,7 +4443,7 @@ wait untill text in selector disabppears add_sub_tree_recursion( instance: instance, - options: options, + options: options, ) end @@ -4494,8 +4494,8 @@ wait untill text in selector disabppears elem.send_keys :enter watch_for( - xpath: '../*/span[contains(@class,"token-label")]', - value: value, + xpath: '../*/span[contains(@class,"token-label")]', + value: value, container: original_element ) end @@ -4551,15 +4551,15 @@ wait untill text in selector disabppears select( browser: instance, - css: '.content.active .searchableSelect-shadow', - value: data[:language], + css: '.content.active .searchableSelect-shadow', + value: data[:language], ) click(browser: instance, css: '.content.active .btn--primary') watch_for( browser: instance, - css: '#notify', + css: '#notify', ) end @@ -4668,7 +4668,7 @@ wait untill text in selector disabppears loop do target = { browser: instance, - css: '.modal .js-Table .js-remove', + css: '.modal .js-Table .js-remove', mute_log: true, } break if !instance.find_elements(css: target[:css])[0] @@ -4733,12 +4733,12 @@ wait untill text in selector disabppears if params[:error] sleep 4 watch_for( - css: '.modal', + css: '.modal', value: params[:error], ) click( browser: instance, - css: '.modal .js-close', + css: '.modal .js-close', ) modal_disappear(browser: instance) return diff --git a/test/fixtures/seeds.rb b/test/fixtures/seeds.rb index 92aee72e4..8ff35e882 100644 --- a/test/fixtures/seeds.rb +++ b/test/fixtures/seeds.rb @@ -11,9 +11,9 @@ if channel end email_address = EmailAddress.create_or_update( - realname: 'Zammad', - email: 'zammad@localhost', - channel_id: channel_id, + realname: 'Zammad', + email: 'zammad@localhost', + channel_id: channel_id, updated_by_id: 1, created_by_id: 1 ) @@ -23,13 +23,13 @@ Group.all.each do |group| end User.create_or_update( - login: 'admin@example.com', - firstname: 'Default', - lastname: 'Admin', - email: 'admin@example.com', - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin]), + login: 'admin@example.com', + firstname: 'Default', + lastname: 'Admin', + email: 'admin@example.com', + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin]), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/integration/aaa_auto_wizard_base_setup_test.rb b/test/integration/aaa_auto_wizard_base_setup_test.rb index 44f405db9..57880719c 100644 --- a/test/integration/aaa_auto_wizard_base_setup_test.rb +++ b/test/integration/aaa_auto_wizard_base_setup_test.rb @@ -6,10 +6,10 @@ class AaaAutoWizardBaseSetupTest < TestCase @browser = browser_instance location(url: "#{browser_url}/#getting_started/auto_wizard") watch_for( - css: '.user-menu .user a', + css: '.user-menu .user a', attribute: 'title', - value: 'master@example.com', - timeout: 14, + value: 'master@example.com', + timeout: 14, ) end diff --git a/test/integration/auto_wizard_browser_test.rb b/test/integration/auto_wizard_browser_test.rb index 216d6128b..170937ce8 100644 --- a/test/integration/auto_wizard_browser_test.rb +++ b/test/integration/auto_wizard_browser_test.rb @@ -6,26 +6,26 @@ class AutoWizardBrowserTest < TestCase location(url: browser_url) watch_for( - css: 'body', - value: 'auto wizard is enabled', + css: 'body', + value: 'auto wizard is enabled', timeout: 10, ) location(url: "#{browser_url}/#getting_started/auto_wizard") watch_for( - css: 'body', - value: 'auto wizard is enabled', + css: 'body', + value: 'auto wizard is enabled', timeout: 10, ) location(url: "#{browser_url}/#getting_started/auto_wizard/secret_token") watch_for( - css: '.user-menu .user a', + css: '.user-menu .user a', attribute: 'title', - value: 'hans.atila@zammad.org', - timeout: 20, + value: 'hans.atila@zammad.org', + timeout: 20, ) clues_close @@ -37,11 +37,11 @@ class AutoWizardBrowserTest < TestCase value: 'Demo Organization', ) watch_for( - css: '.active .profile-window', + css: '.active .profile-window', value: 'Demo Organization', ) watch_for( - css: '.active .profile-window', + css: '.active .profile-window', value: 'Atila', ) @@ -52,10 +52,10 @@ class AutoWizardBrowserTest < TestCase password: 'Z4mm4dr0ckZ!', ) watch_for( - css: '.user-menu .user a', + css: '.user-menu .user a', attribute: 'title', - value: 'hans.atila@zammad.org', - timeout: 8, + value: 'hans.atila@zammad.org', + timeout: 8, ) end diff --git a/test/integration/clearbit_test.rb b/test/integration/clearbit_test.rb index ca1aed55d..2625c615e 100644 --- a/test/integration/clearbit_test.rb +++ b/test/integration/clearbit_test.rb @@ -13,34 +13,34 @@ class ClearbitTest < ActiveSupport::TestCase Setting.set('clearbit_integration', true) Setting.set('clearbit_config', { - api_key: ENV['CLEARBIT_CI_API_KEY'], + api_key: ENV['CLEARBIT_CI_API_KEY'], organization_autocreate: true, - organization_shared: false, - user_sync: { - 'person.name.givenName' => 'user.firstname', + organization_shared: false, + user_sync: { + 'person.name.givenName' => 'user.firstname', 'person.name.familyName' => 'user.lastname', - 'person.email' => 'user.email', - 'person.bio' => 'user.note', - 'company.url' => 'user.web', - 'person.site' => 'user.web', - 'company.location' => 'user.address', - 'person.location' => 'user.address', + 'person.email' => 'user.email', + 'person.bio' => 'user.note', + 'company.url' => 'user.web', + 'person.site' => 'user.web', + 'company.location' => 'user.address', + 'person.location' => 'user.address', #'person.timeZone' => 'user.preferences[:timezone]', #'person.gender' => 'user.preferences[:gender]', }, - organization_sync: { - 'company.legalName' => 'organization.name', - 'company.name' => 'organization.name', + organization_sync: { + 'company.legalName' => 'organization.name', + 'company.name' => 'organization.name', 'company.description' => 'organization.note', }, }) # case 1 - person + company (demo data set) customer1 = User.create!( - firstname: '', - lastname: 'Should be still there', - email: 'alex@alexmaccaw.com', - note: '', + firstname: '', + lastname: 'Should be still there', + email: 'alex@alexmaccaw.com', + note: '', updated_by_id: 1, created_by_id: 1, ) @@ -65,10 +65,10 @@ class ClearbitTest < ActiveSupport::TestCase # case 2 - person + company customer2 = User.create!( - firstname: '', - lastname: '', - email: 'me@example.com', - note: '', + firstname: '', + lastname: '', + email: 'me@example.com', + note: '', updated_by_id: 1, created_by_id: 1, ) @@ -94,7 +94,7 @@ class ClearbitTest < ActiveSupport::TestCase # update with own values (do not overwrite) customer2.update!( firstname: 'Martini', - note: 'changed by my self', + note: 'changed by my self', ) Observer::Transaction.commit @@ -123,7 +123,7 @@ class ClearbitTest < ActiveSupport::TestCase # update with own values (do not overwrite) customer2.update!( firstname: '', - note: 'changed by my self', + note: 'changed by my self', ) customer2_enrichment = Enrichment::Clearbit::User.new(customer2) @@ -160,10 +160,10 @@ class ClearbitTest < ActiveSupport::TestCase # case 3 - no person customer3 = User.create!( - firstname: '', - lastname: '', - email: 'testing3@znuny.com', - note: '', + firstname: '', + lastname: '', + email: 'testing3@znuny.com', + note: '', updated_by_id: 1, created_by_id: 1, ) @@ -189,13 +189,13 @@ class ClearbitTest < ActiveSupport::TestCase # case 4 - person with organization but organization is already assigned (own created) customer4 = User.create!( - firstname: '', - lastname: '', - email: 'testing4@znuny.com', - note: '', + firstname: '', + lastname: '', + email: 'testing4@znuny.com', + note: '', organization_id: 1, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) assert(customer4) @@ -217,13 +217,13 @@ class ClearbitTest < ActiveSupport::TestCase # case 5 - person with organization but organization is already assigned (own created) customer5 = User.create!( - firstname: '', - lastname: '', - email: 'testing5@znuny.com', - note: '', + firstname: '', + lastname: '', + email: 'testing5@znuny.com', + note: '', organization_id: organization3.id, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) assert(customer5) @@ -248,10 +248,10 @@ class ClearbitTest < ActiveSupport::TestCase # case 6 - no person / real api call customer6 = User.create!( - firstname: '', - lastname: '', - email: 'testing6@clearbit.com', - note: '', + firstname: '', + lastname: '', + email: 'testing6@clearbit.com', + note: '', updated_by_id: 1, created_by_id: 1, ) @@ -295,32 +295,32 @@ class ClearbitTest < ActiveSupport::TestCase Setting.set('clearbit_integration', true) Setting.set('clearbit_config', { - api_key: ENV['CLEARBIT_CI_API_KEY'], + api_key: ENV['CLEARBIT_CI_API_KEY'], organization_autocreate: true, - organization_shared: true, - user_sync: { - 'person.name.givenName' => 'user.firstname', + organization_shared: true, + user_sync: { + 'person.name.givenName' => 'user.firstname', 'person.name.familyName' => 'user.lastname', - 'person.email' => 'user.email', - 'person.bio' => 'user.note_not_existing', - 'company.url' => 'user.web', - 'person.site' => 'user.web', - 'company.location' => 'user.address', - 'person.location' => 'user.address', + 'person.email' => 'user.email', + 'person.bio' => 'user.note_not_existing', + 'company.url' => 'user.web', + 'person.site' => 'user.web', + 'company.location' => 'user.address', + 'person.location' => 'user.address', }, - organization_sync: { - 'company.legalName' => 'organization.name', - 'company.name' => 'organization.name', + organization_sync: { + 'company.legalName' => 'organization.name', + 'company.name' => 'organization.name', 'company.description' => 'organization.note_not_existing', }, }) # case 1 - person + company (demo data set) customer1 = User.create!( - firstname: '', - lastname: 'Should be still there', - email: 'testing6@znuny.com', - note: '', + firstname: '', + lastname: 'Should be still there', + email: 'testing6@znuny.com', + note: '', updated_by_id: 1, created_by_id: 1, ) diff --git a/test/integration/elasticsearch_active_test.rb b/test/integration/elasticsearch_active_test.rb index d02e03af3..118c0f210 100644 --- a/test/integration/elasticsearch_active_test.rb +++ b/test/integration/elasticsearch_active_test.rb @@ -13,13 +13,13 @@ class ElasticsearchActiveTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') @agent = User.create!( - login: 'es-agent@example.com', - firstname: 'E', - lastname: 'S', - email: 'es-agent@example.com', - password: 'agentpw', - active: true, - roles: roles, + login: 'es-agent@example.com', + firstname: 'E', + lastname: 'S', + email: 'es-agent@example.com', + password: 'agentpw', + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) @@ -29,17 +29,17 @@ class ElasticsearchActiveTest < ActiveSupport::TestCase (1..6).each do |i| name = i.even? ? "Active-#{i}" : "Inactive-#{i}" User.create!( - login: "#{name}-customer#{i}@example.com", - firstname: 'ActiveTest', - lastname: name, - active: i.even?, - roles: roles, + login: "#{name}-customer#{i}@example.com", + firstname: 'ActiveTest', + lastname: name, + active: i.even?, + roles: roles, updated_by_id: 1, created_by_id: 1, ) Organization.create!( - name: "TestOrg-#{name}", - active: i.even?, + name: "TestOrg-#{name}", + active: i.even?, updated_by_id: 1, created_by_id: 1, ) @@ -54,8 +54,8 @@ class ElasticsearchActiveTest < ActiveSupport::TestCase test 'active users appear before inactive users in search results' do result = User.search( current_user: @agent, - query: 'ActiveTest', - limit: 15, + query: 'ActiveTest', + limit: 15, ) assert(result.present?, 'result should not be empty') @@ -68,8 +68,8 @@ class ElasticsearchActiveTest < ActiveSupport::TestCase test 'active organizations appear before inactive organizations in search results' do result = Organization.search( current_user: @agent, - query: 'TestOrg', - limit: 15, + query: 'TestOrg', + limit: 15, ) assert(result.present?, 'result should not be empty') @@ -89,8 +89,8 @@ class ElasticsearchActiveTest < ActiveSupport::TestCase result = Ticket.search( current_user: User.find(1), - query: 'ticket', - limit: 15, + query: 'ticket', + limit: 15, ) assert(result.present?, 'result should not be empty') @@ -102,18 +102,18 @@ class ElasticsearchActiveTest < ActiveSupport::TestCase def ticket_setup result = Ticket.search( current_user: User.find(1), - query: 'ticket', - limit: 15, + query: 'ticket', + limit: 15, ) return if result.present? (1..6).each do |i| Ticket.create!( - title: "Ticket-#{i}", - group: Group.lookup(name: 'Users'), - customer_id: 1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "Ticket-#{i}", + group: Group.lookup(name: 'Users'), + customer_id: 1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/integration/elasticsearch_test.rb b/test/integration/elasticsearch_test.rb index b045c5724..f5b6bff05 100644 --- a/test/integration/elasticsearch_test.rb +++ b/test/integration/elasticsearch_test.rb @@ -12,62 +12,62 @@ class ElasticsearchTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') @agent = User.create!( - login: 'es-agent@example.com', - firstname: 'E', - lastname: 'S', - email: 'es-agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'es-agent@example.com', + firstname: 'E', + lastname: 'S', + email: 'es-agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) group_without_access = Group.create_if_not_exists( - name: 'WithoutAccess', - note: 'Test for not access check.', + name: 'WithoutAccess', + note: 'Test for not access check.', updated_by_id: 1, created_by_id: 1 ) roles = Role.where(name: 'Customer') @organization1 = Organization.create_if_not_exists( - name: 'Customer Organization Update', - note: 'some note', + name: 'Customer Organization Update', + note: 'some note', updated_by_id: 1, created_by_id: 1, ) @customer1 = User.create!( - login: 'es-customer1@example.com', - firstname: 'ES', - lastname: 'Customer1', - email: 'es-customer1@example.com', - password: 'customerpw', - active: true, + login: 'es-customer1@example.com', + firstname: 'ES', + lastname: 'Customer1', + email: 'es-customer1@example.com', + password: 'customerpw', + active: true, organization_id: @organization1.id, - roles: roles, - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_by_id: 1, + created_by_id: 1, ) @customer2 = User.create!( - login: 'es-customer2@example.com', - firstname: 'ES', - lastname: 'Customer2', - email: 'es-customer2@example.com', - password: 'customerpw', - active: true, + login: 'es-customer2@example.com', + firstname: 'ES', + lastname: 'Customer2', + email: 'es-customer2@example.com', + password: 'customerpw', + active: true, organization_id: @organization1.id, - roles: roles, - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_by_id: 1, + created_by_id: 1, ) @customer3 = User.create!( - login: 'es-customer3@example.com', - firstname: 'ES', - lastname: 'Customer3', - email: 'es-customer3@example.com', - password: 'customerpw', - active: true, - roles: roles, + login: 'es-customer3@example.com', + firstname: 'ES', + lastname: 'Customer3', + email: 'es-customer3@example.com', + password: 'customerpw', + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) @@ -118,33 +118,33 @@ class ElasticsearchTest < ActiveSupport::TestCase # ticket/article ticket1 = Ticket.create!( - title: 'some title äöüß', - group: Group.lookup(name: 'Users'), - customer_id: @customer1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some title äöüß', + group: Group.lookup(name: 'Users'), + customer_id: @customer1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-normal.txt')), - filename: 'es-normal.txt', - preferences: {}, + object: 'Ticket::Article', + o_id: article1.id, + data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-normal.txt')), + filename: 'es-normal.txt', + preferences: {}, created_by_id: 1, ) @@ -176,24 +176,24 @@ class ElasticsearchTest < ActiveSupport::TestCase Scheduler.worker(true) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: @customer1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: @customer1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) @@ -201,69 +201,69 @@ class ElasticsearchTest < ActiveSupport::TestCase # add attachments which should get index / .txt # "some normal text66" Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-normal.txt')), - filename: 'es-normal.txt', - preferences: {}, + object: 'Ticket::Article', + o_id: article1.id, + data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-normal.txt')), + filename: 'es-normal.txt', + preferences: {}, created_by_id: 1, ) # add attachments which should get index / .pdf # "Zammad Test77" Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-pdf1.pdf')), - filename: 'es-pdf1.pdf', - preferences: {}, + object: 'Ticket::Article', + o_id: article1.id, + data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-pdf1.pdf')), + filename: 'es-pdf1.pdf', + preferences: {}, created_by_id: 1, ) # add attachments which should get index / .box # "Old programmers never die test99" Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-box1.box')), - filename: 'mail1.box', - preferences: {}, + object: 'Ticket::Article', + o_id: article1.id, + data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-box1.box')), + filename: 'mail1.box', + preferences: {}, created_by_id: 1, ) # add to big attachment which should not get index # "some too big text88" Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-too-big.txt')), - filename: 'es-too-big.txt', - preferences: {}, + object: 'Ticket::Article', + o_id: article1.id, + data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-too-big.txt')), + filename: 'es-too-big.txt', + preferences: {}, created_by_id: 1, ) ticket1.tag_add('someTagA', 1) travel 1.minute ticket2 = Ticket.create!( - title: 'something else', - group: Group.lookup(name: 'Users'), - customer_id: @customer2.id, - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'something else', + group: Group.lookup(name: 'Users'), + customer_id: @customer2.id, + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article2 = Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.org', - to: 'some_recipient@example.org', - subject: 'some subject2 / autobahn what else?', - message_id: 'some@id', - body: 'some other message with strong text', - content_type: 'text/html', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket2.id, + from: 'some_sender@example.org', + to: 'some_recipient@example.org', + subject: 'some subject2 / autobahn what else?', + message_id: 'some@id', + body: 'some other message with strong text', + content_type: 'text/html', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) @@ -271,24 +271,24 @@ class ElasticsearchTest < ActiveSupport::TestCase travel 1.minute ticket3 = Ticket.create!( - title: 'something else', - group: Group.lookup(name: 'WithoutAccess'), - customer_id: @customer3.id, - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'something else', + group: Group.lookup(name: 'WithoutAccess'), + customer_id: @customer3.id, + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article3 = Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.org', - to: 'some_recipient@example.org', - subject: 'some subject3', - message_id: 'some@id', - body: 'some other message 3 / kindergarden what else?', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket3.id, + from: 'some_sender@example.org', + to: 'some_recipient@example.org', + subject: 'some subject3', + message_id: 'some@id', + body: 'some other message 3 / kindergarden what else?', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) @@ -302,8 +302,8 @@ class ElasticsearchTest < ActiveSupport::TestCase # search for article data result = Ticket.search( current_user: @agent, - query: 'autobahn', - limit: 15, + query: 'autobahn', + limit: 15, ) assert(result.present?, 'result exists not') @@ -314,8 +314,8 @@ class ElasticsearchTest < ActiveSupport::TestCase # search for html content result = Ticket.search( current_user: @agent, - query: 'strong', - limit: 15, + query: 'strong', + limit: 15, ) assert(result.present?, 'result exists not') @@ -326,16 +326,16 @@ class ElasticsearchTest < ActiveSupport::TestCase # search for indexed attachment result = Ticket.search( current_user: @agent, - query: '"some normal text66"', - limit: 15, + query: '"some normal text66"', + limit: 15, ) assert(result[0], 'record 1') assert_equal(result[0].id, ticket1.id) result = Ticket.search( current_user: @agent, - query: 'test77', - limit: 15, + query: 'test77', + limit: 15, ) assert(result[0], 'record 1') assert_equal(result[0].id, ticket1.id) @@ -343,23 +343,23 @@ class ElasticsearchTest < ActiveSupport::TestCase # search for not indexed attachment result = Ticket.search( current_user: @agent, - query: 'test88', - limit: 15, + query: 'test88', + limit: 15, ) assert_not(result[0], 'record 1') result = Ticket.search( current_user: @agent, - query: 'test99', - limit: 15, + query: 'test99', + limit: 15, ) assert_not(result[0], 'record 1') # search for ticket with no permissions result = Ticket.search( current_user: @agent, - query: 'kindergarden', - limit: 15, + query: 'kindergarden', + limit: 15, ) assert(result.blank?, 'result should be empty') assert_not(result[0], 'record 1') @@ -367,8 +367,8 @@ class ElasticsearchTest < ActiveSupport::TestCase # search as @customer1 result = Ticket.search( current_user: @customer1, - query: 'title OR else', - limit: 15, + query: 'title OR else', + limit: 15, ) assert(result.present?, 'result exists not') @@ -381,8 +381,8 @@ class ElasticsearchTest < ActiveSupport::TestCase # search as @customer2 result = Ticket.search( current_user: @customer2, - query: 'title OR else', - limit: 15, + query: 'title OR else', + limit: 15, ) assert(result.present?, 'result exists not') @@ -395,8 +395,8 @@ class ElasticsearchTest < ActiveSupport::TestCase # search as @customer3 result = Ticket.search( current_user: @customer3, - query: 'title OR else', - limit: 15, + query: 'title OR else', + limit: 15, ) assert(result.present?, 'result exists not') @@ -407,8 +407,8 @@ class ElasticsearchTest < ActiveSupport::TestCase # search for tags result = Ticket.search( current_user: @agent, - query: 'tags:someTagA', - limit: 15, + query: 'tags:someTagA', + limit: 15, ) assert(result[0], 'record 1') assert_not(result[1], 'record 1') @@ -416,8 +416,8 @@ class ElasticsearchTest < ActiveSupport::TestCase result = Ticket.search( current_user: @agent, - query: 'tags:someTagB', - limit: 15, + query: 'tags:someTagB', + limit: 15, ) assert(result[0], 'record 2') assert_not(result[1], 'record 2') @@ -426,8 +426,8 @@ class ElasticsearchTest < ActiveSupport::TestCase # rename tag (e. g. via admin interface) tag_item = Tag::Item.lookup(name: 'someTagA') Tag::Item.rename( - id: tag_item.id, - name: 'someTagC', + id: tag_item.id, + name: 'someTagC', updated_by_id: 1, ) @@ -438,16 +438,16 @@ class ElasticsearchTest < ActiveSupport::TestCase # search for tags result = Ticket.search( current_user: @agent, - query: 'tags:someTagA', - limit: 15, + query: 'tags:someTagA', + limit: 15, ) assert_not(result[0], 'record 1') assert_not(result[1], 'record 1') result = Ticket.search( current_user: @agent, - query: 'tags:someTagB', - limit: 15, + query: 'tags:someTagB', + limit: 15, ) assert(result[0], 'record 2') assert_not(result[1], 'record 2') @@ -455,8 +455,8 @@ class ElasticsearchTest < ActiveSupport::TestCase result = Ticket.search( current_user: @agent, - query: 'tags:someTagC', - limit: 15, + query: 'tags:someTagC', + limit: 15, ) assert(result[0], 'record 1') assert_not(result[1], 'record 2') @@ -464,8 +464,8 @@ class ElasticsearchTest < ActiveSupport::TestCase result = Ticket.search( current_user: @agent, - query: 'state:open', - limit: 15, + query: 'state:open', + limit: 15, ) assert(result[0], 'record 1') assert_not(result[1], 'record 2') @@ -473,8 +473,8 @@ class ElasticsearchTest < ActiveSupport::TestCase result = Ticket.search( current_user: @agent, - query: '"some_sender@example.com"', - limit: 15, + query: '"some_sender@example.com"', + limit: 15, ) assert(result[0], 'record 1') assert_not(result[1], 'record 2') @@ -482,8 +482,8 @@ class ElasticsearchTest < ActiveSupport::TestCase result = Ticket.search( current_user: @agent, - query: 'article.from:"some_sender@example.com"', - limit: 15, + query: 'article.from:"some_sender@example.com"', + limit: 15, ) assert(result[0], 'record 1') assert_not(result[1], 'record 2') @@ -493,8 +493,8 @@ class ElasticsearchTest < ActiveSupport::TestCase # search as @agent result = User.search( current_user: @agent, - query: 'customer1', - limit: 15, + query: 'customer1', + limit: 15, ) assert(result.present?, 'result should not be empty') assert(result[0], 'record 1') @@ -504,8 +504,8 @@ class ElasticsearchTest < ActiveSupport::TestCase # search as @customer1 result = User.search( current_user: @customer1, - query: 'customer1', - limit: 15, + query: 'customer1', + limit: 15, ) assert(result.blank?, 'result should be empty') assert_not(result[0], 'record 1') diff --git a/test/integration/email_deliver_test.rb b/test/integration/email_deliver_test.rb index d5a684f10..4c40d0924 100644 --- a/test/integration/email_deliver_test.rb +++ b/test/integration/email_deliver_test.rb @@ -14,37 +14,37 @@ class EmailDeliverTest < ActiveSupport::TestCase server_password = ENV['MAIL_SERVER_ACCOUNT'].split(':')[1] email_address = EmailAddress.create!( - realname: 'me Helpdesk', - email: "me#{rand(999_999_999)}@example.com", + realname: 'me Helpdesk', + email: "me#{rand(999_999_999)}@example.com", updated_by_id: 1, created_by_id: 1, ) group = Group.create_or_update( - name: 'DeliverTest', + name: 'DeliverTest', email_address_id: email_address.id, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) channel = Channel.create!( - area: 'Email::Account', - group_id: group.id, - options: { - inbound: { + area: 'Email::Account', + group_id: group.id, + options: { + inbound: { adapter: 'imap', options: { - host: 'mx1.example.com', - user: 'example', + host: 'mx1.example.com', + user: 'example', password: 'some_pw', - ssl: true, + ssl: true, } }, outbound: { adapter: 'sendmail' } }, - active: true, + active: true, updated_by_id: 1, created_by_id: 1, ) @@ -53,25 +53,25 @@ class EmailDeliverTest < ActiveSupport::TestCase email_address.save! ticket1 = Ticket.create!( - title: 'some delivery test', - group: group, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some delivery test', + group: group, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) assert(ticket1, 'ticket created') article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - to: 'some_recipient@example_not_existing_what_ever.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message delivery test', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + to: 'some_recipient@example_not_existing_what_ever.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message delivery test', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -93,23 +93,23 @@ class EmailDeliverTest < ActiveSupport::TestCase # send with invalid smtp settings channel.update!( options: { - inbound: { + inbound: { adapter: 'imap', options: { - host: 'mx1.example.com', - user: 'example', + host: 'mx1.example.com', + user: 'example', password: 'some_pw', - ssl: true, + ssl: true, } }, outbound: { adapter: 'smtp', options: { - host: 'mx1.example.com', - port: 25, + host: 'mx1.example.com', + port: 25, start_tls: true, - user: 'not_existing', - password: 'not_existing', + user: 'not_existing', + password: 'not_existing', }, }, }, @@ -127,23 +127,23 @@ class EmailDeliverTest < ActiveSupport::TestCase # send with correct smtp settings channel.update!( options: { - inbound: { + inbound: { adapter: 'imap', options: { - host: 'mx1.example.com', - user: 'example', + host: 'mx1.example.com', + user: 'example', password: 'some_pw', - ssl: true, + ssl: true, } }, outbound: { adapter: 'smtp', options: { - host: ENV['MAIL_SERVER'], - port: 25, + host: ENV['MAIL_SERVER'], + port: 25, start_tls: true, - user: server_login, - password: server_password, + user: server_login, + password: server_password, }, }, }, @@ -164,23 +164,23 @@ class EmailDeliverTest < ActiveSupport::TestCase # send with invalid smtp settings channel.update!( options: { - inbound: { + inbound: { adapter: 'imap', options: { - host: 'mx1.example.com', - user: 'example', + host: 'mx1.example.com', + user: 'example', password: 'some_pw', - ssl: true, + ssl: true, } }, outbound: { adapter: 'smtp', options: { - host: 'mx1.example.com', - port: 25, + host: 'mx1.example.com', + port: 25, start_tls: true, - user: 'not_existing', - password: 'not_existing', + user: 'not_existing', + password: 'not_existing', }, }, }, @@ -190,14 +190,14 @@ class EmailDeliverTest < ActiveSupport::TestCase Delayed::Job.destroy_all article2 = Ticket::Article.create!( - ticket_id: ticket1.id, - to: 'some_recipient@example_not_existing_what_ever.com', - subject: 'some subject2', - message_id: 'some@id', - body: 'some message delivery test2', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + to: 'some_recipient@example_not_existing_what_ever.com', + subject: 'some subject2', + message_id: 'some@id', + body: 'some message delivery test2', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/integration/email_helper_test.rb b/test/integration/email_helper_test.rb index 8265deebe..383e9c792 100644 --- a/test/integration/email_helper_test.rb +++ b/test/integration/email_helper_test.rb @@ -142,10 +142,10 @@ class EmailHelperTest < ActiveSupport::TestCase result = EmailHelper::Probe.inbound( adapter: 'imap2', options: { - host: 'not_existsing_host', - port: 993, - ssl: true, - user: 'some@example.com', + host: 'not_existsing_host', + port: 993, + ssl: true, + user: 'some@example.com', password: 'password', } ) @@ -156,10 +156,10 @@ class EmailHelperTest < ActiveSupport::TestCase result = EmailHelper::Probe.inbound( adapter: 'imap', options: { - host: 'not_existsing_host', - port: 993, - ssl: true, - user: 'some@example.com', + host: 'not_existsing_host', + port: 993, + ssl: true, + user: 'some@example.com', password: 'password', } ) @@ -171,10 +171,10 @@ class EmailHelperTest < ActiveSupport::TestCase result = EmailHelper::Probe.inbound( adapter: 'imap', options: { - host: 'www.znuny.com', - port: 993, - ssl: true, - user: 'some@example.com', + host: 'www.znuny.com', + port: 993, + ssl: true, + user: 'some@example.com', password: 'password', } ) @@ -185,10 +185,10 @@ class EmailHelperTest < ActiveSupport::TestCase result = EmailHelper::Probe.inbound( adapter: 'imap', options: { - host: '172.42.42.42', - port: 993, - ssl: true, - user: 'some@example.com', + host: '172.42.42.42', + port: 993, + ssl: true, + user: 'some@example.com', password: 'password', } ) @@ -200,10 +200,10 @@ class EmailHelperTest < ActiveSupport::TestCase result = EmailHelper::Probe.inbound( adapter: 'imap', options: { - host: 'imap.gmail.com', - port: 993, - ssl: true, - user: 'some@example.com', + host: 'imap.gmail.com', + port: 993, + ssl: true, + user: 'some@example.com', password: 'password', } ) @@ -214,10 +214,10 @@ class EmailHelperTest < ActiveSupport::TestCase result = EmailHelper::Probe.inbound( adapter: 'imap', options: { - host: 'imap.gmail.com', - port: 993, - ssl: true, - user: 'frank.tailor05@googlemail.com', + host: 'imap.gmail.com', + port: 993, + ssl: true, + user: 'frank.tailor05@googlemail.com', password: 'password', } ) @@ -235,10 +235,10 @@ class EmailHelperTest < ActiveSupport::TestCase result = EmailHelper::Probe.inbound( adapter: 'imap', options: { - host: 'arber.znuny.com', - port: 993, - ssl: true, - user: 'some@example.com', + host: 'arber.znuny.com', + port: 993, + ssl: true, + user: 'some@example.com', password: 'password', } ) @@ -257,10 +257,10 @@ class EmailHelperTest < ActiveSupport::TestCase result = EmailHelper::Probe.inbound( adapter: 'imap', options: { - host: 'arber.znuny.com', - port: 993, - ssl: true, - user: user, + host: 'arber.znuny.com', + port: 993, + ssl: true, + user: user, password: mailbox_password, } ) @@ -275,11 +275,11 @@ class EmailHelperTest < ActiveSupport::TestCase { adapter: 'smtp2', options: { - host: 'not_existsing_host', - port: 25, + host: 'not_existsing_host', + port: 25, start_tls: true, - user: 'some@example.com', - password: 'password', + user: 'some@example.com', + password: 'password', }, }, 'some@example.com', @@ -292,11 +292,11 @@ class EmailHelperTest < ActiveSupport::TestCase { adapter: 'smtp', options: { - host: 'not_existsing_host', - port: 25, + host: 'not_existsing_host', + port: 25, start_tls: true, - user: 'some@example.com', - password: 'password', + user: 'some@example.com', + password: 'password', } }, 'some@example.com', @@ -310,11 +310,11 @@ class EmailHelperTest < ActiveSupport::TestCase { adapter: 'smtp', options: { - host: 'www.znuny.com', - port: 26, + host: 'www.znuny.com', + port: 26, start_tls: true, - user: 'some@example.com', - password: 'password', + user: 'some@example.com', + password: 'password', } }, 'some@example.com', @@ -327,11 +327,11 @@ class EmailHelperTest < ActiveSupport::TestCase { adapter: 'smtp', options: { - host: '172.42.42.42', - port: 25, + host: '172.42.42.42', + port: 25, start_tls: true, - user: 'some@example.com', - password: 'password', + user: 'some@example.com', + password: 'password', } }, 'some@example.com', @@ -345,11 +345,11 @@ class EmailHelperTest < ActiveSupport::TestCase { adapter: 'smtp', options: { - host: 'smtp.gmail.com', - port: 25, + host: 'smtp.gmail.com', + port: 25, start_tls: true, - user: 'some@example.com', - password: 'password', + user: 'some@example.com', + password: 'password', } }, 'some@example.com', @@ -362,11 +362,11 @@ class EmailHelperTest < ActiveSupport::TestCase { adapter: 'smtp', options: { - host: 'smtp.gmail.com', - port: 25, + host: 'smtp.gmail.com', + port: 25, start_tls: true, - user: 'frank.tailor05@googlemail.com', - password: 'password', + user: 'frank.tailor05@googlemail.com', + password: 'password', } }, 'some@example.com', @@ -386,11 +386,11 @@ class EmailHelperTest < ActiveSupport::TestCase { adapter: 'smtp', options: { - host: 'arber.znuny.com', - port: 25, + host: 'arber.znuny.com', + port: 25, start_tls: true, - user: 'some@example.com', - password: 'password', + user: 'some@example.com', + password: 'password', } }, 'some@example.com', @@ -411,11 +411,11 @@ class EmailHelperTest < ActiveSupport::TestCase { adapter: 'smtp', options: { - host: 'arber.znuny.com', - port: 25, + host: 'arber.znuny.com', + port: 25, start_tls: true, - user: user, - password: mailbox_password, + user: user, + password: mailbox_password, } }, mailbox_user, @@ -426,7 +426,7 @@ class EmailHelperTest < ActiveSupport::TestCase test 'zz probe' do result = EmailHelper::Probe.full( - email: 'invalid_format', + email: 'invalid_format', password: 'somepass', ) assert_equal('invalid', result[:result]) @@ -441,7 +441,7 @@ class EmailHelperTest < ActiveSupport::TestCase mailbox_password = ENV['EMAILHELPER_MAILBOX_1'].split(':')[1] result = EmailHelper::Probe.full( - email: mailbox_user, + email: mailbox_user, password: mailbox_password, ) assert_equal('ok', result[:result]) @@ -457,7 +457,7 @@ class EmailHelperTest < ActiveSupport::TestCase mailbox_password = ENV['EMAILHELPER_MAILBOX_2'].split(':')[1] result = EmailHelper::Probe.full( - email: mailbox_user, + email: mailbox_user, password: mailbox_password, ) assert_nil(result[:reason]) @@ -478,27 +478,27 @@ class EmailHelperTest < ActiveSupport::TestCase mailbox_password = ENV['EMAILHELPER_MAILBOX_1'].split(':')[1] user, domain = EmailHelper.parse_email(mailbox_user) result = EmailHelper::Verify.email( - inbound: { + inbound: { adapter: 'imap', options: { - host: 'arber.znuny.com', - port: 993, - ssl: true, - user: user, + host: 'arber.znuny.com', + port: 993, + ssl: true, + user: user, password: mailbox_password, }, }, outbound: { adapter: 'smtp', options: { - host: 'arber.znuny.com', - port: 25, + host: 'arber.znuny.com', + port: 25, start_tls: true, - user: user, - password: mailbox_password, + user: user, + password: mailbox_password, }, }, - sender: mailbox_user, + sender: mailbox_user, ) assert_equal('ok', result[:result]) @@ -511,27 +511,27 @@ class EmailHelperTest < ActiveSupport::TestCase mailbox_password = ENV['EMAILHELPER_MAILBOX_2'].split(':')[1] user, domain = EmailHelper.parse_email(mailbox_user) result = EmailHelper::Verify.email( - inbound: { + inbound: { adapter: 'pop3', options: { - host: 'pop.gmail.com', - port: 995, - ssl: true, - user: mailbox_user, + host: 'pop.gmail.com', + port: 995, + ssl: true, + user: mailbox_user, password: mailbox_password, }, }, outbound: { adapter: 'smtp', options: { - host: 'smtp.gmail.com', - port: 25, + host: 'smtp.gmail.com', + port: 25, start_tls: true, - user: mailbox_user, - password: mailbox_password, + user: mailbox_user, + password: mailbox_password, }, }, - sender: mailbox_user, + sender: mailbox_user, ) assert_equal('ok', result[:result]) diff --git a/test/integration/email_keep_on_server_test.rb b/test/integration/email_keep_on_server_test.rb index 7d3fd7ec8..b37504dd5 100644 --- a/test/integration/email_keep_on_server_test.rb +++ b/test/integration/email_keep_on_server_test.rb @@ -17,31 +17,31 @@ class EmailKeepOnServerTest < ActiveSupport::TestCase @folder = "keep_on_mail_server_#{rand(999_999_999)}" email_address = EmailAddress.create!( - realname: 'me Helpdesk', - email: "me#{rand(999_999_999)}@example.com", + realname: 'me Helpdesk', + email: "me#{rand(999_999_999)}@example.com", updated_by_id: 1, created_by_id: 1, ) group = Group.create_or_update( - name: 'KeepOnServerTest', + name: 'KeepOnServerTest', email_address_id: email_address.id, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) @channel = Channel.create!( - area: 'Email::Account', - group_id: group.id, - options: { - inbound: { + area: 'Email::Account', + group_id: group.id, + options: { + inbound: { adapter: 'imap', options: { - host: ENV['KEEP_ON_MAIL_SERVER'], - user: @server_login, + host: ENV['KEEP_ON_MAIL_SERVER'], + user: @server_login, password: @server_password, - ssl: true, - folder: @folder, + ssl: true, + folder: @folder, #keep_on_server: true, } }, @@ -49,7 +49,7 @@ class EmailKeepOnServerTest < ActiveSupport::TestCase adapter: 'sendmail' } }, - active: true, + active: true, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/integration/facebook_browser_test.rb b/test/integration/facebook_browser_test.rb index 4972f224b..7ab9e30f4 100644 --- a/test/integration/facebook_browser_test.rb +++ b/test/integration/facebook_browser_test.rb @@ -40,9 +40,9 @@ class FacebookBrowserTest < TestCase @browser = browser_instance login( - username: 'master@example.com', - password: 'test', - url: browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, auto_wizard: true, ) tasks_close_all() @@ -53,78 +53,78 @@ class FacebookBrowserTest < TestCase click(css: '.content.active .js-configApp') modal_ready() set( - css: '.content.active .modal [name=application_id]', + css: '.content.active .modal [name=application_id]', value: app_id, ) set( - css: '.content.active .modal [name=application_secret]', + css: '.content.active .modal [name=application_secret]', value: 'wrong', ) click(css: '.content.active .modal .js-submit') watch_for( - css: '.content.active .modal .alert', + css: '.content.active .modal .alert', value: 'Error', ) set( - css: '.content.active .modal [name=application_secret]', + css: '.content.active .modal [name=application_secret]', value: app_secret, ) click(css: '.content.active .modal .js-submit') watch_for_disappear( - css: '.content.active .modal .alert', + css: '.content.active .modal .alert', value: 'Error', ) watch_for( - css: '.content.active .js-new', + css: '.content.active .js-new', value: 'add account', ) click(css: '.content.active .js-configApp') modal_ready() set( - css: '.content.active .modal [name=application_secret]', + css: '.content.active .modal [name=application_secret]', value: 'wrong', ) click(css: '.content.active .modal .js-submit') watch_for( - css: '.content.active .modal .alert', + css: '.content.active .modal .alert', value: 'Error', ) set( - css: '.content.active .modal [name=application_secret]', + css: '.content.active .modal [name=application_secret]', value: app_secret, ) click(css: '.content.active .modal .js-submit') watch_for_disappear( - css: '.content.active .modal .alert', + css: '.content.active .modal .alert', value: 'Error', ) watch_for( - css: '.content.active .js-new', + css: '.content.active .js-new', value: 'add account', ) click(css: '.content.active .js-new') watch_for( - css: 'body', + css: 'body', value: '(Facebook Login|Log into Facebook)', ) set( - css: '#email', + css: '#email', value: user_login, ) set( - css: '#pass', + css: '#pass', value: user_pw, ) click(css: '#loginbutton') @@ -141,7 +141,7 @@ class FacebookBrowserTest < TestCase #) watch_for( - css: '#navigation', + css: '#navigation', value: 'Dashboard', ) @@ -151,7 +151,7 @@ class FacebookBrowserTest < TestCase sleep 5 watch_for( - css: '.content.active', + css: '.content.active', value: 'Hansi Merkur', ) exists( @@ -175,7 +175,7 @@ class FacebookBrowserTest < TestCase click(css: '.content.active .modal .js-close') watch_for( - css: '.content.active', + css: '.content.active', value: 'Hansi Merkur', ) exists( @@ -204,8 +204,8 @@ class FacebookBrowserTest < TestCase post = customer_client.put_wall_post(message, {}, page_id) watch_for( - css: '.content.active', - value: hash, + css: '.content.active', + value: hash, timeout: 320, ) sleep 6 @@ -226,7 +226,7 @@ class FacebookBrowserTest < TestCase sleep 20 match( - css: '.content.active .ticket-article', + css: '.content.active .ticket-article', value: re_hash, ) diff --git a/test/integration/facebook_test.rb b/test/integration/facebook_test.rb index 2bf801efe..916fece9d 100644 --- a/test/integration/facebook_test.rb +++ b/test/integration/facebook_test.rb @@ -9,8 +9,8 @@ class FacebookTest < ActiveSupport::TestCase # needed to check correct behavior group = Group.create_if_not_exists( - name: 'Facebook', - note: 'All Facebook feed posts.', + name: 'Facebook', + note: 'All Facebook feed posts.', updated_by_id: 1, created_by_id: 1 ) @@ -42,21 +42,21 @@ class FacebookTest < ActiveSupport::TestCase provider_options = { adapter: 'facebook', - auth: { + auth: { access_token: user_access_token }, - user: { + user: { name: user_name, - id: user_id, + id: user_id, }, - pages: [ + pages: [ { - 'id' => page_id, - 'name' => page_name, + 'id' => page_id, + 'name' => page_name, 'access_token' => page_access_token, } ], - sync: { + sync: { pages: { page_id => { 'group_id' => group.id.to_s }, } diff --git a/test/integration/geo_location_test.rb b/test/integration/geo_location_test.rb index ea4219ec2..ce0b0ae32 100644 --- a/test/integration/geo_location_test.rb +++ b/test/integration/geo_location_test.rb @@ -61,13 +61,13 @@ class GeoLocationTest < ActiveSupport::TestCase end user1 = User.create( - login: 'some_geo_login1', - firstname: 'First', - lastname: 'Last', - email: 'some_geo_login1@example.com', - password: 'test', - address: 'Marienstrasse 13 10117 Berlin', - active: false, + login: 'some_geo_login1', + firstname: 'First', + lastname: 'Last', + email: 'some_geo_login1@example.com', + password: 'test', + address: 'Marienstrasse 13 10117 Berlin', + active: false, updated_by_id: 1, created_by_id: 1 ) @@ -83,15 +83,15 @@ class GeoLocationTest < ActiveSupport::TestCase end user2 = User.create( - login: 'some_geo_login2', - firstname: 'First', - lastname: 'Last', - email: 'some_geo_login2@example.com', - password: 'test', - street: 'Marienstrasse 13', - city: 'Berlin', - zip: '10117', - active: false, + login: 'some_geo_login2', + firstname: 'First', + lastname: 'Last', + email: 'some_geo_login2@example.com', + password: 'test', + street: 'Marienstrasse 13', + city: 'Berlin', + zip: '10117', + active: false, updated_by_id: 1, created_by_id: 1 ) @@ -107,13 +107,13 @@ class GeoLocationTest < ActiveSupport::TestCase end user3 = User.create( - login: 'some_geo_login3', - firstname: 'First', - lastname: 'Last', - email: 'some_geo_login3@example.com', - password: 'test', - address: 'Martinsbruggstrasse 35, 9016 St. Gallen', - active: false, + login: 'some_geo_login3', + firstname: 'First', + lastname: 'Last', + email: 'some_geo_login3@example.com', + password: 'test', + address: 'Martinsbruggstrasse 35, 9016 St. Gallen', + active: false, updated_by_id: 1, created_by_id: 1 ) @@ -129,15 +129,15 @@ class GeoLocationTest < ActiveSupport::TestCase end user4 = User.create( - login: 'some_geo_login4', - firstname: 'First', - lastname: 'Last', - email: 'some_geo_login4@example.com', - password: 'test', - street: 'Martinsbruggstrasse 35', - city: 'St. Gallen', - zip: '9016', - active: false, + login: 'some_geo_login4', + firstname: 'First', + lastname: 'Last', + email: 'some_geo_login4@example.com', + password: 'test', + street: 'Martinsbruggstrasse 35', + city: 'St. Gallen', + zip: '9016', + active: false, updated_by_id: 1, created_by_id: 1 ) diff --git a/test/integration/idoit_browser_test.rb b/test/integration/idoit_browser_test.rb index a9c813276..f2ca456e1 100644 --- a/test/integration/idoit_browser_test.rb +++ b/test/integration/idoit_browser_test.rb @@ -23,9 +23,9 @@ class IntegrationIdoitTest < TestCase id = rand(99_999_999) @browser = browser_instance login( - username: 'master@example.com', - password: 'test', - url: browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, auto_wizard: true, ) @@ -34,33 +34,33 @@ class IntegrationIdoitTest < TestCase click(css: 'a[href="#system/integration"]') click(css: 'a[href="#system/integration/idoit"]') switch( - css: '.content.active .js-switch', + css: '.content.active .js-switch', type: 'on' ) # fill in i-doit login details set( - css: '.content.active .main input[name="api_token"]', + css: '.content.active .main input[name="api_token"]', value: api_token, ) set( - css: '.content.active .main input[name="endpoint"]', + css: '.content.active .main input[name="endpoint"]', value: api_endpoint, ) click(css: '.content.active .main .js-submit') watch_for( - css: '#notify', + css: '#notify', value: 'update successful', ) # new create a new ticket with an i-doit object ticket = ticket_create( - data: { + data: { customer: 'nico', - group: 'Users', - title: 'subject - i-doit integration #1', - body: 'body - i-doit integration', + group: 'Users', + title: 'subject - i-doit integration #1', + body: 'body - i-doit integration', }, do_not_submit: true, ) @@ -116,11 +116,11 @@ class IntegrationIdoitTest < TestCase # new create a new ticket with an i-doit object ticket = ticket_create( - data: { + data: { customer: 'nico', - group: 'Users', - title: 'subject - i-doit integration #2', - body: 'body - i-doit integration', + group: 'Users', + title: 'subject - i-doit integration #2', + body: 'body - i-doit integration', }, do_not_submit: true, ) @@ -181,7 +181,7 @@ class IntegrationIdoitTest < TestCase css: ".content.active .sidebar[data-tab='idoit'] .sidebar-content", ) match( - css: ".content.active .sidebar[data-tab='idoit'] .sidebar-content", + css: ".content.active .sidebar[data-tab='idoit'] .sidebar-content", value: 'none', ) exists_not( @@ -233,7 +233,7 @@ class IntegrationIdoitTest < TestCase click(css: 'a[href="#system/integration/idoit"]') switch( - css: '.content.active .js-switch', + css: '.content.active .js-switch', type: 'off' ) end diff --git a/test/integration/object_manager_test.rb b/test/integration/object_manager_test.rb index 8a4302341..a43ebb46a 100644 --- a/test/integration/object_manager_test.rb +++ b/test/integration/object_manager_test.rb @@ -14,22 +14,22 @@ class ObjectManagerTest < ActiveSupport::TestCase # create simple attribute attribute1 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test1', - display: 'Test 1', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'test1', + display: 'Test 1', + data_type: 'input', + data_option: { maxlength: 200, - type: 'text', - null: false, + type: 'text', + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, - editable: false, - to_migrate: false, + editable: false, + to_migrate: false, ) assert(attribute1) assert_equal('test1', attribute1.name) @@ -41,7 +41,7 @@ class ObjectManagerTest < ActiveSupport::TestCase attribute1 = ObjectManager::Attribute.get( object: 'Ticket', - name: 'test1', + name: 'test1', ) assert(attribute1) assert_equal('test1', attribute1.name) @@ -54,12 +54,12 @@ class ObjectManagerTest < ActiveSupport::TestCase # delete attribute without execute migrations ObjectManager::Attribute.remove( object: 'Ticket', - name: 'test1', + name: 'test1', ) attribute1 = ObjectManager::Attribute.get( object: 'Ticket', - name: 'test1', + name: 'test1', ) assert_not(attribute1) @@ -68,81 +68,81 @@ class ObjectManagerTest < ActiveSupport::TestCase attribute1 = ObjectManager::Attribute.get( object: 'Ticket', - name: 'test1', + name: 'test1', ) assert_not(attribute1) # create invalid attributes assert_raises(RuntimeError) do attribute2 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test2_id', - display: 'Test 2 with id', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'test2_id', + display: 'Test 2 with id', + data_type: 'input', + data_option: { maxlength: 200, - type: 'text', - null: false, + type: 'text', + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) end assert_raises(RuntimeError) do attribute3 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test3_ids', - display: 'Test 3 with id', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'test3_ids', + display: 'Test 3 with id', + data_type: 'input', + data_option: { maxlength: 200, - type: 'text', - null: false, + type: 'text', + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) end assert_raises(ActiveRecord::RecordInvalid) do attribute4 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test4', - display: 'Test 4 with missing data_option[:type]', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'test4', + display: 'Test 4 with missing data_option[:type]', + data_type: 'input', + data_option: { maxlength: 200, - null: false, + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) end attribute5 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test5', - display: 'Test 5', - data_type: 'boolean', - data_option: { + object: 'Ticket', + name: 'test5', + display: 'Test 5', + data_type: 'boolean', + data_option: { default: true, options: { - true: 'Yes', + true: 'Yes', false: 'No', }, - null: false, + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -150,46 +150,46 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_equal('test5', attribute5.name) ObjectManager::Attribute.remove( object: 'Ticket', - name: 'test5', + name: 'test5', ) assert_raises(ActiveRecord::RecordInvalid) do attribute6 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test6', - display: 'Test 6', - data_type: 'boolean', - data_option: { + object: 'Ticket', + name: 'test6', + display: 'Test 6', + data_type: 'boolean', + data_option: { options: { - true: 'Yes', + true: 'Yes', false: 'No', }, - null: false, + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) end attribute7 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test7', - display: 'Test 7', - data_type: 'select', - data_option: { + object: 'Ticket', + name: 'test7', + display: 'Test 7', + data_type: 'select', + data_option: { default: 1, options: { '1' => 'aa', '2' => 'bb', }, - null: false, + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -197,41 +197,41 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_equal('test7', attribute7.name) ObjectManager::Attribute.remove( object: 'Ticket', - name: 'test7', + name: 'test7', ) assert_raises(ActiveRecord::RecordInvalid) do attribute8 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test8', - display: 'Test 8', - data_type: 'select', - data_option: { + object: 'Ticket', + name: 'test8', + display: 'Test 8', + data_type: 'select', + data_option: { default: 1, - null: false, + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) end attribute9 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test9', - display: 'Test 9', - data_type: 'datetime', - data_option: { + object: 'Ticket', + name: 'test9', + display: 'Test 9', + data_type: 'datetime', + data_option: { future: true, - past: false, - diff: 24, - null: true, + past: false, + diff: 24, + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -239,42 +239,42 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_equal('test9', attribute9.name) ObjectManager::Attribute.remove( object: 'Ticket', - name: 'test9', + name: 'test9', ) assert_raises(ActiveRecord::RecordInvalid) do attribute10 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test10', - display: 'Test 10', - data_type: 'datetime', - data_option: { + object: 'Ticket', + name: 'test10', + display: 'Test 10', + data_type: 'datetime', + data_option: { past: false, diff: 24, null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) end attribute11 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test11', - display: 'Test 11', - data_type: 'date', - data_option: { + object: 'Ticket', + name: 'test11', + display: 'Test 11', + data_type: 'date', + data_option: { future: true, - past: false, - diff: 24, - null: true, + past: false, + diff: 24, + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -282,23 +282,23 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_equal('test11', attribute11.name) ObjectManager::Attribute.remove( object: 'Ticket', - name: 'test11', + name: 'test11', ) assert_raises(ActiveRecord::RecordInvalid) do attribute12 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test12', - display: 'Test 12', - data_type: 'date', - data_option: { + object: 'Ticket', + name: 'test12', + display: 'Test 12', + data_type: 'date', + data_option: { past: false, diff: 24, null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -307,19 +307,19 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_raises(RuntimeError) do attribute13 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test13|', - display: 'Test 13', - data_type: 'date', - data_option: { + object: 'Ticket', + name: 'test13|', + display: 'Test 13', + data_type: 'date', + data_option: { future: true, - past: false, - diff: 24, - null: true, + past: false, + diff: 24, + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -328,19 +328,19 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_raises(RuntimeError) do attribute14 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test14!', - display: 'Test 14', - data_type: 'date', - data_option: { + object: 'Ticket', + name: 'test14!', + display: 'Test 14', + data_type: 'date', + data_option: { future: true, - past: false, - diff: 24, - null: true, + past: false, + diff: 24, + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -349,19 +349,19 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_raises(RuntimeError) do attribute15 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test15ä', - display: 'Test 15', - data_type: 'date', - data_option: { + object: 'Ticket', + name: 'test15ä', + display: 'Test 15', + data_type: 'date', + data_option: { future: true, - past: false, - diff: 24, - null: true, + past: false, + diff: 24, + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -372,17 +372,17 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_raises(ActiveRecord::RecordInvalid) do attribute17 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'test17', - display: 'Test 17', - data_type: 'integer', - data_option: { + object: 'Ticket', + name: 'test17', + display: 'Test 17', + data_type: 'integer', + data_option: { default: 2, - min: 1, + min: 1, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -391,18 +391,18 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_raises(RuntimeError) do attribute18 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'delete', - display: 'Test 18', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'delete', + display: 'Test 18', + data_type: 'input', + data_option: { maxlength: 200, - type: 'text', - null: false, + type: 'text', + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -412,19 +412,19 @@ class ObjectManagerTest < ActiveSupport::TestCase attribute_count = ObjectManager::Attribute.count assert_raises(RuntimeError) do attribute19 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'updated_at', - display: 'Update Time', - data_type: 'datetime', - data_option: { + object: 'Ticket', + name: 'updated_at', + display: 'Update Time', + data_type: 'datetime', + data_option: { future: true, - past: true, - diff: 24, - null: true, + past: true, + diff: 24, + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -434,19 +434,19 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_raises(RuntimeError) do attribute20 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'updated_AT', - display: 'Update Time', - data_type: 'datetime', - data_option: { + object: 'Ticket', + name: 'updated_AT', + display: 'Update Time', + data_type: 'datetime', + data_option: { future: true, - past: true, - diff: 24, - null: true, + past: true, + diff: 24, + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -464,18 +464,18 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_equal(0, ObjectManager::Attribute.migrations.count) attribute1 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'attribute1', - display: 'Attribute 1', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'attribute1', + display: 'Attribute 1', + data_type: 'input', + data_option: { maxlength: 200, - type: 'text', - null: true, + type: 'text', + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -494,12 +494,12 @@ class ObjectManagerTest < ActiveSupport::TestCase # create example ticket ticket1 = Ticket.create( - title: 'some attribute test1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - attribute1: 'some attribute text', + title: 'some attribute test1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + attribute1: 'some attribute text', updated_by_id: 1, created_by_id: 1, ) @@ -512,55 +512,55 @@ class ObjectManagerTest < ActiveSupport::TestCase # add additional attributes attribute2 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'attribute2', - display: 'Attribute 2', - data_type: 'select', - data_option: { + object: 'Ticket', + name: 'attribute2', + display: 'Attribute 2', + data_type: 'select', + data_option: { default: '2', options: { '1' => 'aa', '2' => 'bb', }, - null: true, + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) attribute3 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'attribute3', - display: 'Attribute 3', - data_type: 'datetime', - data_option: { + object: 'Ticket', + name: 'attribute3', + display: 'Attribute 3', + data_type: 'datetime', + data_option: { future: true, - past: false, - diff: 24, - null: true, + past: false, + diff: 24, + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) attribute4 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'attribute4', - display: 'Attribute 4', - data_type: 'datetime', - data_option: { + object: 'Ticket', + name: 'attribute4', + display: 'Attribute 4', + data_type: 'datetime', + data_option: { future: true, - past: false, - diff: 24, - null: true, + past: false, + diff: 24, + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -572,15 +572,15 @@ class ObjectManagerTest < ActiveSupport::TestCase # create example ticket ticket2 = Ticket.create( - title: 'some attribute test2', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - attribute1: 'some attribute text', - attribute2: '1', - attribute3: Time.zone.parse('2016-05-12 00:59:59 UTC'), - attribute4: Date.parse('2016-05-11'), + title: 'some attribute test2', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + attribute1: 'some attribute text', + attribute2: '1', + attribute3: Time.zone.parse('2016-05-12 00:59:59 UTC'), + attribute4: Date.parse('2016-05-11'), updated_by_id: 1, created_by_id: 1, ) @@ -596,18 +596,18 @@ class ObjectManagerTest < ActiveSupport::TestCase # update data_option null -> to_config attribute1 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'attribute1', - display: 'Attribute 1', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'attribute1', + display: 'Attribute 1', + data_type: 'input', + data_option: { maxlength: 200, - type: 'text', - null: false, + type: 'text', + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -628,18 +628,18 @@ class ObjectManagerTest < ActiveSupport::TestCase # update data_option maxlength -> to_config && to_migrate attribute1 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'attribute1', - display: 'Attribute 1', - data_type: 'input', - data_option: { + object: 'Ticket', + name: 'attribute1', + display: 'Attribute 1', + data_type: 'input', + data_option: { maxlength: 250, - type: 'text', - null: false, + type: 'text', + null: false, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -661,19 +661,19 @@ class ObjectManagerTest < ActiveSupport::TestCase # remove attribute ObjectManager::Attribute.remove( object: 'Ticket', - name: 'attribute1', + name: 'attribute1', ) ObjectManager::Attribute.remove( object: 'Ticket', - name: 'attribute2', + name: 'attribute2', ) ObjectManager::Attribute.remove( object: 'Ticket', - name: 'attribute3', + name: 'attribute3', ) ObjectManager::Attribute.remove( object: 'Ticket', - name: 'attribute4', + name: 'attribute4', ) assert(ObjectManager::Attribute.migration_execute) @@ -697,18 +697,18 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_equal(0, ObjectManager::Attribute.migrations.count) attribute1 = ObjectManager::Attribute.add( - object: 'Ticket', - name: '1_a_anfrage_status', - display: '1_a_anfrage_status', - data_type: 'input', - data_option: { + object: 'Ticket', + name: '1_a_anfrage_status', + display: '1_a_anfrage_status', + data_type: 'input', + data_option: { maxlength: 200, - type: 'text', - null: true, + type: 'text', + null: true, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -727,14 +727,14 @@ class ObjectManagerTest < ActiveSupport::TestCase # create example ticket ticket1 = Ticket.create!( - title: 'some attribute test3', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some attribute test3', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), '1_a_anfrage_status': 'some attribute text', - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) assert('ticket1 created', ticket1) @@ -746,7 +746,7 @@ class ObjectManagerTest < ActiveSupport::TestCase condition = { 'ticket.title' => { operator: 'is', - value: 'some attribute test3', + value: 'some attribute test3', }, } ticket_count, tickets = Ticket.selectors(condition, 10) @@ -756,7 +756,7 @@ class ObjectManagerTest < ActiveSupport::TestCase condition = { 'ticket.1_a_anfrage_status' => { operator: 'is', - value: 'some attribute text', + value: 'some attribute text', }, } ticket_count, tickets = Ticket.selectors(condition, 10) @@ -764,40 +764,40 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_equal(tickets[0].id, ticket1.id) agent1 = User.create_or_update( - login: 'agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'agent1@example.com', - password: 'agentpw', - active: true, - roles: Role.where(name: 'Agent'), - groups: Group.all, + login: 'agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'agent1@example.com', + password: 'agentpw', + active: true, + roles: Role.where(name: 'Agent'), + groups: Group.all, updated_by_id: 1, created_by_id: 1, ) overview1 = Overview.create!( - name: 'Overview1', - link: 'my_overview', - roles: Role.all, - condition: { + name: 'Overview1', + link: 'my_overview', + roles: Role.all, + condition: { 'ticket.1_a_anfrage_status' => { operator: 'is', - value: 'some attribute text', + value: 'some attribute text', }, }, - order: { - by: '1_a_anfrage_status', + order: { + by: '1_a_anfrage_status', direction: 'DESC', }, - group_by: '1_a_anfrage_status', - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + group_by: '1_a_anfrage_status', + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, - prio: 1, + prio: 1, updated_by_id: 1, created_by_id: 1, ) @@ -821,20 +821,20 @@ class ObjectManagerTest < ActiveSupport::TestCase test 'd object manager attribute - update attribute type' do attribute1 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'example_1', - display: 'example_1', - data_type: 'input', - data_option: { - default: '', + object: 'Ticket', + name: 'example_1', + display: 'example_1', + data_type: 'input', + data_option: { + default: '', maxlength: 200, - type: 'text', - null: true, - options: {}, + type: 'text', + null: true, + options: {}, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -846,44 +846,44 @@ class ObjectManagerTest < ActiveSupport::TestCase assert_raises(ActiveRecord::RecordInvalid) do ObjectManager::Attribute.add( - object: 'Ticket', - name: 'example_1', - display: 'example_1', - data_type: 'boolean', - data_option: { + object: 'Ticket', + name: 'example_1', + display: 'example_1', + data_type: 'boolean', + data_option: { default: true, options: { - true: 'Yes', + true: 'Yes', false: 'No', }, - null: false, + null: false, }, - active: true, - screens: {}, - position: 200, + active: true, + screens: {}, + position: 200, created_by_id: 1, updated_by_id: 1, ) end attribute2 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'example_1', - display: 'example_1', - data_type: 'select', - data_option: { - default: '', + object: 'Ticket', + name: 'example_1', + display: 'example_1', + data_type: 'select', + data_option: { + default: '', maxlength: 200, - type: 'text', - null: true, - options: { + type: 'text', + null: true, + options: { aa: 'aa', bb: 'bb', }, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -899,45 +899,45 @@ class ObjectManagerTest < ActiveSupport::TestCase test 'overview any owner / no owner is set' do group = Group.create!( - name: 'OverviewTest', - updated_at: '2015-02-05 16:37:00', + name: 'OverviewTest', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Agent') agent1 = User.create!( - login: 'ticket-overview-agent1@example.com', - firstname: 'Overview', - lastname: 'Agent1', - email: 'ticket-overview-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: [group], - updated_at: '2015-02-05 16:37:00', + login: 'ticket-overview-agent1@example.com', + firstname: 'Overview', + lastname: 'Agent1', + email: 'ticket-overview-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: [group], + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) attribute1 = ObjectManager::Attribute.add( - object: 'Ticket', - name: 'watcher', - display: 'watcher', - data_type: 'select', - data_option: { - default: '', + object: 'Ticket', + name: 'watcher', + display: 'watcher', + data_type: 'select', + data_option: { + default: '', maxlength: 200, - type: 'text', - null: true, - options: { + type: 'text', + null: true, + options: { aa: 'agent a', bb: 'agent b', cc: 'agent c', }, }, - active: true, - screens: {}, - position: 20, + active: true, + screens: {}, + position: 20, created_by_id: 1, updated_by_id: 1, ) @@ -953,211 +953,211 @@ class ObjectManagerTest < ActiveSupport::TestCase UserInfo.current_user_id = 1 overview_role = Role.find_by(name: 'Agent') overview1 = Overview.create!( - name: 'not watched', - prio: 1000, - role_ids: [overview_role.id], + name: 'not watched', + prio: 1000, + role_ids: [overview_role.id], condition: { 'ticket.watcher' => { operator: 'is', - value: '', + value: '', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) overview2 = Overview.create!( - name: 'not watched by somebody', - prio: 2000, - role_ids: [overview_role.id], + name: 'not watched by somebody', + prio: 2000, + role_ids: [overview_role.id], condition: { 'ticket.watcher' => { operator: 'is not', - value: '', + value: '', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) overview3 = Overview.create!( - name: 'not watched as array', - prio: 3000, - role_ids: [overview_role.id], + name: 'not watched as array', + prio: 3000, + role_ids: [overview_role.id], condition: { 'ticket.watcher' => { operator: 'is', - value: [''], + value: [''], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) overview4 = Overview.create!( - name: 'not watched by somebody as array', - prio: 4000, - role_ids: [overview_role.id], + name: 'not watched by somebody as array', + prio: 4000, + role_ids: [overview_role.id], condition: { 'ticket.watcher' => { operator: 'is not', - value: [''], + value: [''], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) overview5 = Overview.create!( - name: 'watched by aa', - prio: 5000, - role_ids: [overview_role.id], + name: 'watched by aa', + prio: 5000, + role_ids: [overview_role.id], condition: { 'ticket.watcher' => { operator: 'is', - value: 'aa', + value: 'aa', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) overview6 = Overview.create!( - name: 'not watched by aa', - prio: 6000, - role_ids: [overview_role.id], + name: 'not watched by aa', + prio: 6000, + role_ids: [overview_role.id], condition: { 'ticket.watcher' => { operator: 'is not', - value: 'aa', + value: 'aa', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) overview7 = Overview.create!( - name: 'watched by aa array', - prio: 7000, - role_ids: [overview_role.id], + name: 'watched by aa array', + prio: 7000, + role_ids: [overview_role.id], condition: { 'ticket.watcher' => { operator: 'is', - value: ['aa'], + value: ['aa'], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) overview8 = Overview.create!( - name: 'not watched by aa array', - prio: 8000, - role_ids: [overview_role.id], + name: 'not watched by aa array', + prio: 8000, + role_ids: [overview_role.id], condition: { 'ticket.watcher' => { operator: 'is not', - value: ['aa'], + value: ['aa'], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) ticket1 = Ticket.create!( - title: 'overview test 1', - group: Group.lookup(name: 'OverviewTest'), + title: 'overview test 1', + group: Group.lookup(name: 'OverviewTest'), customer_id: 2, - owner_id: 1, - watcher: '', - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + owner_id: 1, + watcher: '', + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), ) travel 2.seconds ticket2 = Ticket.create!( - title: 'overview test 2', - group: Group.lookup(name: 'OverviewTest'), + title: 'overview test 2', + group: Group.lookup(name: 'OverviewTest'), customer_id: 2, - owner_id: nil, - watcher: nil, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + owner_id: nil, + watcher: nil, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), ) travel 2.seconds ticket3 = Ticket.create!( - title: 'overview test 3', - group: Group.lookup(name: 'OverviewTest'), + title: 'overview test 3', + group: Group.lookup(name: 'OverviewTest'), customer_id: 2, - owner_id: agent1.id, - watcher: 'aa', - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + owner_id: agent1.id, + watcher: 'aa', + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), ) result = Ticket::Overviews.index(agent1) diff --git a/test/integration/otrs_import_browser_test.rb b/test/integration/otrs_import_browser_test.rb index 71dbe083b..7d2bdcca1 100644 --- a/test/integration/otrs_import_browser_test.rb +++ b/test/integration/otrs_import_browser_test.rb @@ -27,7 +27,7 @@ class OtrsImportBrowserTest < TestCase sleep 5 watch_for( - css: '.otrs-link-error', + css: '.otrs-link-error', value: 'Invalid API key.', ) @@ -39,20 +39,20 @@ class OtrsImportBrowserTest < TestCase sleep 5 watch_for_disappear( - css: '.otrs-link-error', + css: '.otrs-link-error', value: 'Invalid API key.', ) click(css: '.js-migration-check') watch_for( - css: '.wizard-slide:not(.hide)', + css: '.wizard-slide:not(.hide)', value: 'Notice', ) click(css: '.js-migration-start') watch_for( - css: 'body', - value: 'login', + css: 'body', + value: 'login', timeout: 600, ) diff --git a/test/integration/package_test.rb b/test/integration/package_test.rb index 292f37395..2adaa7549 100644 --- a/test/integration/package_test.rb +++ b/test/integration/package_test.rb @@ -7,7 +7,7 @@ class PackageTest < ActiveSupport::TestCase # test 1 - normal install { - zpm: '{ + zpm: '{ "name": "UnitTestSample", "version": "1.0.1", "vendor": "Znuny GmbH", @@ -40,22 +40,22 @@ class PackageTest < ActiveSupport::TestCase action: 'install', result: true, verify: { - package: { - name: 'UnitTestSample', + package: { + name: 'UnitTestSample', version: '1.0.1', }, check_files: [ { location: 'test.txt', - result: true, + result: true, }, { location: 'test2.txt', - result: false, + result: false, }, { location: 'some/dir/test.txt', - result: true, + result: true, }, ], }, @@ -64,25 +64,25 @@ class PackageTest < ActiveSupport::TestCase # test 2 - renstall { action: 'reinstall', - name: 'UnitTestSample', + name: 'UnitTestSample', result: true, verify: { - package: { - name: 'UnitTestSample', + package: { + name: 'UnitTestSample', version: '1.0.1', }, check_files: [ { location: 'test.txt', - result: true, + result: true, }, { location: 'test2.txt', - result: false, + result: false, }, { location: 'some/dir/test.txt', - result: true, + result: true, }, ], }, @@ -90,7 +90,7 @@ class PackageTest < ActiveSupport::TestCase # test 3 - try to install same package again / should not work { - zpm: '{ + zpm: '{ "name": "UnitTestSample", "version": "1.0.1", "vendor": "Znuny GmbH", @@ -116,7 +116,7 @@ class PackageTest < ActiveSupport::TestCase # test 4 - try to install lower version / should not work { - zpm: '{ + zpm: '{ "name": "UnitTestSample", "version": "1.0.0", "vendor": "Znuny GmbH", @@ -142,7 +142,7 @@ class PackageTest < ActiveSupport::TestCase # test 5 - upgrade 7 should work { - zpm: '{ + zpm: '{ "name": "UnitTestSample", "version": "1.0.2", "vendor": "Znuny GmbH", @@ -175,26 +175,26 @@ class PackageTest < ActiveSupport::TestCase action: 'install', result: true, verify: { - package: { - name: 'UnitTestSample', + package: { + name: 'UnitTestSample', version: '1.0.2', }, check_files: [ { location: 'test.txt2', - result: true, + result: true, }, { location: 'test.txt', - result: false, + result: false, }, { location: 'test2.txt', - result: false, + result: false, }, { location: 'some/dir/test.txt2', - result: true, + result: true, }, ], }, @@ -202,19 +202,19 @@ class PackageTest < ActiveSupport::TestCase # test 6 - uninstall package / should work { - name: 'UnitTestSample', + name: 'UnitTestSample', version: '1.0.2', - action: 'uninstall', - result: true, - verify: { + action: 'uninstall', + result: true, + verify: { check_files: [ { location: 'test.txt', - result: false, + result: false, }, { location: 'test2.txt', - result: false, + result: false, }, ], }, @@ -222,7 +222,7 @@ class PackageTest < ActiveSupport::TestCase # test 7 - check auto_install mechanism { - zpm: '{ + zpm: '{ "name": "UnitTestSample", "version": "1.0.2", "vendor": "Znuny GmbH", @@ -255,26 +255,26 @@ class PackageTest < ActiveSupport::TestCase action: 'auto_install', result: true, verify: { - package: { - name: 'UnitTestSample', + package: { + name: 'UnitTestSample', version: '1.0.2', }, check_files: [ { location: 'test.txt2', - result: true, + result: true, }, { location: 'test.txt', - result: false, + result: false, }, { location: 'test2.txt', - result: false, + result: false, }, { location: 'some/dir/test.txt2', - result: true, + result: true, }, ], }, @@ -282,19 +282,19 @@ class PackageTest < ActiveSupport::TestCase # test 8 - check uninstall / should work { - name: 'UnitTestSample', + name: 'UnitTestSample', version: '1.0.2', - action: 'uninstall', - result: true, - verify: { + action: 'uninstall', + result: true, + verify: { check_files: [ { location: 'test.txt', - result: false, + result: false, }, { location: 'test2.txt', - result: false, + result: false, }, ], }, diff --git a/test/integration/report_test.rb b/test/integration/report_test.rb index 2c6f4e560..da72eb15b 100644 --- a/test/integration/report_test.rb +++ b/test/integration/report_test.rb @@ -13,272 +13,272 @@ class ReportTest < ActiveSupport::TestCase group1 = Group.lookup(name: 'Users') group2 = Group.create!( - name: 'Report Test', + name: 'Report Test', updated_by_id: 1, created_by_id: 1 ) @ticket1 = Ticket.create!( - title: 'test 1', - group: group2, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2015-10-28 09:30:00 UTC', - updated_at: '2015-10-28 09:30:00 UTC', + title: 'test 1', + group: group2, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2015-10-28 09:30:00 UTC', + updated_at: '2015-10-28 09:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: @ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_inbound', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, - created_at: '2015-10-28 09:30:00 UTC', - updated_at: '2015-10-28 09:30:00 UTC', + ticket_id: @ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_inbound', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + created_at: '2015-10-28 09:30:00 UTC', + updated_at: '2015-10-28 09:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @ticket1.tag_add('aaa', 1) @ticket1.tag_add('bbb', 1) @ticket1.update!( - group: Group.lookup(name: 'Users'), + group: Group.lookup(name: 'Users'), updated_at: '2015-10-28 14:30:00 UTC', ) @ticket2 = Ticket.create!( - title: 'test 2', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2015-10-28 09:30:01 UTC', - updated_at: '2015-10-28 09:30:01 UTC', + title: 'test 2', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2015-10-28 09:30:01 UTC', + updated_at: '2015-10-28 09:30:01 UTC', updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: @ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_inbound', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, - created_at: '2015-10-28 09:30:01 UTC', - updated_at: '2015-10-28 09:30:01 UTC', + ticket_id: @ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_inbound', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + created_at: '2015-10-28 09:30:01 UTC', + updated_at: '2015-10-28 09:30:01 UTC', updated_by_id: 1, created_by_id: 1, ) @ticket2.tag_add('aaa', 1) @ticket2.update!( - group_id: group2.id, + group_id: group2.id, updated_at: '2015-10-28 14:30:00 UTC', ) @ticket3 = Ticket.create!( - title: 'test 3', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '3 high'), - created_at: '2015-10-28 10:30:00 UTC', - updated_at: '2015-10-28 10:30:00 UTC', + title: 'test 3', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '3 high'), + created_at: '2015-10-28 10:30:00 UTC', + updated_at: '2015-10-28 10:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: @ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_inbound', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, - created_at: '2015-10-28 10:30:00 UTC', - updated_at: '2015-10-28 10:30:00 UTC', + ticket_id: @ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_inbound', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + created_at: '2015-10-28 10:30:00 UTC', + updated_at: '2015-10-28 10:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @ticket4 = Ticket.create!( - title: 'test 4', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), - close_at: '2015-10-28 11:30:00 UTC', - created_at: '2015-10-28 10:30:01 UTC', - updated_at: '2015-10-28 10:30:01 UTC', + title: 'test 4', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), + close_at: '2015-10-28 11:30:00 UTC', + created_at: '2015-10-28 10:30:01 UTC', + updated_at: '2015-10-28 10:30:01 UTC', updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: @ticket4.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_inbound', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, - created_at: '2015-10-28 10:30:01 UTC', - updated_at: '2015-10-28 10:30:01 UTC', + ticket_id: @ticket4.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_inbound', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, + created_at: '2015-10-28 10:30:01 UTC', + updated_at: '2015-10-28 10:30:01 UTC', updated_by_id: 1, created_by_id: 1, ) @ticket5 = Ticket.create!( - title: 'test 5', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '3 high'), - close_at: '2015-10-28 11:40:00 UTC', - created_at: '2015-10-28 11:30:00 UTC', - updated_at: '2015-10-28 11:30:00 UTC', + title: 'test 5', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '3 high'), + close_at: '2015-10-28 11:40:00 UTC', + created_at: '2015-10-28 11:30:00 UTC', + updated_at: '2015-10-28 11:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: @ticket5.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_outbound', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, - created_at: '2015-10-28 11:30:00 UTC', - updated_at: '2015-10-28 11:30:00 UTC', + ticket_id: @ticket5.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_outbound', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, + created_at: '2015-10-28 11:30:00 UTC', + updated_at: '2015-10-28 11:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @ticket5.tag_add('bbb', 1) @ticket5.update!( - state: Ticket::State.lookup(name: 'open'), + state: Ticket::State.lookup(name: 'open'), updated_at: '2015-10-28 14:30:00 UTC', ) @ticket6 = Ticket.create!( - title: 'test 6', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), - close_at: '2015-10-31 12:35:00 UTC', - created_at: '2015-10-31 12:30:00 UTC', - updated_at: '2015-10-31 12:30:00 UTC', + title: 'test 6', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), + close_at: '2015-10-31 12:35:00 UTC', + created_at: '2015-10-31 12:30:00 UTC', + updated_at: '2015-10-31 12:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: @ticket6.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_outbound', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, - created_at: '2015-10-31 12:30:00 UTC', - updated_at: '2015-10-31 12:30:00 UTC', + ticket_id: @ticket6.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_outbound', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, + created_at: '2015-10-31 12:30:00 UTC', + updated_at: '2015-10-31 12:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @ticket7 = Ticket.create!( - title: 'test 7', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), - close_at: '2015-11-01 12:30:00 UTC', - created_at: '2015-11-01 12:30:00 UTC', - updated_at: '2015-11-01 12:30:00 UTC', + title: 'test 7', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), + close_at: '2015-11-01 12:30:00 UTC', + created_at: '2015-11-01 12:30:00 UTC', + updated_at: '2015-11-01 12:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: @ticket7.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_outbound', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, - created_at: '2015-11-01 12:30:00 UTC', - updated_at: '2015-11-01 12:30:00 UTC', + ticket_id: @ticket7.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_outbound', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, + created_at: '2015-11-01 12:30:00 UTC', + updated_at: '2015-11-01 12:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @ticket8 = Ticket.create!( - title: 'test 8', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'merged'), - priority: Ticket::Priority.lookup(name: '2 normal'), - close_at: '2015-11-02 12:30:00 UTC', - created_at: '2015-11-02 12:30:00 UTC', - updated_at: '2015-11-02 12:30:00 UTC', + title: 'test 8', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'merged'), + priority: Ticket::Priority.lookup(name: '2 normal'), + close_at: '2015-11-02 12:30:00 UTC', + created_at: '2015-11-02 12:30:00 UTC', + updated_at: '2015-11-02 12:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: @ticket8.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_outbound', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, - created_at: '2015-11-02 12:30:00 UTC', - updated_at: '2015-11-02 12:30:00 UTC', + ticket_id: @ticket8.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_outbound', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, + created_at: '2015-11-02 12:30:00 UTC', + updated_at: '2015-11-02 12:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @ticket9 = Ticket.create!( - title: 'test 9', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '2 normal'), - close_at: '2037-11-02 12:30:00 UTC', - created_at: '2037-11-02 12:30:00 UTC', - updated_at: '2037-11-02 12:30:00 UTC', + title: 'test 9', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '2 normal'), + close_at: '2037-11-02 12:30:00 UTC', + created_at: '2037-11-02 12:30:00 UTC', + updated_at: '2037-11-02 12:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: @ticket9.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_outbound', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, - created_at: '2037-11-02 12:30:00 UTC', - updated_at: '2037-11-02 12:30:00 UTC', + ticket_id: @ticket9.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_outbound', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, + created_at: '2037-11-02 12:30:00 UTC', + updated_at: '2037-11-02 12:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -330,7 +330,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.priority_id' => { 'operator' => 'is', - 'value' => [Ticket::Priority.lookup(name: '3 high').id], + 'value' => [Ticket::Priority.lookup(name: '3 high').id], } }, # ticket selector to get only a collection of tickets ) @@ -355,7 +355,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.priority_id' => { 'operator' => 'is', - 'value' => [Ticket::Priority.lookup(name: '3 high').id], + 'value' => [Ticket::Priority.lookup(name: '3 high').id], } }, # ticket selector to get only a collection of tickets ) @@ -371,7 +371,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket_state.name' => { 'operator' => 'is not', - 'value' => 'merged', + 'value' => 'merged', } }, # ticket selector to get only a collection of tickets ) @@ -396,7 +396,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket_state.name' => { 'operator' => 'is not', - 'value' => 'merged', + 'value' => 'merged', } }, # ticket selector to get only a collection of tickets ) @@ -412,7 +412,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.priority_id' => { 'operator' => 'is not', - 'value' => [Ticket::Priority.lookup(name: '3 high').id], + 'value' => [Ticket::Priority.lookup(name: '3 high').id], } }, # ticket selector to get only a collection of tickets ) @@ -437,7 +437,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.priority_id' => { 'operator' => 'is not', - 'value' => [Ticket::Priority.lookup(name: '3 high').id], + 'value' => [Ticket::Priority.lookup(name: '3 high').id], } }, # ticket selector to get only a collection of tickets ) @@ -610,7 +610,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.priority_id' => { 'operator' => 'is', - 'value' => [Ticket::Priority.lookup(name: '3 high').id], + 'value' => [Ticket::Priority.lookup(name: '3 high').id], } }, # ticket selector to get only a collection of tickets ) @@ -635,7 +635,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.priority_id' => { 'operator' => 'is', - 'value' => [Ticket::Priority.lookup(name: '3 high').id], + 'value' => [Ticket::Priority.lookup(name: '3 high').id], } }, # ticket selector to get only a collection of tickets ) @@ -651,7 +651,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.priority_id' => { 'operator' => 'is not', - 'value' => [Ticket::Priority.lookup(name: '3 high').id], + 'value' => [Ticket::Priority.lookup(name: '3 high').id], } }, # ticket selector to get only a collection of tickets ) @@ -676,7 +676,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.priority_id' => { 'operator' => 'is not', - 'value' => [Ticket::Priority.lookup(name: '3 high').id], + 'value' => [Ticket::Priority.lookup(name: '3 high').id], } }, # ticket selector to get only a collection of tickets ) @@ -691,7 +691,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket_state.name' => { 'operator' => 'is not', - 'value' => 'merged', + 'value' => 'merged', } }, # ticket selector to get only a collection of tickets ) @@ -716,7 +716,7 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket_state.name' => { 'operator' => 'is not', - 'value' => 'merged', + 'value' => 'merged', } }, # ticket selector to get only a collection of tickets ) @@ -732,10 +732,10 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket_state.name' => { 'operator' => 'is not', - 'value' => 'merged', + 'value' => 'merged', } }, # ticket selector to get only a collection of tickets - params: { + params: { type: 'in', }, ) @@ -760,10 +760,10 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.group_id' => { 'operator' => 'is', - 'value' => [Group.lookup(name: 'Users').id], + 'value' => [Group.lookup(name: 'Users').id], } }, # ticket selector to get only a collection of tickets - params: { + params: { type: 'in', }, ) @@ -779,10 +779,10 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.group_id' => { 'operator' => 'is', - 'value' => [Group.lookup(name: 'Users').id], + 'value' => [Group.lookup(name: 'Users').id], } }, # ticket selector to get only a collection of tickets - params: { + params: { type: 'in', }, ) @@ -807,10 +807,10 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.group_id' => { 'operator' => 'is', - 'value' => [Group.lookup(name: 'Users').id], + 'value' => [Group.lookup(name: 'Users').id], } }, # ticket selector to get only a collection of tickets - params: { + params: { type: 'in', }, ) @@ -826,10 +826,10 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket_state.name' => { 'operator' => 'is not', - 'value' => 'merged', + 'value' => 'merged', } }, # ticket selector to get only a collection of tickets - params: { + params: { type: 'out', }, ) @@ -854,10 +854,10 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket_state.name' => { 'operator' => 'is not', - 'value' => 'merged', + 'value' => 'merged', } }, # ticket selector to get only a collection of tickets - params: { + params: { type: 'out', }, ) @@ -872,10 +872,10 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.group_id' => { 'operator' => 'is', - 'value' => [Group.lookup(name: 'Users').id], + 'value' => [Group.lookup(name: 'Users').id], } }, # ticket selector to get only a collection of tickets - params: { + params: { type: 'out', }, ) @@ -900,10 +900,10 @@ class ReportTest < ActiveSupport::TestCase selector: { 'ticket.group_id' => { 'operator' => 'is', - 'value' => [Group.lookup(name: 'Users').id], + 'value' => [Group.lookup(name: 'Users').id], } }, # ticket selector to get only a collection of tickets - params: { + params: { type: 'out', }, ) @@ -955,10 +955,10 @@ class ReportTest < ActiveSupport::TestCase range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', interval: 'month', # year, quarter, month, week, day, hour, minute, second - selector: { + selector: { 'state' => { 'operator' => 'is not', - 'value' => 'merged' + 'value' => 'merged' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -981,10 +981,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'state' => { 'operator' => 'is not', - 'value' => 'merged' + 'value' => 'merged' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1003,10 +1003,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'created_at' => { 'operator' => 'before (absolute)', - 'value' => '2015-10-31T00:00:00Z' + 'value' => '2015-10-31T00:00:00Z' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1023,10 +1023,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'created_at' => { 'operator' => 'after (absolute)', - 'value' => '2015-10-31T00:00:00Z' + 'value' => '2015-10-31T00:00:00Z' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1040,11 +1040,11 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'created_at' => { 'operator' => 'before (relative)', - 'range' => 'day', - 'value' => '1' + 'range' => 'day', + 'value' => '1' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1053,11 +1053,11 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'created_at' => { 'operator' => 'after (relative)', - 'range' => 'day', - 'value' => '1' + 'range' => 'day', + 'value' => '1' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1069,11 +1069,11 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2037-01-01T00:00:00Z', range_end: '2037-12-31T23:59:59Z', - selector: { + selector: { 'created_at' => { 'operator' => 'before (relative)', - 'range' => 'day', - 'value' => '1' + 'range' => 'day', + 'value' => '1' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1085,11 +1085,11 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2037-01-01T00:00:00Z', range_end: '2037-12-31T23:59:59Z', - selector: { + selector: { 'created_at' => { 'operator' => 'after (relative)', - 'range' => 'day', - 'value' => '5' + 'range' => 'day', + 'value' => '5' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1102,11 +1102,11 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2037-01-01T00:00:00Z', range_end: '2037-12-31T23:59:59Z', - selector: { + selector: { 'created_at' => { 'operator' => 'before (relative)', - 'range' => 'month', - 'value' => '1' + 'range' => 'month', + 'value' => '1' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1118,11 +1118,11 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2037-01-01T00:00:00Z', range_end: '2037-12-31T23:59:59Z', - selector: { + selector: { 'created_at' => { 'operator' => 'after (relative)', - 'range' => 'month', - 'value' => '5' + 'range' => 'month', + 'value' => '5' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1135,11 +1135,11 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2037-01-01T00:00:00Z', range_end: '2037-12-31T23:59:59Z', - selector: { + selector: { 'created_at' => { 'operator' => 'before (relative)', - 'range' => 'year', - 'value' => '1' + 'range' => 'year', + 'value' => '1' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1151,11 +1151,11 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2037-01-01T00:00:00Z', range_end: '2037-12-31T23:59:59Z', - selector: { + selector: { 'created_at' => { 'operator' => 'after (relative)', - 'range' => 'year', - 'value' => '5' + 'range' => 'year', + 'value' => '5' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1168,10 +1168,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'tags' => { 'operator' => 'contains all', - 'value' => 'aaa, bbb' + 'value' => 'aaa, bbb' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1184,10 +1184,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'tags' => { 'operator' => 'contains all not', - 'value' => 'aaa, bbb' + 'value' => 'aaa, bbb' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1205,10 +1205,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'tags' => { 'operator' => 'contains all', - 'value' => 'aaa' + 'value' => 'aaa' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1223,10 +1223,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'tags' => { 'operator' => 'contains all not', - 'value' => 'aaa' + 'value' => 'aaa' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1243,10 +1243,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'tags' => { 'operator' => 'contains one not', - 'value' => 'aaa' + 'value' => 'aaa' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1264,10 +1264,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'tags' => { 'operator' => 'contains one not', - 'value' => 'aaa, bbb' + 'value' => 'aaa, bbb' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1283,10 +1283,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'tags' => { 'operator' => 'contains one', - 'value' => 'aaa' + 'value' => 'aaa' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1301,10 +1301,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'tags' => { 'operator' => 'contains one', - 'value' => 'aaa, bbb' + 'value' => 'aaa, bbb' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1319,10 +1319,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'title' => { 'operator' => 'contains', - 'value' => 'test' + 'value' => 'test' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, @@ -1341,10 +1341,10 @@ class ReportTest < ActiveSupport::TestCase result = Report::TicketGenericTime.items( range_start: '2015-01-01T00:00:00Z', range_end: '2015-12-31T23:59:59Z', - selector: { + selector: { 'title' => { 'operator' => 'contains not', - 'value' => 'test' + 'value' => 'test' } }, # ticket selector to get only a collection of tickets params: { field: 'created_at' }, diff --git a/test/integration/slack_test.rb b/test/integration/slack_test.rb index 765a9dad1..3e0d00a45 100644 --- a/test/integration/slack_test.rb +++ b/test/integration/slack_test.rb @@ -5,7 +5,7 @@ class SlackTest < ActiveSupport::TestCase # needed to check correct behavior slack_group = Group.create_if_not_exists( - name: 'Slack', + name: 'Slack', updated_by_id: 1, created_by_id: 1 ) @@ -33,11 +33,11 @@ class SlackTest < ActiveSupport::TestCase items = [ { group_ids: [slack_group.id], - types: %w[create update reminder_reached], - webhook: webhook, - channel: channel, - username: 'zammad bot', - expand: false, + types: %w[create update reminder_reached], + webhook: webhook, + channel: channel, + username: 'zammad bot', + expand: false, } ] Setting.set('slack_config', { items: items }) @@ -152,11 +152,11 @@ class SlackTest < ActiveSupport::TestCase items = [ { group_ids: slack_group.id.to_s, - types: 'create', - webhook: webhook, - channel: channel, - username: 'zammad bot', - expand: false, + types: 'create', + webhook: webhook, + channel: channel, + username: 'zammad bot', + expand: false, } ] Setting.set('slack_config', { items: items }) diff --git a/test/integration/twitter_browser_test.rb b/test/integration/twitter_browser_test.rb index 232afe60e..bc9fa4de5 100644 --- a/test/integration/twitter_browser_test.rb +++ b/test/integration/twitter_browser_test.rb @@ -5,9 +5,9 @@ class TwitterBrowserTest < TestCase @browser = browser_instance login( - username: 'master@example.com', - password: 'test', - url: browser_url, + username: 'master@example.com', + password: 'test', + url: browser_url, auto_wizard: true, ) tasks_close_all() @@ -17,39 +17,39 @@ class TwitterBrowserTest < TestCase click(css: '.content.active .js-configApp') sleep 2 set( - css: '.content.active .modal [name=consumer_key]', + css: '.content.active .modal [name=consumer_key]', value: 'some_key', ) set( - css: '.content.active .modal [name=consumer_secret]', + css: '.content.active .modal [name=consumer_secret]', value: 'some_secret', ) click(css: '.content.active .modal .js-submit') watch_for( - css: '.content.active .modal .alert', + css: '.content.active .modal .alert', value: '401 Authorization Required', ) set( - css: '.content.active .modal [name=oauth_token]', + css: '.content.active .modal [name=oauth_token]', value: 'some_oauth_token', ) set( - css: '.content.active .modal [name=oauth_token_secret]', + css: '.content.active .modal [name=oauth_token_secret]', value: 'some_oauth_token_secret', ) set( - css: '.content.active .modal [name=env]', + css: '.content.active .modal [name=env]', value: 'some_env', ) click(css: '.content.active .modal .js-submit') watch_for( - css: '.content.active .modal .alert', + css: '.content.active .modal .alert', value: '401 Authorization Required', ) diff --git a/test/integration/user_agent_test.rb b/test/integration/user_agent_test.rb index 3c23d7c95..2d04a2316 100644 --- a/test/integration/user_agent_test.rb +++ b/test/integration/user_agent_test.rb @@ -129,7 +129,7 @@ class UserAgentTest < ActiveSupport::TestCase "#{host}/test_basic_auth/get/1?submitted=123", {}, { - user: 'basic_auth_user', + user: 'basic_auth_user', password: 'test123', } ) @@ -149,7 +149,7 @@ class UserAgentTest < ActiveSupport::TestCase "#{host}/test_basic_auth/get/1?submitted=123", {}, { - user: 'basic_auth_user_not_existing', + user: 'basic_auth_user_not_existing', password: 'test<>123', } ) @@ -165,7 +165,7 @@ class UserAgentTest < ActiveSupport::TestCase submitted: 'some value', }, { - user: 'basic_auth_user', + user: 'basic_auth_user', password: 'test123', } ) @@ -187,7 +187,7 @@ class UserAgentTest < ActiveSupport::TestCase submitted: 'some value', }, { - user: 'basic_auth_user_not_existing', + user: 'basic_auth_user_not_existing', password: 'test<>123', } ) @@ -203,7 +203,7 @@ class UserAgentTest < ActiveSupport::TestCase submitted: 'some value', }, { - user: 'basic_auth_user', + user: 'basic_auth_user', password: 'test123', } ) @@ -225,7 +225,7 @@ class UserAgentTest < ActiveSupport::TestCase submitted: 'some value', }, { - user: 'basic_auth_user_not_existing', + user: 'basic_auth_user_not_existing', password: 'test<>123', } ) @@ -238,7 +238,7 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.delete( "#{host}/test_basic_auth/delete/1", { - user: 'basic_auth_user', + user: 'basic_auth_user', password: 'test123', } ) @@ -256,7 +256,7 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.delete( "#{host}/test_basic_auth/delete/1", { - user: 'basic_auth_user_not_existing', + user: 'basic_auth_user_not_existing', password: 'test<>123', } ) @@ -288,7 +288,7 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.request( "#{host}/test_basic_auth/redirect", { - user: 'basic_auth_user', + user: 'basic_auth_user', password: 'test123', } ) @@ -307,7 +307,7 @@ class UserAgentTest < ActiveSupport::TestCase result = UserAgent.request( "#{host}/test_basic_auth/redirect", { - user: 'basic_auth_user_not_existing', + user: 'basic_auth_user_not_existing', password: 'test123', } ) diff --git a/test/integration/zendesk_import_browser_test.rb b/test/integration/zendesk_import_browser_test.rb index 51293395c..674a2aa89 100644 --- a/test/integration/zendesk_import_browser_test.rb +++ b/test/integration/zendesk_import_browser_test.rb @@ -28,7 +28,7 @@ class ZendeskImportBrowserTest < TestCase sleep 5 watch_for( - css: '.zendesk-url-error', + css: '.zendesk-url-error', value: 'Hostname not found!', ) @@ -40,38 +40,38 @@ class ZendeskImportBrowserTest < TestCase sleep 5 watch_for_disappear( - css: '.zendesk-url-error', + css: '.zendesk-url-error', value: 'Hostname not found!', ) click(css: '.js-zendesk-credentials') set( - css: '#zendesk-email', + css: '#zendesk-email', value: ENV['IMPORT_BT_ZENDESK_ENDPOINT_USERNAME'] ) set( - css: '#zendesk-api-token', + css: '#zendesk-api-token', value: '1nv4l1dT0K3N' ) sleep 5 watch_for( - css: '.zendesk-api-token-error', + css: '.zendesk-api-token-error', value: 'Invalid credentials!', ) set( - css: '#zendesk-api-token', + css: '#zendesk-api-token', value: ENV['IMPORT_BT_ZENDESK_ENDPOINT_KEY'] ) sleep 5 watch_for_disappear( - css: '.zendesk-url-error', + css: '.zendesk-url-error', value: 'Invalid credentials!', ) @@ -90,14 +90,14 @@ class ZendeskImportBrowserTest < TestCase ) watch_for( - css: '.js-users .js-done', - value: '141', + css: '.js-users .js-done', + value: '141', timeout: 120, ) watch_for( - css: 'body', - value: 'login', + css: 'body', + value: 'login', timeout: 800, ) end diff --git a/test/integration/zendesk_import_test.rb b/test/integration/zendesk_import_test.rb index 63036bfc0..319682e6e 100644 --- a/test/integration/zendesk_import_test.rb +++ b/test/integration/zendesk_import_test.rb @@ -27,7 +27,7 @@ class ZendeskImportTest < ActiveSupport::TestCase # retrive statistic compare_statistic = { - Groups: { + Groups: { skipped: 0, created: 2, updated: 0, @@ -37,7 +37,7 @@ class ZendeskImportTest < ActiveSupport::TestCase sum: 2, total: 2 }, - Users: { + Users: { skipped: 0, created: 141, updated: 0, @@ -57,7 +57,7 @@ class ZendeskImportTest < ActiveSupport::TestCase sum: 1, total: 1 }, - Tickets: { + Tickets: { skipped: 0, created: 142, updated: 1, @@ -98,8 +98,8 @@ class ZendeskImportTest < ActiveSupport::TestCase checks = [ { - id: 5, - data: { + id: 5, + data: { firstname: 'Bob', lastname: 'Smith', login: 'bob.smith@znuny.com', @@ -112,8 +112,8 @@ class ZendeskImportTest < ActiveSupport::TestCase groups: [group_support], }, { - id: 6, - data: { + id: 6, + data: { firstname: 'Hansimerkur', lastname: '', login: 'hansimerkur@znuny.com', @@ -125,8 +125,8 @@ class ZendeskImportTest < ActiveSupport::TestCase groups: [group_additional_group, group_support], }, { - id: 7, - data: { + id: 7, + data: { firstname: 'Bernd', lastname: 'Hofbecker', login: 'bernd.hofbecker@znuny.com', @@ -137,8 +137,8 @@ class ZendeskImportTest < ActiveSupport::TestCase groups: [], }, { - id: 8, - data: { + id: 8, + data: { firstname: 'Zendesk', lastname: '', login: 'noreply@zendesk.com', @@ -149,8 +149,8 @@ class ZendeskImportTest < ActiveSupport::TestCase groups: [], }, { - id: 90, - data: { + id: 90, + data: { firstname: 'Hans', lastname: 'Peter Wurst', login: 'hansimerkur+zd-c1@znuny.com', @@ -265,20 +265,20 @@ class ZendeskImportTest < ActiveSupport::TestCase checks = [ { - id: 1, + id: 1, data: { - name: 'Zammad Foundation', - note: '', - api_key: nil, + name: 'Zammad Foundation', + note: '', + api_key: nil, custom_dropdown: nil, }, }, { - id: 2, + id: 2, data: { - name: 'Znuny', - note: nil, - api_key: 'my api öäüß', + name: 'Znuny', + note: nil, + api_key: 'my api öäüß', custom_dropdown: 'b', }, }, @@ -326,7 +326,7 @@ class ZendeskImportTest < ActiveSupport::TestCase checks = [ { - id: 2, + id: 2, data: { title: 'test', #note: 'This is the first comment. Feel free to delete this sample ticket.', @@ -348,7 +348,7 @@ class ZendeskImportTest < ActiveSupport::TestCase }, }, { - id: 3, + id: 3, data: { title: 'Bob Smith, here is the test ticket you requested', note: 'Hello! This is a Zendesk ticket. We are going to go through the basic support ticket operation in Zendesk. @@ -371,7 +371,7 @@ If you\'re reading this message in your email, click the ticket number link that }, }, { - id: 5, + id: 5, data: { title: 'Twitter', note: "@gabyalanisr Brandon Arely Snuppy Jaz Jerry Liz Irvig & Wera\nY Losa Otrs Yop \npero si quieres Los Que Puedas", @@ -387,7 +387,7 @@ If you\'re reading this message in your email, click the ticket number link that }, }, { - id: 143, + id: 143, data: { title: 'Basti ist cool', note: 'Basti ist cool', @@ -440,25 +440,25 @@ If you\'re reading this message in your email, click the ticket number link that checks = [ { message_id: 39_984_258_725, - data: { + data: { count: 1, 1 => { preferences: { 'Content-Type' => 'image/jpeg' }, - filename: '1a3496b9-53d9-494d-bbb0-e1d2e22074f8.jpeg', + filename: '1a3496b9-53d9-494d-bbb0-e1d2e22074f8.jpeg', }, }, }, { message_id: 32_817_827_921, - data: { + data: { count: 1, 1 => { preferences: { 'Content-Type' => 'image/jpeg' }, - filename: 'paris.jpg', + filename: 'paris.jpg', }, }, }, diff --git a/test/unit/activity_stream_test.rb b/test/unit/activity_stream_test.rb index fde8f857d..ba88c29c5 100644 --- a/test/unit/activity_stream_test.rb +++ b/test/unit/activity_stream_test.rb @@ -6,14 +6,14 @@ class ActivityStreamTest < ActiveSupport::TestCase roles = Role.where(name: %w[Admin Agent]) groups = Group.where(name: 'Users') @admin_user = User.create_or_update( - login: 'admin', - firstname: 'Bob', - lastname: 'Smith', - email: 'bob+active_stream@example.com', - password: 'some_pass', - active: true, - roles: roles, - groups: groups, + login: 'admin', + firstname: 'Bob', + lastname: 'Smith', + email: 'bob+active_stream@example.com', + password: 'some_pass', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1 ) @@ -23,39 +23,39 @@ class ActivityStreamTest < ActiveSupport::TestCase test 'ticket+user' do ticket = Ticket.create!( - group_id: Group.lookup(name: 'Users').id, - customer_id: @current_user.id, - owner_id: User.lookup(login: '-').id, - title: 'Unit Test 1 (äöüß)!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group_id: Group.lookup(name: 'Users').id, + customer_id: @current_user.id, + owner_id: User.lookup(login: '-').id, + title: 'Unit Test 1 (äöüß)!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: @current_user.id, created_by_id: @current_user.id, ) travel 2.seconds article = Ticket::Article.create!( - ticket_id: ticket.id, + ticket_id: ticket.id, updated_by_id: @current_user.id, created_by_id: @current_user.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Unit Test ', - body: 'Unit Test 123', - internal: false, + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false, ) travel 100.seconds ticket.update!( - title: 'Unit Test 1 (äöüß) - update!', - state_id: Ticket::State.lookup(name: 'open').id, + title: 'Unit Test 1 (äöüß) - update!', + state_id: Ticket::State.lookup(name: 'open').id, priority_id: Ticket::Priority.lookup(name: '1 low').id, ) updated_at = ticket.updated_at travel 1.second ticket.update!( - title: 'Unit Test 2 (äöüß) - update!', + title: 'Unit Test 2 (äöüß) - update!', priority_id: Ticket::Priority.lookup(name: '2 normal').id, ) @@ -113,7 +113,7 @@ class ActivityStreamTest < ActiveSupport::TestCase test 'organization' do organization = Organization.create!( - name: 'some name', + name: 'some name', updated_by_id: @current_user.id, created_by_id: @current_user.id, ) @@ -152,16 +152,16 @@ class ActivityStreamTest < ActiveSupport::TestCase test 'user with update check false' do user = User.create!( - login: 'someemail@example.com', - email: 'someemail@example.com', - firstname: 'Bob Smith II', + login: 'someemail@example.com', + email: 'someemail@example.com', + firstname: 'Bob Smith II', updated_by_id: @current_user.id, created_by_id: @current_user.id, ) assert_equal(user.class, User) user.update!( firstname: 'Bob U', - lastname: 'Smith U', + lastname: 'Smith U', ) # check activity_stream @@ -184,9 +184,9 @@ class ActivityStreamTest < ActiveSupport::TestCase test 'user with update check true' do user = User.create!( - login: 'someemail@example.com', - email: 'someemail@example.com', - firstname: 'Bob Smith II', + login: 'someemail@example.com', + email: 'someemail@example.com', + firstname: 'Bob Smith II', updated_by_id: @current_user.id, created_by_id: @current_user.id, ) @@ -195,14 +195,14 @@ class ActivityStreamTest < ActiveSupport::TestCase user.update!( firstname: 'Bob U', - lastname: 'Smith U', + lastname: 'Smith U', ) updated_at = user.updated_at travel 10.seconds user.update!( firstname: 'Bob', - lastname: 'Smith', + lastname: 'Smith', ) # check activity_stream diff --git a/test/unit/auth_test.rb b/test/unit/auth_test.rb index b5f33a30f..79df7994e 100644 --- a/test/unit/auth_test.rb +++ b/test/unit/auth_test.rb @@ -5,12 +5,12 @@ class AuthTest < ActiveSupport::TestCase user = User.find_by(email: 'nicole.braun@zammad.org') user.update!( - login: 'nicole.braun', - firstname: 'Nicole', - lastname: 'Braun', - email: 'nicole.braun@zammad.org', - password: 'some_pass', - active: true, + login: 'nicole.braun', + firstname: 'Nicole', + lastname: 'Braun', + email: 'nicole.braun@zammad.org', + password: 'some_pass', + active: true, updated_by_id: 1, created_by_id: 1 ) @@ -21,18 +21,18 @@ class AuthTest < ActiveSupport::TestCase { username: 'not_existing', password: 'password', - result: nil, + result: nil, }, # test 2 { username: 'nicole.braun@zammad.org', password: 'some_pass', - result: true, - verify: { + result: true, + verify: { firstname: 'Nicole', - lastname: 'Braun', - email: 'nicole.braun@zammad.org', + lastname: 'Braun', + email: 'nicole.braun@zammad.org', } }, @@ -40,11 +40,11 @@ class AuthTest < ActiveSupport::TestCase { username: 'nicole.bRaUn@zammad.org', password: 'some_pass', - result: true, - verify: { + result: true, + verify: { firstname: 'Nicole', - lastname: 'Braun', - email: 'nicole.braun@zammad.org', + lastname: 'Braun', + email: 'nicole.braun@zammad.org', } }, @@ -52,11 +52,11 @@ class AuthTest < ActiveSupport::TestCase { username: 'nicole.bRaUn', password: 'some_pass', - result: true, - verify: { + result: true, + verify: { firstname: 'Nicole', - lastname: 'Braun', - email: 'nicole.braun@zammad.org', + lastname: 'Braun', + email: 'nicole.braun@zammad.org', } }, diff --git a/test/unit/auto_wizard_test.rb b/test/unit/auto_wizard_test.rb index 00fe67ef7..940489f76 100644 --- a/test/unit/auto_wizard_test.rb +++ b/test/unit/auto_wizard_test.rb @@ -4,36 +4,36 @@ class AutoWizardTest < ActiveSupport::TestCase test 'a simple' do auto_wizard_data = { - Users: [ + Users: [ { - login: 'master_unit_test01@example.com', + login: 'master_unit_test01@example.com', firstname: 'Test Master', - lastname: 'Agent', - email: 'master_unit_test01@example.com', - password: 'test', + lastname: 'Agent', + email: 'master_unit_test01@example.com', + password: 'test', }, { - login: 'agent1_unit_test01@example.com', + login: 'agent1_unit_test01@example.com', firstname: 'Agent 1', - lastname: 'Test', - email: 'agent1_unit_test01@example.com', - password: 'test', - roles: ['Agent'], + lastname: 'Test', + email: 'agent1_unit_test01@example.com', + password: 'test', + roles: ['Agent'], } ], - Groups: [ + Groups: [ { - name: 'some group1', + name: 'some group1', users: ['master_unit_test01@example.com', 'agent1_unit_test01@example.com'] } ], Settings: [ { - name: 'developer_mode', + name: 'developer_mode', value: true }, { - name: 'product_name', + name: 'product_name', value: 'Zammad UnitTest01 System' }, ] @@ -79,77 +79,77 @@ class AutoWizardTest < ActiveSupport::TestCase test 'b complex' do auto_wizard_data = { - Organizations: [ + Organizations: [ { - name: 'Auto Wizard Test Org', + name: 'Auto Wizard Test Org', shared: false, } ], - Users: [ + Users: [ { - login: 'master_unit_test01@example.com', - firstname: 'Test Master', - lastname: 'Agent', - email: 'master_unit_test01@example.com', - password: 'test', + login: 'master_unit_test01@example.com', + firstname: 'Test Master', + lastname: 'Agent', + email: 'master_unit_test01@example.com', + password: 'test', organization: 'Auto Wizard Test Org', - roles: ['Admin'], + roles: ['Admin'], }, { - login: 'agent1_unit_test01@example.com', + login: 'agent1_unit_test01@example.com', firstname: 'Agent 1', - lastname: 'Test', - email: 'agent1_unit_test01@example.com', - password: 'test', - roles: ['Agent'], + lastname: 'Test', + email: 'agent1_unit_test01@example.com', + password: 'test', + roles: ['Agent'], } ], - Groups: [ + Groups: [ { - name: 'some group1', + name: 'some group1', users: ['master_unit_test01@example.com', 'agent1_unit_test01@example.com'] }, { - name: 'Users', - users: ['master_unit_test01@example.com', 'agent1_unit_test01@example.com'], - signature: 'default', + name: 'Users', + users: ['master_unit_test01@example.com', 'agent1_unit_test01@example.com'], + signature: 'default', email_address_id: 1, - note: 'Standard Group/Pool for Tickets.', + note: 'Standard Group/Pool for Tickets.', } ], - Settings: [ + Settings: [ { - name: 'developer_mode', + name: 'developer_mode', value: false, }, { - name: 'product_name', + name: 'product_name', value: 'Zammad UnitTest02 System' }, ], - Permissions: [ + Permissions: [ { - name: 'admin.session', + name: 'admin.session', active: false, }, { - name: 'admin.session.new', + name: 'admin.session.new', active: true, }, ], - Channels: [ + Channels: [ { - id: 1, - area: 'Email::Account', - group: 'Users', - options: { - inbound: { + id: 1, + area: 'Email::Account', + group: 'Users', + options: { + inbound: { adapter: 'imap', options: { - host: 'mx1.example.com', - user: 'not_existing', + host: 'mx1.example.com', + user: 'not_existing', password: 'some_pass', - ssl: true + ssl: true } }, outbound: { @@ -159,21 +159,21 @@ class AutoWizardTest < ActiveSupport::TestCase preferences: { online_service_disable: true, }, - active: true + active: true } ], - EmailAddresses: [ + EmailAddresses: [ { - id: 1, + id: 1, channel_id: 1, - realname: 'Zammad', - email: 'zammad@localhost', + realname: 'Zammad', + email: 'zammad@localhost', } ], TextModuleLocale: { Locale: 'de-de', }, - CalendarSetup: { + CalendarSetup: { Ip: '195.65.29.254', }, } diff --git a/test/unit/calendar_subscription_test.rb b/test/unit/calendar_subscription_test.rb index 43ed59c99..868994d25 100644 --- a/test/unit/calendar_subscription_test.rb +++ b/test/unit/calendar_subscription_test.rb @@ -6,227 +6,227 @@ class CalendarSubscriptionTest < ActiveSupport::TestCase # create base group_default = Group.lookup(name: 'Users') group_calendar = Group.create!( - name: 'CalendarSubscription', + name: 'CalendarSubscription', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Agent') agent1 = User.create!( - login: 'ticket-calendar-subscription-agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'ticket-calendar-subscription-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: [group_calendar], - preferences: {}, + login: 'ticket-calendar-subscription-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'ticket-calendar-subscription-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: [group_calendar], + preferences: {}, updated_by_id: 1, created_by_id: 1, ) agent2 = User.create!( - login: 'ticket-calendar-subscription-agent2@example.com', - firstname: 'Notification', - lastname: 'Agent2', - email: 'ticket-calendar-subscription-agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: [group_default], - preferences: {}, - updated_at: '2016-02-05 16:38:00', + login: 'ticket-calendar-subscription-agent2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'ticket-calendar-subscription-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: [group_default], + preferences: {}, + updated_at: '2016-02-05 16:38:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') organization1 = Organization.create_if_not_exists( - name: 'Selector Org', - updated_at: '2016-02-05 16:37:00', + name: 'Selector Org', + updated_at: '2016-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) customer1 = User.create!( - login: 'ticket-calendar-subscription-customer1@example.com', - firstname: 'Notification', - lastname: 'Customer1', - email: 'ticket-calendar-subscription-customer1@example.com', - password: 'customerpw', - active: true, + login: 'ticket-calendar-subscription-customer1@example.com', + firstname: 'Notification', + lastname: 'Customer1', + email: 'ticket-calendar-subscription-customer1@example.com', + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - preferences: {}, - updated_at: '2016-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + preferences: {}, + updated_at: '2016-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer2 = User.create!( - login: 'ticket-calendar-subscription-customer2@example.com', - firstname: 'Notification', - lastname: 'Customer2', - email: 'ticket-calendar-subscription-customer2@example.com', - password: 'customerpw', - active: true, + login: 'ticket-calendar-subscription-customer2@example.com', + firstname: 'Notification', + lastname: 'Customer2', + email: 'ticket-calendar-subscription-customer2@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - preferences: {}, - updated_at: '2016-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + preferences: {}, + updated_at: '2016-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) Ticket.destroy_all ticket1 = Ticket.create!( - title: 'some title1 - new - group_calendar', - group: group_calendar, - customer_id: customer1.id, - owner_id: agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 16:37:00', - updated_at: '2016-02-05 16:37:00', + title: 'some title1 - new - group_calendar', + group: group_calendar, + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 16:37:00', + updated_at: '2016-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) ticket2 = Ticket.create!( - title: 'some title1 - new - group_default', - group: group_default, - customer_id: customer1.id, - owner_id: agent2.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 16:38:00', - updated_at: '2016-02-05 16:38:00', + title: 'some title1 - new - group_default', + group: group_default, + customer_id: customer1.id, + owner_id: agent2.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 16:38:00', + updated_at: '2016-02-05 16:38:00', updated_by_id: 1, created_by_id: 1, ) ticket3 = Ticket.create!( - title: 'some title1 - pending - group_calendar', - group: group_calendar, - customer_id: customer1.id, - owner_id: agent1.id, - state: Ticket::State.lookup(name: 'pending reminder'), - pending_time: '2016-02-07 16:37:00', - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 16:39:00', - updated_at: '2016-02-05 16:39:00', + title: 'some title1 - pending - group_calendar', + group: group_calendar, + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup(name: 'pending reminder'), + pending_time: '2016-02-07 16:37:00', + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 16:39:00', + updated_at: '2016-02-05 16:39:00', updated_by_id: 1, created_by_id: 1, ) ticket4 = Ticket.create!( - title: 'some title1 - pending - group_default', - group: group_default, - customer_id: customer1.id, - owner_id: agent2.id, - state: Ticket::State.lookup(name: 'pending reminder'), - pending_time: '2016-02-07 16:38:00', - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 16:40:00', - updated_at: '2016-02-05 16:40:00', + title: 'some title1 - pending - group_default', + group: group_default, + customer_id: customer1.id, + owner_id: agent2.id, + state: Ticket::State.lookup(name: 'pending reminder'), + pending_time: '2016-02-07 16:38:00', + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 16:40:00', + updated_at: '2016-02-05 16:40:00', updated_by_id: 1, created_by_id: 1, ) ticket5 = Ticket.create!( - title: 'some title1 - escalation - group_calendar', - group: group_calendar, - customer_id: customer1.id, - owner_id: agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 16:41:00', - updated_at: '2016-02-05 16:41:00', + title: 'some title1 - escalation - group_calendar', + group: group_calendar, + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 16:41:00', + updated_at: '2016-02-05 16:41:00', updated_by_id: 1, created_by_id: 1, ) ticket5.update_columns(escalation_at: '2016-02-07 17:39:00') ticket6 = Ticket.create!( - title: 'some title1 - escalation - group_default', - group: group_default, - customer_id: customer1.id, - owner_id: agent2.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 16:42:00', - updated_at: '2016-02-05 16:42:00', + title: 'some title1 - escalation - group_default', + group: group_default, + customer_id: customer1.id, + owner_id: agent2.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 16:42:00', + updated_at: '2016-02-05 16:42:00', updated_by_id: 1, created_by_id: 1, ) ticket6.update_columns(escalation_at: '2016-02-07 16:37:00') ticket7 = Ticket.create!( - title: 'some title2 - new - group_calendar', - group: group_calendar, - customer_id: customer1.id, - owner_id: 1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 17:37:00', - updated_at: '2016-02-05 17:37:00', + title: 'some title2 - new - group_calendar', + group: group_calendar, + customer_id: customer1.id, + owner_id: 1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 17:37:00', + updated_at: '2016-02-05 17:37:00', updated_by_id: 1, created_by_id: 1, ) ticket8 = Ticket.create!( - title: 'some title2 - new - group_default', - group: group_default, - customer_id: customer1.id, - owner_id: 1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 17:38:00', - updated_at: '2016-02-05 17:38:00', + title: 'some title2 - new - group_default', + group: group_default, + customer_id: customer1.id, + owner_id: 1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 17:38:00', + updated_at: '2016-02-05 17:38:00', updated_by_id: 1, created_by_id: 1, ) ticket9 = Ticket.create!( - title: 'some title2 - pending - group_calendar', - group: group_calendar, - customer_id: customer1.id, - owner_id: 1, - state: Ticket::State.lookup(name: 'pending reminder'), - pending_time: '2016-02-08 16:37:00', - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 17:39:00', - updated_at: '2016-02-05 17:39:00', + title: 'some title2 - pending - group_calendar', + group: group_calendar, + customer_id: customer1.id, + owner_id: 1, + state: Ticket::State.lookup(name: 'pending reminder'), + pending_time: '2016-02-08 16:37:00', + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 17:39:00', + updated_at: '2016-02-05 17:39:00', updated_by_id: 1, created_by_id: 1, ) ticket10 = Ticket.create!( - title: 'some title2 - pending - group_default', - group: group_default, - customer_id: customer1.id, - owner_id: 1, - state: Ticket::State.lookup(name: 'pending reminder'), - pending_time: '2016-02-08 16:38:00', - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 17:40:00', - updated_at: '2016-02-05 17:40:00', + title: 'some title2 - pending - group_default', + group: group_default, + customer_id: customer1.id, + owner_id: 1, + state: Ticket::State.lookup(name: 'pending reminder'), + pending_time: '2016-02-08 16:38:00', + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 17:40:00', + updated_at: '2016-02-05 17:40:00', updated_by_id: 1, created_by_id: 1, ) ticket11 = Ticket.create!( - title: 'some title2 - escalation - group_calendar', - group: group_calendar, - customer_id: customer1.id, - owner_id: 1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 17:41:00', - updated_at: '2016-02-05 17:41:00', + title: 'some title2 - escalation - group_calendar', + group: group_calendar, + customer_id: customer1.id, + owner_id: 1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 17:41:00', + updated_at: '2016-02-05 17:41:00', updated_by_id: 1, created_by_id: 1, ) ticket11.update_columns(escalation_at: '2016-02-08 18:37:00') ticket12 = Ticket.create!( - title: 'some title2 - escalation - group_default', - group: group_default, - customer_id: customer1.id, - owner_id: 1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-02-05 17:42:00', - updated_at: '2016-02-05 17:42:00', + title: 'some title2 - escalation - group_default', + group: group_default, + customer_id: customer1.id, + owner_id: 1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-02-05 17:42:00', + updated_at: '2016-02-05 17:42:00', updated_by_id: 1, created_by_id: 1, ) @@ -268,18 +268,18 @@ class CalendarSubscriptionTest < ActiveSupport::TestCase end agent1.preferences[:calendar_subscriptions][:tickets] = { escalation: { - own: true, + own: true, not_assigned: true, }, - new_open: { - own: true, + new_open: { + own: true, not_assigned: true, }, - pending: { - own: true, + pending: { + own: true, not_assigned: true, }, - alarm: true, + alarm: true, } agent1.save! @@ -363,18 +363,18 @@ class CalendarSubscriptionTest < ActiveSupport::TestCase end agent2.preferences[:calendar_subscriptions][:tickets] = { escalation: { - own: true, + own: true, not_assigned: true, }, - new_open: { - own: true, + new_open: { + own: true, not_assigned: true, }, - pending: { - own: true, + pending: { + own: true, not_assigned: true, }, - alarm: false, + alarm: false, } agent2.save! diff --git a/test/unit/calendar_test.rb b/test/unit/calendar_test.rb index 6d1c29f0b..0ede03674 100644 --- a/test/unit/calendar_test.rb +++ b/test/unit/calendar_test.rb @@ -4,8 +4,8 @@ class CalendarTest < ActiveSupport::TestCase test 'default test' do Calendar.destroy_all calendar1 = Calendar.create_or_update( - name: 'US 1', - timezone: 'America/Los_Angeles', + name: 'US 1', + timezone: 'America/Los_Angeles', business_hours: { mon: { '09:00' => '17:00' }, tue: { '09:00' => '17:00' }, @@ -13,15 +13,15 @@ class CalendarTest < ActiveSupport::TestCase thu: { '09:00' => '17:00' }, fri: { '09:00' => '17:00' } }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) travel 1.second calendar2 = Calendar.create_or_update( - name: 'US 2', - timezone: 'America/Los_Angeles', + name: 'US 2', + timezone: 'America/Los_Angeles', business_hours: { mon: { '09:00' => '17:00' }, tue: { '09:00' => '17:00' }, @@ -29,15 +29,15 @@ class CalendarTest < ActiveSupport::TestCase thu: { '09:00' => '17:00' }, fri: { '09:00' => '17:00' } }, - default: false, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: false, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) calendar3 = Calendar.create_or_update( - name: 'US 3', - timezone: 'America/Los_Angeles', + name: 'US 3', + timezone: 'America/Los_Angeles', business_hours: { mon: { '09:00' => '17:00' }, tue: { '09:00' => '17:00' }, @@ -45,10 +45,10 @@ class CalendarTest < ActiveSupport::TestCase thu: { '09:00' => '17:00' }, fri: { '09:00' => '17:00' } }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) calendar1 = Calendar.find_by(name: 'US 1') @@ -100,8 +100,8 @@ class CalendarTest < ActiveSupport::TestCase travel_to Time.zone.parse('2017-08-24T01:04:44Z0') calendar1 = Calendar.create_or_update( - name: 'Sync 1', - timezone: 'America/Los_Angeles', + name: 'Sync 1', + timezone: 'America/Los_Angeles', business_hours: { mon: { '09:00' => '17:00' }, tue: { '09:00' => '17:00' }, @@ -109,10 +109,10 @@ class CalendarTest < ActiveSupport::TestCase thu: { '09:00' => '17:00' }, fri: { '09:00' => '17:00' } }, - default: true, - ical_url: Rails.root.join('test', 'data', 'calendar', 'calendar1.ics'), - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: Rails.root.join('test', 'data', 'calendar', 'calendar1.ics'), + updated_by_id: 1, + created_by_id: 1, ) assert_equal(true, calendar1.public_holidays['2016-12-24']['active']) @@ -202,8 +202,8 @@ class CalendarTest < ActiveSupport::TestCase Calendar.destroy_all calendar1 = Calendar.create_or_update( - name: 'Sync 2', - timezone: 'America/Los_Angeles', + name: 'Sync 2', + timezone: 'America/Los_Angeles', business_hours: { mon: { '09:00' => '17:00' }, tue: { '09:00' => '17:00' }, @@ -211,10 +211,10 @@ class CalendarTest < ActiveSupport::TestCase thu: { '09:00' => '17:00' }, fri: { '09:00' => '17:00' } }, - default: true, - ical_url: Rails.root.join('test', 'data', 'calendar', 'calendar3.ics'), - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: Rails.root.join('test', 'data', 'calendar', 'calendar3.ics'), + updated_by_id: 1, + created_by_id: 1, ) assert_equal(true, calendar1.public_holidays['2016-12-24']['active']) diff --git a/test/unit/chat_test.rb b/test/unit/chat_test.rb index 258b471f7..c9f4e4fe0 100644 --- a/test/unit/chat_test.rb +++ b/test/unit/chat_test.rb @@ -6,28 +6,28 @@ class ChatTest < ActiveSupport::TestCase groups = Group.all roles = Role.where(name: %w[Agent]) @agent1 = User.create_or_update( - login: 'ticket-chat-agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'ticket-chat-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'ticket-chat-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'ticket-chat-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) @agent2 = User.create_or_update( - login: 'ticket-chat-agent2@example.com', - firstname: 'Notification', - lastname: 'Agent2', - email: 'ticket-chat-agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:38:00', + login: 'ticket-chat-agent2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'ticket-chat-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:38:00', updated_by_id: 1, created_by_id: 1, ) @@ -59,17 +59,17 @@ class ChatTest < ActiveSupport::TestCase assert(User.first) message = Sessions::Event.run( - event: 'login', - payload: {}, - session: 123, + event: 'login', + payload: {}, + session: 123, remote_ip: '127.0.0.1', client_id: '123', - clients: { + clients: { '123' => { websocket: DummyWs.new # to simulate a ws connection } }, - options: {}, + options: {}, ) assert_equal(message, false) @@ -78,15 +78,15 @@ class ChatTest < ActiveSupport::TestCase end message = Sessions::Event.run( - event: 'chat_status_customer', - payload: {}, - session: 123, + event: 'chat_status_customer', + payload: {}, + session: 123, remote_ip: '127.0.0.1', client_id: '123', - clients: { + clients: { '123' => DummyWs.new # to simulate a ws connection }, - options: {}, + options: {}, ) assert_equal(message[:event], 'chat_error') @@ -100,25 +100,25 @@ class ChatTest < ActiveSupport::TestCase # with ajax long polling assert(User.first) message = Sessions::Event.run( - event: 'login', - payload: {}, - session: 123, + event: 'login', + payload: {}, + session: 123, remote_ip: '127.0.0.1', client_id: '123', - clients: {}, - options: {}, + clients: {}, + options: {}, ) assert_equal(message, false) assert(User.first) message = Sessions::Event.run( - event: 'chat_status_customer', - payload: {}, - session: 123, + event: 'chat_status_customer', + payload: {}, + session: 123, remote_ip: '127.0.0.1', client_id: '123', - clients: {}, - options: {}, + clients: {}, + options: {}, ) assert_equal(message[:event], 'chat_error') assert(User.first) @@ -127,10 +127,10 @@ class ChatTest < ActiveSupport::TestCase test 'default test' do chat = Chat.create_or_update( - name: 'default', - max_queue: 5, - note: '', - active: true, + name: 'default', + max_queue: 5, + note: '', + active: true, updated_by_id: 1, created_by_id: 1, ) @@ -154,8 +154,8 @@ class ChatTest < ActiveSupport::TestCase # set agent 1 to active chat_agent1 = Chat::Agent.create_or_update( - active: true, - concurrent: 4, + active: true, + concurrent: 4, updated_by_id: @agent1.id, created_by_id: @agent1.id, ) @@ -193,8 +193,8 @@ class ChatTest < ActiveSupport::TestCase # activate second agent chat_agent2 = Chat::Agent.create_or_update( - active: true, - concurrent: 2, + active: true, + concurrent: 2, updated_by_id: @agent2.id, created_by_id: @agent2.id, ) @@ -287,26 +287,26 @@ class ChatTest < ActiveSupport::TestCase Chat::Message.create( chat_session_id: chat_session6.id, - content: 'message 1', - created_by_id: @agent1.id, + content: 'message 1', + created_by_id: @agent1.id, ) travel 1.second Chat::Message.create( chat_session_id: chat_session6.id, - content: 'message 2', - created_by_id: @agent1.id, + content: 'message 2', + created_by_id: @agent1.id, ) travel 1.second Chat::Message.create( chat_session_id: chat_session6.id, - content: 'message 3', - created_by_id: @agent1.id, + content: 'message 3', + created_by_id: @agent1.id, ) travel 1.second Chat::Message.create( chat_session_id: chat_session6.id, - content: 'message 4', - created_by_id: nil, + content: 'message 4', + created_by_id: nil, ) # check customer state @@ -438,11 +438,11 @@ class ChatTest < ActiveSupport::TestCase test 'blocked ip test' do chat = Chat.create!( - name: 'ip test', - max_queue: 5, - note: '', - block_ip: '127.0.0.1;127.0.0.2;127.1.0.*', - active: true, + name: 'ip test', + max_queue: 5, + note: '', + block_ip: '127.0.0.1;127.0.0.2;127.1.0.*', + active: true, updated_by_id: 1, created_by_id: 1, ) @@ -457,11 +457,11 @@ class ChatTest < ActiveSupport::TestCase test 'blocked country test' do chat = Chat.create!( - name: 'country test', - max_queue: 5, - note: '', + name: 'country test', + max_queue: 5, + note: '', block_country: 'AU;CH', - active: true, + active: true, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/cti_caller_id_test.rb b/test/unit/cti_caller_id_test.rb index 33a1ed926..5f7cacf4a 100644 --- a/test/unit/cti_caller_id_test.rb +++ b/test/unit/cti_caller_id_test.rb @@ -7,46 +7,46 @@ class CtiCallerIdTest < ActiveSupport::TestCase Ticket.destroy_all Cti::CallerId.destroy_all @agent1 = User.create_or_update( - login: 'ticket-caller_id-agent1@example.com', - firstname: 'CallerId', - lastname: 'Agent1', - email: 'ticket-caller_id-agent1@example.com', - active: true, - phone: '+49 1111 222222', - fax: '+49 1111 222223', - mobile: '+49 1111 222223', - note: 'Phone at home: +49 1111 222224', + login: 'ticket-caller_id-agent1@example.com', + firstname: 'CallerId', + lastname: 'Agent1', + email: 'ticket-caller_id-agent1@example.com', + active: true, + phone: '+49 1111 222222', + fax: '+49 1111 222223', + mobile: '+49 1111 222223', + note: 'Phone at home: +49 1111 222224', updated_by_id: 1, created_by_id: 1, ) @agent2 = User.create_or_update( - login: 'ticket-caller_id-agent2@example.com', - firstname: 'CallerId', - lastname: 'Agent2', - email: 'ticket-caller_id-agent2@example.com', - phone: '+49 2222 222222', - note: 'Phone at home: +49 2222 222224', - active: true, + login: 'ticket-caller_id-agent2@example.com', + firstname: 'CallerId', + lastname: 'Agent2', + email: 'ticket-caller_id-agent2@example.com', + phone: '+49 2222 222222', + note: 'Phone at home: +49 2222 222224', + active: true, updated_by_id: 1, created_by_id: 1, ) @agent3 = User.create_or_update( - login: 'ticket-caller_id-agent3@example.com', - firstname: 'CallerId', - lastname: 'Agent3', - email: 'ticket-caller_id-agent3@example.com', - phone: '+49 2222 222222', - active: true, + login: 'ticket-caller_id-agent3@example.com', + firstname: 'CallerId', + lastname: 'Agent3', + email: 'ticket-caller_id-agent3@example.com', + phone: '+49 2222 222222', + active: true, updated_by_id: 1, created_by_id: 1, ) @customer1 = User.create_or_update( - login: 'ticket-caller_id-customer1@example.com', - firstname: 'CallerId', - lastname: 'Customer1', - email: 'ticket-caller_id-customer1@example.com', - active: true, + login: 'ticket-caller_id-customer1@example.com', + firstname: 'CallerId', + lastname: 'Customer1', + email: 'ticket-caller_id-customer1@example.com', + active: true, updated_by_id: 1, created_by_id: 1, ) @@ -76,26 +76,26 @@ class CtiCallerIdTest < ActiveSupport::TestCase # create ticket in group ticket1 = Ticket.create!( - title: 'some caller id test 1', - group: Group.lookup(name: 'Users'), - customer: @customer1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some caller id test 1', + group: Group.lookup(name: 'Users'), + customer: @customer1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @agent1.id, created_by_id: @agent1.id, ) article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message\nFon (GEL): +49 111 366-1111 Mi-Fr + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message\nFon (GEL): +49 111 366-1111 Mi-Fr Fon (LIN): +49 222 6112222 Mo-Di Mob: +49 333 8362222", - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer1.id, created_by_id: @customer1.id, ) @@ -103,26 +103,26 @@ Mob: +49 333 8362222", # create ticket in group ticket2 = Ticket.create!( - title: 'some caller id test 2', - group: Group.lookup(name: 'Users'), - customer: @customer1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some caller id test 2', + group: Group.lookup(name: 'Users'), + customer: @customer1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @agent1.id, created_by_id: @agent1.id, ) article2 = Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message\nFon (GEL): +49 111 111-1111 Mi-Fr + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message\nFon (GEL): +49 111 111-1111 Mi-Fr Fon (LIN): +49 222 1112222 Mo-Di Mob: +49 333 1112222", - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @agent1.id, created_by_id: @agent1.id, ) @@ -162,19 +162,19 @@ Mob: +49 333 1112222", Cti::CallerId.maybe_add( caller_id: '4999999999', - level: 'maybe', - user_id: 2, - object: 'Ticket', - o_id: 2, + level: 'maybe', + user_id: 2, + object: 'Ticket', + o_id: 2, ) Cti::CallerId.maybe_add( caller_id: '4912345678901', - comment: 'Hairdresser Bob Smith, San Francisco', - level: 'public', - user_id: 2, - object: 'GoYello', - o_id: 1, + comment: 'Hairdresser Bob Smith, San Francisco', + level: 'public', + user_id: 2, + object: 'GoYello', + o_id: 1, ) caller_ids = Cti::CallerId.lookup('4912345678901') @@ -185,10 +185,10 @@ Mob: +49 333 1112222", Cti::CallerId.maybe_add( caller_id: '4912345678901', - level: 'maybe', - user_id: 2, - object: 'Ticket', - o_id: 2, + level: 'maybe', + user_id: 2, + object: 'Ticket', + o_id: 2, ) caller_ids = Cti::CallerId.lookup('4912345678901') @@ -199,10 +199,10 @@ Mob: +49 333 1112222", Cti::CallerId.maybe_add( caller_id: '4912345678901', - level: 'maybe', - user_id: 2, - object: 'Ticket', - o_id: 2, + level: 'maybe', + user_id: 2, + object: 'Ticket', + o_id: 2, ) caller_ids = Cti::CallerId.lookup('4912345678901') @@ -215,10 +215,10 @@ Mob: +49 333 1112222", Cti::CallerId.maybe_add( caller_id: '4912345678901', - level: 'maybe', - user_id: user_id, - object: 'Ticket', - o_id: 2, + level: 'maybe', + user_id: user_id, + object: 'Ticket', + o_id: 2, ) caller_ids = Cti::CallerId.lookup('4912345678901') @@ -232,10 +232,10 @@ Mob: +49 333 1112222", Cti::CallerId.maybe_add( caller_id: '4912345678901', - level: 'known', - user_id: user_id, - object: 'User', - o_id: 2, + level: 'known', + user_id: user_id, + object: 'User', + o_id: 2, ) caller_ids = Cti::CallerId.lookup('4912345678901') @@ -249,51 +249,51 @@ Mob: +49 333 1112222", test '3 process - log' do ticket1 = Ticket.create!( - title: 'some caller id test 1', - group: Group.lookup(name: 'Users'), - customer: @customer1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some caller id test 1', + group: Group.lookup(name: 'Users'), + customer: @customer1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @agent1.id, created_by_id: @agent1.id, ) article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message\nFon (GEL): +49 111 366-1111 Mi-Fr + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message\nFon (GEL): +49 111 366-1111 Mi-Fr Fon (LIN): +49 222 6112222 Mo-Di Mob: +49 333 8362222", - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer1.id, created_by_id: @customer1.id, ) assert(ticket1) ticket2 = Ticket.create!( - title: 'some caller id test 2', - group: Group.lookup(name: 'Users'), - customer: @customer1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some caller id test 2', + group: Group.lookup(name: 'Users'), + customer: @customer1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @agent1.id, created_by_id: @agent1.id, ) article2 = Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message\nFon (GEL): +49 111 366-1111 Mi-Fr + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message\nFon (GEL): +49 111 366-1111 Mi-Fr Fon (LIN): +49 222 6112222 Mo-Di Mob: +49 333 8362222", - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer1.id, created_by_id: @customer1.id, ) @@ -302,12 +302,12 @@ Mob: +49 333 8362222", Cti::CallerId.rebuild Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491113661111', - 'to' => '4930600000000', - 'callId' => '4991155921769858278-1', + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491113661111', + 'to' => '4930600000000', + 'callId' => '4991155921769858278-1', 'direction' => 'in', ) @@ -328,12 +328,12 @@ Mob: +49 333 8362222", 5.times do |count| travel 2.seconds Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => "touch-loop-#{count}", + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => "touch-loop-#{count}", 'direction' => 'in', ) end @@ -358,12 +358,12 @@ Mob: +49 333 8362222", # new call with not known number travel 10.minutes Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '49111122222277', - 'to' => '4930600000000', - 'callId' => 'touch-loop-20', + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '49111122222277', + 'to' => '4930600000000', + 'callId' => 'touch-loop-20', 'direction' => 'in', ) @@ -389,11 +389,11 @@ Mob: +49 333 8362222", last_updated_at = Cti::Log.order(updated_at: :desc).first.updated_at travel 30.minutes agent4 = User.create!( - login: 'ticket-caller_id-agent4@example.com', - firstname: 'CallerId', - lastname: 'Agent4', - email: 'ticket-caller_id-agent4@example.com', - active: true, + login: 'ticket-caller_id-agent4@example.com', + firstname: 'CallerId', + lastname: 'Agent4', + email: 'ticket-caller_id-agent4@example.com', + active: true, updated_by_id: 1, created_by_id: 1, ) @@ -448,24 +448,24 @@ Mob: +49 333 8362222", travel 30.minutes last_caller_id_count = Cti::CallerId.count ticket1 = Ticket.create!( - title: 'some caller id test 1', - group: Group.lookup(name: 'Users'), - customer: @customer1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some caller id test 1', + group: Group.lookup(name: 'Users'), + customer: @customer1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer1.id, created_by_id: @customer1.id, ) article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message\n+49 1111 222222", - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message\n+49 1111 222222", + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer1.id, created_by_id: @customer1.id, ) @@ -479,12 +479,12 @@ Mob: +49 333 8362222", test '5 probe if caller log need to be pushed' do Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-0', + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-0', 'direction' => 'in', ) assert(Cti::Log.push_caller_list_update?(Cti::Log.last)) @@ -492,12 +492,12 @@ Mob: +49 333 8362222", 65.times do |count| travel 1.hour Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => "touch-loop-1-#{count}", + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => "touch-loop-1-#{count}", 'direction' => 'in', ) end @@ -507,12 +507,12 @@ Mob: +49 333 8362222", 65.times do |count| travel 1.minute Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => "touch-loop-2-#{count}", + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => "touch-loop-2-#{count}", 'direction' => 'in', ) end @@ -521,12 +521,12 @@ Mob: +49 333 8362222", travel 2.seconds Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-3-1', + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-3-1', 'direction' => 'in', ) assert(Cti::Log.push_caller_list_update?(Cti::Log.last)) @@ -548,12 +548,12 @@ Mob: +49 333 8362222", test 'order of events' do Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) @@ -563,12 +563,12 @@ Mob: +49 333 8362222", travel 2.seconds Cti::Log.process( - 'cause' => '', - 'event' => 'hangup', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'hangup', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) last.reload @@ -577,12 +577,12 @@ Mob: +49 333 8362222", travel 2.seconds Cti::Log.process( - 'cause' => '', - 'event' => 'answer', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'answer', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) last.reload @@ -594,12 +594,12 @@ Mob: +49 333 8362222", test 'not answered should be not marked as done' do Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) @@ -609,12 +609,12 @@ Mob: +49 333 8362222", travel 2.seconds Cti::Log.process( - 'cause' => '', - 'event' => 'hangup', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'hangup', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) last.reload @@ -625,12 +625,12 @@ Mob: +49 333 8362222", test 'answered should be marked as done' do Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) @@ -640,12 +640,12 @@ Mob: +49 333 8362222", travel 2.seconds Cti::Log.process( - 'cause' => '', - 'event' => 'answer', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'answer', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) last = Cti::Log.last @@ -654,12 +654,12 @@ Mob: +49 333 8362222", travel 2.seconds Cti::Log.process( - 'cause' => '', - 'event' => 'hangup', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'hangup', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) last.reload @@ -670,12 +670,12 @@ Mob: +49 333 8362222", test 'voicemail should not be marked as done' do Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) @@ -684,12 +684,12 @@ Mob: +49 333 8362222", assert_equal(last.done, false) Cti::Log.process( - 'cause' => '', - 'event' => 'answer', - 'user' => 'voicemail', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'answer', + 'user' => 'voicemail', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) last = Cti::Log.last @@ -698,12 +698,12 @@ Mob: +49 333 8362222", travel 2.seconds Cti::Log.process( - 'cause' => '', - 'event' => 'hangup', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'hangup', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) last.reload @@ -714,12 +714,12 @@ Mob: +49 333 8362222", test 'forwarded should be marked as done' do Cti::Log.process( - 'cause' => '', - 'event' => 'newCall', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => '', + 'event' => 'newCall', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) @@ -729,12 +729,12 @@ Mob: +49 333 8362222", travel 2.seconds Cti::Log.process( - 'cause' => 'forwarded', - 'event' => 'hangup', - 'user' => 'user 1', - 'from' => '491111222222', - 'to' => '4930600000000', - 'callId' => 'touch-loop-1', + 'cause' => 'forwarded', + 'event' => 'hangup', + 'user' => 'user 1', + 'from' => '491111222222', + 'to' => '4930600000000', + 'callId' => 'touch-loop-1', 'direction' => 'in', ) last.reload diff --git a/test/unit/email_address_test.rb b/test/unit/email_address_test.rb index a50c83b1d..f98778ea0 100644 --- a/test/unit/email_address_test.rb +++ b/test/unit/email_address_test.rb @@ -4,9 +4,9 @@ class EmailAddressTest < ActiveSupport::TestCase test 'basic tests' do email_address1 = EmailAddress.create_or_update( - realname: 'address #1', - email: 'address1@example.com', - active: true, + realname: 'address #1', + email: 'address1@example.com', + active: true, updated_by_id: 1, created_by_id: 1, ) @@ -21,19 +21,19 @@ class EmailAddressTest < ActiveSupport::TestCase test 'group tests' do email_address1 = EmailAddress.create_or_update( - realname: 'address #1', - email: 'address1@example.com', - active: true, + realname: 'address #1', + email: 'address1@example.com', + active: true, updated_by_id: 1, created_by_id: 1, ) group1 = Group.create_or_update( - name: 'group email address 1', + name: 'group email address 1', email_address_id: email_address1.id, - active: true, - updated_by_id: 1, - created_by_id: 1, + active: true, + updated_by_id: 1, + created_by_id: 1, ) assert(group1.email_address_id) email_address1.destroy @@ -45,26 +45,26 @@ class EmailAddressTest < ActiveSupport::TestCase test 'channel tests' do channel1 = Channel.create( - area: 'Email::Account', - options: {}, - active: true, + area: 'Email::Account', + options: {}, + active: true, updated_by_id: 1, created_by_id: 1, ) email_address1 = EmailAddress.create_or_update( - realname: 'address #1', - email: 'address1@example.com', - active: true, - channel_id: channel1.id, + realname: 'address #1', + email: 'address1@example.com', + active: true, + channel_id: channel1.id, updated_by_id: 1, created_by_id: 1, ) email_address2 = EmailAddress.create_or_update( - realname: 'address #2', - email: 'address2@example.com', - active: true, - channel_id: channel1.id, + realname: 'address #2', + email: 'address2@example.com', + active: true, + channel_id: channel1.id, updated_by_id: 1, created_by_id: 1, ) @@ -78,9 +78,9 @@ class EmailAddressTest < ActiveSupport::TestCase assert_not(email_address2.channel_id) channel1 = Channel.create( - area: 'Email::Account', - options: {}, - active: true, + area: 'Email::Account', + options: {}, + active: true, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_build_test.rb b/test/unit/email_build_test.rb index 55289bb1d..362c9ee67 100644 --- a/test/unit/email_build_test.rb +++ b/test/unit/email_build_test.rb @@ -42,15 +42,15 @@ class EmailBuildTest < ActiveSupport::TestCase MSG_HTML mail = Channel::EmailBuild.build( - from: 'sender@example.com', - to: 'recipient@example.com', - body: html, + from: 'sender@example.com', + to: 'recipient@example.com', + body: html, content_type: 'text/html', - attachments: [ + attachments: [ { 'Mime-Type' => 'image/png', - :content => 'xxx', - :filename => 'somename.png' + :content => 'xxx', + :filename => 'somename.png' } ], ) @@ -101,14 +101,14 @@ class EmailBuildTest < ActiveSupport::TestCase > MSG_TEXT mail = Channel::EmailBuild.build( - from: 'sender@example.com', - to: 'recipient@example.com', - body: text, + from: 'sender@example.com', + to: 'recipient@example.com', + body: text, attachments: [ { 'Mime-Type' => 'image/png', - :content => 'xxx', - :filename => 'somename.png' + :content => 'xxx', + :filename => 'somename.png' } ], ) @@ -141,11 +141,11 @@ class EmailBuildTest < ActiveSupport::TestCase test 'plain email + attachment check 2' do ticket1 = Ticket.create!( - title: 'some article helper test1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some article helper test1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -153,26 +153,26 @@ class EmailBuildTest < ActiveSupport::TestCase # create inbound article #1 article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message article helper test1
asdasd
', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message article helper test1
asdasd
', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) store1 = Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: 'content_file1_normally_should_be_an_ics_calendar_file', - filename: 'schedule.ics', - preferences: { + object: 'Ticket::Article', + o_id: article1.id, + data: 'content_file1_normally_should_be_an_ics_calendar_file', + filename: 'schedule.ics', + preferences: { 'Mime-Type' => 'text/calendar' }, created_by_id: 1, @@ -185,9 +185,9 @@ class EmailBuildTest < ActiveSupport::TestCase > MSG_TEXT mail = Channel::EmailBuild.build( - from: 'sender@example.com', - to: 'recipient@example.com', - body: text, + from: 'sender@example.com', + to: 'recipient@example.com', + body: text, attachments: [ store1 ], @@ -228,7 +228,7 @@ class EmailBuildTest < ActiveSupport::TestCase MSG_TEXT mail = Channel::EmailBuild.build( from: 'sender@example.com', - to: 'recipient@example.com', + to: 'recipient@example.com', body: text, ) diff --git a/test/unit/email_process_auto_response_test.rb b/test/unit/email_process_auto_response_test.rb index e24eea9cb..0541a7981 100644 --- a/test/unit/email_process_auto_response_test.rb +++ b/test/unit/email_process_auto_response_test.rb @@ -6,48 +6,48 @@ class EmailProcessAutoResponseTest < ActiveSupport::TestCase roles = Role.where(name: 'Agent') agent1 = User.create!( - login: 'ticket-auto-responder-agent1@example.com', - firstname: 'AutoReponder', - lastname: 'Agent1', - email: 'ticket-auto-responder-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: Group.all, + login: 'ticket-auto-responder-agent1@example.com', + firstname: 'AutoReponder', + lastname: 'Agent1', + email: 'ticket-auto-responder-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: Group.all, updated_by_id: 1, created_by_id: 1, ) Trigger.create!( - name: '002 auto reply', - condition: { - 'ticket.action' => { + name: '002 auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk, auto-reply', + 'value' => 'aa, kk, auto-reply', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = "From: me@example.com @@ -193,31 +193,31 @@ test" # add an agent notification Trigger.create!( - name: '001 additional agent notification', - condition: { + name: '001 additional agent notification', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', 'recipient' => 'ticket_agents', - 'subject' => 'New Ticket add. info (#{ticket.title})!', + 'subject' => 'New Ticket add. info (#{ticket.title})!', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk, agent-notification', + 'value' => 'aa, kk, agent-notification', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = "From: me@example.com @@ -350,48 +350,48 @@ Some Text" roles = Role.where(name: 'Agent') agent1 = User.create!( - login: 'ticket-auto-responder-agent1@example.com', - firstname: 'AutoReponder', - lastname: 'Agent1', - email: 'ticket-auto-responder-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: Group.all, + login: 'ticket-auto-responder-agent1@example.com', + firstname: 'AutoReponder', + lastname: 'Agent1', + email: 'ticket-auto-responder-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: Group.all, updated_by_id: 1, created_by_id: 1, ) Trigger.create!( - name: '001 auto reply', - condition: { - 'ticket.action' => { + name: '001 auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk, auto-reply', + 'value' => 'aa, kk, auto-reply', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = "From: me@example.com @@ -537,31 +537,31 @@ test" # add an agent notification Trigger.create!( - name: '002 additional agent notification', - condition: { + name: '002 additional agent notification', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', 'recipient' => 'ticket_agents', - 'subject' => 'New Ticket add. info (#{ticket.title})!', + 'subject' => 'New Ticket add. info (#{ticket.title})!', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk, agent-notification', + 'value' => 'aa, kk, agent-notification', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = "From: me@example.com @@ -694,80 +694,80 @@ Some Text" roles = Role.where(name: 'Agent') agent1 = User.create!( - login: 'ticket-auto-responder-agent1@example.com', - firstname: 'AutoReponder', - lastname: 'Agent1', - email: 'ticket-auto-responder-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: Group.all, + login: 'ticket-auto-responder-agent1@example.com', + firstname: 'AutoReponder', + lastname: 'Agent1', + email: 'ticket-auto-responder-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: Group.all, updated_by_id: 1, created_by_id: 1, ) Trigger.create!( - name: '001 auto reply', - condition: { - 'ticket.action' => { + name: '001 auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'open').id.to_s, + 'value' => Ticket::State.lookup(name: 'open').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk, auto-reply', + 'value' => 'aa, kk, auto-reply', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # add an agent notification Trigger.create!( - name: '002 additional agent notification', - condition: { + name: '002 additional agent notification', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}', 'recipient' => 'ticket_agents', - 'subject' => 'New Ticket add. info (#{ticket.title})!', + 'subject' => 'New Ticket add. info (#{ticket.title})!', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk, agent-notification', + 'value' => 'aa, kk, agent-notification', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = "From: me@example.com diff --git a/test/unit/email_process_bounce_delivery_permanent_failed_test.rb b/test/unit/email_process_bounce_delivery_permanent_failed_test.rb index 27297f096..cfe11907d 100644 --- a/test/unit/email_process_bounce_delivery_permanent_failed_test.rb +++ b/test/unit/email_process_bounce_delivery_permanent_failed_test.rb @@ -5,77 +5,77 @@ class EmailProcessBounceDeliveryPermanentFailedTest < ActiveSupport::TestCase test 'process with bounce trigger email loop check - article based blocker' do roles = Role.where(name: %w[Customer]) customer1 = User.create_or_update( - login: 'ticket-bounce-trigger1@example.com', - firstname: 'Notification', - lastname: 'Customer1', - email: 'ticket-bounce-trigger1@example.com', - active: true, - roles: roles, - preferences: {}, + login: 'ticket-bounce-trigger1@example.com', + firstname: 'Notification', + lastname: 'Customer1', + email: 'ticket-bounce-trigger1@example.com', + active: true, + roles: roles, + preferences: {}, updated_by_id: 1, created_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply new ticket', - condition: { + name: 'auto reply new ticket', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply followup', - condition: { + name: 'auto reply followup', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your follow up (#{ticket.title})!', + 'subject' => 'Thanks for your follow up (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket = Ticket.create!( - title: 'bounce check', - group: Group.lookup(name: 'Users'), - customer: customer1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'bounce check', + group: Group.lookup(name: 'Users'), + customer: customer1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'bounce check', - message_id: '<20150830145601.30.6088xx@edenhofer.zammad.com>', - body: 'some message bounce check', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'bounce check', + message_id: '<20150830145601.30.6088xx@edenhofer.zammad.com>', + body: 'some message bounce check', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) @@ -84,15 +84,15 @@ class EmailProcessBounceDeliveryPermanentFailedTest < ActiveSupport::TestCase assert_equal(2, ticket.articles.count) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: customer1.email, - subject: 'bounce check 2', - message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', - body: 'some message bounce check 2', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: customer1.email, + subject: 'bounce check 2', + message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', + body: 'some message bounce check 2', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) @@ -112,77 +112,77 @@ class EmailProcessBounceDeliveryPermanentFailedTest < ActiveSupport::TestCase test 'process with bounce trigger email loop check - bounce based blocker' do roles = Role.where(name: %w[Customer]) customer2 = User.create_or_update( - login: 'ticket-bounce-trigger2@example.com', - firstname: 'Notification', - lastname: 'Customer2', - email: 'ticket-bounce-trigger2@example.com', - active: true, - roles: roles, - preferences: {}, + login: 'ticket-bounce-trigger2@example.com', + firstname: 'Notification', + lastname: 'Customer2', + email: 'ticket-bounce-trigger2@example.com', + active: true, + roles: roles, + preferences: {}, updated_by_id: 1, created_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply new ticket', - condition: { + name: 'auto reply new ticket', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply followup', - condition: { + name: 'auto reply followup', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your follow up (#{ticket.title})!', + 'subject' => 'Thanks for your follow up (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket = Ticket.create!( - title: 'bounce check', - group: Group.lookup(name: 'Users'), - customer: customer2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'bounce check', + group: Group.lookup(name: 'Users'), + customer: customer2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'bounce check', - message_id: '<20150830145601.30.6088xx@edenhofer.zammad.com>', - body: 'some message bounce check', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'bounce check', + message_id: '<20150830145601.30.6088xx@edenhofer.zammad.com>', + body: 'some message bounce check', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) @@ -191,15 +191,15 @@ class EmailProcessBounceDeliveryPermanentFailedTest < ActiveSupport::TestCase assert_equal(2, ticket.articles.count) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'bounce check 2', - message_id: '<20170526150141.232.13312@example.zammad.loc>', - body: 'some message bounce check 2', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'bounce check 2', + message_id: '<20170526150141.232.13312@example.zammad.loc>', + body: 'some message bounce check 2', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_process_bounce_delivery_temporary_failed_test.rb b/test/unit/email_process_bounce_delivery_temporary_failed_test.rb index a4d7c85e2..11d5359ae 100644 --- a/test/unit/email_process_bounce_delivery_temporary_failed_test.rb +++ b/test/unit/email_process_bounce_delivery_temporary_failed_test.rb @@ -5,24 +5,24 @@ class EmailProcessBounceDeliveryTemporaryFailed < ActiveSupport::TestCase test 'process with temp faild bounce email' do ticket = Ticket.create!( - title: 'temp failed check - ms', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'temp failed check - ms', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'temp failed check', - message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', - body: 'some message bounce check', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'temp failed check', + message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', + body: 'some message bounce check', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_process_bounce_follow_test.rb b/test/unit/email_process_bounce_follow_test.rb index 9e6045ec2..76d21212c 100644 --- a/test/unit/email_process_bounce_follow_test.rb +++ b/test/unit/email_process_bounce_follow_test.rb @@ -5,24 +5,24 @@ class EmailProcessBounceFollowUpTest < ActiveSupport::TestCase test 'process with bounce follow up check' do ticket = Ticket.create( - title: 'bounce check', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'bounce check', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'bounce check', - message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', - body: 'some message bounce check', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'bounce check', + message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', + body: 'some message bounce check', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) @@ -40,77 +40,77 @@ class EmailProcessBounceFollowUpTest < ActiveSupport::TestCase test 'process with bounce trigger email loop check - article based blocker' do roles = Role.where(name: %w[Customer]) customer1 = User.create_or_update( - login: 'ticket-bounce-trigger1@example.com', - firstname: 'Notification', - lastname: 'Customer1', - email: 'ticket-bounce-trigger1@example.com', - active: true, - roles: roles, - preferences: {}, + login: 'ticket-bounce-trigger1@example.com', + firstname: 'Notification', + lastname: 'Customer1', + email: 'ticket-bounce-trigger1@example.com', + active: true, + roles: roles, + preferences: {}, updated_by_id: 1, created_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply new ticket', - condition: { + name: 'auto reply new ticket', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply followup', - condition: { + name: 'auto reply followup', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your follow up (#{ticket.title})!', + 'subject' => 'Thanks for your follow up (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket = Ticket.create( - title: 'bounce check', - group: Group.lookup(name: 'Users'), - customer: customer1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'bounce check', + group: Group.lookup(name: 'Users'), + customer: customer1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'bounce check', - message_id: '<20150830145601.30.6088xx@edenhofer.zammad.com>', - body: 'some message bounce check', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'bounce check', + message_id: '<20150830145601.30.6088xx@edenhofer.zammad.com>', + body: 'some message bounce check', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) @@ -119,15 +119,15 @@ class EmailProcessBounceFollowUpTest < ActiveSupport::TestCase assert_equal(2, ticket.articles.count) article = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: customer1.email, - subject: 'bounce check 2', - message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', - body: 'some message bounce check 2', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: customer1.email, + subject: 'bounce check 2', + message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', + body: 'some message bounce check 2', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) @@ -148,77 +148,77 @@ class EmailProcessBounceFollowUpTest < ActiveSupport::TestCase test 'process with bounce trigger email loop check - bounce based blocker' do roles = Role.where(name: %w[Customer]) customer2 = User.create_or_update( - login: 'ticket-bounce-trigger2@example.com', - firstname: 'Notification', - lastname: 'Customer2', - email: 'ticket-bounce-trigger2@example.com', - active: true, - roles: roles, - preferences: {}, + login: 'ticket-bounce-trigger2@example.com', + firstname: 'Notification', + lastname: 'Customer2', + email: 'ticket-bounce-trigger2@example.com', + active: true, + roles: roles, + preferences: {}, updated_by_id: 1, created_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply new ticket', - condition: { + name: 'auto reply new ticket', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply followup', - condition: { + name: 'auto reply followup', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your follow up (#{ticket.title})!', + 'subject' => 'Thanks for your follow up (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket = Ticket.create( - title: 'bounce check', - group: Group.lookup(name: 'Users'), - customer: customer2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'bounce check', + group: Group.lookup(name: 'Users'), + customer: customer2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'bounce check', - message_id: '<20150830145601.30.6088xx@edenhofer.zammad.com>', - body: 'some message bounce check', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'bounce check', + message_id: '<20150830145601.30.6088xx@edenhofer.zammad.com>', + body: 'some message bounce check', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) @@ -227,15 +227,15 @@ class EmailProcessBounceFollowUpTest < ActiveSupport::TestCase assert_equal(2, ticket.articles.count) article = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'bounce check 2', - message_id: '<20170526150141.232.13312@example.zammad.loc>', - body: 'some message bounce check 2', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'bounce check 2', + message_id: '<20170526150141.232.13312@example.zammad.loc>', + body: 'some message bounce check 2', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_process_customer_selection_based_on_sender_recipient_test.rb b/test/unit/email_process_customer_selection_based_on_sender_recipient_test.rb index 528aec7bb..68193fabf 100644 --- a/test/unit/email_process_customer_selection_based_on_sender_recipient_test.rb +++ b/test/unit/email_process_customer_selection_based_on_sender_recipient_test.rb @@ -6,26 +6,26 @@ class EmailProcessCustomerSelectionBasedOnSenderRecipient < ActiveSupport::TestC groups = Group.all roles = Role.where(name: 'Agent') @agent1 = User.create_or_update( - login: 'user-customer-selection-agent1@example.com', - firstname: 'UserOutOfOffice', - lastname: 'Agent1', - email: 'user-customer-selection-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'user-customer-selection-agent1@example.com', + firstname: 'UserOutOfOffice', + lastname: 'Agent1', + email: 'user-customer-selection-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') @customer1 = User.create_or_update( - login: 'user-customer-selection-customer1@example.com', - firstname: 'UserOutOfOffice', - lastname: 'customer1', - email: 'user-customer-selection-customer1@example.com', - password: 'customerpw', - active: true, - roles: roles, + login: 'user-customer-selection-customer1@example.com', + firstname: 'UserOutOfOffice', + lastname: 'customer1', + email: 'user-customer-selection-customer1@example.com', + password: 'customerpw', + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_process_follow_up_possible_test.rb b/test/unit/email_process_follow_up_possible_test.rb index e804931b9..ed05bf634 100644 --- a/test/unit/email_process_follow_up_possible_test.rb +++ b/test/unit/email_process_follow_up_possible_test.rb @@ -7,24 +7,24 @@ class EmailProcessFollowUpPossibleTest < ActiveSupport::TestCase users_group = Group.lookup(name: 'Users') ticket = Ticket.create( - title: 'follow up check', - group: users_group, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'follow up check', + group: users_group, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'follow up check', - message_id: '<20150830145601.30.608882@edenhofer.zammad.com>', - body: 'some message article', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'follow up check', + message_id: '<20150830145601.30.608882@edenhofer.zammad.com>', + body: 'some message article', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_process_follow_up_test.rb b/test/unit/email_process_follow_up_test.rb index 6fd7b8541..03ab989dd 100644 --- a/test/unit/email_process_follow_up_test.rb +++ b/test/unit/email_process_follow_up_test.rb @@ -5,24 +5,24 @@ class EmailProcessFollowUpTest < ActiveSupport::TestCase test 'process with follow up check' do ticket = Ticket.create( - title: 'follow up check', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'follow up check', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'follow up check', - message_id: '<20150830145601.30.608882@edenhofer.zammad.com>', - body: 'some message article', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'follow up check', + message_id: '<20150830145601.30.608882@edenhofer.zammad.com>', + body: 'some message article', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -198,24 +198,24 @@ no reference " Setting.set('ticket_hook', 'VD-Ticket#') ticket = Ticket.create( - title: 'follow up check ticket hook', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'follow up check ticket hook', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'follow up check', - message_id: '<20150830145601.30.608882.123123@edenhofer.zammad.com>', - body: 'some message article', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'follow up check', + message_id: '<20150830145601.30.608882.123123@edenhofer.zammad.com>', + body: 'some message article', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -286,24 +286,24 @@ test 123 test 'process with follow up check - with auto responses and no T# in subject_build' do ticket = Ticket.create( - title: 'follow up - with references follow up check', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'follow up - with references follow up check', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'follow up with references follow up check', - message_id: '<20151222145601.30.608881@edenhofer.zammad.com>', - body: 'some message with references follow up check', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'follow up with references follow up check', + message_id: '<20151222145601.30.608881@edenhofer.zammad.com>', + body: 'some message with references follow up check', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -331,24 +331,24 @@ Some Text" test 'process with follow up check - email with more forgein T#\'s in subject' do ticket = Ticket.create( - title: 'email with more forgein T#\'s in subject', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'email with more forgein T#\'s in subject', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'follow up with references follow up check', - message_id: '<20151222145601.30.608881@edenhofer.zammad.com>', - body: 'some message with references follow up check', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'follow up with references follow up check', + message_id: '<20151222145601.30.608881@edenhofer.zammad.com>', + body: 'some message with references follow up check', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_process_out_of_office_test.rb b/test/unit/email_process_out_of_office_test.rb index 3fcff5326..5428dca89 100644 --- a/test/unit/email_process_out_of_office_test.rb +++ b/test/unit/email_process_out_of_office_test.rb @@ -5,24 +5,24 @@ class EmailProcessOutOfOfficeTest < ActiveSupport::TestCase test 'process with out of office check - ms' do ticket = Ticket.create!( - title: 'ooo check - ms', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'ooo check - ms', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'ooo check', - message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', - body: 'some message bounce check', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'ooo check', + message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', + body: 'some message bounce check', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -91,24 +91,24 @@ Some Text" test 'process with out of office check - zimbra' do ticket = Ticket.create!( - title: 'ooo check - zimbra', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'ooo check - zimbra', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'ooo check', - message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', - body: 'some message bounce check', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'ooo check', + message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', + body: 'some message bounce check', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -169,24 +169,24 @@ Some Text" test 'process with out of office check - cloud' do ticket = Ticket.create!( - title: 'ooo check - cloud', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'ooo check - cloud', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'ooo check', - message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', - body: 'some message bounce check', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'ooo check', + message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', + body: 'some message bounce check', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -242,24 +242,24 @@ Some Text" test 'process with out of office check - gmail' do ticket = Ticket.create!( - title: 'ooo check - gmail', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'ooo check - gmail', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'ooo check', - message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', - body: 'some message bounce check', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'ooo check', + message_id: '<20150830145601.30.608881@edenhofer.zammad.com>', + body: 'some message bounce check', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_process_reply_to_test.rb b/test/unit/email_process_reply_to_test.rb index 6e87dbe61..56dcb1cc7 100644 --- a/test/unit/email_process_reply_to_test.rb +++ b/test/unit/email_process_reply_to_test.rb @@ -119,9 +119,9 @@ Some Text" Setting.set('postmaster_sender_based_on_reply_to', 'as_sender_of_email') EmailAddress.create!( - realname: 'address #1', - email: 'marketing_tool@example.com', - active: true, + realname: 'address #1', + email: 'marketing_tool@example.com', + active: true, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_process_sender_is_system_address_or_agent_test.rb b/test/unit/email_process_sender_is_system_address_or_agent_test.rb index 2eb3f7e48..2a5fcb2e0 100644 --- a/test/unit/email_process_sender_is_system_address_or_agent_test.rb +++ b/test/unit/email_process_sender_is_system_address_or_agent_test.rb @@ -4,10 +4,10 @@ class EmailProcessSenderIsSystemAddressOrAgent < ActiveSupport::TestCase setup do EmailAddress.create_or_update( - channel_id: 1, - realname: 'My System', - email: 'Myzammad@system.TEST', - active: true, + channel_id: 1, + realname: 'My System', + email: 'Myzammad@system.TEST', + active: true, updated_by_id: 1, created_by_id: 1, ) @@ -95,13 +95,13 @@ Some Text" # create customer roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'ticket-system-sender-customer1@example.com', - firstname: 'system-sender', - lastname: 'Customer1', - email: 'ticket-system-sender-customer1@example.com', - password: 'customerpw', - active: true, - roles: roles, + login: 'ticket-system-sender-customer1@example.com', + firstname: 'system-sender', + lastname: 'Customer1', + email: 'ticket-system-sender-customer1@example.com', + password: 'customerpw', + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) @@ -110,14 +110,14 @@ Some Text" groups = Group.all roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'ticket-system-sender-agent1@example.com', - firstname: 'system-sender', - lastname: 'Agent1', - email: 'ticket-system-sender-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'ticket-system-sender-agent1@example.com', + firstname: 'system-sender', + lastname: 'Agent1', + email: 'ticket-system-sender-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_process_state_open_set.rb b/test/unit/email_process_state_open_set.rb index 732a1472b..f29386c1d 100644 --- a/test/unit/email_process_state_open_set.rb +++ b/test/unit/email_process_state_open_set.rb @@ -6,26 +6,26 @@ class EmailProcessStateOpenSet < ActiveSupport::TestCase groups = Group.all roles = Role.where(name: 'Agent') @agent1 = User.create_or_update( - login: 'agent-ticket-state-open-set@example.com', - firstname: 'StateOpenSet', - lastname: 'Agent1', - email: 'agent-ticket-state-open-set@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent-ticket-state-open-set@example.com', + firstname: 'StateOpenSet', + lastname: 'Agent1', + email: 'agent-ticket-state-open-set@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') @customer1 = User.create_or_update( - login: 'customer-ticket-state-open-set@example.com', - firstname: 'StateOpenSet', - lastname: 'Customer', - email: 'customer-ticket-state-open-set@example.com', - password: 'customerpw', - active: true, - roles: roles, + login: 'customer-ticket-state-open-set@example.com', + firstname: 'StateOpenSet', + lastname: 'Customer', + email: 'customer-ticket-state-open-set@example.com', + password: 'customerpw', + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) @@ -51,11 +51,11 @@ Some Text" assert_equal('Customer', ticket.customer.lastname) article = Ticket::Article.create!( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'email').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - body: 'test', - internal: false, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.find_by(name: 'email').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, + body: 'test', + internal: false, updated_by_id: @customer1.id, created_by_id: @customer1.id, ) @@ -70,11 +70,11 @@ Some Text" assert_equal('Customer', ticket.customer.lastname) article = Ticket::Article.create!( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'email').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Agent').id, - body: 'test', - internal: false, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.find_by(name: 'email').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Agent').id, + body: 'test', + internal: false, updated_by_id: @agent1.id, created_by_id: @agent1.id, ) @@ -110,11 +110,11 @@ Some Text" assert_equal('Customer', ticket.customer.lastname) article = Ticket::Article.create!( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'email').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - body: 'test', - internal: false, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.find_by(name: 'email').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, + body: 'test', + internal: false, updated_by_id: @customer1.id, created_by_id: @customer1.id, ) @@ -129,11 +129,11 @@ Some Text" assert_equal('Customer', ticket.customer.lastname) article = Ticket::Article.create!( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'email').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Agent').id, - body: 'test', - internal: false, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.find_by(name: 'email').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Agent').id, + body: 'test', + internal: false, updated_by_id: @agent1.id, created_by_id: @agent1.id, ) diff --git a/test/unit/email_signature_detection_test.rb b/test/unit/email_signature_detection_test.rb index 4a5429274..c31aff317 100644 --- a/test/unit/email_signature_detection_test.rb +++ b/test/unit/email_signature_detection_test.rb @@ -9,9 +9,9 @@ class EmailSignatureDetectionTest < ActiveSupport::TestCase signature_lines = [10, 20, 6] messages = message_files.zip(signature_lines).map do |f, l| - { content: File.read(Rails.root.join('test', 'data', f)), + { content: File.read(Rails.root.join('test', 'data', f)), content_type: 'text/plain', - line: l } + line: l } end signature = SignatureDetection.find_signature(messages) @@ -30,9 +30,9 @@ class EmailSignatureDetectionTest < ActiveSupport::TestCase signature_lines = [26, 4, 6] messages = message_files.zip(signature_lines).map do |f, l| - { content: File.read(Rails.root.join('test', 'data', f)), + { content: File.read(Rails.root.join('test', 'data', f)), content_type: 'text/plain', - line: l } + line: l } end signature = SignatureDetection.find_signature(messages) @@ -58,9 +58,9 @@ class EmailSignatureDetectionTest < ActiveSupport::TestCase signature_lines = [8, 29, 6] messages = message_files.zip(signature_lines).map do |f, l| - { content: File.read(Rails.root.join('test', 'data', f)), + { content: File.read(Rails.root.join('test', 'data', f)), content_type: 'text/html', - line: l } + line: l } end signature = SignatureDetection.find_signature(messages) diff --git a/test/unit/history_test.rb b/test/unit/history_test.rb index 893a2c93f..36c540b20 100644 --- a/test/unit/history_test.rb +++ b/test/unit/history_test.rb @@ -9,66 +9,66 @@ class HistoryTest < ActiveSupport::TestCase # test 1 { ticket_create: { - ticket: { - group_id: Group.lookup(name: 'Users').id, - customer_id: current_user.id, - owner_id: User.lookup(login: '-').id, - title: 'Unit Test 1 (äöüß)!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + ticket: { + group_id: Group.lookup(name: 'Users').id, + customer_id: current_user.id, + owner_id: User.lookup(login: '-').id, + title: 'Unit Test 1 (äöüß)!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: current_user.id, created_by_id: current_user.id, }, article: { updated_by_id: current_user.id, created_by_id: current_user.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Unit Test ', - body: 'Unit Test 123', - internal: false, + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false, }, }, ticket_update: { ticket: { - title: 'Unit Test 1 (äöüß) - update!', - state_id: Ticket::State.lookup(name: 'open').id, + title: 'Unit Test 1 (äöüß) - update!', + state_id: Ticket::State.lookup(name: 'open').id, priority_id: Ticket::Priority.lookup(name: '1 low').id, }, }, history_check: [ { - result: true, + result: true, history_object: 'Ticket', - history_type: 'created', + history_type: 'created', }, { - result: true, - history_object: 'Ticket', - history_type: 'updated', + result: true, + history_object: 'Ticket', + history_type: 'updated', history_attribute: 'title', - value_from: 'Unit Test 1 (äöüß)!', - value_to: 'Unit Test 1 (äöüß) - update!', + value_from: 'Unit Test 1 (äöüß)!', + value_to: 'Unit Test 1 (äöüß) - update!', }, { - result: true, - history_object: 'Ticket', - history_type: 'updated', + result: true, + history_object: 'Ticket', + history_type: 'updated', history_attribute: 'state', - value_from: 'new', - value_to: 'open', - id_from: Ticket::State.lookup(name: 'new').id, - id_to: Ticket::State.lookup(name: 'open').id, + value_from: 'new', + value_to: 'open', + id_from: Ticket::State.lookup(name: 'new').id, + id_to: Ticket::State.lookup(name: 'open').id, }, { - result: true, + result: true, history_object: 'Ticket::Article', - history_type: 'created', + history_type: 'created', }, { - result: false, + result: false, history_object: 'User', - history_type: 'updated', + history_type: 'updated', }, ] }, @@ -76,29 +76,29 @@ class HistoryTest < ActiveSupport::TestCase # test 2 { ticket_create: { - ticket: { - group_id: Group.lookup(name: 'Users').id, - customer_id: current_user.id, - owner_id: User.lookup(login: '-').id, - title: 'Unit Test 2 (äöüß)!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + ticket: { + group_id: Group.lookup(name: 'Users').id, + customer_id: current_user.id, + owner_id: User.lookup(login: '-').id, + title: 'Unit Test 2 (äöüß)!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: current_user.id, created_by_id: current_user.id, }, article: { created_by_id: current_user.id, updated_by_id: current_user.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Unit Test ', - body: 'Unit Test 123', - internal: false, + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false, }, }, ticket_update: { - ticket: { - title: 'Unit Test 2 (äöüß) - update!', + ticket: { + title: 'Unit Test 2 (äöüß) - update!', state_id: Ticket::State.lookup(name: 'open').id, owner_id: current_user.id, }, @@ -108,40 +108,40 @@ class HistoryTest < ActiveSupport::TestCase }, history_check: [ { - result: true, + result: true, history_object: 'Ticket', - history_type: 'created', + history_type: 'created', }, { - result: true, - history_object: 'Ticket', - history_type: 'updated', + result: true, + history_object: 'Ticket', + history_type: 'updated', history_attribute: 'title', - value_from: 'Unit Test 2 (äöüß)!', - value_to: 'Unit Test 2 (äöüß) - update!', + value_from: 'Unit Test 2 (äöüß)!', + value_to: 'Unit Test 2 (äöüß) - update!', }, { - result: false, - history_object: 'Ticket', - history_type: 'updated', + result: false, + history_object: 'Ticket', + history_type: 'updated', history_attribute: 'owner', - value_from: '-', - value_to: 'Nicole Braun', - id_from: User.lookup(login: '-').id, - id_to: current_user.id, + value_from: '-', + value_to: 'Nicole Braun', + id_from: User.lookup(login: '-').id, + id_to: current_user.id, }, { - result: true, + result: true, history_object: 'Ticket::Article', - history_type: 'created', + history_type: 'created', }, { - result: true, - history_object: 'Ticket::Article', - history_type: 'updated', + result: true, + history_object: 'Ticket::Article', + history_type: 'updated', history_attribute: 'body', - value_from: 'Unit Test 123', - value_to: 'Unit Test 123 - 2', + value_from: 'Unit Test 123', + value_to: 'Unit Test 123 - 2', }, ] }, @@ -193,54 +193,54 @@ class HistoryTest < ActiveSupport::TestCase # test 1 { - user_create: { + user_create: { user: { - login: "some_login_test-#{name}", - firstname: 'Bob', - lastname: 'Smith', - email: "somebody-#{name}@example.com", - active: true, + login: "some_login_test-#{name}", + firstname: 'Bob', + lastname: 'Smith', + email: "somebody-#{name}@example.com", + active: true, updated_by_id: current_user.id, created_by_id: current_user.id, }, }, - user_update: { + user_update: { user: { firstname: 'Bob', - lastname: 'Master', - email: "master-#{name}@example.com", - active: false, + lastname: 'Master', + email: "master-#{name}@example.com", + active: false, }, }, history_check: [ { - result: true, + result: true, history_object: 'User', - history_type: 'created', + history_type: 'created', }, { - result: true, - history_object: 'User', - history_type: 'updated', + result: true, + history_object: 'User', + history_type: 'updated', history_attribute: 'lastname', - value_from: 'Smith', - value_to: 'Master', + value_from: 'Smith', + value_to: 'Master', }, { - result: true, - history_object: 'User', - history_type: 'updated', + result: true, + history_object: 'User', + history_type: 'updated', history_attribute: 'email', - value_from: "somebody-#{name}@example.com", - value_to: "master-#{name}@example.com", + value_from: "somebody-#{name}@example.com", + value_to: "master-#{name}@example.com", }, { - result: true, - history_object: 'User', - history_type: 'updated', + result: true, + history_object: 'User', + history_type: 'updated', history_attribute: 'active', - value_from: 'true', - value_to: 'false', + value_from: 'true', + value_to: 'false', }, ], }, @@ -281,8 +281,8 @@ class HistoryTest < ActiveSupport::TestCase { organization_create: { organization: { - name: 'Org äöüß', - note: 'some note', + name: 'Org äöüß', + note: 'some note', updated_by_id: current_user.id, created_by_id: current_user.id, }, @@ -293,19 +293,19 @@ class HistoryTest < ActiveSupport::TestCase note: 'some note', }, }, - history_check: [ + history_check: [ { - result: true, + result: true, history_object: 'Organization', - history_type: 'created', + history_type: 'created', }, { - result: true, - history_object: 'Organization', - history_type: 'updated', + result: true, + history_object: 'Organization', + history_type: 'updated', history_attribute: 'name', - value_from: 'Org äöüß', - value_to: 'Org 123', + value_from: 'Org äöüß', + value_to: 'Org 123', }, ], }, diff --git a/test/unit/job_assets_test.rb b/test/unit/job_assets_test.rb index 3dcbe339b..8cbf938a2 100644 --- a/test/unit/job_assets_test.rb +++ b/test/unit/job_assets_test.rb @@ -7,60 +7,60 @@ class JobAssetsTest < ActiveSupport::TestCase roles = Role.where(name: %w[Customer]) user1 = User.create_or_update( - login: 'assets_job1@example.org', + login: 'assets_job1@example.org', firstname: 'assets_job1', - lastname: 'assets_job1', - email: 'assets_job1@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_job1', + email: 'assets_job1@example.org', + password: 'some_pass', + active: true, + roles: roles, ) user2 = User.create_or_update( - login: 'assets_job2@example.org', + login: 'assets_job2@example.org', firstname: 'assets_job2', - lastname: 'assets_job2', - email: 'assets_job2@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_job2', + email: 'assets_job2@example.org', + password: 'some_pass', + active: true, + roles: roles, ) user3 = User.create_or_update( - login: 'assets_job3@example.org', + login: 'assets_job3@example.org', firstname: 'assets_job3', - lastname: 'assets_job3', - email: 'assets_job3@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_job3', + email: 'assets_job3@example.org', + password: 'some_pass', + active: true, + roles: roles, ) ticket_state1 = Ticket::State.find_by(name: 'new') ticket_state2 = Ticket::State.find_by(name: 'open') ticket_priority2 = Ticket::Priority.find_by(name: '2 normal') job = Job.create_or_update( - name: 'my job', - timeplan: { + name: 'my job', + timeplan: { mon: true, }, - condition: { + condition: { 'ticket.state_id' => { operator: 'is', - value: [ ticket_state1.id, ticket_state2.id ], + value: [ ticket_state1.id, ticket_state2.id ], }, 'ticket.owner_id' => { - operator: 'is', - pre_condition: 'specific', - value: user1.id, + operator: 'is', + pre_condition: 'specific', + value: user1.id, value_completion: 'John Smith ' }, }, - perform: { + perform: { 'ticket.priority_id' => { value: ticket_priority2.id, }, - 'ticket.owner_id' => { - pre_condition: 'specific', - value: user2.id, + 'ticket.owner_id' => { + pre_condition: 'specific', + value: user2.id, value_completion: 'metest123@znuny.com ' }, }, diff --git a/test/unit/job_test.rb b/test/unit/job_test.rb index 29873f806..2d10389de 100644 --- a/test/unit/job_test.rb +++ b/test/unit/job_test.rb @@ -6,71 +6,71 @@ class JobTest < ActiveSupport::TestCase # create ticket group1 = Group.lookup(name: 'Users') group2 = Group.create_or_update( - name: 'JobTest2', + name: 'JobTest2', updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'job test 1', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: Time.zone.now - 3.days, - updated_at: Time.zone.now - 3.days, + title: 'job test 1', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: Time.zone.now - 3.days, + updated_at: Time.zone.now - 3.days, created_by_id: 1, updated_by_id: 1, ) ticket2 = Ticket.create!( - title: 'job test 2', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: Time.zone.now - 1.day, + title: 'job test 2', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: Time.zone.now - 1.day, created_by_id: 1, - updated_at: Time.zone.now - 1.day, + updated_at: Time.zone.now - 1.day, updated_by_id: 1, ) ticket3 = Ticket.create!( - title: 'job test 3', - group: group2, - customer_id: 2, - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '3 high'), - created_at: Time.zone.now - 1.day, + title: 'job test 3', + group: group2, + customer_id: 2, + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '3 high'), + created_at: Time.zone.now - 1.day, created_by_id: 1, - updated_at: Time.zone.now - 1.day, + updated_at: Time.zone.now - 1.day, updated_by_id: 1, ) ticket4 = Ticket.create!( - title: 'job test 4', - group: group2, - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: Time.zone.now - 3.days, + title: 'job test 4', + group: group2, + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: Time.zone.now - 3.days, created_by_id: 1, - updated_at: Time.zone.now - 3.days, + updated_at: Time.zone.now - 3.days, updated_by_id: 1, ) ticket5 = Ticket.create!( - title: 'job test 5', - group: group2, - customer_id: 2, - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: Time.zone.now - 3.days, + title: 'job test 5', + group: group2, + customer_id: 2, + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: Time.zone.now - 3.days, created_by_id: 1, updated_by_id: 1, - updated_at: Time.zone.now - 3.days, + updated_at: Time.zone.now - 3.days, ) # create jobs job1 = Job.create_or_update( - name: 'Test Job1', - timeplan: { - days: { + name: 'Test Job1', + timeplan: { + days: { Mon: false, Tue: false, Wed: false, @@ -79,17 +79,17 @@ class JobTest < ActiveSupport::TestCase Sat: false, Sun: false, }, - hours: { - 0 => false, - 1 => false, - 2 => false, - 3 => false, - 4 => false, - 5 => false, - 6 => false, - 7 => false, - 8 => false, - 9 => false, + hours: { + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, 10 => false, 11 => false, 12 => false, @@ -106,7 +106,7 @@ class JobTest < ActiveSupport::TestCase 23 => false, }, minutes: { - 0 => false, + 0 => false, 10 => false, 20 => false, 30 => false, @@ -114,20 +114,20 @@ class JobTest < ActiveSupport::TestCase 50 => false, }, }, - condition: { - 'ticket.state_id' => { 'operator' => 'is', 'value' => [Ticket::State.lookup(name: 'new').id.to_s, Ticket::State.lookup(name: 'open').id.to_s] }, + condition: { + 'ticket.state_id' => { 'operator' => 'is', 'value' => [Ticket::State.lookup(name: 'new').id.to_s, Ticket::State.lookup(name: 'open').id.to_s] }, 'ticket.created_at' => { 'operator' => 'before (relative)', 'value' => '2', 'range' => 'day' }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s } }, disable_notification: true, - last_run_at: nil, - active: true, - created_by_id: 1, - created_at: Time.zone.now, - updated_by_id: 1, - updated_at: Time.zone.now, + last_run_at: nil, + active: true, + created_by_id: 1, + created_at: Time.zone.now, + updated_by_id: 1, + updated_at: Time.zone.now, ) assert_not(job1.next_run_at) assert_not(job1.executable?) @@ -258,38 +258,38 @@ class JobTest < ActiveSupport::TestCase # create ticket group1 = Group.lookup(name: 'Users') group2 = Group.create_or_update( - name: 'JobTest2', + name: 'JobTest2', updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'job test 1', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: Time.zone.now - 3.days, - updated_at: Time.zone.now - 3.days, + title: 'job test 1', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: Time.zone.now - 3.days, + updated_at: Time.zone.now - 3.days, created_by_id: 1, updated_by_id: 1, ) ticket2 = Ticket.create!( - title: 'job test 2', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: Time.zone.now - 1.day, + title: 'job test 2', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: Time.zone.now - 1.day, created_by_id: 1, - updated_at: Time.zone.now - 1.day, + updated_at: Time.zone.now - 1.day, updated_by_id: 1, ) # create jobs job1 = Job.create_or_update( - name: 'Test Job1', - timeplan: { - days: { + name: 'Test Job1', + timeplan: { + days: { Mon: true, Tue: true, Wed: true, @@ -298,17 +298,17 @@ class JobTest < ActiveSupport::TestCase Sat: true, Sun: true, }, - hours: { - 0 => true, - 1 => true, - 2 => true, - 3 => true, - 4 => true, - 5 => true, - 6 => true, - 7 => true, - 8 => true, - 9 => true, + hours: { + 0 => true, + 1 => true, + 2 => true, + 3 => true, + 4 => true, + 5 => true, + 6 => true, + 7 => true, + 8 => true, + 9 => true, 10 => true, 11 => true, 12 => true, @@ -325,7 +325,7 @@ class JobTest < ActiveSupport::TestCase 23 => true, }, minutes: { - 0 => true, + 0 => true, 10 => true, 20 => true, 30 => true, @@ -333,19 +333,19 @@ class JobTest < ActiveSupport::TestCase 50 => true, }, }, - condition: { - 'ticket.state_id' => { 'operator' => 'is', 'value' => '9999' }, + condition: { + 'ticket.state_id' => { 'operator' => 'is', 'value' => '9999' }, 'ticket.created_at' => { 'operator' => 'before (relative)', 'value' => '2', 'range' => 'day' }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s } }, disable_notification: true, - last_run_at: nil, - updated_at: Time.zone.now - 15.minutes, - active: true, - updated_by_id: 1, - created_by_id: 1, + last_run_at: nil, + updated_at: Time.zone.now - 15.minutes, + active: true, + updated_by_id: 1, + created_by_id: 1, ) assert(job1.executable?) assert(job1.in_timeplan?) @@ -365,9 +365,9 @@ class JobTest < ActiveSupport::TestCase # create jobs job1 = Job.create_or_update( - name: 'Test Job1', - timeplan: { - days: { + name: 'Test Job1', + timeplan: { + days: { Mon: true, Tue: false, Wed: false, @@ -376,17 +376,17 @@ class JobTest < ActiveSupport::TestCase Sat: false, Sun: false, }, - hours: { - 0 => false, - 1 => true, - 2 => false, - 3 => false, - 4 => false, - 5 => false, - 6 => false, - 7 => false, - 8 => false, - 9 => false, + hours: { + 0 => false, + 1 => true, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, 10 => true, 11 => false, 12 => false, @@ -403,7 +403,7 @@ class JobTest < ActiveSupport::TestCase 23 => false, }, minutes: { - 0 => true, + 0 => true, 10 => false, 20 => false, 30 => false, @@ -411,20 +411,20 @@ class JobTest < ActiveSupport::TestCase 50 => false, }, }, - condition: { - 'ticket.state_id' => { 'operator' => 'is', 'value' => [Ticket::State.lookup(name: 'new').id.to_s, Ticket::State.lookup(name: 'open').id.to_s] }, + condition: { + 'ticket.state_id' => { 'operator' => 'is', 'value' => [Ticket::State.lookup(name: 'new').id.to_s, Ticket::State.lookup(name: 'open').id.to_s] }, 'ticket.created_at' => { 'operator' => 'before (relative)', 'value' => '2', 'range' => 'day' }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s } }, disable_notification: true, - last_run_at: nil, - active: true, - created_by_id: 1, - created_at: Time.zone.now, - updated_by_id: 1, - updated_at: Time.zone.now, + last_run_at: nil, + active: true, + created_by_id: 1, + created_at: Time.zone.now, + updated_by_id: 1, + updated_at: Time.zone.now, ) time_now = Time.zone.parse('2016-03-18 09:17:13 UTC') @@ -493,9 +493,9 @@ class JobTest < ActiveSupport::TestCase # create jobs job1 = Job.create_or_update( - name: 'Test Job1', - timeplan: { - days: { + name: 'Test Job1', + timeplan: { + days: { Mon: true, Tue: false, Wed: false, @@ -504,17 +504,17 @@ class JobTest < ActiveSupport::TestCase Sat: false, Sun: false, }, - hours: { - 0 => true, - 1 => false, - 2 => false, - 3 => false, - 4 => false, - 5 => false, - 6 => false, - 7 => false, - 8 => false, - 9 => false, + hours: { + 0 => true, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, 10 => true, 11 => false, 12 => false, @@ -531,7 +531,7 @@ class JobTest < ActiveSupport::TestCase 23 => false, }, minutes: { - 0 => true, + 0 => true, 10 => false, 20 => false, 30 => false, @@ -539,20 +539,20 @@ class JobTest < ActiveSupport::TestCase 50 => false, }, }, - condition: { - 'ticket.state_id' => { 'operator' => 'is', 'value' => [Ticket::State.lookup(name: 'new').id.to_s, Ticket::State.lookup(name: 'open').id.to_s] }, + condition: { + 'ticket.state_id' => { 'operator' => 'is', 'value' => [Ticket::State.lookup(name: 'new').id.to_s, Ticket::State.lookup(name: 'open').id.to_s] }, 'ticket.created_at' => { 'operator' => 'before (relative)', 'value' => '2', 'range' => 'day' }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s } }, disable_notification: true, - last_run_at: nil, - active: true, - created_by_id: 1, - created_at: Time.zone.now, - updated_by_id: 1, - updated_at: Time.zone.now, + last_run_at: nil, + active: true, + created_by_id: 1, + created_at: Time.zone.now, + updated_by_id: 1, + updated_at: Time.zone.now, ) time_now = Time.zone.parse('2016-03-17 23:51:23 UTC') @@ -582,9 +582,9 @@ class JobTest < ActiveSupport::TestCase test 'check next_run_at' do job1 = Job.create_or_update( - name: 'Test Job1', - timeplan: { - days: { + name: 'Test Job1', + timeplan: { + days: { Mon: true, Tue: false, Wed: false, @@ -593,17 +593,17 @@ class JobTest < ActiveSupport::TestCase Sat: false, Sun: false, }, - hours: { - '0' => true, - '1' => false, - '2' => false, - '3' => false, - '4' => false, - '5' => false, - '6' => false, - '7' => false, - '8' => false, - '9' => false, + hours: { + '0' => true, + '1' => false, + '2' => false, + '3' => false, + '4' => false, + '5' => false, + '6' => false, + '7' => false, + '8' => false, + '9' => false, '10' => false, '11' => false, '12' => false, @@ -620,7 +620,7 @@ class JobTest < ActiveSupport::TestCase '23' => false, }, minutes: { - '0' => true, + '0' => true, '10' => false, '20' => false, '30' => false, @@ -628,20 +628,20 @@ class JobTest < ActiveSupport::TestCase '50' => false, }, }, - condition: { - 'ticket.state_id' => { 'operator' => 'is', 'value' => [Ticket::State.lookup(name: 'new').id.to_s, Ticket::State.lookup(name: 'open').id.to_s] }, + condition: { + 'ticket.state_id' => { 'operator' => 'is', 'value' => [Ticket::State.lookup(name: 'new').id.to_s, Ticket::State.lookup(name: 'open').id.to_s] }, 'ticket.created_at' => { 'operator' => 'before (relative)', 'value' => '2', 'range' => 'day' }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s } }, disable_notification: true, - last_run_at: nil, - active: true, - created_by_id: 1, - created_at: Time.zone.now, - updated_by_id: 1, - updated_at: Time.zone.now, + last_run_at: nil, + active: true, + created_by_id: 1, + created_at: Time.zone.now, + updated_by_id: 1, + updated_at: Time.zone.now, ) time_now = Time.zone.parse('2016-03-17 23:51:23 UTC') @@ -654,9 +654,9 @@ class JobTest < ActiveSupport::TestCase travel_to Time.zone.local(2017, 11, 10, 22, 0o4, 44) job1 = Job.create_or_update( - name: 'Test Job1', - timeplan: { - days: { + name: 'Test Job1', + timeplan: { + days: { Mon: false, Tue: false, Wed: false, @@ -665,17 +665,17 @@ class JobTest < ActiveSupport::TestCase Sat: true, Sun: false, }, - hours: { - '0' => false, - '1' => false, - '2' => false, - '3' => false, - '4' => false, - '5' => false, - '6' => false, - '7' => false, - '8' => false, - '9' => false, + hours: { + '0' => false, + '1' => false, + '2' => false, + '3' => false, + '4' => false, + '5' => false, + '6' => false, + '7' => false, + '8' => false, + '9' => false, '10' => false, '11' => false, '12' => false, @@ -692,7 +692,7 @@ class JobTest < ActiveSupport::TestCase '23' => true, }, minutes: { - '0' => true, + '0' => true, '10' => false, '20' => false, '30' => false, @@ -700,19 +700,19 @@ class JobTest < ActiveSupport::TestCase '50' => false, }, }, - condition: { + condition: { 'ticket.state_id' => { 'operator' => 'is', 'value' => [Ticket::State.lookup(name: 'new').id.to_s, Ticket::State.lookup(name: 'open').id.to_s] }, }, - perform: { + perform: { 'ticket.action' => { 'value' => 'delete' }, }, disable_notification: true, - last_run_at: nil, - active: true, - created_by_id: 1, - created_at: Time.zone.now, - updated_by_id: 1, - updated_at: Time.zone.now, + last_run_at: nil, + active: true, + created_by_id: 1, + created_at: Time.zone.now, + updated_by_id: 1, + updated_at: Time.zone.now, ) assert_equal('2017-11-11 23:00:00 UTC', job1.next_run_at.to_s) @@ -737,28 +737,28 @@ class JobTest < ActiveSupport::TestCase group1 = Group.lookup(name: 'Users') ticket1 = Ticket.create!( - title: 'job test 1', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'job test 1', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), created_by_id: 1, updated_by_id: 1, ) ticket2 = Ticket.create!( - title: 'job test 2', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'job test 2', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), created_by_id: 1, updated_by_id: 1, ) job1 = Job.create_or_update( - name: 'Test Job1', - timeplan: { - days: { + name: 'Test Job1', + timeplan: { + days: { Mon: false, Tue: false, Wed: false, @@ -767,17 +767,17 @@ class JobTest < ActiveSupport::TestCase Sat: false, Sun: false, }, - hours: { - '0' => false, - '1' => false, - '2' => false, - '3' => false, - '4' => false, - '5' => false, - '6' => false, - '7' => false, - '8' => false, - '9' => false, + hours: { + '0' => false, + '1' => false, + '2' => false, + '3' => false, + '4' => false, + '5' => false, + '6' => false, + '7' => false, + '8' => false, + '9' => false, '10' => false, '11' => false, '12' => false, @@ -794,7 +794,7 @@ class JobTest < ActiveSupport::TestCase '23' => true, }, minutes: { - '0' => true, + '0' => true, '10' => false, '20' => false, '30' => false, @@ -802,19 +802,19 @@ class JobTest < ActiveSupport::TestCase '50' => false, }, }, - condition: { + condition: { 'ticket.state_id' => { 'operator' => 'is', 'value' => [Ticket::State.lookup(name: 'new').id.to_s, Ticket::State.lookup(name: 'open').id.to_s] }, }, - perform: { + perform: { 'ticket.action' => { 'value' => 'delete' }, }, disable_notification: true, - last_run_at: nil, - active: true, - created_by_id: 1, - created_at: Time.zone.now, - updated_by_id: 1, - updated_at: Time.zone.now, + last_run_at: nil, + active: true, + created_by_id: 1, + created_at: Time.zone.now, + updated_by_id: 1, + updated_at: Time.zone.now, ) Job.run @@ -836,39 +836,39 @@ class JobTest < ActiveSupport::TestCase # create ticket group1 = Group.lookup(name: 'Users') group2 = Group.create_or_update( - name: 'JobTest2', + name: 'JobTest2', updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'job test 1', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: Time.zone.now - 3.days, - updated_at: Time.zone.now - 3.days, + title: 'job test 1', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: Time.zone.now - 3.days, + updated_at: Time.zone.now - 3.days, created_by_id: 1, updated_by_id: 1, ) ticket1.tag_add('spam', 1) ticket1.tag_add('test1 ', 1) ticket2 = Ticket.create!( - title: 'job test 2', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: Time.zone.now - 1.day, + title: 'job test 2', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: Time.zone.now - 1.day, created_by_id: 1, - updated_at: Time.zone.now - 1.day, + updated_at: Time.zone.now - 1.day, updated_by_id: 1, ) job1 = Job.create_or_update( - name: 'Test Job1', - timeplan: { - days: { + name: 'Test Job1', + timeplan: { + days: { Mon: true, Tue: true, Wed: true, @@ -877,17 +877,17 @@ class JobTest < ActiveSupport::TestCase Sat: true, Sun: true, }, - hours: { - 0 => true, - 1 => true, - 2 => true, - 3 => true, - 4 => true, - 5 => true, - 6 => true, - 7 => true, - 8 => true, - 9 => true, + hours: { + 0 => true, + 1 => true, + 2 => true, + 3 => true, + 4 => true, + 5 => true, + 6 => true, + 7 => true, + 8 => true, + 9 => true, 10 => true, 11 => true, 12 => true, @@ -904,7 +904,7 @@ class JobTest < ActiveSupport::TestCase 23 => true, }, minutes: { - 0 => true, + 0 => true, 10 => true, 20 => true, 30 => true, @@ -912,18 +912,18 @@ class JobTest < ActiveSupport::TestCase 50 => true, }, }, - condition: { + condition: { 'ticket.tags' => { 'operator' => 'contains one', 'value' => 'spam' }, }, - perform: { + perform: { 'ticket.action' => { 'value' => 'delete' }, }, disable_notification: true, - last_run_at: nil, - updated_at: Time.zone.now - 15.minutes, - active: true, - updated_by_id: 1, - created_by_id: 1, + last_run_at: nil, + updated_at: Time.zone.now - 15.minutes, + active: true, + updated_by_id: 1, + created_by_id: 1, ) assert(job1.executable?) assert(job1.in_timeplan?) @@ -939,33 +939,33 @@ class JobTest < ActiveSupport::TestCase # create ticket group1 = Group.lookup(name: 'Users') group2 = Group.create_or_update( - name: 'JobTest2', + name: 'JobTest2', updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'job test 1', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'job test 1', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), created_by_id: 1, updated_by_id: 1, ) ticket2 = Ticket.create!( - title: 'job test 2', - group: group2, - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'job test 2', + group: group2, + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), created_by_id: 1, updated_by_id: 1, ) travel_to Time.zone.parse('2018-08-13T23:01:01Z') job1 = Job.create_or_update( - name: 'Spam entfernen', - timeplan: { - days: { + name: 'Spam entfernen', + timeplan: { + days: { Mon: true, Tue: false, Wed: true, @@ -974,17 +974,17 @@ class JobTest < ActiveSupport::TestCase Sat: false, Sun: false, }, - hours: { - '0' => false, - '1' => false, - '2' => false, - '3' => false, - '4' => false, - '5' => false, - '6' => false, - '7' => false, - '8' => false, - '9' => false, + hours: { + '0' => false, + '1' => false, + '2' => false, + '3' => false, + '4' => false, + '5' => false, + '6' => false, + '7' => false, + '8' => false, + '9' => false, '10' => false, '11' => false, '12' => false, @@ -1001,7 +1001,7 @@ class JobTest < ActiveSupport::TestCase '23' => true, }, minutes: { - '0' => true, + '0' => true, '10' => false, '20' => false, '30' => false, @@ -1009,23 +1009,23 @@ class JobTest < ActiveSupport::TestCase '50' => false, } }, - condition: { + condition: { 'ticket.group_id' => { 'operator' => 'is', 'value' => group1.id }, 'ticket.state_id' => { 'operator' => 'is', 'value' => Ticket::State.find_by(name: 'closed').id } }, - perform: { + perform: { 'ticket.action' => { 'value' => 'delete' } }, disable_notification: true, - last_run_at: nil, - next_run_at: '2018-08-13 23:00:00', - running: false, - processed: 19_393, - matching: 19_428, - updated_at: Time.zone.now - 15.minutes, - active: true, - updated_by_id: 1, - created_by_id: 1, + last_run_at: nil, + next_run_at: '2018-08-13 23:00:00', + running: false, + processed: 19_393, + matching: 19_428, + updated_at: Time.zone.now - 15.minutes, + active: true, + updated_by_id: 1, + created_by_id: 1, ) assert(job1.executable?) @@ -1036,11 +1036,11 @@ class JobTest < ActiveSupport::TestCase assert(Ticket.find_by(id: ticket2.id)) ticket1 = Ticket.create!( - title: 'job test 1', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'job test 1', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), + priority: Ticket::Priority.lookup(name: '2 normal'), created_by_id: 1, updated_by_id: 1, ) diff --git a/test/unit/karma_test.rb b/test/unit/karma_test.rb index eb50cde3d..87634351b 100644 --- a/test/unit/karma_test.rb +++ b/test/unit/karma_test.rb @@ -7,66 +7,66 @@ class KarmaTest < ActiveSupport::TestCase groups = Group.all roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'karma-agent1@example.com', - firstname: 'Karma', - lastname: 'Agent1', - email: 'karma-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'karma-agent1@example.com', + firstname: 'Karma', + lastname: 'Agent1', + email: 'karma-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( - login: 'karma-agent2@example.com', - firstname: 'Karma', - lastname: 'Agent2', - email: 'karma-agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'karma-agent2@example.com', + firstname: 'Karma', + lastname: 'Agent2', + email: 'karma-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) customer1 = User.create_or_update( - login: 'karma-customer1@example.com', - firstname: 'Karma', - lastname: 'Customer1', - email: 'karma-customer1@example.com', - password: 'customerpw', - active: true, - roles: roles, - groups: groups, + login: 'karma-customer1@example.com', + firstname: 'Karma', + lastname: 'Customer1', + email: 'karma-customer1@example.com', + password: 'customerpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create( - title: 'karma test 1', - group: Group.lookup(name: 'Users'), - customer: customer1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'karma test 1', + group: Group.lookup(name: 'Users'), + customer: customer1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: agent1.id, created_by_id: agent1.id, - updated_at: Time.zone.now - 10.hours, - created_at: Time.zone.now - 10.hours, + updated_at: Time.zone.now - 10.hours, + created_at: Time.zone.now - 10.hours, ) Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'agent phone 1 / init', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'phone'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'agent phone 1 / init', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'phone'), updated_by_id: agent1.id, created_by_id: agent1.id, - updated_at: Time.zone.now - 10.hours, - created_at: Time.zone.now - 10.hours, + updated_at: Time.zone.now - 10.hours, + created_at: Time.zone.now - 10.hours, ) assert(ticket1) @@ -140,19 +140,19 @@ class KarmaTest < ActiveSupport::TestCase ticket1.save! Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'reply: some subject', - message_id: 'some@id', - body: 'agent phone 2', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'phone'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'reply: some subject', + message_id: 'some@id', + body: 'agent phone 2', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'phone'), updated_by_id: agent2.id, created_by_id: agent2.id, - updated_at: Time.zone.now - (9.hours + 15.minutes), - created_at: Time.zone.now - (9.hours + 15.minutes), + updated_at: Time.zone.now - (9.hours + 15.minutes), + created_at: Time.zone.now - (9.hours + 15.minutes), ) # execute object transaction @@ -179,19 +179,19 @@ class KarmaTest < ActiveSupport::TestCase assert_equal(0, Karma.score_by_user(customer1)) Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'customer phone', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Customer'), - type: Ticket::Article::Type.lookup(name: 'phone'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'customer phone', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Customer'), + type: Ticket::Article::Type.lookup(name: 'phone'), updated_by_id: customer1.id, created_by_id: customer1.id, - updated_at: Time.zone.now - 8.hours, - created_at: Time.zone.now - 8.hours, + updated_at: Time.zone.now - 8.hours, + created_at: Time.zone.now - 8.hours, ) # execute object transaction @@ -203,19 +203,19 @@ class KarmaTest < ActiveSupport::TestCase assert_equal(0, Karma.score_by_user(customer1)) Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'agent phone 3', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'phone'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'agent phone 3', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'phone'), updated_by_id: agent1.id, created_by_id: agent1.id, - updated_at: Time.zone.now - (7.hours + 30.minutes), - created_at: Time.zone.now - (7.hours + 30.minutes), + updated_at: Time.zone.now - (7.hours + 30.minutes), + created_at: Time.zone.now - (7.hours + 30.minutes), ) # execute object transaction @@ -227,19 +227,19 @@ class KarmaTest < ActiveSupport::TestCase assert_equal(0, Karma.score_by_user(customer1)) Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'phone'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'phone'), updated_by_id: agent1.id, created_by_id: agent1.id, - updated_at: Time.zone.now - (7.hours + 15.minutes), - created_at: Time.zone.now - (7.hours + 15.minutes), + updated_at: Time.zone.now - (7.hours + 15.minutes), + created_at: Time.zone.now - (7.hours + 15.minutes), ) # execute object transaction @@ -251,19 +251,19 @@ class KarmaTest < ActiveSupport::TestCase assert_equal(0, Karma.score_by_user(customer1)) Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Customer'), - type: Ticket::Article::Type.lookup(name: 'phone'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Customer'), + type: Ticket::Article::Type.lookup(name: 'phone'), updated_by_id: customer1.id, created_by_id: customer1.id, - updated_at: Time.zone.now - 7.hours, - created_at: Time.zone.now - 7.hours, + updated_at: Time.zone.now - 7.hours, + created_at: Time.zone.now - 7.hours, ) # execute object transaction @@ -275,19 +275,19 @@ class KarmaTest < ActiveSupport::TestCase assert_equal(0, Karma.score_by_user(customer1)) Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'phone'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'phone'), updated_by_id: agent2.id, created_by_id: agent2.id, - updated_at: Time.zone.now - (2.hours + 30.minutes), - created_at: Time.zone.now - (2.hours + 30.minutes), + updated_at: Time.zone.now - (2.hours + 30.minutes), + created_at: Time.zone.now - (2.hours + 30.minutes), ) # execute object transaction @@ -299,19 +299,19 @@ class KarmaTest < ActiveSupport::TestCase assert_equal(0, Karma.score_by_user(customer1)) Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'phone'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'phone'), updated_by_id: agent1.id, created_by_id: agent1.id, - updated_at: Time.zone.now - (2.hours + 45.minutes), - created_at: Time.zone.now - (2.hours + 45.minutes), + updated_at: Time.zone.now - (2.hours + 45.minutes), + created_at: Time.zone.now - (2.hours + 45.minutes), ) # execute object transaction @@ -346,31 +346,31 @@ class KarmaTest < ActiveSupport::TestCase assert_equal(0, Karma.score_by_user(customer1)) ticket2 = Ticket.create( - title: 'karma test 1', - group: Group.lookup(name: 'Users'), - customer: customer1, - state: Ticket::State.lookup(name: 'new'), - owner_id: agent1.id, - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'karma test 1', + group: Group.lookup(name: 'Users'), + customer: customer1, + state: Ticket::State.lookup(name: 'new'), + owner_id: agent1.id, + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: agent1.id, created_by_id: agent1.id, - updated_at: Time.zone.now - 10.hours, - created_at: Time.zone.now - 10.hours, + updated_at: Time.zone.now - 10.hours, + created_at: Time.zone.now - 10.hours, ) Ticket::Article.create( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'phone'), + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'phone'), updated_by_id: agent1.id, created_by_id: agent1.id, - updated_at: Time.zone.now - 2.hours, - created_at: Time.zone.now - 2.hours, + updated_at: Time.zone.now - 2.hours, + created_at: Time.zone.now - 2.hours, ) assert(ticket2) @@ -409,53 +409,53 @@ class KarmaTest < ActiveSupport::TestCase assert_equal(0, Karma.score_by_user(customer1)) calendar1 = Calendar.create_or_update( - name: 'EU 1 - karma test', - timezone: 'Europe/Berlin', + name: 'EU 1 - karma test', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, tue: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, wed: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, thu: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, fri: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, sat: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, sun: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla1 = Sla.create_or_update( - name: 'test sla 1', - condition: {}, + name: 'test sla 1', + condition: {}, first_response_time: 20, - update_time: 60, - solution_time: 120, - calendar_id: calendar1.id, - updated_by_id: 1, - created_by_id: 1, + update_time: 60, + solution_time: 120, + calendar_id: calendar1.id, + updated_by_id: 1, + created_by_id: 1, ) ticket2.state = Ticket::State.lookup(name: 'open') ticket2.save! diff --git a/test/unit/model_test.rb b/test/unit/model_test.rb index 3169316ff..322414d99 100644 --- a/test/unit/model_test.rb +++ b/test/unit/model_test.rb @@ -4,26 +4,26 @@ class ModelTest < ActiveSupport::TestCase test 'create_if_not_exists test' do group1 = Group.create_if_not_exists( - name: 'model1-create_if_not_exists', - active: true, - updated_at: '2015-02-05 16:37:00', + name: 'model1-create_if_not_exists', + active: true, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) assert_raises( ActiveRecord::RecordNotUnique ) do Group.create_if_not_exists( - name: 'model1-Create_If_Not_Exists', - active: true, - updated_at: '2015-02-05 16:37:00', + name: 'model1-Create_If_Not_Exists', + active: true, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) end group2 = Group.create_if_not_exists( - name: 'model1-create_if_not_exists', - active: true, - updated_at: '2015-02-05 16:39:00', + name: 'model1-create_if_not_exists', + active: true, + updated_at: '2015-02-05 16:39:00', updated_by_id: 1, created_by_id: 1, ) @@ -33,26 +33,26 @@ class ModelTest < ActiveSupport::TestCase test 'create_or_update test' do group1 = Group.create_or_update( - name: 'model1-create_or_update', - active: true, - updated_at: '2015-02-05 16:37:00', + name: 'model1-create_or_update', + active: true, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) assert_raises( ActiveRecord::RecordNotUnique ) do Group.create_or_update( - name: 'model1-Create_Or_Update', - active: true, - updated_at: '2015-02-05 16:37:00', + name: 'model1-Create_Or_Update', + active: true, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) end group2 = Group.create_or_update( - name: 'model1-create_or_update', - active: true, - updated_at: '2015-02-05 16:39:00', + name: 'model1-create_or_update', + active: true, + updated_at: '2015-02-05 16:39:00', updated_by_id: 1, created_by_id: 1, ) @@ -66,82 +66,82 @@ class ModelTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: %w[Agent Admin]) agent1 = User.create_or_update( - login: 'model-agent1@example.com', - firstname: 'Model', - lastname: 'Agent1', - email: 'model-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'model-agent1@example.com', + firstname: 'Model', + lastname: 'Agent1', + email: 'model-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( - login: 'model-agent2@example.com', - firstname: 'Model', - lastname: 'Agent2', - email: 'model-agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 17:37:00', + login: 'model-agent2@example.com', + firstname: 'Model', + lastname: 'Agent2', + email: 'model-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 17:37:00', updated_by_id: agent1.id, created_by_id: 1, ) organization1 = Organization.create_if_not_exists( - name: 'Model Org 1', - updated_at: '2015-02-05 16:37:00', + name: 'Model Org 1', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) organization2 = Organization.create_if_not_exists( - name: 'Model Org 2', - updated_at: '2015-02-05 16:37:00', + name: 'Model Org 2', + updated_at: '2015-02-05 16:37:00', updated_by_id: agent1.id, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'model-customer1@example.com', - firstname: 'Model', - lastname: 'Customer1', - email: 'model-customer1@example.com', - password: 'customerpw', - active: true, + login: 'model-customer1@example.com', + firstname: 'Model', + lastname: 'Customer1', + email: 'model-customer1@example.com', + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer2 = User.create_or_update( - login: 'model-customer2@example.com', - firstname: 'Model', - lastname: 'Customer2', - email: 'model-customer2@example.com', - password: 'customerpw', - active: true, + login: 'model-customer2@example.com', + firstname: 'Model', + lastname: 'Customer2', + email: 'model-customer2@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: agent1.id, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: agent1.id, + created_by_id: 1, ) customer3 = User.create_or_update( - login: 'model-customer3@example.com', - firstname: 'Model', - lastname: 'Customer3', - email: 'model-customer3@example.com', - password: 'customerpw', - active: true, + login: 'model-customer3@example.com', + firstname: 'Model', + lastname: 'Customer3', + email: 'model-customer3@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: agent1.id, - created_by_id: agent1.id, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: agent1.id, + created_by_id: agent1.id, ) # user @@ -248,15 +248,15 @@ class ModelTest < ActiveSupport::TestCase test 'param_cleanup test' do params = { - id: 123, - abc: true, - firstname: '123', + id: 123, + abc: true, + firstname: '123', created_by_id: 1, - created_at: Time.zone.now, + created_at: Time.zone.now, updated_by_id: 1, - updated_at: Time.zone.now, - action: 'some action', - controller: 'some controller', + updated_at: Time.zone.now, + action: 'some action', + controller: 'some controller', } result = User.param_cleanup(params, true) assert_not(result.key?(:id)) @@ -270,15 +270,15 @@ class ModelTest < ActiveSupport::TestCase assert_not(result.key?(:controller)) params = { - id: 123, - abc: true, - firstname: '123', + id: 123, + abc: true, + firstname: '123', created_by_id: 1, - created_at: Time.zone.now, + created_at: Time.zone.now, updated_by_id: 1, - updated_at: Time.zone.now, - action: 'some action', - controller: 'some controller', + updated_at: Time.zone.now, + action: 'some action', + controller: 'some controller', } result = User.param_cleanup(params) assert_equal(123, result[:id]) @@ -294,15 +294,15 @@ class ModelTest < ActiveSupport::TestCase Setting.set('import_mode', true) params = { - id: 123, - abc: true, - firstname: '123', + id: 123, + abc: true, + firstname: '123', created_by_id: 1, - created_at: Time.zone.now, + created_at: Time.zone.now, updated_by_id: 1, - updated_at: Time.zone.now, - action: 'some action', - controller: 'some controller', + updated_at: Time.zone.now, + action: 'some action', + controller: 'some controller', } result = User.param_cleanup(params, true) assert_not(result.key?(:abc)) @@ -315,15 +315,15 @@ class ModelTest < ActiveSupport::TestCase assert_not(result.key?(:controller)) params = { - id: 123, - abc: true, - firstname: '123', + id: 123, + abc: true, + firstname: '123', created_by_id: 1, - created_at: Time.zone.now, + created_at: Time.zone.now, updated_by_id: 1, - updated_at: Time.zone.now, - action: 'some action', - controller: 'some controller', + updated_at: Time.zone.now, + action: 'some action', + controller: 'some controller', } result = User.param_cleanup(params) assert_equal(123, result[:id]) @@ -338,13 +338,13 @@ class ModelTest < ActiveSupport::TestCase test 'param_preferences_merge test' do params = { - id: 123, - firstname: '123', + id: 123, + firstname: '123', created_by_id: 1, - created_at: Time.zone.now, + created_at: Time.zone.now, updated_by_id: 1, - updated_at: Time.zone.now, - preferences: {}, + updated_at: Time.zone.now, + preferences: {}, } user = User.new(params) assert(user.preferences.blank?) @@ -353,7 +353,7 @@ class ModelTest < ActiveSupport::TestCase assert(user.preferences.present?) params = { - firstname: '123 ABC', + firstname: '123 ABC', preferences: { 'B' => 3, 'C': 4 }, } clean_params = User.param_cleanup(params) @@ -368,7 +368,7 @@ class ModelTest < ActiveSupport::TestCase assert_equal(clean_user_params[:preferences][:C], 4) params = { - firstname: '123 ABCD', + firstname: '123 ABCD', preferences: {}, } clean_params = User.param_cleanup(params) diff --git a/test/unit/notification_factory_mailer_template_test.rb b/test/unit/notification_factory_mailer_template_test.rb index b03bf8366..29183d008 100644 --- a/test/unit/notification_factory_mailer_template_test.rb +++ b/test/unit/notification_factory_mailer_template_test.rb @@ -9,15 +9,15 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'notification-template-agent1@example.com', - firstname: 'Notificationxxx', - lastname: 'Agent1yyy', - email: 'notification-template-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - preferences: { + login: 'notification-template-agent1@example.com', + firstname: 'Notificationxxx', + lastname: 'Agent1yyy', + email: 'notification-template-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + preferences: { locale: 'de-de', }, updated_by_id: 1, @@ -25,15 +25,15 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase ) agent_current_user = User.create_or_update( - login: 'notification-template-current_user@example.com', - firstname: 'Notification Current', - lastname: 'User', - email: 'notification-template-current_user@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - preferences: { + login: 'notification-template-current_user@example.com', + firstname: 'Notification Current', + lastname: 'User', + email: 'notification-template-current_user@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + preferences: { locale: 'de-de', }, updated_by_id: 1, @@ -42,7 +42,7 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase result = NotificationFactory::Mailer.template( template: 'password_reset', - locale: 'de-de', + locale: 'de-de', objects: { user: agent1, }, @@ -56,7 +56,7 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase result = NotificationFactory::Mailer.template( template: 'password_reset', - locale: 'de', + locale: 'de', objects: { user: agent1, }, @@ -69,7 +69,7 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase result = NotificationFactory::Mailer.template( template: 'password_reset', - locale: 'xx-us', + locale: 'xx-us', objects: { user: agent1, }, @@ -81,24 +81,24 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase assert_no_match('Ihr', result[:body]) ticket = Ticket.create( - group_id: Group.lookup(name: 'Users').id, - customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, - owner_id: User.lookup(login: '-').id, - title: 'Welcome to Zammad!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group_id: Group.lookup(name: 'Users').id, + customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, + owner_id: User.lookup(login: '-').id, + title: 'Welcome to Zammad!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Zammad Feedback ', - content_type: 'text/plain', - body: 'Welcome! + ticket_id: ticket.id, + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Zammad Feedback ', + content_type: 'text/plain', + body: 'Welcome! test123', - internal: false, + internal: false, updated_by_id: 1, created_by_id: 1, ) @@ -106,13 +106,13 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase changes = {} result = NotificationFactory::Mailer.template( template: 'ticket_create', - locale: 'xx-us', + locale: 'xx-us', objects: { - ticket: ticket, - article: article, - recipient: agent1, + ticket: ticket, + article: article, + recipient: agent1, current_user: agent_current_user, - changes: changes, + changes: changes, }, ) assert_match('New Ticket', result[:subject]) @@ -126,13 +126,13 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase result = NotificationFactory::Mailer.template( template: 'ticket_create', - locale: 'de-de', + locale: 'de-de', objects: { - ticket: ticket, - article: article, - recipient: agent1, + ticket: ticket, + article: article, + recipient: agent1, current_user: agent_current_user, - changes: changes, + changes: changes, }, ) assert_match('Neues Ticket', result[:subject]) @@ -145,14 +145,14 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase assert_match('Current User', result[:body]) article = Ticket::Article.create( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Zammad Feedback ', - content_type: 'text/html', - body: 'Welcome! + ticket_id: ticket.id, + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Zammad Feedback ', + content_type: 'text/html', + body: 'Welcome! test123', - internal: false, + internal: false, updated_by_id: 1, created_by_id: 1, ) @@ -162,13 +162,13 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase } result = NotificationFactory::Mailer.template( template: 'ticket_update', - locale: 'xx-us', + locale: 'xx-us', objects: { - ticket: ticket, - article: article, - recipient: agent1, + ticket: ticket, + article: article, + recipient: agent1, current_user: agent_current_user, - changes: changes, + changes: changes, }, ) assert_match('Updated Ticket', result[:subject]) @@ -182,13 +182,13 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase result = NotificationFactory::Mailer.template( template: 'ticket_update', - locale: 'de-de', + locale: 'de-de', objects: { - ticket: ticket, - article: article, - recipient: agent1, + ticket: ticket, + article: article, + recipient: agent1, current_user: agent_current_user, - changes: changes, + changes: changes, }, ) assert_match('Ticket aktualisiert', result[:subject]) @@ -204,11 +204,11 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase result = NotificationFactory::Mailer.template( template: 'ticket_update', objects: { - ticket: ticket, - article: article, - recipient: agent1, + ticket: ticket, + article: article, + recipient: agent1, current_user: agent_current_user, - changes: changes, + changes: changes, }, ) assert_match('Ticket aktualisiert', result[:subject]) @@ -224,11 +224,11 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase result = NotificationFactory::Mailer.template( template: 'ticket_update', objects: { - ticket: ticket, - article: article, - recipient: agent1, + ticket: ticket, + article: article, + recipient: agent1, current_user: agent_current_user, - changes: changes, + changes: changes, }, ) assert_match('Updated Ticket', result[:subject]) @@ -244,11 +244,11 @@ class NotificationFactoryMailerTemplateTest < ActiveSupport::TestCase result = NotificationFactory::Mailer.template( template: 'ticket_update', objects: { - ticket: ticket, - article: article, - recipient: agent1, + ticket: ticket, + article: article, + recipient: agent1, current_user: agent_current_user, - changes: changes, + changes: changes, }, ) assert_match('Chamado atualizado', result[:subject]) diff --git a/test/unit/notification_factory_mailer_test.rb b/test/unit/notification_factory_mailer_test.rb index 6a37ac897..57b4d0dd4 100644 --- a/test/unit/notification_factory_mailer_test.rb +++ b/test/unit/notification_factory_mailer_test.rb @@ -4,9 +4,9 @@ class NotificationFactoryMailerTest < ActiveSupport::TestCase test 'notifications send' do result = NotificationFactory::Mailer.send( - recipient: User.find(2), - subject: 'some subject', - body: 'some body', + recipient: User.find(2), + subject: 'some subject', + body: 'some body', content_type: '', ) assert_match('some body', result.to_s) @@ -14,9 +14,9 @@ class NotificationFactoryMailerTest < ActiveSupport::TestCase assert_no_match('text/html', result.to_s) result = NotificationFactory::Mailer.send( - recipient: User.find(2), - subject: 'some subject', - body: 'some body', + recipient: User.find(2), + subject: 'some subject', + body: 'some body', content_type: 'text/plain', ) assert_match('some body', result.to_s) @@ -24,9 +24,9 @@ class NotificationFactoryMailerTest < ActiveSupport::TestCase assert_no_match('text/html', result.to_s) result = NotificationFactory::Mailer.send( - recipient: User.find(2), - subject: 'some subject', - body: 'some body', + recipient: User.find(2), + subject: 'some subject', + body: 'some body', content_type: 'text/html', ) assert_match('some body', result.to_s) @@ -36,11 +36,11 @@ class NotificationFactoryMailerTest < ActiveSupport::TestCase attachments = [] attachments.push Store.add( - object: 'TestMailer', - o_id: 1, - data: 'content_file1_normally_should_be_an_image', - filename: 'some_file1.jpg', - preferences: { + object: 'TestMailer', + o_id: 1, + data: 'content_file1_normally_should_be_an_image', + filename: 'some_file1.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938@zammad.example.com', @@ -49,11 +49,11 @@ class NotificationFactoryMailerTest < ActiveSupport::TestCase created_by_id: 1, ) attachments.push Store.add( - object: 'TestMailer', - o_id: 1, - data: 'content_file2', - filename: 'some_file2.txt', - preferences: { + object: 'TestMailer', + o_id: 1, + data: 'content_file2', + filename: 'some_file2.txt', + preferences: { 'Content-Type' => 'text/stream', 'Mime-Type' => 'text/stream', }, @@ -61,9 +61,9 @@ class NotificationFactoryMailerTest < ActiveSupport::TestCase ) result = NotificationFactory::Mailer.send( - recipient: User.find(2), - subject: 'some subject', - body: 'some bodyasdasd
', + recipient: User.find(2), + subject: 'some subject', + body: 'some bodyasdasd
', content_type: 'text/html', attachments: attachments, ) @@ -84,77 +84,77 @@ class NotificationFactoryMailerTest < ActiveSupport::TestCase groups = Group.all roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'notification-settings-agent1@example.com', - firstname: 'Notificationxxx', - lastname: 'Agent1', - email: 'notification-settings-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'notification-settings-agent1@example.com', + firstname: 'Notificationxxx', + lastname: 'Agent1', + email: 'notification-settings-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( - login: 'notification-settings-agent2@example.com', - firstname: 'Notificationxxx', - lastname: 'Agent2', - email: 'notification-settings-agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'notification-settings-agent2@example.com', + firstname: 'Notificationxxx', + lastname: 'Agent2', + email: 'notification-settings-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) group_notification_setting = Group.create_or_update( - name: 'NotificationSetting', + name: 'NotificationSetting', updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create( - group_id: Group.lookup(name: 'Users').id, - customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, - owner_id: User.lookup(login: '-').id, - title: 'Notification Settings Test 1!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group_id: Group.lookup(name: 'Users').id, + customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, + owner_id: User.lookup(login: '-').id, + title: 'Notification Settings Test 1!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: 1, created_by_id: 1, ) ticket2 = Ticket.create( - group_id: Group.lookup(name: 'Users').id, - customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, - owner_id: agent1.id, - title: 'Notification Settings Test 2!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group_id: Group.lookup(name: 'Users').id, + customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, + owner_id: agent1.id, + title: 'Notification Settings Test 2!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: 1, created_by_id: 1, ) ticket3 = Ticket.create( - group_id: group_notification_setting.id, - customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, - owner_id: User.lookup(login: '-').id, - title: 'Notification Settings Test 1!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group_id: group_notification_setting.id, + customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, + owner_id: User.lookup(login: '-').id, + title: 'Notification Settings Test 1!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: 1, created_by_id: 1, ) ticket4 = Ticket.create( - group_id: group_notification_setting.id, - customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, - owner_id: agent1.id, - title: 'Notification Settings Test 2!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group_id: group_notification_setting.id, + customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, + owner_id: agent1.id, + title: 'Notification Settings Test 2!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/notification_factory_renderer_test.rb b/test/unit/notification_factory_renderer_test.rb index 1eb6cb6c9..759891d40 100644 --- a/test/unit/notification_factory_renderer_test.rb +++ b/test/unit/notification_factory_renderer_test.rb @@ -13,22 +13,22 @@ class NotificationFactoryRendererTest < ActiveSupport::TestCase recipient = User.new(firstname: 'Recipientxxx', lastname: 'Customer1yyy') state = Ticket::State.new(name: 'new') ticket = Ticket.new( - id: 1, - title: 'Welcome to Zammad!', - group: group, - owner: owner, - state: state, + id: 1, + title: 'Welcome to Zammad!', + group: group, + owner: owner, + state: state, created_by: current_user, updated_by: current_user, created_at: Time.zone.parse('2016-11-12 12:00:00 UTC'), updated_at: Time.zone.parse('2016-11-12 14:00:00 UTC'), ) article_html1 = Ticket::Article.new( - body: 'test hello
some new line', + body: 'test hello
some new line', content_type: 'text/html', ) article_plain1 = Ticket::Article.new( - body: "test hello\nsome new line", + body: "test hello\nsome new line", content_type: 'text/plain', ) article_plain2 = Ticket::Article.new( diff --git a/test/unit/notification_factory_slack_template_test.rb b/test/unit/notification_factory_slack_template_test.rb index 58069fe04..2a1b23ae9 100644 --- a/test/unit/notification_factory_slack_template_test.rb +++ b/test/unit/notification_factory_slack_template_test.rb @@ -9,15 +9,15 @@ class NotificationFactorySlackTemplateTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'notification-template-agent1@example.com', - firstname: 'Notificationxxx', - lastname: 'Agent1yyy', - email: 'notification-template-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - preferences: { + login: 'notification-template-agent1@example.com', + firstname: 'Notificationxxx', + lastname: 'Agent1yyy', + email: 'notification-template-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + preferences: { locale: 'de-de', }, updated_by_id: 1, @@ -25,15 +25,15 @@ class NotificationFactorySlackTemplateTest < ActiveSupport::TestCase ) agent_current_user = User.create_or_update( - login: 'notification-template-current_user@example.com', - firstname: 'Notification Current', - lastname: 'Userxxx', - email: 'notification-template-current_user@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - preferences: { + login: 'notification-template-current_user@example.com', + firstname: 'Notification Current', + lastname: 'Userxxx', + email: 'notification-template-current_user@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + preferences: { locale: 'de-de', }, updated_by_id: 1, @@ -41,24 +41,24 @@ class NotificationFactorySlackTemplateTest < ActiveSupport::TestCase ) ticket = Ticket.create( - group_id: Group.lookup(name: 'Users').id, - customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, - owner_id: User.lookup(login: '-').id, - title: 'Welcome to Zammad!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group_id: Group.lookup(name: 'Users').id, + customer_id: User.lookup(email: 'nicole.braun@zammad.org').id, + owner_id: User.lookup(login: '-').id, + title: 'Welcome to Zammad!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Zammad Feedback ', - content_type: 'text/plain', - body: 'Welcome! + ticket_id: ticket.id, + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Zammad Feedback ', + content_type: 'text/plain', + body: 'Welcome! test123', - internal: false, + internal: false, updated_by_id: 1, created_by_id: 1, ) @@ -66,13 +66,13 @@ class NotificationFactorySlackTemplateTest < ActiveSupport::TestCase changes = {} result = NotificationFactory::Slack.template( template: 'ticket_create', - locale: 'es-us', + locale: 'es-us', objects: { - ticket: ticket, - article: article, - recipient: agent1, + ticket: ticket, + article: article, + recipient: agent1, current_user: agent_current_user, - changes: changes, + changes: changes, }, ) @@ -85,14 +85,14 @@ class NotificationFactorySlackTemplateTest < ActiveSupport::TestCase assert_match('Current User', result[:body]) article = Ticket::Article.create( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Zammad Feedback ', - content_type: 'text/html', - body: 'Welcome! + ticket_id: ticket.id, + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Zammad Feedback ', + content_type: 'text/html', + body: 'Welcome! test123', - internal: false, + internal: false, updated_by_id: 1, created_by_id: 1, ) @@ -102,13 +102,13 @@ class NotificationFactorySlackTemplateTest < ActiveSupport::TestCase } result = NotificationFactory::Slack.template( template: 'ticket_update', - locale: 'es-us', + locale: 'es-us', objects: { - ticket: ticket, - article: article, - recipient: agent1, + ticket: ticket, + article: article, + recipient: agent1, current_user: agent_current_user, - changes: changes, + changes: changes, }, ) assert_match('# Welcome to Zammad!', result[:subject]) diff --git a/test/unit/object_cache_test.rb b/test/unit/object_cache_test.rb index 8e08dd4d1..8ec86436a 100644 --- a/test/unit/object_cache_test.rb +++ b/test/unit/object_cache_test.rb @@ -3,7 +3,7 @@ require 'test_helper' class ObjectCacheTest < ActiveSupport::TestCase test 'organization cache' do org = Organization.create_or_update( - name: 'some org cache member', + name: 'some org cache member', updated_by_id: 1, created_by_id: 1, ) @@ -11,17 +11,17 @@ class ObjectCacheTest < ActiveSupport::TestCase roles = Role.where( name: %w[Agent Admin] ) groups = Group.all user1 = User.create_or_update( - login: 'object_cache1@example.org', - firstname: 'object_cache1', - lastname: 'object_cache1', - email: 'object_cache1@example.org', - password: 'some_pass', - active: true, - updated_by_id: 1, - created_by_id: 1, + login: 'object_cache1@example.org', + firstname: 'object_cache1', + lastname: 'object_cache1', + email: 'object_cache1@example.org', + password: 'some_pass', + active: true, + updated_by_id: 1, + created_by_id: 1, organization_id: org.id, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) assets = org.assets({}) assert_equal(org.member_ids.sort, assets[:Organization][org.id]['member_ids'].sort) @@ -40,29 +40,29 @@ class ObjectCacheTest < ActiveSupport::TestCase # be sure that minimum one admin is available User.create_or_update( - login: 'last_admin_check@example.org', - firstname: 'last_admin_check', - lastname: 'last_admin_check', - email: 'last_admin_check@example.org', - password: 'some_pass', - active: true, + login: 'last_admin_check@example.org', + firstname: 'last_admin_check', + lastname: 'last_admin_check', + email: 'last_admin_check@example.org', + password: 'some_pass', + active: true, updated_by_id: 1, created_by_id: 1, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) user1 = User.create_or_update( - login: 'object_cache1@example.org', - firstname: 'object_cache1', - lastname: 'object_cache1', - email: 'object_cache1@example.org', - password: 'some_pass', - active: true, + login: 'object_cache1@example.org', + firstname: 'object_cache1', + lastname: 'object_cache1', + email: 'object_cache1@example.org', + password: 'some_pass', + active: true, updated_by_id: 1, created_by_id: 1, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) assets = user1.assets({}) assert_equal(user1.group_ids_access_map.sort, assets[:User][user1.id]['group_ids'].sort) @@ -106,7 +106,7 @@ class ObjectCacheTest < ActiveSupport::TestCase name = "object cache test #{rand(9_999_999)}" group = Group.create!( - name: name, + name: name, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/object_create_update_with_ref_name_test.rb b/test/unit/object_create_update_with_ref_name_test.rb index d3b8dee7b..efa49878b 100644 --- a/test/unit/object_create_update_with_ref_name_test.rb +++ b/test/unit/object_create_update_with_ref_name_test.rb @@ -5,33 +5,33 @@ class ObjectCreateUpdateWithRefNameTest < ActiveSupport::TestCase roles = Role.where(name: %w[Agent Admin]) groups = Group.all user1 = User.create_or_update( - login: 'object_ref_name1@example.org', - firstname: 'object_ref_name1', - lastname: 'object_ref_name1', - email: 'object_ref_name1@example.org', - password: 'some_pass', - active: true, + login: 'object_ref_name1@example.org', + firstname: 'object_ref_name1', + lastname: 'object_ref_name1', + email: 'object_ref_name1@example.org', + password: 'some_pass', + active: true, updated_by_id: 1, created_by_id: 1, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) user2 = User.create_or_update( - login: 'object_ref_name2@example.org', - firstname: 'object_ref_name2', - lastname: 'object_ref_name2', - email: 'object_ref_name2@example.org', - password: 'some_pass', - active: true, + login: 'object_ref_name2@example.org', + firstname: 'object_ref_name2', + lastname: 'object_ref_name2', + email: 'object_ref_name2@example.org', + password: 'some_pass', + active: true, updated_by_id: 1, created_by_id: 1, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) org1 = Organization.create_if_not_exists_with_ref( - name: 'some org update_with_ref member', - members: ['object_ref_name1@example.org'], + name: 'some org update_with_ref member', + members: ['object_ref_name1@example.org'], updated_by_id: 1, created_by_id: 1, ) @@ -40,8 +40,8 @@ class ObjectCreateUpdateWithRefNameTest < ActiveSupport::TestCase assert_not(org1.member_ids.sort.include?(user2.id)) org2 = Organization.create_or_update_with_ref( - name: 'some org update_with_ref member', - members: ['object_ref_name2@example.org'], + name: 'some org update_with_ref member', + members: ['object_ref_name2@example.org'], updated_by_id: 1, created_by_id: 1, ) @@ -51,8 +51,8 @@ class ObjectCreateUpdateWithRefNameTest < ActiveSupport::TestCase assert_equal(org1.id, org2.id) org3 = Organization.create_or_update_with_ref( - name: 'some org update_with_ref member2', - members: ['object_ref_name2@example.org'], + name: 'some org update_with_ref member2', + members: ['object_ref_name2@example.org'], updated_by_id: 1, created_by_id: 1, ) @@ -63,9 +63,9 @@ class ObjectCreateUpdateWithRefNameTest < ActiveSupport::TestCase assert_raises( ActiveRecord::AssociationTypeMismatch ) do Organization.create_or_update_with_ref( - name: 'some org update_with_ref member2', - members: ['object_ref_name2@example.org'], - member_ids: [2], + name: 'some org update_with_ref member2', + members: ['object_ref_name2@example.org'], + member_ids: [2], updated_by_id: 1, created_by_id: 1, ) @@ -75,35 +75,35 @@ class ObjectCreateUpdateWithRefNameTest < ActiveSupport::TestCase test 'user' do org1 = Organization.create_if_not_exists_with_ref( - name: 'some org update_with_ref user', + name: 'some org update_with_ref user', updated_by_id: 1, created_by_id: 1, ) user1 = User.create_or_update_with_ref( - login: 'object_ref_name1@example.org', - firstname: 'object_ref_name1', - lastname: 'object_ref_name1', - email: 'object_ref_name1@example.org', - password: 'some_pass', - active: true, - organization: 'some org update_with_ref user', + login: 'object_ref_name1@example.org', + firstname: 'object_ref_name1', + lastname: 'object_ref_name1', + email: 'object_ref_name1@example.org', + password: 'some_pass', + active: true, + organization: 'some org update_with_ref user', updated_by_id: 1, created_by_id: 1, - roles: %w[Agent Admin], - groups: ['Users'], + roles: %w[Agent Admin], + groups: ['Users'], ) user2 = User.create_or_update_with_ref( - login: 'object_ref_name2@example.org', - firstname: 'object_ref_name2', - lastname: 'object_ref_name2', - email: 'object_ref_name2@example.org', - password: 'some_pass', + login: 'object_ref_name2@example.org', + firstname: 'object_ref_name2', + lastname: 'object_ref_name2', + email: 'object_ref_name2@example.org', + password: 'some_pass', organization_id: nil, - active: true, - updated_by_id: 1, - created_by_id: 1, - roles: ['Customer'], - groups: [], + active: true, + updated_by_id: 1, + created_by_id: 1, + roles: ['Customer'], + groups: [], ) admin_role = Role.lookup(name: 'Admin') agent_role = Role.lookup(name: 'Agent') @@ -127,35 +127,35 @@ class ObjectCreateUpdateWithRefNameTest < ActiveSupport::TestCase test 'group' do user1 = User.create_or_update_with_ref( - login: 'object_ref_name1@example.org', - firstname: 'object_ref_name1', - lastname: 'object_ref_name1', - email: 'object_ref_name1@example.org', - password: 'some_pass', - active: true, + login: 'object_ref_name1@example.org', + firstname: 'object_ref_name1', + lastname: 'object_ref_name1', + email: 'object_ref_name1@example.org', + password: 'some_pass', + active: true, organization_id: nil, - updated_by_id: 1, - created_by_id: 1, - roles: %w[Agent Admin], - groups: [], + updated_by_id: 1, + created_by_id: 1, + roles: %w[Agent Admin], + groups: [], ) user2 = User.create_or_update_with_ref( - login: 'object_ref_name2@example.org', - firstname: 'object_ref_name2', - lastname: 'object_ref_name2', - email: 'object_ref_name2@example.org', - password: 'some_pass', + login: 'object_ref_name2@example.org', + firstname: 'object_ref_name2', + lastname: 'object_ref_name2', + email: 'object_ref_name2@example.org', + password: 'some_pass', organization_id: nil, - active: true, - updated_by_id: 1, - created_by_id: 1, - roles: ['Customer'], - groups: [], + active: true, + updated_by_id: 1, + created_by_id: 1, + roles: ['Customer'], + groups: [], ) group1 = Group.create_if_not_exists_with_ref( - name: 'some group update_with_ref', - users: ['object_ref_name1@example.org'], + name: 'some group update_with_ref', + users: ['object_ref_name1@example.org'], updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/online_notifiaction_test.rb b/test/unit/online_notifiaction_test.rb index 717454280..cbbb3911c 100644 --- a/test/unit/online_notifiaction_test.rb +++ b/test/unit/online_notifiaction_test.rb @@ -5,84 +5,84 @@ class OnlineNotificationTest < ActiveSupport::TestCase setup do role = Role.lookup(name: 'Agent') @group = Group.create_or_update( - name: 'OnlineNotificationTest', + name: 'OnlineNotificationTest', updated_by_id: 1, created_by_id: 1 ) @agent_user1 = User.create_or_update( - login: 'agent_online_notify1', - firstname: 'Bob', - lastname: 'Smith', - email: 'agent_online_notify1@example.com', - password: 'some_pass', - active: true, - role_ids: [role.id], - group_ids: [@group.id], + login: 'agent_online_notify1', + firstname: 'Bob', + lastname: 'Smith', + email: 'agent_online_notify1@example.com', + password: 'some_pass', + active: true, + role_ids: [role.id], + group_ids: [@group.id], updated_by_id: 1, created_by_id: 1 ) @agent_user2 = User.create_or_update( - login: 'agent_online_notify2', - firstname: 'Bob', - lastname: 'Smith', - email: 'agent_online_notify2@example.com', - password: 'some_pass', - active: true, - role_ids: [role.id], - group_ids: [@group.id], + login: 'agent_online_notify2', + firstname: 'Bob', + lastname: 'Smith', + email: 'agent_online_notify2@example.com', + password: 'some_pass', + active: true, + role_ids: [role.id], + group_ids: [@group.id], updated_by_id: 1, created_by_id: 1 ) @customer_user = User.lookup(email: 'nicole.braun@zammad.org') calendar1 = Calendar.create_or_update( - name: 'EU 1 - test', - timezone: 'Europe/Berlin', + name: 'EU 1 - test', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, tue: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, wed: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, thu: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, fri: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, sat: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, sun: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla1 = Sla.create_or_update( - name: 'test sla 1', - condition: {}, + name: 'test sla 1', + condition: {}, first_response_time: 20, - update_time: 60, - solution_time: 120, - calendar_id: calendar1.id, - updated_by_id: 1, - created_by_id: 1, + update_time: 60, + solution_time: 120, + calendar_id: calendar1.id, + updated_by_id: 1, + created_by_id: 1, ) end @@ -93,24 +93,24 @@ class OnlineNotificationTest < ActiveSupport::TestCase # case #1 ticket1 = Ticket.create( - group: @group, - customer_id: @customer_user.id, - owner_id: User.lookup(login: '-').id, - title: 'Unit Test 1 (äöüß)!', - state_id: Ticket::State.lookup(name: 'closed').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group: @group, + customer_id: @customer_user.id, + owner_id: User.lookup(login: '-').id, + title: 'Unit Test 1 (äöüß)!', + state_id: Ticket::State.lookup(name: 'closed').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: @agent_user1.id, created_by_id: @agent_user1.id, ) article1 = Ticket::Article.create( - ticket_id: ticket1.id, + ticket_id: ticket1.id, updated_by_id: @agent_user1.id, created_by_id: @agent_user1.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Unit Test ', - body: 'Unit Test 123', - internal: false + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false ) # remember ticket @@ -129,9 +129,9 @@ class OnlineNotificationTest < ActiveSupport::TestCase assert(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket1.id, 'create', @agent_user1, true)) ticket1.update!( - title: 'Unit Test 1 (äöüß) - update!', - state_id: Ticket::State.lookup(name: 'open').id, - priority_id: Ticket::Priority.lookup(name: '1 low').id, + title: 'Unit Test 1 (äöüß) - update!', + state_id: Ticket::State.lookup(name: 'open').id, + priority_id: Ticket::Priority.lookup(name: '1 low').id, updated_by_id: @customer_user.id, ) @@ -148,24 +148,24 @@ class OnlineNotificationTest < ActiveSupport::TestCase # case #2 ticket2 = Ticket.create( - group: @group, - customer_id: @customer_user.id, - owner_id: @agent_user1.id, - title: 'Unit Test 1 (äöüß)!', - state_id: Ticket::State.lookup(name: 'closed').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group: @group, + customer_id: @customer_user.id, + owner_id: @agent_user1.id, + title: 'Unit Test 1 (äöüß)!', + state_id: Ticket::State.lookup(name: 'closed').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: @customer_user.id, created_by_id: @customer_user.id, ) article2 = Ticket::Article.create( - ticket_id: ticket2.id, + ticket_id: ticket2.id, updated_by_id: @customer_user.id, created_by_id: @customer_user.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Unit Test ', - body: 'Unit Test 123', - internal: false + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false ) # remember ticket @@ -184,9 +184,9 @@ class OnlineNotificationTest < ActiveSupport::TestCase assert_not(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket2.id, 'create', @customer_user, true)) ticket2.update!( - title: 'Unit Test 1 (äöüß) - update!', - state_id: Ticket::State.lookup(name: 'open').id, - priority_id: Ticket::Priority.lookup(name: '1 low').id, + title: 'Unit Test 1 (äöüß) - update!', + state_id: Ticket::State.lookup(name: 'open').id, + priority_id: Ticket::Priority.lookup(name: '1 low').id, updated_by_id: @customer_user.id, ) @@ -203,24 +203,24 @@ class OnlineNotificationTest < ActiveSupport::TestCase # case #3 ticket3 = Ticket.create( - group: @group, - customer_id: @customer_user.id, - owner_id: User.lookup(login: '-').id, - title: 'Unit Test 2 (äöüß)!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group: @group, + customer_id: @customer_user.id, + owner_id: User.lookup(login: '-').id, + title: 'Unit Test 2 (äöüß)!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: @agent_user1.id, created_by_id: @agent_user1.id, ) article3 = Ticket::Article.create( - ticket_id: ticket3.id, + ticket_id: ticket3.id, updated_by_id: @agent_user1.id, created_by_id: @agent_user1.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Unit Test ', - body: 'Unit Test 123', - internal: false, + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false, ) # remember ticket @@ -238,9 +238,9 @@ class OnlineNotificationTest < ActiveSupport::TestCase assert_not(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket3.id, 'create', @agent_user1, true)) ticket3.update!( - title: 'Unit Test 2 (äöüß) - update!', - state_id: Ticket::State.lookup(name: 'closed').id, - priority_id: Ticket::Priority.lookup(name: '1 low').id, + title: 'Unit Test 2 (äöüß) - update!', + state_id: Ticket::State.lookup(name: 'closed').id, + priority_id: Ticket::Priority.lookup(name: '1 low').id, updated_by_id: @customer_user.id, ) @@ -258,14 +258,14 @@ class OnlineNotificationTest < ActiveSupport::TestCase assert(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket3.id, 'update', @customer_user, true)) article3 = Ticket::Article.create( - ticket_id: ticket3.id, + ticket_id: ticket3.id, updated_by_id: @customer_user.id, created_by_id: @customer_user.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Unit Test ', - body: 'Unit Test 123 # 2', - internal: false + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Unit Test ', + body: 'Unit Test 123 # 2', + internal: false ) # execute object transaction @@ -283,24 +283,24 @@ class OnlineNotificationTest < ActiveSupport::TestCase # case #4 ticket4 = Ticket.create( - group: @group, - customer_id: @customer_user.id, - owner_id: @agent_user1.id, - title: 'Unit Test 3 (äöüß)!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group: @group, + customer_id: @customer_user.id, + owner_id: @agent_user1.id, + title: 'Unit Test 3 (äöüß)!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: @customer_user.id, created_by_id: @customer_user.id, ) article4 = Ticket::Article.create( - ticket_id: ticket4.id, + ticket_id: ticket4.id, updated_by_id: @customer_user.id, created_by_id: @customer_user.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Unit Test ', - body: 'Unit Test 123', - internal: false, + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false, ) # remember ticket @@ -318,9 +318,9 @@ class OnlineNotificationTest < ActiveSupport::TestCase assert_not(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket4.id, 'create', @customer_user, true)) ticket4.update!( - title: 'Unit Test 3 (äöüß) - update!', - state_id: Ticket::State.lookup(name: 'open').id, - priority_id: Ticket::Priority.lookup(name: '1 low').id, + title: 'Unit Test 3 (äöüß) - update!', + state_id: Ticket::State.lookup(name: 'open').id, + priority_id: Ticket::Priority.lookup(name: '1 low').id, updated_by_id: @customer_user.id, ) @@ -337,24 +337,24 @@ class OnlineNotificationTest < ActiveSupport::TestCase # case #5 ticket5 = Ticket.create( - group: @group, - customer_id: @customer_user.id, - owner_id: User.lookup(login: '-').id, - title: 'Unit Test 4 (äöüß)!', - state_id: Ticket::State.lookup(name: 'new').id, - priority_id: Ticket::Priority.lookup( name: '2 normal').id, + group: @group, + customer_id: @customer_user.id, + owner_id: User.lookup(login: '-').id, + title: 'Unit Test 4 (äöüß)!', + state_id: Ticket::State.lookup(name: 'new').id, + priority_id: Ticket::Priority.lookup( name: '2 normal').id, updated_by_id: @agent_user1.id, created_by_id: @agent_user1.id, ) article5 = Ticket::Article.create( - ticket_id: ticket5.id, + ticket_id: ticket5.id, updated_by_id: @agent_user1.id, created_by_id: @agent_user1.id, - type_id: Ticket::Article::Type.lookup(name: 'phone').id, - sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, - from: 'Unit Test ', - body: 'Unit Test 123', - internal: false, + type_id: Ticket::Article::Type.lookup(name: 'phone').id, + sender_id: Ticket::Article::Sender.lookup(name: 'Customer').id, + from: 'Unit Test ', + body: 'Unit Test 123', + internal: false, ) # remember ticket @@ -372,9 +372,9 @@ class OnlineNotificationTest < ActiveSupport::TestCase assert_not(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket5.id, 'create', @agent_user1, true)) ticket5.update!( - title: 'Unit Test 4 (äöüß) - update!', - state_id: Ticket::State.lookup(name: 'open').id, - priority_id: Ticket::Priority.lookup(name: '1 low').id, + title: 'Unit Test 4 (äöüß) - update!', + state_id: Ticket::State.lookup(name: 'open').id, + priority_id: Ticket::Priority.lookup(name: '1 low').id, updated_by_id: @customer_user.id, ) @@ -392,7 +392,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase # merge tickets - also remove notifications of merged tickets tickets[0].merge_to( ticket_id: tickets[1].id, - user_id: 1, + user_id: 1, ) Scheduler.worker(true) @@ -420,25 +420,25 @@ class OnlineNotificationTest < ActiveSupport::TestCase test 'ticket notification item check' do ticket1 = Ticket.create( - title: 'some title', - group: @group, - customer_id: @customer_user.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some title', + group: @group, + customer_id: @customer_user.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) assert(ticket1, 'ticket created') article_inbound = Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_inbound', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Customer'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_inbound', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Customer'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -449,8 +449,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase # pending reminder, just let new owner to unseed ticket1.update!( - owner_id: @agent_user1.id, - state: Ticket::State.lookup(name: 'pending reminder'), + owner_id: @agent_user1.id, + state: Ticket::State.lookup(name: 'pending reminder'), updated_by_id: @agent_user2.id, ) @@ -460,8 +460,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase # pending reminder, just let new owner to unseed ticket1.update!( - owner_id: 1, - state: Ticket::State.lookup(name: 'pending reminder'), + owner_id: 1, + state: Ticket::State.lookup(name: 'pending reminder'), updated_by_id: @agent_user2.id, ) @@ -471,8 +471,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase # pending reminder, self done, all to unseed ticket1.update!( - owner_id: @agent_user1.id, - state: Ticket::State.lookup(name: 'pending reminder'), + owner_id: @agent_user1.id, + state: Ticket::State.lookup(name: 'pending reminder'), updated_by_id: @agent_user1.id, ) @@ -482,8 +482,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase # pending close, all to unseen ticket1.update!( - owner_id: @agent_user1.id, - state: Ticket::State.lookup(name: 'pending close'), + owner_id: @agent_user1.id, + state: Ticket::State.lookup(name: 'pending close'), updated_by_id: @agent_user2.id, ) @@ -493,8 +493,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase # to open, all to seen ticket1.update!( - owner_id: @agent_user1.id, - state: Ticket::State.lookup(name: 'open'), + owner_id: @agent_user1.id, + state: Ticket::State.lookup(name: 'open'), updated_by_id: @agent_user2.id, ) @@ -504,8 +504,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase # to closed, all only others to seen ticket1.update!( - owner_id: @agent_user1.id, - state: Ticket::State.lookup(name: 'closed'), + owner_id: @agent_user1.id, + state: Ticket::State.lookup(name: 'closed'), updated_by_id: @agent_user2.id, ) @@ -515,8 +515,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase # to closed by owner self, all to seen ticket1.update!( - owner_id: @agent_user1.id, - state: Ticket::State.lookup(name: 'closed'), + owner_id: @agent_user1.id, + state: Ticket::State.lookup(name: 'closed'), updated_by_id: @agent_user1.id, ) @@ -526,8 +526,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase # to closed by owner self, all to seen ticket1.update!( - owner_id: @agent_user1.id, - state: Ticket::State.lookup(name: 'merged'), + owner_id: @agent_user1.id, + state: Ticket::State.lookup(name: 'merged'), updated_by_id: @agent_user2.id, ) @@ -540,12 +540,12 @@ class OnlineNotificationTest < ActiveSupport::TestCase test 'cleanup check' do ticket1 = Ticket.create( - group: @group, - customer_id: @customer_user.id, - owner_id: User.lookup(login: '-').id, - title: 'Unit Test 1 (äöüß)!', - state_id: Ticket::State.lookup(name: 'closed').id, - priority_id: Ticket::Priority.lookup(name: '2 normal').id, + group: @group, + customer_id: @customer_user.id, + owner_id: User.lookup(login: '-').id, + title: 'Unit Test 1 (äöüß)!', + state_id: Ticket::State.lookup(name: 'closed').id, + priority_id: Ticket::Priority.lookup(name: '2 normal').id, updated_by_id: @agent_user1.id, created_by_id: @agent_user1.id, ) diff --git a/test/unit/organization_assets_test.rb b/test/unit/organization_assets_test.rb index f19cb2678..77148bb2f 100644 --- a/test/unit/organization_assets_test.rb +++ b/test/unit/organization_assets_test.rb @@ -5,60 +5,60 @@ class OrganizationAssetsTest < ActiveSupport::TestCase roles = Role.where( name: %w[Agent Admin] ) admin1 = User.create_or_update( - login: 'admin1@example.org', - firstname: 'admin1', - lastname: 'admin1', - email: 'admin1@example.org', - password: 'some_pass', - active: true, + login: 'admin1@example.org', + firstname: 'admin1', + lastname: 'admin1', + email: 'admin1@example.org', + password: 'some_pass', + active: true, updated_by_id: 1, created_by_id: 1, - roles: roles, + roles: roles, ) roles = Role.where( name: %w[Customer] ) org = Organization.create_or_update( - name: 'some customer org', + name: 'some customer org', updated_by_id: admin1.id, created_by_id: 1, ) user1 = User.create_or_update( - login: 'assets1@example.org', - firstname: 'assets1', - lastname: 'assets1', - email: 'assets1@example.org', - password: 'some_pass', - active: true, - updated_by_id: 1, - created_by_id: 1, + login: 'assets1@example.org', + firstname: 'assets1', + lastname: 'assets1', + email: 'assets1@example.org', + password: 'some_pass', + active: true, + updated_by_id: 1, + created_by_id: 1, organization_id: org.id, - roles: roles, + roles: roles, ) user2 = User.create_or_update( - login: 'assets2@example.org', - firstname: 'assets2', - lastname: 'assets2', - email: 'assets2@example.org', - password: 'some_pass', - active: true, - updated_by_id: 1, - created_by_id: 1, + login: 'assets2@example.org', + firstname: 'assets2', + lastname: 'assets2', + email: 'assets2@example.org', + password: 'some_pass', + active: true, + updated_by_id: 1, + created_by_id: 1, organization_id: org.id, - roles: roles, + roles: roles, ) user3 = User.create_or_update( - login: 'assets3@example.org', - firstname: 'assets3', - lastname: 'assets3', - email: 'assets3@example.org', - password: 'some_pass', - active: true, + login: 'assets3@example.org', + firstname: 'assets3', + lastname: 'assets3', + email: 'assets3@example.org', + password: 'some_pass', + active: true, updated_by_id: user1.id, created_by_id: user2.id, - roles: roles, + roles: roles, ) org = Organization.find(org.id) diff --git a/test/unit/organization_csv_import_test.rb b/test/unit/organization_csv_import_test.rb index ede03bd3a..a8eaca763 100644 --- a/test/unit/organization_csv_import_test.rb +++ b/test/unit/organization_csv_import_test.rb @@ -20,11 +20,11 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase test 'empty payload' do csv_string = '' result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_nil(result[:records]) @@ -33,11 +33,11 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase csv_string = 'id;name;shared;domain;domain_assignment;active;' result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert(result[:records].blank?) @@ -48,11 +48,11 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase test 'verify required lookup headers' do csv_string = "firstname;lastname;active;\nfirstname-simple-import1;lastname-simple-import1;;true\nfirstname-simple-import2;lastname-simple-import2;false\n" result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal('failed', result[:result]) @@ -63,11 +63,11 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase csv_string = "id;name;shared;domain;domain_assignment;active;note\n;org-simple-import1;true;org-simple-import1.example.com;false;true;some note1\n;org-simple-import2;true;org-simple-import2.example.com;false;false;some note2\n" result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(2, result[:records].count) @@ -77,11 +77,11 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase assert_nil(Organization.find_by(name: 'org-simple-import2')) result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(2, result[:records].count) @@ -112,11 +112,11 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase csv_string = "id;name;shared;domain;domain_assignment;active;note;\n999999999;organization-simple-invalid_id-import1;\n;organization-simple-invalid_id-import2;\n" result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(1, result[:errors].count) @@ -127,11 +127,11 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase assert_nil(Organization.find_by(name: 'organization-simple-invalid_id-import2')) result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(1, result[:records].count) @@ -152,29 +152,29 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase name = rand(999_999_999) customer1 = User.create_or_update( - login: "customer1-members#{name}@example.com", + login: "customer1-members#{name}@example.com", firstname: 'Member', - lastname: "Customer#{name}", - email: "customer1-members#{name}@example.com", - password: 'customerpw', - active: true, + lastname: "Customer#{name}", + email: "customer1-members#{name}@example.com", + password: 'customerpw', + active: true, ) customer2 = User.create_or_update( - login: "customer2-members#{name}@example.com", + login: "customer2-members#{name}@example.com", firstname: 'Member', - lastname: "Customer#{name}", - email: "customer2-members#{name}@example.com", - password: 'customerpw', - active: true, + lastname: "Customer#{name}", + email: "customer2-members#{name}@example.com", + password: 'customerpw', + active: true, ) csv_string = "id;name;members;\n;organization-member-import1;\n;organization-member-import2;#{customer1.email}\n;;#{customer2.email}" result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) @@ -185,11 +185,11 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase assert_nil(Organization.find_by(name: 'organization-member-import2')) result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) @@ -215,11 +215,11 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase csv_string = "name;note;not existing\norganization-invalid-import1;some note;abc\norganization-invalid-import2;some other note;123; with not exsiting header\n" result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(2, result[:errors].count) @@ -231,11 +231,11 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase assert_nil(Organization.find_by(name: 'organization-invalid-import2')) result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(2, result[:errors].count) @@ -250,12 +250,12 @@ class OrganizationCsvImportTest < ActiveSupport::TestCase test 'simple import with delete' do csv_string = "id;name;shared;domain;domain_assignment;active;note\n;org-simple-import1;true;org-simple-import1.example.com;false;true;some note1\n;org-simple-import2;true;org-simple-import2.example.com;false;false;some note2\n" result = Organization.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, - delete: true, + try: true, + delete: true, ) assert_equal(true, result[:try]) diff --git a/test/unit/organization_domain_based_assignment_test.rb b/test/unit/organization_domain_based_assignment_test.rb index 11d206a91..0d1589f32 100644 --- a/test/unit/organization_domain_based_assignment_test.rb +++ b/test/unit/organization_domain_based_assignment_test.rb @@ -4,69 +4,69 @@ class OrganizationDomainBasedAssignmentTest < ActiveSupport::TestCase test 'organization based assignment' do organization1 = Organization.create_if_not_exists( - name: 'organization based assignment 1', - domain: '@examPle1.com ', + name: 'organization based assignment 1', + domain: '@examPle1.com ', domain_assignment: true, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) organization2 = Organization.create_if_not_exists( - name: 'organization based assignment 2', - domain: 'example2.com', + name: 'organization based assignment 2', + domain: 'example2.com', domain_assignment: false, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'organization-based_assignment-customer1@example1.com', - firstname: 'Domain', - lastname: 'Agent1', - email: 'organization-based_assignment-customer1@example1.com', - password: 'customerpw', - active: true, - roles: roles, + login: 'organization-based_assignment-customer1@example1.com', + firstname: 'Domain', + lastname: 'Agent1', + email: 'organization-based_assignment-customer1@example1.com', + password: 'customerpw', + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) assert_equal(organization1.id, customer1.organization_id) customer2 = User.create_or_update( - login: 'organization-based_assignment-customer2@example1.com', - firstname: 'Domain', - lastname: 'Agent2', - email: 'organization-based_assignment-customer2@example1.com', - password: 'customerpw', - active: true, + login: 'organization-based_assignment-customer2@example1.com', + firstname: 'Domain', + lastname: 'Agent2', + email: 'organization-based_assignment-customer2@example1.com', + password: 'customerpw', + active: true, organization_id: organization2.id, - roles: roles, - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_by_id: 1, + created_by_id: 1, ) assert_equal(organization2.id, customer2.organization_id) customer3 = User.create_or_update( - login: 'organization-based_assignment-customer3@example2.com', - firstname: 'Domain', - lastname: 'Agent2', - email: 'organization-based_assignment-customer3@example2.com', - password: 'customerpw', - active: true, - roles: roles, + login: 'organization-based_assignment-customer3@example2.com', + firstname: 'Domain', + lastname: 'Agent2', + email: 'organization-based_assignment-customer3@example2.com', + password: 'customerpw', + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) assert_nil(customer3.organization_id) customer4 = User.create_or_update( - login: 'organization-based_assignment-customer4', - firstname: 'Domain', - lastname: 'Agent2', - email: '@', - password: 'customerpw', - active: true, - roles: roles, + login: 'organization-based_assignment-customer4', + firstname: 'Domain', + lastname: 'Agent2', + email: '@', + password: 'customerpw', + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/organization_ref_object_touch_test.rb b/test/unit/organization_ref_object_touch_test.rb index 59e818a7c..6c5d43b1b 100644 --- a/test/unit/organization_ref_object_touch_test.rb +++ b/test/unit/organization_ref_object_touch_test.rb @@ -8,65 +8,65 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'organization-ref-object-update-agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'organization-ref-object-update-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'organization-ref-object-update-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'organization-ref-object-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') organization1 = Organization.create_if_not_exists( - name: 'Ref Object Update Org 1', - updated_at: '2015-02-05 16:37:00', + name: 'Ref Object Update Org 1', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) organization2 = Organization.create_if_not_exists( - name: 'Ref Object Update Org 2', - updated_at: '2015-02-05 16:37:00', + name: 'Ref Object Update Org 2', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) customer1 = User.create_or_update( - login: 'organization-ref-object-update-customer1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'organization-ref-object-update-customer1@example.com', - password: 'customerpw', - active: true, + login: 'organization-ref-object-update-customer1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'organization-ref-object-update-customer1@example.com', + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer2 = User.create_or_update( - login: 'organization-ref-object-update-customer2@example.com', - firstname: 'Notification', - lastname: 'Agent2', - email: 'organization-ref-object-update-customer2@example.com', - password: 'customerpw', - active: true, + login: 'organization-ref-object-update-customer2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'organization-ref-object-update-customer2@example.com', + password: 'customerpw', + active: true, organization_id: organization2.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.create!( - title: "some title1\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: customer1.id, - owner_id: agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "some title1\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -124,81 +124,81 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'organization-ref-object-not-update-agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'organization-ref-object-not-update-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'organization-ref-object-not-update-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'organization-ref-object-not-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') organization1 = Organization.create_if_not_exists( - name: 'Ref Object Update Org 1 (no update)', - updated_at: '2015-02-05 16:37:00', + name: 'Ref Object Update Org 1 (no update)', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) organization2 = Organization.create_if_not_exists( - name: 'Ref Object Update Org 2 (no update)', - updated_at: '2015-02-05 16:37:00', + name: 'Ref Object Update Org 2 (no update)', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) customer1 = User.create_or_update( - login: 'organization-ref-object-not-update-customer1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'organization-ref-object-not-update-customer1@example.com', - password: 'customerpw', - active: true, + login: 'organization-ref-object-not-update-customer1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'organization-ref-object-not-update-customer1@example.com', + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer2 = User.create_or_update( - login: 'organization-ref-object-not-update-customer2@example.com', - firstname: 'Notification', - lastname: 'Agent2', - email: 'organization-ref-object-not-update-customer2@example.com', - password: 'customerpw', - active: true, + login: 'organization-ref-object-not-update-customer2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'organization-ref-object-not-update-customer2@example.com', + password: 'customerpw', + active: true, organization_id: organization2.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) (1..100).each do |count| User.create_or_update( - login: "organization-ref-object-update-customer3-#{count}@example.com", - firstname: 'Notification', - lastname: 'Agent2', - email: "organization-ref-object-update-customer3-#{count}@example.com", - password: 'customerpw', - active: true, + login: "organization-ref-object-update-customer3-#{count}@example.com", + firstname: 'Notification', + lastname: 'Agent2', + email: "organization-ref-object-update-customer3-#{count}@example.com", + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) end ticket = Ticket.create!( - title: "some title1\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: customer1.id, - owner_id: agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - updated_at: '2015-02-05 16:39:00', + title: "some title1\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + updated_at: '2015-02-05 16:39:00', updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/overview_assets_test.rb b/test/unit/overview_assets_test.rb index 3c664cb1b..2b573e8a5 100644 --- a/test/unit/overview_assets_test.rb +++ b/test/unit/overview_assets_test.rb @@ -7,80 +7,80 @@ class OverviewAssetsTest < ActiveSupport::TestCase roles = Role.where(name: %w[Customer]) user1 = User.create_or_update( - login: 'assets_overview1@example.org', + login: 'assets_overview1@example.org', firstname: 'assets_overview1', - lastname: 'assets_overview1', - email: 'assets_overview1@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_overview1', + email: 'assets_overview1@example.org', + password: 'some_pass', + active: true, + roles: roles, ) user2 = User.create_or_update( - login: 'assets_overview2@example.org', + login: 'assets_overview2@example.org', firstname: 'assets_overview2', - lastname: 'assets_overview2', - email: 'assets_overview2@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_overview2', + email: 'assets_overview2@example.org', + password: 'some_pass', + active: true, + roles: roles, ) user3 = User.create_or_update( - login: 'assets_overview3@example.org', + login: 'assets_overview3@example.org', firstname: 'assets_overview3', - lastname: 'assets_overview3', - email: 'assets_overview3@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_overview3', + email: 'assets_overview3@example.org', + password: 'some_pass', + active: true, + roles: roles, ) user4 = User.create_or_update( - login: 'assets_overview4@example.org', + login: 'assets_overview4@example.org', firstname: 'assets_overview4', - lastname: 'assets_overview4', - email: 'assets_overview4@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_overview4', + email: 'assets_overview4@example.org', + password: 'some_pass', + active: true, + roles: roles, ) user5 = User.create_or_update( - login: 'assets_overview5@example.org', + login: 'assets_overview5@example.org', firstname: 'assets_overview5', - lastname: 'assets_overview5', - email: 'assets_overview5@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_overview5', + email: 'assets_overview5@example.org', + password: 'some_pass', + active: true, + roles: roles, ) ticket_state1 = Ticket::State.find_by(name: 'new') ticket_state2 = Ticket::State.find_by(name: 'open') overview_role = Role.find_by(name: 'Agent') overview = Overview.create_or_update( - name: 'my asset test', - link: 'my_asset_test', - prio: 1000, - role_ids: [overview_role.id], - user_ids: [user4.id, user5.id], + name: 'my asset test', + link: 'my_asset_test', + prio: 1000, + role_ids: [overview_role.id], + user_ids: [user4.id, user5.id], condition: { 'ticket.state_id' => { operator: 'is', - value: [ ticket_state1.id, ticket_state2.id ], + value: [ ticket_state1.id, ticket_state2.id ], }, 'ticket.owner_id' => { - operator: 'is', - pre_condition: 'specific', - value: user1.id, + operator: 'is', + pre_condition: 'specific', + value: user1.id, value_completion: 'John Smith ' }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) @@ -94,30 +94,30 @@ class OverviewAssetsTest < ActiveSupport::TestCase assert(assets[:TicketState][ticket_state2.id]) overview = Overview.create_or_update( - name: 'my asset test', - link: 'my_asset_test', - prio: 1000, - role_ids: [overview_role.id], - user_ids: [user4.id], + name: 'my asset test', + link: 'my_asset_test', + prio: 1000, + role_ids: [overview_role.id], + user_ids: [user4.id], condition: { 'ticket.state_id' => { operator: 'is', - value: ticket_state1.id, + value: ticket_state1.id, }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'specific', - value: [user1.id, user2.id], + value: [user1.id, user2.id], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) diff --git a/test/unit/permission_test.rb b/test/unit/permission_test.rb index c17554327..b5337123d 100644 --- a/test/unit/permission_test.rb +++ b/test/unit/permission_test.rb @@ -12,37 +12,37 @@ class PermissionTest < ActiveSupport::TestCase test 'user permission' do permission1 = Permission.create_or_update( - name: 'admin.permission1', - note: 'Admin Interface', + name: 'admin.permission1', + note: 'Admin Interface', preferences: {}, - active: true, + active: true, ) permission2 = Permission.create_or_update( - name: 'admin.permission2', - note: 'Admin Interface', + name: 'admin.permission2', + note: 'Admin Interface', preferences: {}, - active: true, + active: true, ) role_permission1 = Role.create_or_update( - name: 'AdminPermission1', - note: 'To configure your permission1.', - preferences: { + name: 'AdminPermission1', + note: 'To configure your permission1.', + preferences: { not: ['Customer'], }, default_at_signup: false, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) role_permission1.permission_revoke('admin') role_permission1.permission_grant('admin.permission1') user_with_permission1 = User.create_or_update( - login: 'setting-permission1', - firstname: 'Setting', - lastname: 'Admin Permission1', - email: 'setting-admin-permission1@example.com', - password: 'some_pw', - active: true, - roles: [role_permission1], + login: 'setting-permission1', + firstname: 'Setting', + lastname: 'Admin Permission1', + email: 'setting-admin-permission1@example.com', + password: 'some_pw', + active: true, + roles: [role_permission1], updated_by_id: 1, created_by_id: 1, ) @@ -77,31 +77,31 @@ class PermissionTest < ActiveSupport::TestCase test 'user permission with invalid role' do permission3 = Permission.create_or_update( - name: 'admin.permission3', - note: 'Admin Interface', + name: 'admin.permission3', + note: 'Admin Interface', preferences: {}, - active: true, + active: true, ) role_permission3 = Role.create_or_update( - name: 'AdminPermission2', - note: 'To configure your permission3.', - preferences: { + name: 'AdminPermission2', + note: 'To configure your permission3.', + preferences: { not: ['Customer'], }, default_at_signup: false, - active: true, - updated_by_id: 1, - created_by_id: 1, + active: true, + updated_by_id: 1, + created_by_id: 1, ) role_permission3.permission_grant('admin.permission3') user_with_permission3 = User.create_or_update( - login: 'setting-permission3', - firstname: 'Setting', - lastname: 'Admin Permission2', - email: 'setting-admin-permission3@example.com', - password: 'some_pw', - active: true, - roles: [role_permission3], + login: 'setting-permission3', + firstname: 'Setting', + lastname: 'Admin Permission2', + email: 'setting-admin-permission3@example.com', + password: 'some_pw', + active: true, + roles: [role_permission3], updated_by_id: 1, created_by_id: 1, ) @@ -125,36 +125,36 @@ class PermissionTest < ActiveSupport::TestCase test 'user permission with childs' do permission1 = Permission.create_or_update( - name: 'admin.permission_child1', - note: 'Admin Interface', + name: 'admin.permission_child1', + note: 'Admin Interface', preferences: {}, - active: true, + active: true, ) permission2 = Permission.create_or_update( - name: 'admin.permission_child2', - note: 'Admin Interface', + name: 'admin.permission_child2', + note: 'Admin Interface', preferences: {}, - active: false, + active: false, ) role_permission1 = Role.create_or_update( - name: 'AdminPermissionChild1', - note: 'To configure your permission child1.', - preferences: { + name: 'AdminPermissionChild1', + note: 'To configure your permission child1.', + preferences: { not: ['Customer'], }, default_at_signup: false, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) role_permission1.permission_grant('admin') user_with_permission1 = User.create_or_update( - login: 'setting-permission-child1', - firstname: 'Setting', - lastname: 'Admin Permission Child1', - email: 'setting-admin-permission-child1@example.com', - password: 'some_pw', - active: true, - roles: [role_permission1], + login: 'setting-permission-child1', + firstname: 'Setting', + lastname: 'Admin Permission Child1', + email: 'setting-admin-permission-child1@example.com', + password: 'some_pw', + active: true, + roles: [role_permission1], updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/role_test.rb b/test/unit/role_test.rb index 7d8554b6f..19393c31b 100644 --- a/test/unit/role_test.rb +++ b/test/unit/role_test.rb @@ -4,84 +4,84 @@ class RoleTest < ActiveSupport::TestCase test 'permission' do permission_test = Permission.create_or_update( - name: 'test', - note: 'parent test permission', + name: 'test', + note: 'parent test permission', preferences: { disabled: true }, ) permission_test_agent = Permission.create_or_update( - name: 'test.agent', - note: 'agent test permission', + name: 'test.agent', + note: 'agent test permission', preferences: { not: ['test.customer'], }, ) permission_test_customer = Permission.create_or_update( - name: 'test.customer', - note: 'customer test permission', + name: 'test.customer', + note: 'customer test permission', preferences: { not: ['test.agent'], }, ) permission_test_normal = Permission.create_or_update( - name: 'test.normal', - note: 'normal test permission', + name: 'test.normal', + note: 'normal test permission', preferences: {}, ) assert_raises(RuntimeError) do Role.create( - name: 'Test1', - note: 'Test1 Role.', - permissions: [permission_test], + name: 'Test1', + note: 'Test1 Role.', + permissions: [permission_test], updated_by_id: 1, created_by_id: 1 ) end assert_raises(RuntimeError) do Role.create( - name: 'Test1', - note: 'Test1 Role.', - permissions: [permission_test_agent, permission_test_customer], + name: 'Test1', + note: 'Test1 Role.', + permissions: [permission_test_agent, permission_test_customer], updated_by_id: 1, created_by_id: 1 ) end assert_raises(RuntimeError) do Role.create( - name: 'Test1', - note: 'Test1 Role.', - permissions: [permission_test_normal, permission_test_agent, permission_test_customer], + name: 'Test1', + note: 'Test1 Role.', + permissions: [permission_test_normal, permission_test_agent, permission_test_customer], updated_by_id: 1, created_by_id: 1 ) end role11 = Role.create( - name: 'Test1.1', - note: 'Test1.1 Role.', - permissions: [permission_test_agent], + name: 'Test1.1', + note: 'Test1.1 Role.', + permissions: [permission_test_agent], updated_by_id: 1, created_by_id: 1 ) role12 = Role.create( - name: 'Test1.2', - note: 'Test1.2 Role.', - permissions: [permission_test_customer], + name: 'Test1.2', + note: 'Test1.2 Role.', + permissions: [permission_test_customer], updated_by_id: 1, created_by_id: 1 ) role13 = Role.create( - name: 'Test1.3', - note: 'Test1.3 Role.', - permissions: [permission_test_normal], + name: 'Test1.3', + note: 'Test1.3 Role.', + permissions: [permission_test_normal], updated_by_id: 1, created_by_id: 1 ) role14 = Role.create( - name: 'Test1.4', - note: 'Test1.4 Role.', - permissions: [permission_test_normal, permission_test_customer], + name: 'Test1.4', + note: 'Test1.4 Role.', + permissions: [permission_test_normal, permission_test_customer], updated_by_id: 1, created_by_id: 1 ) @@ -126,9 +126,9 @@ class RoleTest < ActiveSupport::TestCase ) name = rand(999_999_999) role = Role.create( - name: "Test with Permission? #{name}", - note: "Test with Permission? #{name} Role.", - permissions: [permission_test2], + name: "Test with Permission? #{name}", + note: "Test with Permission? #{name} Role.", + permissions: [permission_test2], updated_by_id: 1, created_by_id: 1 ) @@ -153,22 +153,22 @@ class RoleTest < ActiveSupport::TestCase assert_raises(Exceptions::UnprocessableEntity) do Role.create!( - name: 'Test1', - note: 'Test1 Role.', + name: 'Test1', + note: 'Test1 Role.', default_at_signup: true, - permissions: [Permission.find_by(name: 'admin')], - updated_by_id: 1, - created_by_id: 1 + permissions: [Permission.find_by(name: 'admin')], + updated_by_id: 1, + created_by_id: 1 ) end role = Role.create!( - name: 'Test1', - note: 'Test1 Role.', + name: 'Test1', + note: 'Test1 Role.', default_at_signup: false, - permissions: [Permission.find_by(name: 'admin')], - updated_by_id: 1, - created_by_id: 1 + permissions: [Permission.find_by(name: 'admin')], + updated_by_id: 1, + created_by_id: 1 ) assert(role) @@ -177,44 +177,44 @@ class RoleTest < ActiveSupport::TestCase assert_raises(Exceptions::UnprocessableEntity) do Role.create!( - name: "Test1_#{type}", - note: 'Test1 Role.', + name: "Test1_#{type}", + note: 'Test1 Role.', default_at_signup: true, - permissions: [Permission.find_by(name: type)], - updated_by_id: 1, - created_by_id: 1 + permissions: [Permission.find_by(name: type)], + updated_by_id: 1, + created_by_id: 1 ) end role = Role.create!( - name: "Test1_#{type}", - note: 'Test1 Role.', + name: "Test1_#{type}", + note: 'Test1 Role.', default_at_signup: false, - permissions: [Permission.find_by(name: type)], - updated_by_id: 1, - created_by_id: 1 + permissions: [Permission.find_by(name: type)], + updated_by_id: 1, + created_by_id: 1 ) assert(role) end assert_raises(Exceptions::UnprocessableEntity) do Role.create!( - name: 'Test2', - note: 'Test2 Role.', + name: 'Test2', + note: 'Test2 Role.', default_at_signup: true, - permissions: [Permission.find_by(name: 'ticket.agent')], - updated_by_id: 1, - created_by_id: 1 + permissions: [Permission.find_by(name: 'ticket.agent')], + updated_by_id: 1, + created_by_id: 1 ) end role = Role.create!( - name: 'Test2', - note: 'Test2 Role.', + name: 'Test2', + note: 'Test2 Role.', default_at_signup: false, - permissions: [Permission.find_by(name: 'ticket.agent')], - updated_by_id: 1, - created_by_id: 1 + permissions: [Permission.find_by(name: 'ticket.agent')], + updated_by_id: 1, + created_by_id: 1 ) assert(role) diff --git a/test/unit/role_validate_agent_limit_test.rb b/test/unit/role_validate_agent_limit_test.rb index f74aedc99..edb343477 100644 --- a/test/unit/role_validate_agent_limit_test.rb +++ b/test/unit/role_validate_agent_limit_test.rb @@ -10,16 +10,16 @@ class RoleValidateAgentLimit < ActiveSupport::TestCase permission_ticket_agent = Permission.where(name: 'ticket.agent') role_agent_limit_success = Role.create!( - name: 'agent-limit-test-success', - note: 'agent-limit-test-success Role.', + name: 'agent-limit-test-success', + note: 'agent-limit-test-success Role.', permissions: [], - active: true, + active: true, ) role_agent_limit_fail = Role.create!( - name: 'agent-limit-test-fail', - note: 'agent-limit-test-fail Role.', + name: 'agent-limit-test-fail', + note: 'agent-limit-test-fail Role.', permissions: [], - active: true, + active: true, ) user1 = User.create!( @@ -79,16 +79,16 @@ class RoleValidateAgentLimit < ActiveSupport::TestCase permission_ticket_agent = Permission.where(name: 'ticket.agent') role_agent_limit_success = Role.create!( - name: 'agent-limit-test-success', - note: 'agent-limit-test-success Role.', + name: 'agent-limit-test-success', + note: 'agent-limit-test-success Role.', permissions: [], - active: true, + active: true, ) role_agent_limit_fail = Role.create!( - name: 'agent-limit-test-fail', - note: 'agent-limit-test-fail Role.', + name: 'agent-limit-test-fail', + note: 'agent-limit-test-fail Role.', permissions: [], - active: true, + active: true, ) user1 = User.create!( @@ -148,16 +148,16 @@ class RoleValidateAgentLimit < ActiveSupport::TestCase permission_ticket_agent = Permission.find_by(name: 'ticket.agent') role_agent_limit1 = Role.create!( - name: 'agent-limit-test1', - note: 'agent-limit-test1 Role.', + name: 'agent-limit-test1', + note: 'agent-limit-test1 Role.', permissions: [permission_ticket_agent], - active: true, + active: true, ) role_agent_limit2 = Role.create!( - name: 'agent-limit-test2', - note: 'agent-limit-test2 Role.', + name: 'agent-limit-test2', + note: 'agent-limit-test2 Role.', permissions: [permission_ticket_agent], - active: true, + active: true, ) user1 = User.create!( diff --git a/test/unit/session_basic_test.rb b/test/unit/session_basic_test.rb index a6fc60ddc..83c6ea5ae 100644 --- a/test/unit/session_basic_test.rb +++ b/test/unit/session_basic_test.rb @@ -53,14 +53,14 @@ class SessionBasicTest < ActiveSupport::TestCase groups = Group.all agent1 = User.create_or_update( - login: 'session-agent-1', - firstname: 'Session', - lastname: 'Agent 1', - email: 'session-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'session-agent-1', + firstname: 'Session', + lastname: 'Agent 1', + email: 'session-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) @@ -106,14 +106,14 @@ class SessionBasicTest < ActiveSupport::TestCase groups = Group.all agent1 = User.create_or_update( - login: 'session-collection-agent-1', - firstname: 'Session', - lastname: 'Agent 1', - email: 'session-collection-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'session-collection-agent-1', + firstname: 'Session', + lastname: 'Agent 1', + email: 'session-collection-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) @@ -158,8 +158,8 @@ class SessionBasicTest < ActiveSupport::TestCase # change collection group = Group.create!( - name: "SomeGroup::#{rand(999_999)}", - active: true, + name: "SomeGroup::#{rand(999_999)}", + active: true, created_by_id: 1, updated_by_id: 1, ) @@ -206,14 +206,14 @@ class SessionBasicTest < ActiveSupport::TestCase groups = Group.all agent1 = User.create_or_update( - login: 'activity-stream-agent-1', - firstname: 'Session', - lastname: "activity stream #{rand(99_999)}", - email: 'activity-stream-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'activity-stream-agent-1', + firstname: 'Session', + lastname: "activity stream #{rand(99_999)}", + email: 'activity-stream-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) @@ -221,7 +221,7 @@ class SessionBasicTest < ActiveSupport::TestCase # create min. on activity record random_name = "Random:#{rand(9_999_999_999)}" Group.create_or_update( - name: random_name, + name: random_name, updated_by_id: 1, created_by_id: 1, ) @@ -244,11 +244,11 @@ class SessionBasicTest < ActiveSupport::TestCase agent1.update!(email: 'activity-stream-agent11@example.com') ticket = Ticket.create!( - title: '12323', - group_id: 1, - priority_id: 1, - state_id: 1, - customer_id: 1, + title: '12323', + group_id: 1, + priority_id: 1, + state_id: 1, + customer_id: 1, updated_by_id: 1, created_by_id: 1, ) @@ -268,14 +268,14 @@ class SessionBasicTest < ActiveSupport::TestCase groups = Group.all agent1 = User.create_or_update( - login: 'ticket_create-agent-1', - firstname: 'Session', - lastname: "ticket_create #{rand(99_999)}", - email: 'ticket_create-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'ticket_create-agent-1', + firstname: 'Session', + lastname: "ticket_create #{rand(99_999)}", + email: 'ticket_create-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) @@ -297,8 +297,8 @@ class SessionBasicTest < ActiveSupport::TestCase assert_not(result1, 'check ticket_create - recall 2') Group.create!( - name: "SomeTicketCreateGroup::#{rand(999_999)}", - active: true, + name: "SomeTicketCreateGroup::#{rand(999_999)}", + active: true, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/session_basic_ticket_test.rb b/test/unit/session_basic_ticket_test.rb index 691d31343..c5f92c12c 100644 --- a/test/unit/session_basic_ticket_test.rb +++ b/test/unit/session_basic_ticket_test.rb @@ -8,25 +8,25 @@ class SessionBasicTicketTest < ActiveSupport::TestCase groups = Group.all @agent1 = User.create_or_update( - login: 'session-basic-ticket-agent-1', + login: 'session-basic-ticket-agent-1', firstname: 'Session', - lastname: 'session basic ' + rand(99_999).to_s, - email: 'session-basic-ticket-agent-1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + lastname: 'session basic ' + rand(99_999).to_s, + email: 'session-basic-ticket-agent-1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) @agent2 = User.create_or_update( - login: 'session-basic-ticket-agent-2', + login: 'session-basic-ticket-agent-2', firstname: 'Session', - lastname: 'session basic ' + rand(99_999).to_s, - email: 'session-basic-ticket-agent-2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + lastname: 'session basic ' + rand(99_999).to_s, + email: 'session-basic-ticket-agent-2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) Overview.destroy_all load Rails.root.join('db', 'seeds', 'overviews.rb') diff --git a/test/unit/session_collections_test.rb b/test/unit/session_collections_test.rb index 6753cbfc3..6e544e921 100644 --- a/test/unit/session_collections_test.rb +++ b/test/unit/session_collections_test.rb @@ -11,15 +11,15 @@ class SessionCollectionsTest < ActiveSupport::TestCase groups = Group.all agent1 = User.create_or_update( - login: 'session-collections-agent-1', - firstname: 'Session', - lastname: 'collections 1', - email: 'session-collections-agent-1@example.com', - password: 'agentpw', + login: 'session-collections-agent-1', + firstname: 'Session', + lastname: 'collections 1', + email: 'session-collections-agent-1@example.com', + password: 'agentpw', organization_id: nil, - active: true, - roles: roles, - groups: groups, + active: true, + roles: roles, + groups: groups, ) agent1.save! @@ -27,28 +27,28 @@ class SessionCollectionsTest < ActiveSupport::TestCase groups = Group.all agent2 = User.create_or_update( - login: 'session-collections-agent-2', - firstname: 'Session', - lastname: 'collections 2', - email: 'session-collections-agent-2@example.com', - password: 'agentpw', + login: 'session-collections-agent-2', + firstname: 'Session', + lastname: 'collections 2', + email: 'session-collections-agent-2@example.com', + password: 'agentpw', organization_id: nil, - active: true, - roles: roles, - groups: groups, + active: true, + roles: roles, + groups: groups, ) agent2.save! roles = Role.where(name: ['Customer']) customer1 = User.create_or_update( - login: 'session-collections-customer-1', - firstname: 'Session', - lastname: 'collections 2', - email: 'session-collections-customer-1@example.com', - password: 'customerpw', + login: 'session-collections-customer-1', + firstname: 'Session', + lastname: 'collections 2', + email: 'session-collections-customer-1@example.com', + password: 'customerpw', organization_id: nil, - active: true, - roles: roles, + active: true, + roles: roles, ) customer1.save! collection_client1 = Sessions::Backend::Collections.new(agent1, {}, nil, 'aaa-1', 2) @@ -175,14 +175,14 @@ class SessionCollectionsTest < ActiveSupport::TestCase UserInfo.current_user_id = 2 agent1 = User.create_or_update( - login: "sessions-assets-1-#{rand(99_999)}", + login: "sessions-assets-1-#{rand(99_999)}", firstname: 'Session', - lastname: "sessions assets #{rand(99_999)}", - email: 'sessions-assets1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + lastname: "sessions assets #{rand(99_999)}", + email: 'sessions-assets1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) assert(agent1.save!, 'create/update agent1') diff --git a/test/unit/session_enhanced_test.rb b/test/unit/session_enhanced_test.rb index 6e986fc99..1583ecadd 100644 --- a/test/unit/session_enhanced_test.rb +++ b/test/unit/session_enhanced_test.rb @@ -9,36 +9,36 @@ class SessionEnhancedTest < ActiveSupport::TestCase UserInfo.current_user_id = 1 agent1 = User.create_or_update( - login: 'session-agent-1', + login: 'session-agent-1', firstname: 'Session', - lastname: 'Agent 1', - email: 'session-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + lastname: 'Agent 1', + email: 'session-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent1.save! agent2 = User.create_or_update( - login: 'session-agent-2', + login: 'session-agent-2', firstname: 'Session', - lastname: 'Agent 2', - email: 'session-agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + lastname: 'Agent 2', + email: 'session-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent2.save! agent3 = User.create_or_update( - login: 'session-agent-3', + login: 'session-agent-3', firstname: 'Session', - lastname: 'Agent 3', - email: 'session-agent3@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + lastname: 'Agent 3', + email: 'session-agent3@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) agent3.save! @@ -184,39 +184,39 @@ class SessionEnhancedTest < ActiveSupport::TestCase UserInfo.current_user_id = 1 agent1 = User.create_or_update( - login: 'session-agent-1', - firstname: 'Session', - lastname: 'Agent 1', - email: 'session-agent1@example.com', - password: 'agentpw', - active: true, + login: 'session-agent-1', + firstname: 'Session', + lastname: 'Agent 1', + email: 'session-agent1@example.com', + password: 'agentpw', + active: true, organization: organization, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) agent1.save! agent2 = User.create_or_update( - login: 'session-agent-2', - firstname: 'Session', - lastname: 'Agent 2', - email: 'session-agent2@example.com', - password: 'agentpw', - active: true, + login: 'session-agent-2', + firstname: 'Session', + lastname: 'Agent 2', + email: 'session-agent2@example.com', + password: 'agentpw', + active: true, organization: organization, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) agent2.save! agent3 = User.create_or_update( - login: 'session-agent-3', - firstname: 'Session', - lastname: 'Agent 3', - email: 'session-agent3@example.com', - password: 'agentpw', - active: true, + login: 'session-agent-3', + firstname: 'Session', + lastname: 'Agent 3', + email: 'session-agent3@example.com', + password: 'agentpw', + active: true, organization: organization, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) agent3.save! diff --git a/test/unit/setting_test.rb b/test/unit/setting_test.rb index 32ad22c6d..7a0e652fe 100644 --- a/test/unit/setting_test.rb +++ b/test/unit/setting_test.rb @@ -4,22 +4,22 @@ class SettingTest < ActiveSupport::TestCase test 'basics' do Setting.create!( - title: 'ABC API Token', - name: 'abc_api_token', - area: 'Integration::ABC', + title: 'ABC API Token', + name: 'abc_api_token', + area: 'Integration::ABC', description: 'API Token for ABC to access ABC.', - options: { + options: { form: [ { display: '', - null: false, - name: 'abc_token', - tag: 'input', + null: false, + name: 'abc_token', + tag: 'input', }, ], }, - state: 'abc', - frontend: false + state: 'abc', + frontend: false ) assert_equal(Setting.get('abc_api_token'), 'abc') assert(Setting.set('abc_api_token', 'new_abc')) @@ -30,26 +30,26 @@ class SettingTest < ActiveSupport::TestCase test 'cache reset via preferences' do Setting.create!( - title: 'ABC API Token', - name: 'abc_api_token', - area: 'Integration::ABC', + title: 'ABC API Token', + name: 'abc_api_token', + area: 'Integration::ABC', description: 'API Token for ABC to access ABC.', - options: { + options: { form: [ { display: '', - null: false, - name: 'abc_token', - tag: 'input', + null: false, + name: 'abc_token', + tag: 'input', }, ], }, - state: '', + state: '', preferences: { permission: ['admin.integration'], - cache: ['abcGetVoipUsers'], + cache: ['abcGetVoipUsers'], }, - frontend: false + frontend: false ) Cache.write('abcGetVoipUsers', { a: 1 }) diff --git a/test/unit/sla_assets_test.rb b/test/unit/sla_assets_test.rb index 958cc5b92..33b8c6d06 100644 --- a/test/unit/sla_assets_test.rb +++ b/test/unit/sla_assets_test.rb @@ -7,27 +7,27 @@ class SlaAssetsTest < ActiveSupport::TestCase roles = Role.where(name: %w[Customer]) user1 = User.create_or_update( - login: 'assets_sla1@example.org', + login: 'assets_sla1@example.org', firstname: 'assets_sla1', - lastname: 'assets_sla1', - email: 'assets_sla1@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_sla1', + email: 'assets_sla1@example.org', + password: 'some_pass', + active: true, + roles: roles, ) user2 = User.create_or_update( - login: 'assets_sla2@example.org', + login: 'assets_sla2@example.org', firstname: 'assets_sla2', - lastname: 'assets_sla2', - email: 'assets_sla2@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_sla2', + email: 'assets_sla2@example.org', + password: 'some_pass', + active: true, + roles: roles, ) calendar1 = Calendar.create_or_update( - name: 'US 1', - timezone: 'America/Los_Angeles', + name: 'US 1', + timezone: 'America/Los_Angeles', business_hours: { mon: { '09:00' => '17:00' }, tue: { '09:00' => '17:00' }, @@ -35,25 +35,25 @@ class SlaAssetsTest < ActiveSupport::TestCase thu: { '09:00' => '17:00' }, fri: { '09:00' => '17:00' } }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) ticket_state1 = Ticket::State.find_by(name: 'new') ticket_state2 = Ticket::State.find_by(name: 'open') sla = Sla.create_or_update( - name: 'my asset test', + name: 'my asset test', calendar_id: calendar1.id, - condition: { + condition: { 'ticket.state_id' => { operator: 'is', - value: [ ticket_state1.id, ticket_state2.id ], + value: [ ticket_state1.id, ticket_state2.id ], }, 'ticket.owner_id' => { - operator: 'is', - pre_condition: 'specific', - value: user1.id, + operator: 'is', + pre_condition: 'specific', + value: user1.id, value_completion: 'John Smith ' }, }, diff --git a/test/unit/stats_ticket_waiting_time_test.rb b/test/unit/stats_ticket_waiting_time_test.rb index 743a4a0b1..4c3c582ae 100644 --- a/test/unit/stats_ticket_waiting_time_test.rb +++ b/test/unit/stats_ticket_waiting_time_test.rb @@ -6,34 +6,34 @@ class StatsTicketWaitingTimeTest < ActiveSupport::TestCase test 'single ticket' do group1 = Group.create!( - name: 'Group 1', - active: true, + name: 'Group 1', + active: true, email_address: EmailAddress.first, created_by_id: 1, updated_by_id: 1, ) roles = Role.where(name: 'Agent') user1 = User.create!( - login: 'assets_stats1@example.org', - firstname: 'assets_stats1', - lastname: 'assets_stats1', - email: 'assets_stats1@example.org', - password: 'some_pass', - active: true, - groups: [group1], - roles: roles, + login: 'assets_stats1@example.org', + firstname: 'assets_stats1', + lastname: 'assets_stats1', + email: 'assets_stats1@example.org', + password: 'some_pass', + active: true, + groups: [group1], + roles: roles, created_by_id: 1, updated_by_id: 1, ) user2 = User.create!( - login: 'assets_stats2@example.org', - firstname: 'assets_stats2', - lastname: 'assets_stats2', - email: 'assets_sla2@example.org', - password: 'some_pass', - active: true, - groups: [group1], - roles: roles, + login: 'assets_stats2@example.org', + firstname: 'assets_stats2', + lastname: 'assets_stats2', + email: 'assets_sla2@example.org', + password: 'some_pass', + active: true, + groups: [group1], + roles: roles, created_by_id: 1, updated_by_id: 1, ) @@ -45,11 +45,11 @@ class StatsTicketWaitingTimeTest < ActiveSupport::TestCase assert_equal(0, result[:percent]) ticket1 = Ticket.create!( - title: 'com test 1', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'com test 1', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -183,11 +183,11 @@ class StatsTicketWaitingTimeTest < ActiveSupport::TestCase ) ticket2 = Ticket.create!( - title: 'com test 2', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'com test 2', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -209,12 +209,12 @@ class StatsTicketWaitingTimeTest < ActiveSupport::TestCase assert_equal(0.0, result[:percent]) ticket3 = Ticket.create!( - title: 'com test 3', - group: group1, - customer_id: 2, - owner: user1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'com test 3', + group: group1, + customer_id: 2, + owner: user1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/store_test.rb b/test/unit/store_test.rb index 9755ec83a..492fd313b 100644 --- a/test/unit/store_test.rb +++ b/test/unit/store_test.rb @@ -31,24 +31,24 @@ class StoreTest < ActiveSupport::TestCase test 'store attachment and move it between backends' do files = [ { - data: 'hello world', + data: 'hello world', filename: 'test.txt', - o_id: 1, + o_id: 1, }, { - data: 'hello world äöüß', + data: 'hello world äöüß', filename: 'testäöüß.txt', - o_id: 2, + o_id: 2, }, { - data: File.binread(Rails.root.join('test', 'data', 'pdf', 'test1.pdf')), + data: File.binread(Rails.root.join('test', 'data', 'pdf', 'test1.pdf')), filename: 'test.pdf', - o_id: 3, + o_id: 3, }, { - data: File.binread(Rails.root.join('test', 'data', 'pdf', 'test1.pdf')), + data: File.binread(Rails.root.join('test', 'data', 'pdf', 'test1.pdf')), filename: 'test-again.pdf', - o_id: 4, + o_id: 4, }, ] @@ -57,11 +57,11 @@ class StoreTest < ActiveSupport::TestCase # add attachments store = Store.add( - object: 'Test', - o_id: file[:o_id], - data: file[:data], - filename: file[:filename], - preferences: {}, + object: 'Test', + o_id: file[:o_id], + data: file[:data], + filename: file[:filename], + preferences: {}, created_by_id: 1, ) assert store @@ -69,7 +69,7 @@ class StoreTest < ActiveSupport::TestCase # get list of attachments attachments = Store.list( object: 'Test', - o_id: file[:o_id], + o_id: file[:o_id], ) assert attachments @@ -95,7 +95,7 @@ class StoreTest < ActiveSupport::TestCase # get list of attachments attachments = Store.list( object: 'Test', - o_id: file[:o_id], + o_id: file[:o_id], ) assert attachments @@ -121,7 +121,7 @@ class StoreTest < ActiveSupport::TestCase # get list of attachments attachments = Store.list( object: 'Test', - o_id: file[:o_id], + o_id: file[:o_id], ) assert(attachments) assert_equal(attachments.count, 1) @@ -139,14 +139,14 @@ class StoreTest < ActiveSupport::TestCase # delete attachments success = Store.remove( object: 'Test', - o_id: file[:o_id], + o_id: file[:o_id], ) assert(success) # check attachments again attachments = Store.list( object: 'Test', - o_id: file[:o_id], + o_id: file[:o_id], ) assert_not(attachments[0]) end diff --git a/test/unit/tag_test.rb b/test/unit/tag_test.rb index 08488dabb..bf700aeac 100644 --- a/test/unit/tag_test.rb +++ b/test/unit/tag_test.rb @@ -7,14 +7,14 @@ class TagTest < ActiveSupport::TestCase # test 1 { tag_add: { - item: 'tag1', - object: 'Object1', - o_id: 123, + item: 'tag1', + object: 'Object1', + o_id: 123, created_by_id: 1 }, - verify: { + verify: { object: 'Object1', - items: { + items: { 'tag1' => true, 'tag2' => false, }, @@ -24,14 +24,14 @@ class TagTest < ActiveSupport::TestCase # test 2 { tag_add: { - item: 'tag2', - object: 'Object1', - o_id: 123, + item: 'tag2', + object: 'Object1', + o_id: 123, created_by_id: 1 }, - verify: { + verify: { object: 'Object1', - items: { + items: { 'tag1' => true, 'tag2' => true, }, @@ -40,14 +40,14 @@ class TagTest < ActiveSupport::TestCase { tag_add: { - item: 'TAG2', - object: 'Object1', - o_id: 123, + item: 'TAG2', + object: 'Object1', + o_id: 123, created_by_id: 1 }, - verify: { + verify: { object: 'Object1', - items: { + items: { 'tag1' => true, 'tag2' => true, 'TAG2' => true, @@ -58,14 +58,14 @@ class TagTest < ActiveSupport::TestCase # test 2 { tag_add: { - item: 'tagöäüß1', - object: 'Object2', - o_id: 123, + item: 'tagöäüß1', + object: 'Object2', + o_id: 123, created_by_id: 1 }, - verify: { + verify: { object: 'Object2', - items: { + items: { 'tagöäüß1' => true, 'tag2' => false, }, @@ -75,14 +75,14 @@ class TagTest < ActiveSupport::TestCase # test 4 { tag_add: { - item: 'Tagöäüß2', - object: 'Object2', - o_id: 123, + item: 'Tagöäüß2', + object: 'Object2', + o_id: 123, created_by_id: 1 }, - verify: { + verify: { object: 'Object2', - items: { + items: { 'tagöäüß1' => true, 'Tagöäüß2' => true, 'tagöäüß3' => false, @@ -93,14 +93,14 @@ class TagTest < ActiveSupport::TestCase # test 5 { tag_remove: { - item: 'tag1', - object: 'Object1', - o_id: 123, + item: 'tag1', + object: 'Object1', + o_id: 123, created_by_id: 1 }, - verify: { + verify: { object: 'Object1', - items: { + items: { 'tag1' => false, 'tag2' => true, 'TAG2' => true, @@ -111,14 +111,14 @@ class TagTest < ActiveSupport::TestCase # test 5 { tag_remove: { - item: 'TAG2', - object: 'Object1', - o_id: 123, + item: 'TAG2', + object: 'Object1', + o_id: 123, created_by_id: 1 }, - verify: { + verify: { object: 'Object1', - items: { + items: { 'tag1' => false, 'tag2' => true, 'TAG2' => false, @@ -162,20 +162,20 @@ class TagTest < ActiveSupport::TestCase test 'tags - real live' do ticket1 = Ticket.create( - title: 'some title tag1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some title tag1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) ticket2 = Ticket.create( - title: 'some title tag2', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some title tag2', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -215,8 +215,8 @@ class TagTest < ActiveSupport::TestCase travel 2.seconds tag_item3 = Tag::Item.find_by(name: 'some tag3') Tag::Item.rename( - id: tag_item3.id, - name: ' some tag33', + id: tag_item3.id, + name: ' some tag33', created_by_id: 1, ) @@ -241,8 +241,8 @@ class TagTest < ActiveSupport::TestCase # merge tags travel 2.seconds Tag::Item.rename( - id: tag_item3.id, - name: 'some tag2', + id: tag_item3.id, + name: 'some tag2', created_by_id: 1, ) @@ -292,16 +292,16 @@ class TagTest < ActiveSupport::TestCase test 'tags - rename tag with same name' do ticket1 = Ticket.create( - title: 'rename tag1', - group: Group.lookup(name: 'Users'), - customer_id: 2, + title: 'rename tag1', + group: Group.lookup(name: 'Users'), + customer_id: 2, updated_by_id: 1, created_by_id: 1, ) ticket2 = Ticket.create( - title: 'rename tag2', - group: Group.lookup(name: 'Users'), - customer_id: 2, + title: 'rename tag2', + group: Group.lookup(name: 'Users'), + customer_id: 2, updated_by_id: 1, created_by_id: 1, ) @@ -322,8 +322,8 @@ class TagTest < ActiveSupport::TestCase tag_item1 = Tag::Item.find_by(name: 'some rename tag1') Tag::Item.rename( - id: tag_item1.id, - name: ' some rename tag1', + id: tag_item1.id, + name: ' some rename tag1', created_by_id: 1, ) @@ -341,16 +341,16 @@ class TagTest < ActiveSupport::TestCase test 'tags - rename and merge tag with existing tag' do ticket1 = Ticket.create( - title: 'rename tag1', - group: Group.lookup(name: 'Users'), - customer_id: 2, + title: 'rename tag1', + group: Group.lookup(name: 'Users'), + customer_id: 2, updated_by_id: 1, created_by_id: 1, ) ticket2 = Ticket.create( - title: 'rename tag2', - group: Group.lookup(name: 'Users'), - customer_id: 2, + title: 'rename tag2', + group: Group.lookup(name: 'Users'), + customer_id: 2, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/text_module_csv_import_test.rb b/test/unit/text_module_csv_import_test.rb index 68e92afbb..590f29e4c 100644 --- a/test/unit/text_module_csv_import_test.rb +++ b/test/unit/text_module_csv_import_test.rb @@ -24,11 +24,11 @@ class TextModuleCsvImportTest < ActiveSupport::TestCase test 'empty payload' do csv_string = '' result = TextModule.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_nil(result[:records]) @@ -37,11 +37,11 @@ class TextModuleCsvImportTest < ActiveSupport::TestCase csv_string = 'name;keywords;content;note;active;' result = TextModule.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert(result[:records].blank?) @@ -52,11 +52,11 @@ class TextModuleCsvImportTest < ActiveSupport::TestCase test 'verify required lookup headers' do csv_string = "firstname;lastname;active;\nfirstname-simple-import1;lastname-simple-import1;;true\nfirstname-simple-import2;lastname-simple-import2;false\n" result = TextModule.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal('failed', result[:result]) @@ -65,20 +65,20 @@ class TextModuleCsvImportTest < ActiveSupport::TestCase test 'simple import' do TextModule.create!( - name: 'nsome name1', - content: 'nsome name1', - active: true, + name: 'nsome name1', + content: 'nsome name1', + active: true, updated_by_id: 1, created_by_id: 1, ) csv_string = "name;keywords;content;note;active;\nsome name1;keyword1;\"some\ncontent1\";-;\nsome name2;keyword2;some content
test123\n" result = TextModule.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) @@ -89,11 +89,11 @@ class TextModuleCsvImportTest < ActiveSupport::TestCase assert_nil(TextModule.find_by(name: 'some name2')) result = TextModule.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) @@ -121,28 +121,28 @@ class TextModuleCsvImportTest < ActiveSupport::TestCase assert_equal(0, TextModule.count) TextModule.create!( - name: 'some name1', - content: 'some name1', - active: true, + name: 'some name1', + content: 'some name1', + active: true, updated_by_id: 1, created_by_id: 1, ) TextModule.create!( - name: 'name should be deleted 2', - content: 'name should be deleted 1', - active: true, + name: 'name should be deleted 2', + content: 'name should be deleted 1', + active: true, updated_by_id: 1, created_by_id: 1, ) csv_string = "name;keywords;content;note;active;\nsome name1;keyword1;\"some\ncontent1\";-;\nsome name2;keyword2;some content
test123\n" result = TextModule.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, - delete: true, + try: true, + delete: true, ) assert_equal(true, result[:try]) @@ -158,12 +158,12 @@ class TextModuleCsvImportTest < ActiveSupport::TestCase assert_nil(TextModule.find_by(name: 'some name2')) result = TextModule.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, - delete: true, + try: false, + delete: true, ) assert_equal(false, result[:try]) diff --git a/test/unit/ticket_article_communicate_test.rb b/test/unit/ticket_article_communicate_test.rb index 4d7824cb5..164852146 100644 --- a/test/unit/ticket_article_communicate_test.rb +++ b/test/unit/ticket_article_communicate_test.rb @@ -7,26 +7,26 @@ class TicketArticleCommunicateTest < ActiveSupport::TestCase # via application server ApplicationHandleInfo.current = 'application_server' ticket1 = Ticket.create( - title: 'com test 1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'com test 1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) assert(ticket1, 'ticket created') article_email1_1 = Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_customer_com-1@example.com', - to: 'some_zammad_com-1@example.com', - subject: 'com test 1', - message_id: 'some@id_com_1', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_customer_com-1@example.com', + to: 'some_zammad_com-1@example.com', + subject: 'com test 1', + message_id: 'some@id_com_1', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -41,15 +41,15 @@ class TicketArticleCommunicateTest < ActiveSupport::TestCase assert_equal(0, email_count('some_zammad_com-1@example.com')) article_email1_2 = Ticket::Article.create( - ticket_id: ticket1.id, - from: 'some_zammad_com-1@example.com', - to: 'some_customer_com-1@example.com', - subject: 'com test 1', - message_id: 'some@id_com_2', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_zammad_com-1@example.com', + to: 'some_customer_com-1@example.com', + subject: 'com test 1', + message_id: 'some@id_com_2', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -66,26 +66,26 @@ class TicketArticleCommunicateTest < ActiveSupport::TestCase # via scheduler (e. g. postmaster) ApplicationHandleInfo.current = 'scheduler.postmaster' ticket2 = Ticket.create( - title: 'com test 2', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'com test 2', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) assert(ticket2, 'ticket created') article_email2_1 = Ticket::Article.create( - ticket_id: ticket2.id, - from: 'some_customer_com-2@example.com', - to: 'some_zammad_com-2@example.com', - subject: 'com test 2', - message_id: 'some@id_com_1', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket2.id, + from: 'some_customer_com-2@example.com', + to: 'some_zammad_com-2@example.com', + subject: 'com test 2', + message_id: 'some@id_com_1', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -101,15 +101,15 @@ class TicketArticleCommunicateTest < ActiveSupport::TestCase ApplicationHandleInfo.current = 'scheduler.postmaster' article_email2_2 = Ticket::Article.create( - ticket_id: ticket2.id, - from: 'some_zammad_com-2@example.com', - to: 'some_customer_com-2@example.com', - subject: 'com test 2', - message_id: 'some@id_com_2', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket2.id, + from: 'some_zammad_com-2@example.com', + to: 'some_customer_com-2@example.com', + subject: 'com test 2', + message_id: 'some@id_com_2', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_article_dos_test.rb b/test/unit/ticket_article_dos_test.rb index 0573c9f2a..0cb816b6c 100644 --- a/test/unit/ticket_article_dos_test.rb +++ b/test/unit/ticket_article_dos_test.rb @@ -12,54 +12,54 @@ class TicketArticleDos < ActiveSupport::TestCase name: 'Zammad Foundation', ) user_community = User.create_or_update( - login: 'article.dos@example.org', - firstname: 'Article', - lastname: 'Dos', - email: 'article.dos@example.org', - password: '', - active: true, - roles: [ Role.find_by(name: 'Customer') ], + login: 'article.dos@example.org', + firstname: 'Article', + lastname: 'Dos', + email: 'article.dos@example.org', + password: '', + active: true, + roles: [ Role.find_by(name: 'Customer') ], organization_id: org_community.id, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) UserInfo.current_user_id = user_community.id ApplicationHandleInfo.current = 'test.postmaster' ticket1 = Ticket.create!( - group_id: Group.first.id, - customer_id: user_community.id, - title: 'DoS 1!', + group_id: Group.first.id, + customer_id: user_community.id, + title: 'DoS 1!', updated_by_id: 1, created_by_id: 1, ) article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - type_id: Ticket::Article::Type.find_by(name: 'phone').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - from: 'Zammad Feedback ', - body: two_mio_random_chars, - internal: false, + ticket_id: ticket1.id, + type_id: Ticket::Article::Type.find_by(name: 'phone').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, + from: 'Zammad Feedback ', + body: two_mio_random_chars, + internal: false, updated_by_id: 1, created_by_id: 1, ) assert_equal(1_500_000, article1.body.length) ticket2 = Ticket.create!( - group_id: Group.first.id, - customer_id: user_community.id, - title: 'DoS 2!', + group_id: Group.first.id, + customer_id: user_community.id, + title: 'DoS 2!', updated_by_id: 1, created_by_id: 1, ) article2 = Ticket::Article.create!( - ticket_id: ticket2.id, - type_id: Ticket::Article::Type.find_by(name: 'phone').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - from: 'Zammad Feedback ', - body: "\u0000#{two_mio_random_chars}", - internal: false, + ticket_id: ticket2.id, + type_id: Ticket::Article::Type.find_by(name: 'phone').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, + from: 'Zammad Feedback ', + body: "\u0000#{two_mio_random_chars}", + internal: false, updated_by_id: 1, created_by_id: 1, ) @@ -68,21 +68,21 @@ class TicketArticleDos < ActiveSupport::TestCase ApplicationHandleInfo.current = 'web' ticket3 = Ticket.create!( - group_id: Group.first.id, - customer_id: user_community.id, - title: 'DoS 3!', + group_id: Group.first.id, + customer_id: user_community.id, + title: 'DoS 3!', updated_by_id: 1, created_by_id: 1, ) assert_raises(Exceptions::UnprocessableEntity) do article3 = Ticket::Article.create!( - ticket_id: ticket3.id, - type_id: Ticket::Article::Type.find_by(name: 'phone').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - from: 'Zammad Feedback ', - body: "\u0000#{two_mio_random_chars}", - internal: false, + ticket_id: ticket3.id, + type_id: Ticket::Article::Type.find_by(name: 'phone').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, + from: 'Zammad Feedback ', + body: "\u0000#{two_mio_random_chars}", + internal: false, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_article_time_accouting_test.rb b/test/unit/ticket_article_time_accouting_test.rb index 455fce5d1..e59990b04 100644 --- a/test/unit/ticket_article_time_accouting_test.rb +++ b/test/unit/ticket_article_time_accouting_test.rb @@ -4,82 +4,82 @@ class TicketArticleTimeAccoutingTest < ActiveSupport::TestCase test 'destroy dependent time accounting for ticket and article' do ticket_test = Ticket.create( - title: 'com test 1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'com test 1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) assert(ticket_test, 'ticket created') article_test1 = Ticket::Article.create( - ticket_id: ticket_test.id, - from: 'some_customer_com-1@example.com', - to: 'some_zammad_com-1@example.com', - subject: 'com test 1', - message_id: 'some@id_com_1', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket_test.id, + from: 'some_customer_com-1@example.com', + to: 'some_zammad_com-1@example.com', + subject: 'com test 1', + message_id: 'some@id_com_1', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) Ticket::TimeAccounting.create!( - ticket_id: ticket_test.id, + ticket_id: ticket_test.id, ticket_article_id: article_test1.id, - time_unit: 10, - created_by_id: 1, + time_unit: 10, + created_by_id: 1, ) article_test2 = Ticket::Article.create( - ticket_id: ticket_test.id, - from: 'some_customer_com-1@example.com', - to: 'some_zammad_com-1@example.com', - subject: 'com test 1', - message_id: 'some@id_com_1', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket_test.id, + from: 'some_customer_com-1@example.com', + to: 'some_zammad_com-1@example.com', + subject: 'com test 1', + message_id: 'some@id_com_1', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) Ticket::TimeAccounting.create!( - ticket_id: ticket_test.id, + ticket_id: ticket_test.id, ticket_article_id: article_test2.id, - time_unit: 10, - created_by_id: 1, + time_unit: 10, + created_by_id: 1, ) article_test3 = Ticket::Article.create( - ticket_id: ticket_test.id, - from: 'some_customer_com-1@example.com', - to: 'some_zammad_com-1@example.com', - subject: 'com test 1', - message_id: 'some@id_com_1', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket_test.id, + from: 'some_customer_com-1@example.com', + to: 'some_zammad_com-1@example.com', + subject: 'com test 1', + message_id: 'some@id_com_1', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) Ticket::TimeAccounting.create!( - ticket_id: ticket_test.id, + ticket_id: ticket_test.id, ticket_article_id: article_test3.id, - time_unit: 10, - created_by_id: 1, + time_unit: 10, + created_by_id: 1, ) Ticket::TimeAccounting.create!( - ticket_id: ticket_test.id, - time_unit: 10, + ticket_id: ticket_test.id, + time_unit: 10, created_by_id: 1, ) diff --git a/test/unit/ticket_csv_import_test.rb b/test/unit/ticket_csv_import_test.rb index faa646bf6..679666c32 100644 --- a/test/unit/ticket_csv_import_test.rb +++ b/test/unit/ticket_csv_import_test.rb @@ -24,11 +24,11 @@ class TicketCsvImportTest < ActiveSupport::TestCase test 'empty payload' do csv_string = '' result = Ticket.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_nil(result[:records]) @@ -37,11 +37,11 @@ class TicketCsvImportTest < ActiveSupport::TestCase csv_string = 'id;number;title;state;priority;' result = Ticket.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert(result[:records].blank?) @@ -52,11 +52,11 @@ class TicketCsvImportTest < ActiveSupport::TestCase test 'verify required lookup headers' do csv_string = "firstname;lastname;active;\nfirstname-simple-import1;lastname-simple-import1;;true\nfirstname-simple-import2;lastname-simple-import2;false\n" result = Ticket.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal('failed', result[:result]) @@ -67,11 +67,11 @@ class TicketCsvImportTest < ActiveSupport::TestCase csv_string = "id;number;title;state;priority;owner;customer;group;note\n;123456;some title1;new;2 normal;-;nicole.braun@zammad.org;Users;some note1\n;123457;some title2;closed;1 low;admin@example.com;nicole.braun@zammad.org;Users;some note2\n" result = Ticket.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(2, result[:records].count) @@ -81,11 +81,11 @@ class TicketCsvImportTest < ActiveSupport::TestCase assert_nil(Ticket.find_by(number: '123457')) result = Ticket.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) @@ -119,11 +119,11 @@ class TicketCsvImportTest < ActiveSupport::TestCase csv_string = "id;number;title;state;priority;owner;customer;group;note\n999999999;123456;some title1;new;2 normal;-;nicole.braun@zammad.org;Users;some note1\n;123457;some title2;closed;1 low;admin@example.com;nicole.braun@zammad.org;Users;some note2\n" result = Ticket.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(1, result[:errors].count) @@ -134,11 +134,11 @@ class TicketCsvImportTest < ActiveSupport::TestCase assert_nil(Ticket.find_by(number: '123457')) result = Ticket.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(1, result[:records].count) @@ -154,11 +154,11 @@ class TicketCsvImportTest < ActiveSupport::TestCase csv_string = "id;number;title;state;priority;owner;customer;group;note\n999999999;123456;some title1;new;2 normal;-;nicole.braun@zammad.org;Users;some note1\n;123457;some title22;closed;1 low;admin@example.com;nicole.braun@zammad.org;Users;some note22\n" result = Ticket.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(1, result[:records].count) @@ -178,11 +178,11 @@ class TicketCsvImportTest < ActiveSupport::TestCase csv_string = "id;number;not_existing;state;priority;owner;customer;group;note\n;123456;some title1;new;2 normal;-;nicole.braun@zammad.org;Users;some note1\n;123457;some title2;closed;1 low;admin@example.com;nicole.braun@zammad.org;Users;some note2\n" result = Ticket.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(2, result[:errors].count) @@ -194,11 +194,11 @@ class TicketCsvImportTest < ActiveSupport::TestCase assert_nil(Ticket.find_by(number: '123457')) result = Ticket.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(2, result[:errors].count) diff --git a/test/unit/ticket_customer_organization_update_test.rb b/test/unit/ticket_customer_organization_update_test.rb index 5f55764cc..fbd985507 100644 --- a/test/unit/ticket_customer_organization_update_test.rb +++ b/test/unit/ticket_customer_organization_update_test.rb @@ -6,49 +6,49 @@ class TicketCustomerOrganizationUpdateTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') @agent1 = User.create_or_update( - login: 'ticket-customer-organization-update-agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'ticket-customer-organization-update-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'ticket-customer-organization-update-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'ticket-customer-organization-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') @organization1 = Organization.create_if_not_exists( - name: 'Customer Organization Update', - updated_at: '2015-02-05 16:37:00', + name: 'Customer Organization Update', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) @customer1 = User.create_or_update( - login: 'ticket-customer-organization-update-customer1@example.com', - firstname: 'Notification', - lastname: 'Customer1', - email: 'ticket-customer-organization-update-customer1@example.com', - password: 'customerpw', - active: true, + login: 'ticket-customer-organization-update-customer1@example.com', + firstname: 'Notification', + lastname: 'Customer1', + email: 'ticket-customer-organization-update-customer1@example.com', + password: 'customerpw', + active: true, organization_id: @organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) end test 'create ticket, update customers organization later' do ticket = Ticket.create( - title: "some title1\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: @customer1.id, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "some title1\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: @customer1.id, + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_escalation_test.rb b/test/unit/ticket_escalation_test.rb index 4899acc26..dab3b9e65 100644 --- a/test/unit/ticket_escalation_test.rb +++ b/test/unit/ticket_escalation_test.rb @@ -3,9 +3,9 @@ require 'test_helper' class TicketEscalationTest < ActiveSupport::TestCase test 'ticket create' do ticket = Ticket.new( - title: 'some value 123', - group: Group.lookup(name: 'Users'), - customer_id: 2, + title: 'some value 123', + group: Group.lookup(name: 'Users'), + customer_id: 2, updated_by_id: 1, created_by_id: 1, ) @@ -15,11 +15,11 @@ class TicketEscalationTest < ActiveSupport::TestCase assert_not(ticket.has_changes_to_save?) article = Ticket::Article.create!( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'note').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - body: 'some body', - internal: false, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.find_by(name: 'note').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, + body: 'some body', + internal: false, updated_by_id: 1, created_by_id: 1, ) @@ -27,64 +27,64 @@ class TicketEscalationTest < ActiveSupport::TestCase assert_not(ticket.has_changes_to_save?) calendar = Calendar.create_or_update( - name: 'Escalation Test', - timezone: 'Europe/Berlin', + name: 'Escalation Test', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, tue: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, wed: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, thu: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, fri: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, sat: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, sun: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 1', - condition: { + name: 'test sla 1', + condition: { 'ticket.title' => { operator: 'contains', - value: 'some value 123', + value: 'some value 123', }, }, first_response_time: 60, - update_time: 180, - solution_time: 240, - calendar_id: calendar.id, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + calendar_id: calendar.id, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.new( - title: 'some value 123', - group: Group.lookup(name: 'Users'), - customer_id: 2, + title: 'some value 123', + group: Group.lookup(name: 'Users'), + customer_id: 2, updated_by_id: 1, created_by_id: 1, ) @@ -95,11 +95,11 @@ class TicketEscalationTest < ActiveSupport::TestCase assert_not(ticket.has_changes_to_save?) article = Ticket::Article.create!( - ticket_id: ticket.id, - type_id: Ticket::Article::Type.find_by(name: 'note').id, - sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, - body: 'some body', - internal: false, + ticket_id: ticket.id, + type_id: Ticket::Article::Type.find_by(name: 'note').id, + sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id, + body: 'some body', + internal: false, updated_by_id: 1, created_by_id: 1, ) @@ -128,58 +128,58 @@ class TicketEscalationTest < ActiveSupport::TestCase test 'email process and reply via email' do calendar = Calendar.create_or_update( - name: 'Escalation Test', - timezone: 'Europe/Berlin', + name: 'Escalation Test', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, tue: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, wed: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, thu: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, fri: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, sat: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, sun: { - active: true, + active: true, timeframes: [ ['00:00', '23:59'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 1', - condition: { + name: 'test sla 1', + condition: { 'ticket.title' => { operator: 'contains', - value: 'some value 123', + value: 'some value 123', }, }, first_response_time: 60, - update_time: 180, - solution_time: 240, - calendar_id: calendar.id, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + calendar_id: calendar.id, + updated_by_id: 1, + created_by_id: 1, ) email = "From: Bob Smith @@ -201,15 +201,15 @@ Some Text" ticket_p.with_lock do article = Ticket::Article.create!( - ticket_id: ticket_p.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket_p.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_last_owner_update_test.rb b/test/unit/ticket_last_owner_update_test.rb index 39eac16ec..31f516c88 100644 --- a/test/unit/ticket_last_owner_update_test.rb +++ b/test/unit/ticket_last_owner_update_test.rb @@ -4,22 +4,22 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase setup do group = Group.create_or_update( - name: 'LastOwnerUpdate', - email_address: EmailAddress.first, + name: 'LastOwnerUpdate', + email_address: EmailAddress.first, assignment_timeout: 60, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) roles = Role.where(name: 'Agent') @agent1 = User.create_or_update( - login: 'ticket-assignment_timeout-agent1@example.com', - firstname: 'Overview', - lastname: 'Agent1', - email: 'ticket-assignment_timeout-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: Group.all, + login: 'ticket-assignment_timeout-agent1@example.com', + firstname: 'Overview', + lastname: 'Agent1', + email: 'ticket-assignment_timeout-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: Group.all, updated_by_id: 1, created_by_id: 1, ) @@ -28,11 +28,11 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase test 'last_owner_update_at check by state' do ticket = Ticket.create!( - title: 'assignment_timeout test by state 1', - group: Group.lookup(name: 'LastOwnerUpdate'), - owner: @agent1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), + title: 'assignment_timeout test by state 1', + group: Group.lookup(name: 'LastOwnerUpdate'), + owner: @agent1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), updated_by_id: 1, created_by_id: 1, ) @@ -43,11 +43,11 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase assert_nil(ticket.last_owner_update_at) ticket = Ticket.create!( - title: 'assignment_timeout test by state 1', - group: Group.lookup(name: 'LastOwnerUpdate'), - owner: @agent1, - customer_id: 2, - state: Ticket::State.lookup(name: 'pending reminder'), + title: 'assignment_timeout test by state 1', + group: Group.lookup(name: 'LastOwnerUpdate'), + owner: @agent1, + customer_id: 2, + state: Ticket::State.lookup(name: 'pending reminder'), updated_by_id: 1, created_by_id: 1, ) @@ -63,11 +63,11 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase test 'last_owner_update_at check with agent reply' do ticket = Ticket.create!( - title: 'assignment_timeout test by state 1', - group: Group.lookup(name: 'LastOwnerUpdate'), - owner: @agent1, - customer_id: 2, - state: Ticket::State.lookup(name: 'open'), + title: 'assignment_timeout test by state 1', + group: Group.lookup(name: 'LastOwnerUpdate'), + owner: @agent1, + customer_id: 2, + state: Ticket::State.lookup(name: 'open'), updated_by_id: 1, created_by_id: 1, ) @@ -76,15 +76,15 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase travel 1.hour article1 = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message reply by customer email', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message reply by customer email', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 2, created_by_id: 2, ) @@ -97,15 +97,15 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase travel 1.hour article2 = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message reply by agent email', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message reply by agent email', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: @agent1.id, created_by_id: @agent1.id, ) @@ -120,10 +120,10 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase test 'last_owner_update_at check' do ticket = Ticket.create!( - title: 'assignment_timeout test 1', - group: Group.lookup(name: 'LastOwnerUpdate'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), + title: 'assignment_timeout test 1', + group: Group.lookup(name: 'LastOwnerUpdate'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), updated_by_id: 1, created_by_id: 1, ) @@ -136,10 +136,10 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase assert_in_delta(ticket.last_owner_update_at.to_i, ticket.updated_at.to_i, 1) ticket = Ticket.create!( - title: 'assignment_timeout test 1', - group: Group.lookup(name: 'LastOwnerUpdate'), - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), + title: 'assignment_timeout test 1', + group: Group.lookup(name: 'LastOwnerUpdate'), + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), updated_by_id: 1, created_by_id: 1, ) @@ -152,11 +152,11 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase assert_in_delta(ticket.last_owner_update_at.to_i, ticket.updated_at.to_i, 1) ticket = Ticket.create!( - title: 'assignment_timeout test 1', - group: Group.lookup(name: 'LastOwnerUpdate'), - owner: @agent1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), + title: 'assignment_timeout test 1', + group: Group.lookup(name: 'LastOwnerUpdate'), + owner: @agent1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), updated_by_id: 1, created_by_id: 1, ) @@ -168,11 +168,11 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase assert_nil(ticket.last_owner_update_at) ticket = Ticket.create!( - title: 'assignment_timeout test 1', - group: Group.lookup(name: 'LastOwnerUpdate'), - owner: @agent1, - customer_id: 2, - state: Ticket::State.lookup(name: 'open'), + title: 'assignment_timeout test 1', + group: Group.lookup(name: 'LastOwnerUpdate'), + owner: @agent1, + customer_id: 2, + state: Ticket::State.lookup(name: 'open'), updated_by_id: 1, created_by_id: 1, ) @@ -183,10 +183,10 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase assert_nil(ticket.last_owner_update_at) ticket = Ticket.create!( - title: 'assignment_timeout test 2', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), + title: 'assignment_timeout test 2', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), updated_by_id: 1, created_by_id: 1, ) @@ -199,10 +199,10 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase assert_in_delta(ticket.last_owner_update_at.to_i, ticket.updated_at.to_i, 1) ticket = Ticket.create!( - title: 'assignment_timeout test 2', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), + title: 'assignment_timeout test 2', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), updated_by_id: 1, created_by_id: 1, ) @@ -215,11 +215,11 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase assert_in_delta(ticket.last_owner_update_at.to_i, ticket.updated_at.to_i, 1) ticket = Ticket.create!( - title: 'assignment_timeout test 2', - group: Group.lookup(name: 'LastOwnerUpdate'), - owner: @agent1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), + title: 'assignment_timeout test 2', + group: Group.lookup(name: 'LastOwnerUpdate'), + owner: @agent1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), updated_by_id: 1, created_by_id: 1, ) @@ -231,11 +231,11 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase assert_nil(ticket.last_owner_update_at) ticket = Ticket.create!( - title: 'assignment_timeout test 2', - group: Group.lookup(name: 'Users'), - owner: @agent1, - customer_id: 2, - state: Ticket::State.lookup(name: 'closed'), + title: 'assignment_timeout test 2', + group: Group.lookup(name: 'Users'), + owner: @agent1, + customer_id: 2, + state: Ticket::State.lookup(name: 'closed'), updated_by_id: 1, created_by_id: 1, ) @@ -250,21 +250,21 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase test 'last_owner_update_at assignment_timeout check' do ticket1 = Ticket.create!( - title: 'assignment_timeout test 1', - group: Group.lookup(name: 'LastOwnerUpdate'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), + title: 'assignment_timeout test 1', + group: Group.lookup(name: 'LastOwnerUpdate'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), updated_by_id: 1, created_by_id: 1, ) assert_nil(ticket1.last_owner_update_at) ticket2 = Ticket.create!( - title: 'assignment_timeout test 2', - group: Group.lookup(name: 'LastOwnerUpdate'), - owner: @agent1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), + title: 'assignment_timeout test 2', + group: Group.lookup(name: 'LastOwnerUpdate'), + owner: @agent1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), updated_by_id: 1, created_by_id: 1, ) @@ -272,11 +272,11 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase assert_in_delta(ticket2.last_owner_update_at.to_i, ticket2.updated_at.to_i, 1) ticket3 = Ticket.create!( - title: 'assignment_timeout test 3', - group: Group.lookup(name: 'LastOwnerUpdate'), - owner: @agent1, - customer_id: 2, - state: Ticket::State.lookup(name: 'open'), + title: 'assignment_timeout test 3', + group: Group.lookup(name: 'LastOwnerUpdate'), + owner: @agent1, + customer_id: 2, + state: Ticket::State.lookup(name: 'open'), updated_by_id: 1, created_by_id: 1, ) @@ -284,21 +284,21 @@ class TicketLastOwnerUpdateTest < ActiveSupport::TestCase assert_in_delta(ticket3.last_owner_update_at.to_i, ticket3.updated_at.to_i, 1) ticket4 = Ticket.create!( - title: 'assignment_timeout test 4', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), + title: 'assignment_timeout test 4', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), updated_by_id: 1, created_by_id: 1, ) assert_nil(ticket4.last_owner_update_at) ticket5 = Ticket.create!( - title: 'assignment_timeout test 5', - group: Group.lookup(name: 'LastOwnerUpdate'), - owner: @agent1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), + title: 'assignment_timeout test 5', + group: Group.lookup(name: 'LastOwnerUpdate'), + owner: @agent1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_notification_test.rb b/test/unit/ticket_notification_test.rb index 40acc85b7..f1e965127 100644 --- a/test/unit/ticket_notification_test.rb +++ b/test/unit/ticket_notification_test.rb @@ -3,29 +3,29 @@ require 'test_helper' class TicketNotificationTest < ActiveSupport::TestCase setup do Trigger.create_or_update( - name: 'auto reply - new ticket', - condition: { - 'ticket.action' => { + name: 'auto reply - new ticket', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is not', - 'value' => Ticket::State.lookup(name: 'closed').id, + 'value' => Ticket::State.lookup(name: 'closed').id, }, 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, - perform: { + perform: { 'notification.email' => { # rubocop:disable Lint/InterpolationCheck - 'body' => '

Your request (Ticket##{ticket.number}) has been received and will be reviewed by our support staff.

+ 'body' => '

Your request (Ticket##{ticket.number}) has been received and will be reviewed by our support staff.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -33,91 +33,91 @@ class TicketNotificationTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})', + 'subject' => 'Thanks for your inquiry (#{ticket.title})', # rubocop:enable Lint/InterpolationCheck }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # create @agent1 & @agent2 Group.create_or_update( - name: 'TicketNotificationTest', + name: 'TicketNotificationTest', updated_by_id: 1, created_by_id: 1 ) groups = Group.where(name: 'TicketNotificationTest') roles = Role.where(name: 'Agent') @agent1 = User.create_or_update( - login: 'ticket-notification-agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'ticket-notification-agent1@example.com', - password: 'agentpw', + login: 'ticket-notification-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'ticket-notification-agent1@example.com', + password: 'agentpw', out_of_office: false, - active: true, - roles: roles, - groups: groups, - preferences: { + active: true, + roles: roles, + groups: groups, + preferences: { locale: 'de-de', }, updated_by_id: 1, created_by_id: 1, ) @agent2 = User.create_or_update( - login: 'ticket-notification-agent2@example.com', - firstname: 'Notification', - lastname: 'Agent2', - email: 'ticket-notification-agent2@example.com', - password: 'agentpw', + login: 'ticket-notification-agent2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'ticket-notification-agent2@example.com', + password: 'agentpw', out_of_office: false, - active: true, - roles: roles, - groups: groups, - preferences: { + active: true, + roles: roles, + groups: groups, + preferences: { locale: 'en-ca', }, updated_by_id: 1, created_by_id: 1, ) @agent3 = User.create_or_update( - login: 'ticket-notification-agent3@example.com', - firstname: 'Notification', - lastname: 'Agent3', - email: 'ticket-notification-agent3@example.com', - password: 'agentpw', + login: 'ticket-notification-agent3@example.com', + firstname: 'Notification', + lastname: 'Agent3', + email: 'ticket-notification-agent3@example.com', + password: 'agentpw', out_of_office: false, - active: true, - roles: roles, - groups: groups, - preferences: { + active: true, + roles: roles, + groups: groups, + preferences: { locale: 'de-de', }, updated_by_id: 1, created_by_id: 1, ) @agent4 = User.create_or_update( - login: 'ticket-notification-agent4@example.com', - firstname: 'Notification', - lastname: 'Agent4', - email: 'ticket-notification-agent4@example.com', - password: 'agentpw', + login: 'ticket-notification-agent4@example.com', + firstname: 'Notification', + lastname: 'Agent4', + email: 'ticket-notification-agent4@example.com', + password: 'agentpw', out_of_office: false, - active: true, - roles: roles, - groups: groups, - preferences: { + active: true, + roles: roles, + groups: groups, + preferences: { locale: 'de-de', }, updated_by_id: 1, created_by_id: 1, ) Group.create_if_not_exists( - name: 'WithoutAccess', - note: 'Test for notification check.', + name: 'WithoutAccess', + note: 'Test for notification check.', updated_by_id: 1, created_by_id: 1 ) @@ -125,14 +125,14 @@ class TicketNotificationTest < ActiveSupport::TestCase # create @customer roles = Role.where(name: 'Customer') @customer = User.create_or_update( - login: 'ticket-notification-customer@example.com', - firstname: 'Notification', - lastname: 'Customer', - email: 'ticket-notification-customer@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'ticket-notification-customer@example.com', + firstname: 'Notification', + lastname: 'Customer', + email: 'ticket-notification-customer@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) @@ -143,24 +143,24 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ApplicationHandleInfo.current = 'scheduler.postmaster' ticket1 = Ticket.create!( - title: 'some notification test 1', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test 1', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @agent1.id, created_by_id: @agent1.id, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @agent1.id, created_by_id: @agent1.id, ) @@ -177,24 +177,24 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ApplicationHandleInfo.current = 'application_server' ticket1 = Ticket.create!( - title: 'some notification test 2', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test 2', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @agent1.id, created_by_id: @agent1.id, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @agent1.id, created_by_id: @agent1.id, ) @@ -214,24 +214,24 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ApplicationHandleInfo.current = 'application_server' ticket1 = Ticket.create!( - title: 'some notification test 3', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test 3', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -260,13 +260,13 @@ class TicketNotificationTest < ActiveSupport::TestCase # add article to ticket Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some person', - subject: 'some note', - body: 'some message', - internal: true, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'note').first, + ticket_id: ticket1.id, + from: 'some person', + subject: 'some note', + body: 'some message', + internal: true, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'note').first, updated_by_id: @agent1.id, created_by_id: @agent1.id, ) @@ -284,13 +284,13 @@ class TicketNotificationTest < ActiveSupport::TestCase ticket1.updated_by_id = @agent1.id ticket1.save! Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some person', - subject: 'some note', - body: 'some message', - internal: true, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'note').first, + ticket_id: ticket1.id, + from: 'some person', + subject: 'some note', + body: 'some message', + internal: true, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'note').first, updated_by_id: @agent1.id, created_by_id: @agent1.id, ) @@ -305,25 +305,25 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket with @agent1 as owner ticket2 = Ticket.create!( - title: 'some notification test 4', - group: Group.lookup(name: 'TicketNotificationTest'), - customer_id: 2, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test 4', + group: Group.lookup(name: 'TicketNotificationTest'), + customer_id: 2, + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @agent1.id, created_by_id: @agent1.id, ) Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'phone').first, + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'phone').first, updated_by_id: @agent1.id, created_by_id: @agent1.id, ) @@ -367,25 +367,25 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket with @agent2 and @agent1 as owner ticket3 = Ticket.create!( - title: 'some notification test 5', - group: Group.lookup(name: 'TicketNotificationTest'), - customer_id: 2, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test 5', + group: Group.lookup(name: 'TicketNotificationTest'), + customer_id: 2, + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @agent2.id, created_by_id: @agent2.id, ) article_inbound = Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'phone').first, + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'phone').first, updated_by_id: @agent2.id, created_by_id: @agent2.id, ) @@ -454,24 +454,24 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ticket1 = Ticket.create!( - title: 'some notification test 1 - no notification', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test 1 - no notification', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -508,24 +508,24 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ApplicationHandleInfo.current = 'scheduler.postmaster' ticket1 = Ticket.create!( - title: 'some notification test - z preferences tests 1', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test - z preferences tests 1', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -553,25 +553,25 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ticket2 = Ticket.create!( - title: 'some notification test - z preferences tests 2', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - owner: @agent1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test - z preferences tests 2', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + owner: @agent1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -599,25 +599,25 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ticket3 = Ticket.create!( - title: 'some notification test - z preferences tests 3', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - owner: @agent2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test - z preferences tests 3', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + owner: @agent2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -664,24 +664,24 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ApplicationHandleInfo.current = 'scheduler.postmaster' ticket4 = Ticket.create!( - title: 'some notification test - z preferences tests 4', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test - z preferences tests 4', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket4.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket4.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -728,24 +728,24 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ApplicationHandleInfo.current = 'scheduler.postmaster' ticket5 = Ticket.create!( - title: 'some notification test - z preferences tests 5', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test - z preferences tests 5', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket5.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket5.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -792,25 +792,25 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ApplicationHandleInfo.current = 'scheduler.postmaster' ticket6 = Ticket.create!( - title: 'some notification test - z preferences tests 6', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - owner: @agent1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test - z preferences tests 6', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + owner: @agent1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket6.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket6.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -869,25 +869,25 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ApplicationHandleInfo.current = 'scheduler.postmaster' ticket7 = Ticket.create!( - title: 'some notification test - z preferences tests 7', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - owner: @agent1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification test - z preferences tests 7', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + owner: @agent1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket7.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket7.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -923,24 +923,24 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ticket1 = Ticket.create!( - title: 'some notification event test 1', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification event test 1', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -983,25 +983,25 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ticket1 = Ticket.create!( - title: 'some notification test out of office', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - owner_id: @agent2.id, + title: 'some notification test out of office', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + owner_id: @agent2.id, #state: Ticket::State.lookup(name: 'new'), #priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -1026,25 +1026,25 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ticket2 = Ticket.create!( - title: 'some notification test out of office', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - owner_id: @agent2.id, + title: 'some notification test out of office', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + owner_id: @agent2.id, #state: Ticket::State.lookup(name: 'new'), #priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) @@ -1103,38 +1103,38 @@ class TicketNotificationTest < ActiveSupport::TestCase # create ticket in group ticket1 = Ticket.create!( - title: 'some notification template test 1 Bobs\'s resumé', - group: Group.lookup(name: 'TicketNotificationTest'), - customer: @customer, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some notification template test 1 Bobs\'s resumé', + group: Group.lookup(name: 'TicketNotificationTest'), + customer: @customer, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: @customer.id, created_by_id: @customer.id, ) article = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message\nnewline1 abc\nnewline2", - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message\nnewline1 abc\nnewline2", + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: @customer.id, created_by_id: @customer.id, ) assert(ticket1, 'ticket created - ticket notification template') bg = Transaction::Notification.new( - ticket_id: ticket1.id, + ticket_id: ticket1.id, article_id: article.id, - type: 'update', - changes: { + type: 'update', + changes: { 'priority_id' => [1, 2], 'pending_time' => [nil, Time.zone.parse('2015-01-11 23:33:47 UTC')], }, - user_id: ticket1.updated_by_id, + user_id: ticket1.updated_by_id, ) # check changed attributes @@ -1151,13 +1151,13 @@ class TicketNotificationTest < ActiveSupport::TestCase # en notification result = NotificationFactory::Mailer.template( - locale: @agent2.preferences[:locale], + locale: @agent2.preferences[:locale], template: 'ticket_update', - objects: { - ticket: ticket1, - article: article, + objects: { + ticket: ticket1, + article: article, recipient: @agent2, - changes: human_changes, + changes: human_changes, }, ) assert_match(/Bobs's resumé/, result[:subject]) @@ -1183,13 +1183,13 @@ class TicketNotificationTest < ActiveSupport::TestCase # de notification result = NotificationFactory::Mailer.template( - locale: @agent1.preferences[:locale], + locale: @agent1.preferences[:locale], template: 'ticket_update', - objects: { - ticket: ticket1, - article: article, + objects: { + ticket: ticket1, + article: article, recipient: @agent1, - changes: human_changes, + changes: human_changes, }, ) @@ -1204,14 +1204,14 @@ class TicketNotificationTest < ActiveSupport::TestCase assert_no_match(/i18n/, result[:body]) bg = Transaction::Notification.new( - ticket_id: ticket1.id, + ticket_id: ticket1.id, article_id: article.id, - type: 'update', - changes: { - title: ['some notification template test old 1', 'some notification template test 1 #2'], + type: 'update', + changes: { + title: ['some notification template test old 1', 'some notification template test 1 #2'], priority_id: [2, 3], }, - user_id: @customer.id, + user_id: @customer.id, ) # check changed attributes @@ -1228,13 +1228,13 @@ class TicketNotificationTest < ActiveSupport::TestCase # de notification result = NotificationFactory::Mailer.template( - locale: @agent1.preferences[:locale], + locale: @agent1.preferences[:locale], template: 'ticket_update', - objects: { - ticket: ticket1, - article: article, + objects: { + ticket: ticket1, + article: article, recipient: @agent1, - changes: human_changes, + changes: human_changes, } ) @@ -1253,13 +1253,13 @@ class TicketNotificationTest < ActiveSupport::TestCase # en notification result = NotificationFactory::Mailer.template( - locale: @agent2.preferences[:locale], + locale: @agent2.preferences[:locale], template: 'ticket_update', - objects: { - ticket: ticket1, - article: article, + objects: { + ticket: ticket1, + article: article, recipient: @agent2, - changes: human_changes, + changes: human_changes, } ) diff --git a/test/unit/ticket_null_byte_test.rb b/test/unit/ticket_null_byte_test.rb index a6a6e78db..df9e91f4b 100644 --- a/test/unit/ticket_null_byte_test.rb +++ b/test/unit/ticket_null_byte_test.rb @@ -3,24 +3,24 @@ require 'test_helper' class TicketNullByteTest < ActiveSupport::TestCase test 'null byte test' do ticket1 = Ticket.create!( - title: "some title \u0000 123", - group: Group.lookup(name: 'Users'), - customer_id: 2, + title: "some title \u0000 123", + group: Group.lookup(name: 'Users'), + customer_id: 2, updated_by_id: 1, created_by_id: 1, ) assert(ticket1, 'ticket created') article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_customer_com-1@example.com', - to: 'some_zammad_com-1@example.com', - subject: "com test 1\u0000", - message_id: 'some@id_com_1', - body: "some\u0000message 123", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_customer_com-1@example.com', + to: 'some_zammad_com-1@example.com', + subject: "com test 1\u0000", + message_id: 'some@id_com_1', + body: "some\u0000message 123", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_number_test.rb b/test/unit/ticket_number_test.rb index a656a4d67..d97cca3f0 100644 --- a/test/unit/ticket_number_test.rb +++ b/test/unit/ticket_number_test.rb @@ -63,11 +63,11 @@ class TicketNumberTest < ActiveSupport::TestCase Setting.set('system_id', 1) ticket = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -139,11 +139,11 @@ class TicketNumberTest < ActiveSupport::TestCase Setting.set('system_id', 1) ticket = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_overview_out_of_office_test.rb b/test/unit/ticket_overview_out_of_office_test.rb index a3272e64b..765b46f01 100644 --- a/test/unit/ticket_overview_out_of_office_test.rb +++ b/test/unit/ticket_overview_out_of_office_test.rb @@ -4,144 +4,144 @@ class TicketOverviewOutOfOfficeTest < ActiveSupport::TestCase setup do group = Group.create_or_update( - name: 'OverviewReplacementTest', - updated_at: '2015-02-05 16:37:00', + name: 'OverviewReplacementTest', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Agent') @agent1 = User.create_or_update( - login: 'ticket-overview-agent1@example.com', - firstname: 'Overview', - lastname: 'Agent1', - email: 'ticket-overview-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: [group], + login: 'ticket-overview-agent1@example.com', + firstname: 'Overview', + lastname: 'Agent1', + email: 'ticket-overview-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: [group], out_of_office: false, - updated_at: '2015-02-05 16:37:00', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) @agent2 = User.create_or_update( - login: 'ticket-overview-agent2@example.com', - firstname: 'Overview', - lastname: 'Agent2', - email: 'ticket-overview-agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: [group], + login: 'ticket-overview-agent2@example.com', + firstname: 'Overview', + lastname: 'Agent2', + email: 'ticket-overview-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: [group], out_of_office: false, - updated_at: '2015-02-05 16:38:00', + updated_at: '2015-02-05 16:38:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') organization1 = Organization.create_or_update( - name: 'Overview Org', - updated_at: '2015-02-05 16:37:00', + name: 'Overview Org', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) @customer1 = User.create_or_update( - login: 'ticket-overview-customer1@example.com', - firstname: 'Overview', - lastname: 'Customer1', - email: 'ticket-overview-customer1@example.com', - password: 'customerpw', - active: true, + login: 'ticket-overview-customer1@example.com', + firstname: 'Overview', + lastname: 'Customer1', + email: 'ticket-overview-customer1@example.com', + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - out_of_office: false, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + out_of_office: false, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) Overview.destroy_all UserInfo.current_user_id = 1 overview_role = Role.find_by(name: 'Agent') @overview1 = Overview.create_or_update( - name: 'My replacement Tickets', - link: 'my_replacement', - prio: 1000, - role_ids: [overview_role.id], + name: 'My replacement Tickets', + link: 'my_replacement', + prio: 1000, + role_ids: [overview_role.id], out_of_office: true, - condition: { - 'ticket.state_id' => { + condition: { + 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:open).pluck(:id), + value: Ticket::State.by_category(:open).pluck(:id), }, 'ticket.out_of_office_replacement_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) @overview2 = Overview.create_if_not_exists( - name: 'My assigned Tickets', - link: 'my_assigned', - prio: 900, - role_ids: [overview_role.id], + name: 'My assigned Tickets', + link: 'my_assigned', + prio: 900, + role_ids: [overview_role.id], condition: { 'ticket.state_id' => { operator: 'is', - value: Ticket::State.by_category(:open).pluck(:id), + value: Ticket::State.by_category(:open).pluck(:id), }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) overview_role = Role.find_by(name: 'Customer') @overview3 = Overview.create_or_update( - name: 'My Tickets', - link: 'my_tickets', - prio: 1100, - role_ids: [overview_role.id], + name: 'My Tickets', + link: 'my_tickets', + prio: 1100, + role_ids: [overview_role.id], out_of_office: true, - condition: { - 'ticket.state_id' => { + condition: { + 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3, 4, 6, 7], + value: [1, 2, 3, 4, 6, 7], }, 'ticket.out_of_office_replacement_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.organization_id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title state created_at], - m: %w[number title state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title state created_at], + m: %w[number title state created_at], view_mode_default: 's', }, ) @@ -258,25 +258,25 @@ class TicketOverviewOutOfOfficeTest < ActiveSupport::TestCase assert(result[0][:tickets].blank?) ticket1 = Ticket.create!( - title: 'overview test 1', - group: Group.lookup(name: 'OverviewReplacementTest'), - customer_id: 2, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'overview test 1', + group: Group.lookup(name: 'OverviewReplacementTest'), + customer_id: 2, + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message... 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message... 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_overview_test.rb b/test/unit/ticket_overview_test.rb index f45a22935..87dd7a2cc 100644 --- a/test/unit/ticket_overview_test.rb +++ b/test/unit/ticket_overview_test.rb @@ -4,298 +4,298 @@ class TicketOverviewTest < ActiveSupport::TestCase setup do group = Group.create_or_update( - name: 'OverviewTest', - updated_at: '2015-02-05 16:37:00', + name: 'OverviewTest', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Agent') @agent1 = User.create_or_update( - login: 'ticket-overview-agent1@example.com', - firstname: 'Overview', - lastname: 'Agent1', - email: 'ticket-overview-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: [group], - updated_at: '2015-02-05 16:37:00', + login: 'ticket-overview-agent1@example.com', + firstname: 'Overview', + lastname: 'Agent1', + email: 'ticket-overview-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: [group], + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) @agent2 = User.create_or_update( - login: 'ticket-overview-agent2@example.com', - firstname: 'Overview', - lastname: 'Agent2', - email: 'ticket-overview-agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, + login: 'ticket-overview-agent2@example.com', + firstname: 'Overview', + lastname: 'Agent2', + email: 'ticket-overview-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, #groups: groups, - updated_at: '2015-02-05 16:38:00', + updated_at: '2015-02-05 16:38:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') organization1 = Organization.create_or_update( - name: 'Overview Org', - updated_at: '2015-02-05 16:37:00', + name: 'Overview Org', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) @customer1 = User.create_or_update( - login: 'ticket-overview-customer1@example.com', - firstname: 'Overview', - lastname: 'Customer1', - email: 'ticket-overview-customer1@example.com', - password: 'customerpw', - active: true, + login: 'ticket-overview-customer1@example.com', + firstname: 'Overview', + lastname: 'Customer1', + email: 'ticket-overview-customer1@example.com', + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) @customer2 = User.create_or_update( - login: 'ticket-overview-customer2@example.com', - firstname: 'Overview', - lastname: 'Customer2', - email: 'ticket-overview-customer2@example.com', - password: 'customerpw', - active: true, + login: 'ticket-overview-customer2@example.com', + firstname: 'Overview', + lastname: 'Customer2', + email: 'ticket-overview-customer2@example.com', + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) @customer3 = User.create_or_update( - login: 'ticket-overview-customer3@example.com', - firstname: 'Overview', - lastname: 'Customer3', - email: 'ticket-overview-customer3@example.com', - password: 'customerpw', - active: true, + login: 'ticket-overview-customer3@example.com', + firstname: 'Overview', + lastname: 'Customer3', + email: 'ticket-overview-customer3@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) Overview.destroy_all UserInfo.current_user_id = 1 overview_role = Role.find_by(name: 'Agent') @overview1 = Overview.create_or_update( - name: 'My assigned Tickets', - link: 'my_assigned', - prio: 1000, - role_ids: [overview_role.id], + name: 'My assigned Tickets', + link: 'my_assigned', + prio: 1000, + role_ids: [overview_role.id], condition: { 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3, 7], + value: [1, 2, 3, 7], }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) @overview2 = Overview.create_or_update( - name: 'Unassigned & Open', - link: 'all_unassigned', - prio: 1010, - role_ids: [overview_role.id], + name: 'Unassigned & Open', + link: 'all_unassigned', + prio: 1010, + role_ids: [overview_role.id], condition: { 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3], + value: [1, 2, 3], }, 'ticket.owner_id' => { operator: 'is', - value: 1, + value: 1, }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) @overview3 = Overview.create_or_update( - name: 'My Tickets 2', - link: 'my_tickets_2', - prio: 1020, - role_ids: [overview_role.id], - user_ids: [@agent2.id], + name: 'My Tickets 2', + link: 'my_tickets_2', + prio: 1020, + role_ids: [overview_role.id], + user_ids: [@agent2.id], condition: { 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3, 7], + value: [1, 2, 3, 7], }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) @overview4 = Overview.create_or_update( - name: 'My Tickets only with Note', - link: 'my_tickets_onyl_with_note', - prio: 1030, - role_ids: [overview_role.id], - user_ids: [@agent1.id], + name: 'My Tickets only with Note', + link: 'my_tickets_onyl_with_note', + prio: 1030, + role_ids: [overview_role.id], + user_ids: [@agent1.id], condition: { 'article.type_id' => { operator: 'is', - value: Ticket::Article::Type.find_by(name: 'note').id, + value: Ticket::Article::Type.find_by(name: 'note').id, }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) overview_role = Role.find_by(name: 'Customer') @overview5 = Overview.create_or_update( - name: 'My Tickets', - link: 'my_tickets', - prio: 1100, - role_ids: [overview_role.id], + name: 'My Tickets', + link: 'my_tickets', + prio: 1100, + role_ids: [overview_role.id], condition: { - 'ticket.state_id' => { + 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3, 4, 6, 7], + value: [1, 2, 3, 4, 6, 7], }, 'ticket.customer_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title state created_at], - m: %w[number title state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title state created_at], + m: %w[number title state created_at], view_mode_default: 's', }, ) @overview6 = Overview.create_or_update( - name: 'My Organization Tickets', - link: 'my_organization_tickets', - prio: 1200, - role_ids: [overview_role.id], + name: 'My Organization Tickets', + link: 'my_organization_tickets', + prio: 1200, + role_ids: [overview_role.id], organization_shared: true, - condition: { - 'ticket.state_id' => { + condition: { + 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3, 4, 6, 7], + value: [1, 2, 3, 4, 6, 7], }, 'ticket.organization_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.organization_id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, ) @overview7 = Overview.create_or_update( - name: 'My Organization Tickets (open)', - link: 'my_organization_tickets_open', - prio: 1200, - role_ids: [overview_role.id], - user_ids: [@customer2.id], + name: 'My Organization Tickets (open)', + link: 'my_organization_tickets_open', + prio: 1200, + role_ids: [overview_role.id], + user_ids: [@customer2.id], organization_shared: true, - condition: { - 'ticket.state_id' => { + condition: { + 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3], + value: [1, 2, 3], }, 'ticket.organization_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.organization_id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, ) overview_role = Role.find_by(name: 'Admin') @overview8 = Overview.create_or_update( - name: 'Not Shown Admin', - link: 'not_shown_admin', - prio: 9900, - role_ids: [overview_role.id], + name: 'Not Shown Admin', + link: 'not_shown_admin', + prio: 9900, + role_ids: [overview_role.id], condition: { 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3], + value: [1, 2, 3], }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, ) @@ -348,29 +348,29 @@ class TicketOverviewTest < ActiveSupport::TestCase assert_raises(Exception) do Overview.create!( - name: 'new overview', - link: 'new_overview', - prio: 1200, - user_ids: [@customer2.id], + name: 'new overview', + link: 'new_overview', + prio: 1200, + user_ids: [@customer2.id], organization_shared: true, - condition: { - 'ticket.state_id' => { + condition: { + 'ticket.state_id' => { operator: 'is', - value: [1, 2, 3], + value: [1, 2, 3], }, 'ticket.organization_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.organization_id', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'DESC', }, - view: { - d: %w[title customer state created_at], - s: %w[number title customer state created_at], - m: %w[number title customer state created_at], + view: { + d: %w[title customer state created_at], + s: %w[number title customer state created_at], + m: %w[number title customer state created_at], view_mode_default: 's', }, ) @@ -416,24 +416,24 @@ class TicketOverviewTest < ActiveSupport::TestCase assert(result[2][:tickets].blank?) ticket1 = Ticket.create!( - title: 'overview test 1', - group: Group.lookup(name: 'OverviewTest'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'overview test 1', + group: Group.lookup(name: 'OverviewTest'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message... 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message... 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -474,24 +474,24 @@ class TicketOverviewTest < ActiveSupport::TestCase travel 1.second # because of mysql millitime issues ticket2 = Ticket.create!( - title: 'overview test 2', - group: Group.lookup(name: 'OverviewTest'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '3 high'), + title: 'overview test 2', + group: Group.lookup(name: 'OverviewTest'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '3 high'), updated_by_id: 1, created_by_id: 1, ) article2 = Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message... 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message... 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -571,24 +571,24 @@ class TicketOverviewTest < ActiveSupport::TestCase travel 1.second # because of mysql millitime issues ticket3 = Ticket.create!( - title: 'overview test 3', - group: Group.lookup(name: 'OverviewTest'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '1 low'), + title: 'overview test 3', + group: Group.lookup(name: 'OverviewTest'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '1 low'), updated_by_id: 1, created_by_id: 1, ) article3 = Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message... 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message... 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -637,7 +637,7 @@ class TicketOverviewTest < ActiveSupport::TestCase assert(result[2][:tickets].blank?) @overview2.order = { - by: 'created_at', + by: 'created_at', direction: 'DESC', } @overview2.save! @@ -685,7 +685,7 @@ class TicketOverviewTest < ActiveSupport::TestCase assert(result[2][:tickets].blank?) @overview2.order = { - by: 'priority_id', + by: 'priority_id', direction: 'DESC', } @overview2.save! @@ -733,7 +733,7 @@ class TicketOverviewTest < ActiveSupport::TestCase assert(result[2][:tickets].blank?) @overview2.order = { - by: 'priority_id', + by: 'priority_id', direction: 'ASC', } @overview2.save! @@ -781,7 +781,7 @@ class TicketOverviewTest < ActiveSupport::TestCase assert(result[2][:tickets].blank?) @overview2.order = { - by: 'priority', + by: 'priority', direction: 'DESC', } @overview2.save! @@ -829,7 +829,7 @@ class TicketOverviewTest < ActiveSupport::TestCase assert(result[2][:tickets].blank?) @overview2.order = { - by: 'priority', + by: 'priority', direction: 'ASC', } @overview2.save! @@ -886,76 +886,76 @@ class TicketOverviewTest < ActiveSupport::TestCase UserInfo.current_user_id = 1 overview_role = Role.find_by(name: 'Agent') overview1 = Overview.create_or_update( - name: 'not owned', - prio: 1000, - role_ids: [overview_role.id], + name: 'not owned', + prio: 1000, + role_ids: [overview_role.id], condition: { 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'not_set', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) overview2 = Overview.create_or_update( - name: 'not owned by somebody', - prio: 2000, - role_ids: [overview_role.id], + name: 'not owned by somebody', + prio: 2000, + role_ids: [overview_role.id], condition: { 'ticket.owner_id' => { - operator: 'is not', + operator: 'is not', pre_condition: 'not_set', }, }, - order: { - by: 'created_at', + order: { + by: 'created_at', direction: 'ASC', }, - view: { - d: %w[title customer group created_at], - s: %w[title customer group created_at], - m: %w[number title customer group created_at], + view: { + d: %w[title customer group created_at], + s: %w[title customer group created_at], + m: %w[number title customer group created_at], view_mode_default: 's', }, ) ticket1 = Ticket.create!( - title: 'overview test 1', - group: Group.lookup(name: 'OverviewTest'), + title: 'overview test 1', + group: Group.lookup(name: 'OverviewTest'), customer_id: 2, - owner_id: 1, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + owner_id: 1, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), ) travel 2.seconds ticket2 = Ticket.create!( - title: 'overview test 2', - group: Group.lookup(name: 'OverviewTest'), + title: 'overview test 2', + group: Group.lookup(name: 'OverviewTest'), customer_id: 2, - owner_id: nil, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + owner_id: nil, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), ) travel 2.seconds ticket3 = Ticket.create!( - title: 'overview test 3', - group: Group.lookup(name: 'OverviewTest'), + title: 'overview test 3', + group: Group.lookup(name: 'OverviewTest'), customer_id: 2, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), ) result = Ticket::Overviews.index(@agent1) diff --git a/test/unit/ticket_owner_reset_on_follow_up_test.rb b/test/unit/ticket_owner_reset_on_follow_up_test.rb index 1c162c14d..df78e6d50 100644 --- a/test/unit/ticket_owner_reset_on_follow_up_test.rb +++ b/test/unit/ticket_owner_reset_on_follow_up_test.rb @@ -5,36 +5,36 @@ class TicketOwnerResetOnFollowUpTest < ActiveSupport::TestCase setup do UserInfo.current_user_id = 1 Group.create_or_update( - name: 'Disabled Group', - follow_up_possible: 'yes', + name: 'Disabled Group', + follow_up_possible: 'yes', follow_up_assignment: true, - active: false, + active: false, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') @agent1 = User.create_or_update( - login: 'ticket-customer-organization-update-agent1@example.com', + login: 'ticket-customer-organization-update-agent1@example.com', firstname: 'FollowUpCheck', - lastname: 'Agent1', - email: 'ticket-customer-organization-update-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + lastname: 'Agent1', + email: 'ticket-customer-organization-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) roles = Role.where(name: 'Customer') @organization1 = Organization.create_if_not_exists( name: 'Customer Organization Update', ) @customer1 = User.create_or_update( - login: 'ticket-customer-organization-update-customer1@example.com', - firstname: 'FollowUpCheck', - lastname: 'Customer1', - email: 'ticket-customer-organization-update-customer1@example.com', - password: 'customerpw', - active: true, + login: 'ticket-customer-organization-update-customer1@example.com', + firstname: 'FollowUpCheck', + lastname: 'Customer1', + email: 'ticket-customer-organization-update-customer1@example.com', + password: 'customerpw', + active: true, organization_id: @organization1.id, - roles: roles, + roles: roles, ) UserInfo.current_user_id = nil end @@ -42,10 +42,10 @@ class TicketOwnerResetOnFollowUpTest < ActiveSupport::TestCase test 'create ticket, update owner to user with disabled group' do ticket = Ticket.create!( - title: "some title1\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: @customer1.id, - owner_id: @agent1.id, + title: "some title1\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: @customer1.id, + owner_id: @agent1.id, updated_by_id: 1, created_by_id: 1, ) @@ -66,10 +66,10 @@ class TicketOwnerResetOnFollowUpTest < ActiveSupport::TestCase test 'create ticket, update owner to user which is inactive' do ticket = Ticket.create!( - title: "some title1\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: @customer1.id, - owner_id: @agent1.id, + title: "some title1\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: @customer1.id, + owner_id: @agent1.id, updated_by_id: 1, created_by_id: 1, ) @@ -90,10 +90,10 @@ class TicketOwnerResetOnFollowUpTest < ActiveSupport::TestCase test 'create ticket, update owner to user which active and is in active group' do ticket = Ticket.create!( - title: "some title1\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: @customer1.id, - owner_id: @agent1.id, + title: "some title1\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: @customer1.id, + owner_id: @agent1.id, updated_by_id: 1, created_by_id: 1, ) @@ -110,23 +110,23 @@ class TicketOwnerResetOnFollowUpTest < ActiveSupport::TestCase test 'check if ticket is unassigned on follow up via model if owner in a group is inactive' do ticket = Ticket.create!( - title: 'follow up check for invalid owner', - group: Group.lookup(name: 'Users'), - customer: @customer1, - owner: @agent1, - state: Ticket::State.lookup(name: 'closed'), + title: 'follow up check for invalid owner', + group: Group.lookup(name: 'Users'), + customer: @customer1, + owner: @agent1, + state: Ticket::State.lookup(name: 'closed'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'follow up check', - body: 'some message article', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'follow up check', + body: 'some message article', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -151,23 +151,23 @@ Some Text" test 'check if ticket is unassigned on follow up via email if current owner is inactive' do ticket = Ticket.create!( - title: 'follow up check for invalid owner', - group: Group.lookup(name: 'Users'), - customer: @customer1, - owner: @agent1, - state: Ticket::State.lookup(name: 'closed'), + title: 'follow up check for invalid owner', + group: Group.lookup(name: 'Users'), + customer: @customer1, + owner: @agent1, + state: Ticket::State.lookup(name: 'closed'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'follow up check', - body: 'some message article', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'follow up check', + body: 'some message article', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -191,23 +191,23 @@ Some Text" test 'check if ticket is unassigned on follow up via email if current owner is customer now' do ticket = Ticket.create!( - title: 'follow up check for invalid owner is customer now', - group: Group.lookup(name: 'Users'), - customer: @customer1, - owner: @agent1, - state: Ticket::State.lookup(name: 'closed'), + title: 'follow up check for invalid owner is customer now', + group: Group.lookup(name: 'Users'), + customer: @customer1, + owner: @agent1, + state: Ticket::State.lookup(name: 'closed'), updated_by_id: 1, created_by_id: 1, ) article = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'follow up check', - body: 'some message article', - internal: false, - sender: Ticket::Article::Sender.lookup(name: 'Agent'), - type: Ticket::Article::Type.lookup(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'follow up check', + body: 'some message article', + internal: false, + sender: Ticket::Article::Sender.lookup(name: 'Agent'), + type: Ticket::Article::Type.lookup(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_priority_test.rb b/test/unit/ticket_priority_test.rb index f3ab6d052..277b2d987 100644 --- a/test/unit/ticket_priority_test.rb +++ b/test/unit/ticket_priority_test.rb @@ -10,7 +10,7 @@ class TicketPriorityTest < ActiveSupport::TestCase # add new state priority_new2 = Ticket::Priority.create_if_not_exists( - name: 'priority 2', + name: 'priority 2', updated_by_id: 1, created_by_id: 1, ) @@ -28,10 +28,10 @@ class TicketPriorityTest < ActiveSupport::TestCase # add new state priority_new3 = Ticket::Priority.create_if_not_exists( - name: 'priority 3', + name: 'priority 3', default_create: true, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) # verify states diff --git a/test/unit/ticket_ref_object_touch_test.rb b/test/unit/ticket_ref_object_touch_test.rb index 472880861..c273a8870 100644 --- a/test/unit/ticket_ref_object_touch_test.rb +++ b/test/unit/ticket_ref_object_touch_test.rb @@ -6,62 +6,62 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') @agent1 = User.create_or_update( - login: 'ticket-ref-object-update-agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'ticket-ref-object-update-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'ticket-ref-object-update-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'ticket-ref-object-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') @organization1 = Organization.create_if_not_exists( - name: 'Ref Object Update Org', - updated_at: '2015-02-05 16:37:00', + name: 'Ref Object Update Org', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) @customer1 = User.create_or_update( - login: 'ticket-ref-object-update-customer1@example.com', - firstname: 'Notification', - lastname: 'Customer1', - email: 'ticket-ref-object-update-customer1@example.com', - password: 'customerpw', - active: true, + login: 'ticket-ref-object-update-customer1@example.com', + firstname: 'Notification', + lastname: 'Customer1', + email: 'ticket-ref-object-update-customer1@example.com', + password: 'customerpw', + active: true, organization_id: @organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) @customer2 = User.create_or_update( - login: 'ticket-ref-object-update-customer2@example.com', - firstname: 'Notification', - lastname: 'Customer2', - email: 'ticket-ref-object-update-customer2@example.com', - password: 'customerpw', - active: true, + login: 'ticket-ref-object-update-customer2@example.com', + firstname: 'Notification', + lastname: 'Customer2', + email: 'ticket-ref-object-update-customer2@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) end test 'b - check if customer and organization has been updated' do ticket = Ticket.create( - title: "some title1\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: @customer1.id, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "some title1\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: @customer1.id, + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -110,12 +110,12 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase travel 8.seconds ticket = Ticket.create( - title: "some title2\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: @customer2.id, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "some title2\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: @customer2.id, + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_screen_options_test.rb b/test/unit/ticket_screen_options_test.rb index 2533439b9..87aa32769 100644 --- a/test/unit/ticket_screen_options_test.rb +++ b/test/unit/ticket_screen_options_test.rb @@ -5,33 +5,33 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase test 'base' do group1 = Group.create!( - name: 'Group 1', - active: true, + name: 'Group 1', + active: true, email_address: EmailAddress.first, created_by_id: 1, updated_by_id: 1, ) group2 = Group.create!( - name: 'Group 2', - active: true, + name: 'Group 2', + active: true, created_by_id: 1, updated_by_id: 1, ) group3 = Group.create!( - name: 'Group 3', - active: true, + name: 'Group 3', + active: true, created_by_id: 1, updated_by_id: 1, ) agent1 = User.create!( - login: 'agent1@example.com', - firstname: 'Role', - lastname: 'Agent1', - email: 'agent1@example.com', - password: 'agentpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: 'agent1@example.com', + firstname: 'Role', + lastname: 'Agent1', + email: 'agent1@example.com', + password: 'agentpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -42,13 +42,13 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase } agent2 = User.create!( - login: 'agent2@example.com', - firstname: 'Role', - lastname: 'Agent2', - email: 'agent2@example.com', - password: 'agentpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: 'agent2@example.com', + firstname: 'Role', + lastname: 'Agent2', + email: 'agent2@example.com', + password: 'agentpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -59,13 +59,13 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase } agent3 = User.create!( - login: 'agent3@example.com', - firstname: 'Role', - lastname: 'Agent3', - email: 'agent3@example.com', - password: 'agentpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: 'agent3@example.com', + firstname: 'Role', + lastname: 'Agent3', + email: 'agent3@example.com', + password: 'agentpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -75,13 +75,13 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase } agent4 = User.create!( - login: 'agent4@example.com', - firstname: 'Role', - lastname: 'Agent4', - email: 'agent4@example.com', - password: 'agentpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: 'agent4@example.com', + firstname: 'Role', + lastname: 'Agent4', + email: 'agent4@example.com', + password: 'agentpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -91,13 +91,13 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase } agent5 = User.create!( - login: 'agent5@example.com', - firstname: 'Role', - lastname: 'Agent5', - email: 'agent5@example.com', - password: 'agentpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: 'agent5@example.com', + firstname: 'Role', + lastname: 'Agent5', + email: 'agent5@example.com', + password: 'agentpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -106,13 +106,13 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase } agent6 = User.create!( - login: 'agent6@example.com', - firstname: 'Role', - lastname: 'Agent6', - email: 'agent6@example.com', - password: 'agentpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: 'agent6@example.com', + firstname: 'Role', + lastname: 'Agent6', + email: 'agent6@example.com', + password: 'agentpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -239,53 +239,53 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase assert(result[:form_meta][:dependencies][:group_id][group2.id][:owner_id].include?(agent3.id)) ticket1 = Ticket.create!( - title: 'some title 1', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some title 1', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) ticket2 = Ticket.create!( - title: 'some title 2', - group: group2, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some title 2', + group: group2, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) article2 = Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) result = Ticket::ScreenOptions.attributes_to_change( - ticket_id: ticket1.id, + ticket_id: ticket1.id, current_user: agent1, ) @@ -337,7 +337,7 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase assert(result[:form_meta][:dependencies][:group_id][group3.id][:owner_id].include?(agent5.id)) result = Ticket::ScreenOptions.attributes_to_change( - ticket_id: ticket2.id, + ticket_id: ticket2.id, current_user: agent1, ) @@ -388,7 +388,7 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase assert(result[:form_meta][:dependencies][:group_id][group3.id][:owner_id].include?(agent5.id)) result = Ticket::ScreenOptions.attributes_to_change( - ticket_id: ticket2.id, + ticket_id: ticket2.id, current_user: agent1, ) @@ -439,7 +439,7 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase assert(result[:form_meta][:dependencies][:group_id][group3.id][:owner_id].include?(agent5.id)) result = Ticket::ScreenOptions.attributes_to_change( - ticket_id: ticket1.id, + ticket_id: ticket1.id, current_user: agent2, ) @@ -486,7 +486,7 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase assert(result[:form_meta][:dependencies][:group_id][group2.id][:owner_id].include?(agent3.id)) result = Ticket::ScreenOptions.attributes_to_change( - ticket_id: ticket2.id, + ticket_id: ticket2.id, current_user: agent2, ) @@ -532,7 +532,7 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase assert(result[:form_meta][:dependencies][:group_id][group2.id][:owner_id].include?(agent3.id)) result = Ticket::ScreenOptions.attributes_to_change( - ticket_id: ticket1.id, + ticket_id: ticket1.id, current_user: agent3, ) @@ -577,7 +577,7 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase assert(result[:form_meta][:dependencies][:group_id][group2.id][:owner_id].include?(agent3.id)) result = Ticket::ScreenOptions.attributes_to_change( - ticket_id: ticket2.id, + ticket_id: ticket2.id, current_user: agent3, ) diff --git a/test/unit/ticket_selector_test.rb b/test/unit/ticket_selector_test.rb index 2298f5fa0..4931d4f75 100644 --- a/test/unit/ticket_selector_test.rb +++ b/test/unit/ticket_selector_test.rb @@ -4,69 +4,69 @@ class TicketSelectorTest < ActiveSupport::TestCase setup do @group = Group.create_or_update( - name: 'SelectorTest', - updated_at: '2015-02-05 16:37:00', + name: 'SelectorTest', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Agent') @agent1 = User.create_or_update( - login: 'ticket-selector-agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'ticket-selector-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: [@group], - updated_at: '2015-02-05 16:37:00', + login: 'ticket-selector-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'ticket-selector-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: [@group], + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) @agent2 = User.create_or_update( - login: 'ticket-selector-agent2@example.com', - firstname: 'Notification', - lastname: 'Agent2', - email: 'ticket-selector-agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, - updated_at: '2015-02-05 16:38:00', + login: 'ticket-selector-agent2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'ticket-selector-agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + updated_at: '2015-02-05 16:38:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') @organization1 = Organization.create_if_not_exists( - name: 'Selector Org', - updated_at: '2015-02-05 16:37:00', + name: 'Selector Org', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) @customer1 = User.create_or_update( - login: 'ticket-selector-customer1@example.com', - firstname: 'Notification', - lastname: 'Customer1', - email: 'ticket-selector-customer1@example.com', - password: 'customerpw', - active: true, + login: 'ticket-selector-customer1@example.com', + firstname: 'Notification', + lastname: 'Customer1', + email: 'ticket-selector-customer1@example.com', + password: 'customerpw', + active: true, organization_id: @organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) @customer2 = User.create_or_update( - login: 'ticket-selector-customer2@example.com', - firstname: 'Notification', - lastname: 'Customer2', - email: 'ticket-selector-customer2@example.com', - password: 'customerpw', - active: true, + login: 'ticket-selector-customer2@example.com', + firstname: 'Notification', + lastname: 'Customer2', + email: 'ticket-selector-customer2@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) Ticket.where(group_id: @group.id).destroy_all @@ -77,13 +77,13 @@ class TicketSelectorTest < ActiveSupport::TestCase Ticket.destroy_all ticket1 = Ticket.create!( - title: 'some title1', - group: @group, - customer_id: @customer1.id, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2015-02-05 16:37:00', + title: 'some title1', + group: @group, + customer_id: @customer1.id, + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2015-02-05 16:37:00', #updated_at: '2015-02-05 17:37:00', updated_by_id: 1, created_by_id: 1, @@ -94,12 +94,12 @@ class TicketSelectorTest < ActiveSupport::TestCase travel 1.second ticket2 = Ticket.create!( - title: 'some title2', - group: @group, - customer_id: @customer2.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2015-02-05 16:37:00', + title: 'some title2', + group: @group, + customer_id: @customer2.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2015-02-05 16:37:00', #updated_at: '2015-02-05 17:37:00', updated_by_id: 1, created_by_id: 1, @@ -110,12 +110,12 @@ class TicketSelectorTest < ActiveSupport::TestCase travel 1.second ticket3 = Ticket.create!( - title: 'some title3', - group: @group, - customer_id: @customer2.id, - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2015-02-05 16:37:00', + title: 'some title3', + group: @group, + customer_id: @customer2.id, + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2015-02-05 16:37:00', #updated_at: '2015-02-05 17:37:00', updated_by_id: 1, created_by_id: 1, @@ -130,7 +130,7 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.state_id' => { operator: 'is', - value: [99], + value: [99], }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -149,7 +149,7 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.state_id' => { operator: 'is', @@ -175,11 +175,11 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.state_id' => { operator: 'is', - value: [], + value: [], }, } @@ -202,7 +202,7 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.state_id' => { operator: 'is', @@ -228,11 +228,11 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.state_id' => { operator: 'is', - value: [Ticket::State.lookup(name: 'new').id], + value: [Ticket::State.lookup(name: 'new').id], }, } @@ -254,11 +254,11 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.state_id' => { operator: 'is not', - value: [Ticket::State.lookup(name: 'open').id], + value: [Ticket::State.lookup(name: 'open').id], }, } ticket_count, tickets = Ticket.selectors(condition, 10) @@ -279,7 +279,7 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.escalation_at' => { operator: 'is not', - value: nil, + value: nil, } } ticket_count, tickets = Ticket.selectors(condition, 10) @@ -299,13 +299,13 @@ class TicketSelectorTest < ActiveSupport::TestCase # search - created_at condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.created_at' => { operator: 'after (absolute)', # before (absolute) - value: '2015-02-05T16:00:00.000Z', + value: '2015-02-05T16:00:00.000Z', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -321,13 +321,13 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 2) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.created_at' => { operator: 'after (absolute)', # before (absolute) - value: '2015-02-05T18:00:00.000Z', + value: '2015-02-05T18:00:00.000Z', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -343,13 +343,13 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 0) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.created_at' => { operator: 'before (absolute)', - value: '2015-02-05T18:00:00.000Z', + value: '2015-02-05T18:00:00.000Z', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -365,13 +365,13 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 2) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.created_at' => { operator: 'before (absolute)', - value: '2015-02-05T16:00:00.000Z', + value: '2015-02-05T16:00:00.000Z', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -387,14 +387,14 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 0) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.created_at' => { operator: 'before (relative)', - range: 'day', # minute|hour|day|month| - value: '10', + range: 'day', # minute|hour|day|month| + value: '10', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -410,14 +410,14 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 2) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.created_at' => { operator: 'within next (relative)', - range: 'year', # minute|hour|day|month| - value: '10', + range: 'year', # minute|hour|day|month| + value: '10', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -433,14 +433,14 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 2) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.created_at' => { operator: 'within last (relative)', - range: 'year', # minute|hour|day|month| - value: '10', + range: 'year', # minute|hour|day|month| + value: '10', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -457,13 +457,13 @@ class TicketSelectorTest < ActiveSupport::TestCase # search - updated_at condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.updated_at' => { operator: 'before (absolute)', - value: (Time.zone.now + 1.day).iso8601, + value: (Time.zone.now + 1.day).iso8601, }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -479,13 +479,13 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 2) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.updated_at' => { operator: 'before (absolute)', - value: (Time.zone.now - 1.day).iso8601, + value: (Time.zone.now - 1.day).iso8601, }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -501,13 +501,13 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 0) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.updated_at' => { operator: 'after (absolute)', - value: (Time.zone.now + 1.day).iso8601, + value: (Time.zone.now + 1.day).iso8601, }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -523,13 +523,13 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 0) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.updated_at' => { operator: 'after (absolute)', - value: (Time.zone.now - 1.day).iso8601, + value: (Time.zone.now - 1.day).iso8601, }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -545,14 +545,14 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 2) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.updated_at' => { operator: 'before (relative)', - range: 'day', # minute|hour|day|month| - value: '10', + range: 'day', # minute|hour|day|month| + value: '10', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -568,14 +568,14 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 0) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.updated_at' => { operator: 'within next (relative)', - range: 'year', # minute|hour|day|month| - value: '10', + range: 'year', # minute|hour|day|month| + value: '10', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -591,14 +591,14 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 2) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.updated_at' => { operator: 'within last (relative)', - range: 'year', # minute|hour|day|month| - value: '10', + range: 'year', # minute|hour|day|month| + value: '10', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -622,11 +622,11 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, - 'customer.email' => { + 'customer.email' => { operator: 'contains', - value: 'ticket-selector-customer1', + value: 'ticket-selector-customer1', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -644,11 +644,11 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, - 'customer.email' => { + 'customer.email' => { operator: 'contains not', - value: 'ticket-selector-customer1-not_existing', + value: 'ticket-selector-customer1-not_existing', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -665,13 +665,13 @@ class TicketSelectorTest < ActiveSupport::TestCase # search with organizations condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'organization.name' => { operator: 'contains', - value: 'selector', + value: 'selector', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -688,17 +688,17 @@ class TicketSelectorTest < ActiveSupport::TestCase # search with organizations condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'organization.name' => { operator: 'contains', - value: 'selector', + value: 'selector', }, - 'customer.email' => { + 'customer.email' => { operator: 'contains', - value: 'ticket-selector-customer1', + value: 'ticket-selector-customer1', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -714,17 +714,17 @@ class TicketSelectorTest < ActiveSupport::TestCase assert_equal(ticket_count, 0) condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'organization.name' => { operator: 'contains', - value: 'selector', + value: 'selector', }, - 'customer.email' => { + 'customer.email' => { operator: 'contains not', - value: 'ticket-selector-customer1', + value: 'ticket-selector-customer1', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -743,12 +743,12 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'specific', - value: @agent1.id, + value: @agent1.id, }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -766,10 +766,10 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'specific', #value: @agent1.id, # value is not set, no result should be shown }, @@ -789,10 +789,10 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'not_set', }, } @@ -811,10 +811,10 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.owner_id' => { - operator: 'is not', + operator: 'is not', pre_condition: 'not_set', }, } @@ -834,10 +834,10 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, } @@ -860,10 +860,10 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.owner_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, } @@ -884,12 +884,12 @@ class TicketSelectorTest < ActiveSupport::TestCase UserInfo.current_user_id = @customer1.id condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.customer_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, } @@ -910,12 +910,12 @@ class TicketSelectorTest < ActiveSupport::TestCase UserInfo.current_user_id = @customer2.id condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.customer_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.id', }, } @@ -936,12 +936,12 @@ class TicketSelectorTest < ActiveSupport::TestCase UserInfo.current_user_id = @customer1.id condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.organization_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.organization_id', }, } @@ -962,12 +962,12 @@ class TicketSelectorTest < ActiveSupport::TestCase UserInfo.current_user_id = @customer2.id condition = { - 'ticket.group_id' => { + 'ticket.group_id' => { operator: 'is', - value: @group.id, + value: @group.id, }, 'ticket.organization_id' => { - operator: 'is', + operator: 'is', pre_condition: 'current_user.organization_id', }, } @@ -990,61 +990,61 @@ class TicketSelectorTest < ActiveSupport::TestCase test 'ticket tags filter' do ticket_tags_1 = Ticket.create!( - title: 'some title1', - group: @group, - customer_id: @customer1.id, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2015-02-05 16:37:00', + title: 'some title1', + group: @group, + customer_id: @customer1.id, + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) ticket_tags_2 = Ticket.create!( - title: 'some title1', - group: @group, - customer_id: @customer1.id, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2015-02-05 16:37:00', + title: 'some title1', + group: @group, + customer_id: @customer1.id, + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) ticket_tags_3 = Ticket.create!( - title: 'some title1', - group: @group, - customer_id: @customer1.id, - owner_id: @agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2015-02-05 16:37:00', + title: 'some title1', + group: @group, + customer_id: @customer1.id, + owner_id: @agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) Tag.tag_add( - object: 'Ticket', - o_id: ticket_tags_1.id, - item: 'contains_all_1', + object: 'Ticket', + o_id: ticket_tags_1.id, + item: 'contains_all_1', created_by_id: 1, ) Tag.tag_add( - object: 'Ticket', - o_id: ticket_tags_1.id, - item: 'contains_all_2', + object: 'Ticket', + o_id: ticket_tags_1.id, + item: 'contains_all_2', created_by_id: 1, ) Tag.tag_add( - object: 'Ticket', - o_id: ticket_tags_1.id, - item: 'contains_all_3', + object: 'Ticket', + o_id: ticket_tags_1.id, + item: 'contains_all_3', created_by_id: 1, ) Tag.tag_add( - object: 'Ticket', - o_id: ticket_tags_2.id, - item: 'contains_all_3', + object: 'Ticket', + o_id: ticket_tags_2.id, + item: 'contains_all_3', created_by_id: 1, ) @@ -1052,7 +1052,7 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.tags' => { operator: 'contains all', - value: 'contains_all_1, contains_all_2, contains_all_3', + value: 'contains_all_1, contains_all_2, contains_all_3', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -1061,7 +1061,7 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.tags' => { operator: 'contains all', - value: 'contains_all_1, contains_all_2, contains_all_3, xxx', + value: 'contains_all_1, contains_all_2, contains_all_3, xxx', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -1071,7 +1071,7 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.tags' => { operator: 'contains one', - value: 'contains_all_1, contains_all_2, contains_all_3', + value: 'contains_all_1, contains_all_2, contains_all_3', }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -1080,7 +1080,7 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.tags' => { operator: 'contains one', - value: 'contains_all_1, contains_all_2' + value: 'contains_all_1, contains_all_2' }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -1090,7 +1090,7 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.tags' => { operator: 'contains one', - value: 'contains_all_1, contains_all_3' + value: 'contains_all_1, contains_all_3' }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) @@ -1099,7 +1099,7 @@ class TicketSelectorTest < ActiveSupport::TestCase condition = { 'ticket.tags' => { operator: 'contains one', - value: 'contains_all_1, contains_all_2, contains_all_3' + value: 'contains_all_1, contains_all_2, contains_all_3' }, } ticket_count, tickets = Ticket.selectors(condition, 10, @agent1) diff --git a/test/unit/ticket_sla_test.rb b/test/unit/ticket_sla_test.rb index 825361038..2e012960b 100644 --- a/test/unit/ticket_sla_test.rb +++ b/test/unit/ticket_sla_test.rb @@ -4,13 +4,13 @@ class TicketSlaTest < ActiveSupport::TestCase test 'ticket sla' do ticket = Ticket.create!( - title: 'some title äöüß', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-03-21 09:30:00 UTC', - updated_at: '2013-03-21 09:30:00 UTC', + title: 'some title äöüß', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-03-21 09:30:00 UTC', + updated_at: '2013-03-21 09:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -18,53 +18,53 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket.escalation_at, 'ticket.escalation_at verify') calendar1 = Calendar.create_or_update( - name: 'EU 1', - timezone: 'Europe/Berlin', + name: 'EU 1', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['09:00', '17:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['09:00', '17:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['09:00', '17:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['09:00', '17:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['09:00', '17:00'] ] }, sat: { - active: false, + active: false, timeframes: [ ['08:00', '17:00'] ] }, sun: { - active: false, + active: false, timeframes: [ ['08:00', '17:00'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 1', - condition: {}, + name: 'test sla 1', + condition: {}, first_response_time: 60, - update_time: 180, - solution_time: 240, - calendar_id: calendar1.id, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + calendar_id: calendar1.id, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -74,14 +74,14 @@ class TicketSlaTest < ActiveSupport::TestCase assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_escalation_at verify 1') sla = Sla.create_or_update( - name: 'test sla 1', - condition: {}, + name: 'test sla 1', + condition: {}, first_response_time: 120, - update_time: 180, - solution_time: 240, - calendar_id: calendar1.id, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + calendar_id: calendar1.id, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -93,57 +93,57 @@ class TicketSlaTest < ActiveSupport::TestCase assert(delete, 'sla destroy 1') calendar2 = Calendar.create_or_update( - name: 'EU 2', - timezone: 'Europe/Berlin', + name: 'EU 2', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['08:00', '18:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['08:00', '18:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['08:00', '18:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['08:00', '18:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['08:00', '18:00'] ] }, sat: { - active: false, + active: false, timeframes: [ ['08:00', '17:00'] ] }, sun: { - active: false, + active: false, timeframes: [ ['08:00', '17:00'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 2', - condition: { + name: 'test sla 2', + condition: { 'ticket.priority_id' => { operator: 'is', - value: %w[1 2 3], + value: %w[1 2 3], }, }, - calendar_id: calendar2.id, + calendar_id: calendar2.id, first_response_time: 60, - update_time: 120, - solution_time: 180, - updated_by_id: 1, - created_by_id: 1, + update_time: 120, + solution_time: 180, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -336,15 +336,15 @@ class TicketSlaTest < ActiveSupport::TestCase assert(delete, 'ticket destroy') ticket = Ticket.create!( - title: 'some title äöüß', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some title äöüß', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, - created_at: '2013-03-28 23:49:00 UTC', - updated_at: '2013-03-28 23:49:00 UTC', + created_at: '2013-03-28 23:49:00 UTC', + updated_at: '2013-03-28 23:49:00 UTC', ) assert(ticket, 'ticket created') @@ -354,19 +354,19 @@ class TicketSlaTest < ActiveSupport::TestCase # create inbound article article_inbound = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, - created_at: '2013-03-28 23:49:00 UTC', - updated_at: '2013-03-28 23:49:00 UTC', + created_at: '2013-03-28 23:49:00 UTC', + updated_at: '2013-03-28 23:49:00 UTC', ) ticket = Ticket.find(ticket.id) assert_equal(ticket.article_count, 1, 'ticket.article_count verify - inbound') @@ -378,19 +378,19 @@ class TicketSlaTest < ActiveSupport::TestCase # create outbound article article_outbound = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_recipient@example.com', - to: 'some_sender@example.com', - subject: 'some subject', - message_id: 'some@id2', - body: 'some message 2', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_recipient@example.com', + to: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id2', + body: 'some message 2', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, - created_at: '2013-03-29 07:00:03 UTC', - updated_at: '2013-03-29 07:00:03 UTC', + created_at: '2013-03-29 07:00:03 UTC', + updated_at: '2013-03-29 07:00:03 UTC', ) ticket = Ticket.find(ticket.id) @@ -407,15 +407,15 @@ class TicketSlaTest < ActiveSupport::TestCase assert(delete, 'ticket destroy') ticket = Ticket.create!( - title: 'some title äöüß', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some title äöüß', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, - created_at: '2013-03-28 23:49:00 UTC', - updated_at: '2013-03-28 23:49:00 UTC', + created_at: '2013-03-28 23:49:00 UTC', + updated_at: '2013-03-28 23:49:00 UTC', ) assert(ticket, 'ticket created') @@ -425,18 +425,18 @@ class TicketSlaTest < ActiveSupport::TestCase # create inbound article article_inbound = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'phone').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'phone').first, updated_by_id: 1, created_by_id: 1, - created_at: '2013-03-28 23:49:00 UTC', - updated_at: '2013-03-28 23:49:00 UTC', + created_at: '2013-03-28 23:49:00 UTC', + updated_at: '2013-03-28 23:49:00 UTC', ) ticket = Ticket.find(ticket.id) assert_equal(ticket.article_count, 1, 'ticket.article_count verify - inbound') @@ -448,18 +448,18 @@ class TicketSlaTest < ActiveSupport::TestCase # create note article article_note = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'note').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'note').first, updated_by_id: 1, created_by_id: 1, - created_at: '2013-03-28 23:52:00 UTC', - updated_at: '2013-03-28 23:52:00 UTC', + created_at: '2013-03-28 23:52:00 UTC', + updated_at: '2013-03-28 23:52:00 UTC', ) ticket = Ticket.find(ticket.id) assert_equal(ticket.article_count, 2, 'ticket.article_count verify - inbound') @@ -471,18 +471,18 @@ class TicketSlaTest < ActiveSupport::TestCase # create outbound article article_outbound = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'phone').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'phone').first, updated_by_id: 1, created_by_id: 1, - created_at: '2013-03-28 23:55:00 UTC', - updated_at: '2013-03-28 23:55:00 UTC', + created_at: '2013-03-28 23:55:00 UTC', + updated_at: '2013-03-28 23:55:00 UTC', ) ticket = Ticket.find(ticket.id) assert_equal(ticket.article_count, 3, 'ticket.article_count verify - inbound') @@ -497,68 +497,68 @@ class TicketSlaTest < ActiveSupport::TestCase test 'ticket sla + selector' do calendar1 = Calendar.create_or_update( - name: 'EU 1', - timezone: 'Europe/Berlin', + name: 'EU 1', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['09:00', '17:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['09:00', '17:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['09:00', '17:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['09:00', '17:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['09:00', '17:00'] ] }, sat: { - active: false, + active: false, timeframes: [ ['08:00', '17:00'] ] }, sun: { - active: false, + active: false, timeframes: [ ['08:00', '17:00'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 1', - condition: { + name: 'test sla 1', + condition: { 'ticket.priority_id' => { operator: 'is', - value: %w[2], + value: %w[2], }, }, first_response_time: 60, - update_time: 180, - solution_time: 240, - calendar_id: calendar1.id, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + calendar_id: calendar1.id, + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.create!( - title: 'some title äöüß', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-03-21 09:30:00 UTC', - updated_at: '2013-03-21 09:30:00 UTC', + title: 'some title äöüß', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-03-21 09:30:00 UTC', + updated_at: '2013-03-21 09:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -601,13 +601,13 @@ class TicketSlaTest < ActiveSupport::TestCase test 'ticket sla + timezone + holiday' do ticket = Ticket.create!( - title: 'some title äöüß', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-03-21 09:30:00 UTC', - updated_at: '2013-03-21 09:30:00 UTC', + title: 'some title äöüß', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-03-21 09:30:00 UTC', + updated_at: '2013-03-21 09:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -616,72 +616,72 @@ class TicketSlaTest < ActiveSupport::TestCase # set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 7:00-16:00 calendar = Calendar.create_or_update( - name: 'EU 3', - timezone: 'Europe/Berlin', + name: 'EU 3', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, sat: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, sun: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'aaa should not match', - condition: { + name: 'aaa should not match', + condition: { 'ticket.priority_id' => { operator: 'is not', - value: %w[1 2 3], + value: %w[1 2 3], }, }, - calendar_id: calendar.id, + calendar_id: calendar.id, first_response_time: 10, - update_time: 20, - solution_time: 300, - updated_by_id: 1, - created_by_id: 1, + update_time: 20, + solution_time: 300, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 3', - condition: { + name: 'test sla 3', + condition: { 'ticket.priority_id' => { operator: 'is not', - value: '1', + value: '1', }, }, - calendar_id: calendar.id, + calendar_id: calendar.id, first_response_time: 120, - update_time: 180, - solution_time: 240, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -696,13 +696,13 @@ class TicketSlaTest < ActiveSupport::TestCase delete = ticket.destroy assert(delete, 'ticket destroy') ticket = Ticket.create!( - title: 'some title äöüß', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-10-21 09:30:00 UTC', - updated_at: '2013-10-21 09:30:00 UTC', + title: 'some title äöüß', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-10-21 09:30:00 UTC', + updated_at: '2013-10-21 09:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -711,45 +711,45 @@ class TicketSlaTest < ActiveSupport::TestCase # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 6:00-15:00 calendar = Calendar.create_or_update( - name: 'EU 4', - timezone: 'Europe/Berlin', - business_hours: { + name: 'EU 4', + timezone: 'Europe/Berlin', + business_hours: { mon: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, sat: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, sun: { - active: true, + active: true, timeframes: [ ['08:00', '17:00'] ] }, }, public_holidays: { '2015-09-22' => { - 'active' => true, + 'active' => true, 'summary' => 'test 1', }, '2015-09-23' => { - 'active' => false, + 'active' => false, 'summary' => 'test 2', }, '2015-09-24' => { @@ -757,20 +757,20 @@ class TicketSlaTest < ActiveSupport::TestCase 'summary' => 'test 3', }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 4', - condition: {}, - calendar_id: calendar.id, + name: 'test sla 4', + condition: {}, + calendar_id: calendar.id, first_response_time: 120, - update_time: 180, - solution_time: 240, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -786,13 +786,13 @@ class TicketSlaTest < ActiveSupport::TestCase assert(delete, 'sla destroy') ticket = Ticket.create!( - title: 'some title äöüß', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-10-21 05:30:00 UTC', - updated_at: '2013-10-21 05:30:00 UTC', + title: 'some title äöüß', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-10-21 05:30:00 UTC', + updated_at: '2013-10-21 05:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -801,14 +801,14 @@ class TicketSlaTest < ActiveSupport::TestCase # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 6:00-15:00 sla = Sla.create_or_update( - name: 'test sla 5', - condition: {}, - calendar_id: calendar.id, + name: 'test sla 5', + condition: {}, + calendar_id: calendar.id, first_response_time: 120, - update_time: 180, - solution_time: 240, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -818,13 +818,13 @@ class TicketSlaTest < ActiveSupport::TestCase assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-10-21 10:00:00 UTC', 'ticket.close_escalation_at verify 1') ticket = Ticket.create!( - title: 'some title holiday test', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2015-09-21 14:30:00 UTC', - updated_at: '2015-09-21 14:30:00 UTC', + title: 'some title holiday test', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2015-09-21 14:30:00 UTC', + updated_at: '2015-09-21 14:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -845,13 +845,13 @@ class TicketSlaTest < ActiveSupport::TestCase test 'ticket escalation suspend close reopen bug' do ticket1 = Ticket.create!( - title: 'some title äöüß3', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-06-04 09:00:00 UTC', - updated_at: '2013-06-04 09:00:00 UTC', + title: 'some title äöüß3', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-06-04 09:00:00 UTC', + updated_at: '2013-06-04 09:00:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -859,112 +859,112 @@ class TicketSlaTest < ActiveSupport::TestCase # set ticket at 09:30 to pending History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket1.id, - id_from: Ticket::State.lookup(name: 'open').id, - id_to: Ticket::State.lookup(name: 'pending reminder').id, - value_from: 'open', - value_to: 'pending reminder', - created_by_id: 1, - created_at: '2013-06-04 09:30:00 UTC', - updated_at: '2013-06-04 09:30:00 UTC', + o_id: ticket1.id, + id_from: Ticket::State.lookup(name: 'open').id, + id_to: Ticket::State.lookup(name: 'pending reminder').id, + value_from: 'open', + value_to: 'pending reminder', + created_by_id: 1, + created_at: '2013-06-04 09:30:00 UTC', + updated_at: '2013-06-04 09:30:00 UTC', ) # set ticket at 09:45 to open History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket1.id, - id_from: Ticket::State.lookup(name: 'pending reminder').id, - id_to: Ticket::State.lookup(name: 'open').id, - value_from: 'pending reminder', - value_to: 'open', - created_by_id: 1, - created_at: '2013-06-04 09:45:00 UTC', - updated_at: '2013-06-04 09:45:00 UTC', + o_id: ticket1.id, + id_from: Ticket::State.lookup(name: 'pending reminder').id, + id_to: Ticket::State.lookup(name: 'open').id, + value_from: 'pending reminder', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 09:45:00 UTC', + updated_at: '2013-06-04 09:45:00 UTC', ) # set ticket at 10:00 to closed History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket1.id, - id_from: Ticket::State.lookup(name: 'open').id, - id_to: Ticket::State.lookup(name: 'closed').id, - value_from: 'open', - value_to: 'closed', - created_by_id: 1, - created_at: '2013-06-04 10:00:00 UTC', - updated_at: '2013-06-04 10:00:00 UTC', + o_id: ticket1.id, + id_from: Ticket::State.lookup(name: 'open').id, + id_to: Ticket::State.lookup(name: 'closed').id, + value_from: 'open', + value_to: 'closed', + created_by_id: 1, + created_at: '2013-06-04 10:00:00 UTC', + updated_at: '2013-06-04 10:00:00 UTC', ) # set ticket at 10:30 to open History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket1.id, - id_from: Ticket::State.lookup(name: 'closed').id, - id_to: Ticket::State.lookup(name: 'open').id, - value_from: 'closed', - value_to: 'open', - created_by_id: 1, - created_at: '2013-06-04 10:30:00 UTC', - updated_at: '2013-06-04 10:30:00 UTC', + o_id: ticket1.id, + id_from: Ticket::State.lookup(name: 'closed').id, + id_to: Ticket::State.lookup(name: 'open').id, + value_from: 'closed', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 10:30:00 UTC', + updated_at: '2013-06-04 10:30:00 UTC', ) # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00 calendar = Calendar.create_or_update( - name: 'EU 5', - timezone: 'Europe/Berlin', + name: 'EU 5', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sat: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sun: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla suspend bug', - condition: {}, - calendar_id: calendar.id, + name: 'test sla suspend bug', + condition: {}, + calendar_id: calendar.id, first_response_time: 120, - update_time: 180, - solution_time: 250, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 250, + updated_by_id: 1, + created_by_id: 1, ) ticket1.escalation_calculation ticket1 = Ticket.find(ticket1.id) @@ -974,13 +974,13 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket1.first_response_diff_in_min, 'ticket1.first_response_diff_in_min verify 3') ticket2 = Ticket.create!( - title: 'some title äöüß4', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-06-04 09:00:00 UTC', - updated_at: '2013-06-04 09:00:00 UTC', + title: 'some title äöüß4', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-06-04 09:00:00 UTC', + updated_at: '2013-06-04 09:00:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -988,32 +988,32 @@ class TicketSlaTest < ActiveSupport::TestCase # set ticket at 10:00 to pending History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket2.id, - id_from: Ticket::State.lookup(name: 'open').id, - id_to: Ticket::State.lookup(name: 'pending reminder').id, - value_from: 'open', - value_to: 'pending reminder', - created_by_id: 1, - created_at: '2013-06-04 10:00:00 UTC', - updated_at: '2013-06-04 10:00:00 UTC', + o_id: ticket2.id, + id_from: Ticket::State.lookup(name: 'open').id, + id_to: Ticket::State.lookup(name: 'pending reminder').id, + value_from: 'open', + value_to: 'pending reminder', + created_by_id: 1, + created_at: '2013-06-04 10:00:00 UTC', + updated_at: '2013-06-04 10:00:00 UTC', ) # set ticket at 15:00 to open History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket2.id, - id_from: Ticket::State.lookup(name: 'pending reminder').id, - id_to: Ticket::State.lookup(name: 'open').id, - value_from: 'pending reminder', - value_to: 'open', - created_by_id: 1, - created_at: '2013-06-04 15:00:00 UTC', - updated_at: '2013-06-04 15:00:00 UTC', + o_id: ticket2.id, + id_from: Ticket::State.lookup(name: 'pending reminder').id, + id_to: Ticket::State.lookup(name: 'open').id, + value_from: 'pending reminder', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 15:00:00 UTC', + updated_at: '2013-06-04 15:00:00 UTC', ) ticket2.escalation_calculation(true) ticket2 = Ticket.find(ticket2.id) @@ -1035,13 +1035,13 @@ class TicketSlaTest < ActiveSupport::TestCase test 'ticket escalation suspend' do ticket = Ticket.create!( - title: 'some title äöüß3', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-06-04 09:00:00 UTC', - updated_at: '2013-06-04 09:00:00 UTC', + title: 'some title äöüß3', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-06-04 09:00:00 UTC', + updated_at: '2013-06-04 09:00:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -1049,32 +1049,32 @@ class TicketSlaTest < ActiveSupport::TestCase # set ticket at 10:00 to pending History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 3, - id_from: 2, - value_from: 'open', - value_to: 'pending reminder', - created_by_id: 1, - created_at: '2013-06-04 10:00:00 UTC', - updated_at: '2013-06-04 10:00:00 UTC', + o_id: ticket.id, + id_to: 3, + id_from: 2, + value_from: 'open', + value_to: 'pending reminder', + created_by_id: 1, + created_at: '2013-06-04 10:00:00 UTC', + updated_at: '2013-06-04 10:00:00 UTC', ) # set ticket at 10:30 to open History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 2, - id_from: 3, - value_from: 'pending reminder', - value_to: 'open', - created_by_id: 1, - created_at: '2013-06-04 10:30:00 UTC', - updated_at: '2013-06-04 10:30:00 UTC' + o_id: ticket.id, + id_to: 2, + id_from: 3, + value_from: 'pending reminder', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 10:30:00 UTC', + updated_at: '2013-06-04 10:30:00 UTC' ) # set update time @@ -1089,17 +1089,17 @@ class TicketSlaTest < ActiveSupport::TestCase # set ticket from 11:30 to closed History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 3, - id_from: 2, - value_from: 'open', - value_to: 'closed', - created_by_id: 1, - created_at: '2013-06-04 12:00:00 UTC', - updated_at: '2013-06-04 12:00:00 UTC' + o_id: ticket.id, + id_to: 3, + id_from: 2, + value_from: 'open', + value_to: 'closed', + created_by_id: 1, + created_at: '2013-06-04 12:00:00 UTC', + updated_at: '2013-06-04 12:00:00 UTC' ) ticket.update!( @@ -1108,52 +1108,52 @@ class TicketSlaTest < ActiveSupport::TestCase # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00 calendar = Calendar.create_or_update( - name: 'EU 5', - timezone: 'Europe/Berlin', + name: 'EU 5', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sat: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sun: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 5', - condition: {}, - calendar_id: calendar.id, + name: 'test sla 5', + condition: {}, + calendar_id: calendar.id, first_response_time: 120, - update_time: 180, - solution_time: 250, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 250, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -1173,13 +1173,13 @@ class TicketSlaTest < ActiveSupport::TestCase # test Ticket created in state pending and closed without reopen or state change ticket = Ticket.create!( - title: 'some title äöüß3', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'pending reminder'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-06-04 09:00:00 UTC', - updated_at: '2013-06-04 09:00:00 UTC', + title: 'some title äöüß3', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'pending reminder'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-06-04 09:00:00 UTC', + updated_at: '2013-06-04 09:00:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -1187,17 +1187,17 @@ class TicketSlaTest < ActiveSupport::TestCase # set ticket from 11:30 to closed History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 4, - id_from: 3, - value_from: 'pending reminder', - value_to: 'closed', - created_by_id: 1, - created_at: '2013-06-04 12:00:00 UTC', - updated_at: '2013-06-04 12:00:00 UTC', + o_id: ticket.id, + id_to: 4, + id_from: 3, + value_from: 'pending reminder', + value_to: 'closed', + created_by_id: 1, + created_at: '2013-06-04 12:00:00 UTC', + updated_at: '2013-06-04 12:00:00 UTC', ) ticket.update!( close_at: '2013-06-04 12:00:00 UTC', @@ -1205,52 +1205,52 @@ class TicketSlaTest < ActiveSupport::TestCase ticket.escalation_calculation(true) calendar = Calendar.create_or_update( - name: 'EU 5', - timezone: 'Europe/Berlin', + name: 'EU 5', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sat: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sun: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 5', - condition: {}, - calendar_id: calendar.id, + name: 'test sla 5', + condition: {}, + calendar_id: calendar.id, first_response_time: 120, - update_time: 180, - solution_time: 240, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -1271,13 +1271,13 @@ class TicketSlaTest < ActiveSupport::TestCase # test Ticket created in state pending, changed state to openen, back to pending and closed ticket = Ticket.create!( - title: 'some title äöüß3', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'pending reminder'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-06-04 09:00:00 UTC', - updated_at: '2013-06-04 09:00:00 UTC', + title: 'some title äöüß3', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'pending reminder'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-06-04 09:00:00 UTC', + updated_at: '2013-06-04 09:00:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -1285,99 +1285,99 @@ class TicketSlaTest < ActiveSupport::TestCase # state change to open 10:30 History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 2, - id_from: 3, - value_from: 'pending reminder', - value_to: 'open', - created_by_id: 1, - created_at: '2013-06-04 10:30:00 UTC', - updated_at: '2013-06-04 10:30:00 UTC', + o_id: ticket.id, + id_to: 2, + id_from: 3, + value_from: 'pending reminder', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 10:30:00 UTC', + updated_at: '2013-06-04 10:30:00 UTC', ) # state change to pending 11:00 History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 3, - id_from: 2, - value_from: 'open', - value_to: 'pending reminder', - created_by_id: 1, - created_at: '2013-06-04 11:00:00 UTC', - updated_at: '2013-06-04 11:00:00 UTC', + o_id: ticket.id, + id_to: 3, + id_from: 2, + value_from: 'open', + value_to: 'pending reminder', + created_by_id: 1, + created_at: '2013-06-04 11:00:00 UTC', + updated_at: '2013-06-04 11:00:00 UTC', ) # set ticket from 12:00 to closed History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 4, - id_from: 3, - value_from: 'pending reminder', - value_to: 'closed', - created_by_id: 1, - created_at: '2013-06-04 12:00:00 UTC', - updated_at: '2013-06-04 12:00:00 UTC', + o_id: ticket.id, + id_to: 4, + id_from: 3, + value_from: 'pending reminder', + value_to: 'closed', + created_by_id: 1, + created_at: '2013-06-04 12:00:00 UTC', + updated_at: '2013-06-04 12:00:00 UTC', ) ticket.update!( close_at: '2013-06-04 12:00:00 UTC', ) calendar = Calendar.create_or_update( - name: 'EU 5', - timezone: 'Europe/Berlin', + name: 'EU 5', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sat: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sun: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 5', - condition: {}, - calendar_id: calendar.id, + name: 'test sla 5', + condition: {}, + calendar_id: calendar.id, first_response_time: 120, - update_time: 180, - solution_time: 240, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -1399,13 +1399,13 @@ class TicketSlaTest < ActiveSupport::TestCase ### Test Ticket created in state pending, changed state to openen, back to pending and back to open then ### close ticket ticket = Ticket.create!( - title: 'some title äöüß3', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'pending reminder'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2013-06-04 09:00:00 UTC', - updated_at: '2013-06-04 09:00:00 UTC', + title: 'some title äöüß3', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'pending reminder'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2013-06-04 09:00:00 UTC', + updated_at: '2013-06-04 09:00:00 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -1413,114 +1413,114 @@ class TicketSlaTest < ActiveSupport::TestCase # state change to open from pending History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 2, - id_from: 3, - value_from: 'pending reminder', - value_to: 'open', - created_by_id: 1, - created_at: '2013-06-04 10:30:00 UTC', - updated_at: '2013-06-04 10:30:00 UTC', + o_id: ticket.id, + id_to: 2, + id_from: 3, + value_from: 'pending reminder', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 10:30:00 UTC', + updated_at: '2013-06-04 10:30:00 UTC', ) # state change to pending from open 11:00 History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 3, - id_from: 2, - value_from: 'open', - value_to: 'pending reminder', - created_by_id: 1, - created_at: '2013-06-04 11:00:00 UTC', - updated_at: '2013-06-04 11:00:00 UTC', + o_id: ticket.id, + id_to: 3, + id_from: 2, + value_from: 'open', + value_to: 'pending reminder', + created_by_id: 1, + created_at: '2013-06-04 11:00:00 UTC', + updated_at: '2013-06-04 11:00:00 UTC', ) # state change to open 11:30 History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 2, - id_from: 3, - value_from: 'pending reminder', - value_to: 'open', - created_by_id: 1, - created_at: '2013-06-04 11:30:00 UTC', - updated_at: '2013-06-04 11:30:00 UTC', + o_id: ticket.id, + id_to: 2, + id_from: 3, + value_from: 'pending reminder', + value_to: 'open', + created_by_id: 1, + created_at: '2013-06-04 11:30:00 UTC', + updated_at: '2013-06-04 11:30:00 UTC', ) # set ticket from open to closed 12:00 History.add( - history_type: 'updated', - history_object: 'Ticket', + history_type: 'updated', + history_object: 'Ticket', history_attribute: 'state', - o_id: ticket.id, - id_to: 4, - id_from: 3, - value_from: 'open', - value_to: 'closed', - created_by_id: 1, - created_at: '2013-06-04 12:00:00 UTC', - updated_at: '2013-06-04 12:00:00 UTC', + o_id: ticket.id, + id_to: 4, + id_from: 3, + value_from: 'open', + value_to: 'closed', + created_by_id: 1, + created_at: '2013-06-04 12:00:00 UTC', + updated_at: '2013-06-04 12:00:00 UTC', ) ticket.update!( close_at: '2013-06-04 12:00:00 UTC', ) calendar = Calendar.create_or_update( - name: 'EU 5', - timezone: 'Europe/Berlin', + name: 'EU 5', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sat: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sun: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 5', - condition: {}, - calendar_id: calendar.id, + name: 'test sla 5', + condition: {}, + calendar_id: calendar.id, first_response_time: 120, - update_time: 180, - solution_time: 240, - updated_by_id: 1, - created_by_id: 1, + update_time: 180, + solution_time: 240, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -1544,89 +1544,89 @@ class TicketSlaTest < ActiveSupport::TestCase test 'ticket ticket.title and article.subject' do ticket = Ticket.create!( - title: 'some title SLATEST1 for you', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-03-21 12:30:00 UTC', - updated_at: '2016-03-21 12:30:00 UTC', + title: 'some title SLATEST1 for you', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-03-21 12:30:00 UTC', + updated_at: '2016-03-21 12:30:00 UTC', updated_by_id: 1, created_by_id: 1, ) article_inbound = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some title SLATEST2 for you', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some title SLATEST2 for you', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, - created_at: '2016-03-21 12:30:00 UTC', - updated_at: '2016-03-21 12:30:00 UTC', + created_at: '2016-03-21 12:30:00 UTC', + updated_at: '2016-03-21 12:30:00 UTC', ) calendar = Calendar.create_or_update( - name: 'EU 5', - timezone: 'Europe/Berlin', + name: 'EU 5', + timezone: 'Europe/Berlin', business_hours: { mon: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sat: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, sun: { - active: true, + active: true, timeframes: [ ['09:00', '18:00'] ] }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla - ticket.title & article.subject', - condition: { + name: 'test sla - ticket.title & article.subject', + condition: { 'ticket.priority_id' => { operator: 'is', - value: %w[1 2 3], + value: %w[1 2 3], }, - 'article.subject' => { + 'article.subject' => { operator: 'contains', - value: 'SLATEST2', + value: 'SLATEST2', }, }, - calendar_id: calendar.id, + calendar_id: calendar.id, first_response_time: 60, - update_time: 120, - solution_time: 180, - updated_by_id: 1, - created_by_id: 1, + update_time: 120, + solution_time: 180, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -1640,23 +1640,23 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min# verify 3') sla = Sla.create_or_update( - name: 'test sla - ticket.title & article.subject', - condition: { + name: 'test sla - ticket.title & article.subject', + condition: { 'ticket.priority_id' => { operator: 'is', - value: %w[1 2 3], + value: %w[1 2 3], }, - 'ticket.title' => { + 'ticket.title' => { operator: 'contains', - value: 'SLATEST1', + value: 'SLATEST1', }, }, - calendar_id: calendar.id, + calendar_id: calendar.id, first_response_time: 60, - update_time: 120, - solution_time: 180, - updated_by_id: 1, - created_by_id: 1, + update_time: 120, + solution_time: 180, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -1670,23 +1670,23 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min# verify 3') sla = Sla.create_or_update( - name: 'test sla - ticket.title & article.subject', - condition: { + name: 'test sla - ticket.title & article.subject', + condition: { 'ticket.priority_id' => { operator: 'is', - value: %w[1 2 3], + value: %w[1 2 3], }, - 'ticket.title' => { + 'ticket.title' => { operator: 'contains', - value: 'SLATEST2', + value: 'SLATEST2', }, }, - calendar_id: calendar.id, + calendar_id: calendar.id, first_response_time: 60, - update_time: 120, - solution_time: 180, - updated_by_id: 1, - created_by_id: 1, + update_time: 120, + solution_time: 180, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -1710,13 +1710,13 @@ class TicketSlaTest < ActiveSupport::TestCase test 'ticket sla + holiday 222' do ticket = Ticket.create!( - title: 'some title 222', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-11-01 13:56:21 UTC', - updated_at: '2016-11-01 13:56:21 UTC', + title: 'some title 222', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-11-01 13:56:21 UTC', + updated_at: '2016-11-01 13:56:21 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -1724,75 +1724,75 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket.escalation_at, 'ticket.escalation_at verify') article_customer = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'web').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'web').first, updated_by_id: 1, created_by_id: 1, - created_at: '2016-11-01 13:56:21 UTC', - updated_at: '2016-11-01 13:56:21 UTC', + created_at: '2016-11-01 13:56:21 UTC', + updated_at: '2016-11-01 13:56:21 UTC', ) # set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 7:00-18:00 calendar = Calendar.create_or_update( - name: 'EU', - timezone: 'Europe/Berlin', - business_hours: { + name: 'EU', + timezone: 'Europe/Berlin', + business_hours: { mon: { - active: true, + active: true, timeframes: [ ['08:00', '20:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['08:00', '20:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['08:00', '20:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['08:00', '20:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['08:00', '20:00'] ] }, sat: { - active: false, + active: false, timeframes: [ ['08:00', '17:00'] ] }, sun: { - active: false, + active: false, timeframes: [ ['08:00', '17:00'] ] }, }, public_holidays: { '2016-11-01' => { - 'active' => true, + 'active' => true, 'summary' => 'test 1', }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 1', - condition: {}, - calendar_id: calendar.id, + name: 'test sla 1', + condition: {}, + calendar_id: calendar.id, first_response_time: 120, - update_time: 1200, - solution_time: nil, - updated_by_id: 1, - created_by_id: 1, + update_time: 1200, + solution_time: nil, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -1807,19 +1807,19 @@ class TicketSlaTest < ActiveSupport::TestCase ticket.save! article_agent = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, - created_at: '2016-11-01 15:25:40 UTC', - updated_at: '2016-11-01 15:25:40 UTC', + created_at: '2016-11-01 15:25:40 UTC', + updated_at: '2016-11-01 15:25:40 UTC', ) Scheduler.worker(true) @@ -1834,19 +1834,19 @@ class TicketSlaTest < ActiveSupport::TestCase ticket.save! article_customer = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, - created_at: '2016-11-01 15:59:14 UTC', - updated_at: '2016-11-01 15:59:14 UTC', + created_at: '2016-11-01 15:59:14 UTC', + updated_at: '2016-11-01 15:59:14 UTC', ) Scheduler.worker(true) @@ -1873,19 +1873,19 @@ class TicketSlaTest < ActiveSupport::TestCase ticket.save! article_customer = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, - created_at: '2016-11-07 13:26:36 UTC', - updated_at: '2016-11-07 13:26:36 UTC', + created_at: '2016-11-07 13:26:36 UTC', + updated_at: '2016-11-07 13:26:36 UTC', ) Scheduler.worker(true) @@ -1896,19 +1896,19 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket.close_escalation_at, 'ticket.close_escalation_at verify 1') article_agent = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, - created_at: '2016-11-07 14:26:36 UTC', - updated_at: '2016-11-07 14:26:36 UTC', + created_at: '2016-11-07 14:26:36 UTC', + updated_at: '2016-11-07 14:26:36 UTC', ) Scheduler.worker(true) @@ -1929,13 +1929,13 @@ class TicketSlaTest < ActiveSupport::TestCase test 'ticket sla + observer check' do ticket = Ticket.create!( - title: 'some title observer#1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2016-11-01 13:56:21 UTC', - updated_at: '2016-11-01 13:56:21 UTC', + title: 'some title observer#1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2016-11-01 13:56:21 UTC', + updated_at: '2016-11-01 13:56:21 UTC', updated_by_id: 1, created_by_id: 1, ) @@ -1943,75 +1943,75 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket.escalation_at, 'ticket.escalation_at verify') article_customer = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'web').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'web').first, updated_by_id: 1, created_by_id: 1, - created_at: '2016-11-01 13:56:21 UTC', - updated_at: '2016-11-01 13:56:21 UTC', + created_at: '2016-11-01 13:56:21 UTC', + updated_at: '2016-11-01 13:56:21 UTC', ) # set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 7:00-18:00 calendar = Calendar.create_or_update( - name: 'EU', - timezone: 'Europe/Berlin', - business_hours: { + name: 'EU', + timezone: 'Europe/Berlin', + business_hours: { mon: { - active: true, + active: true, timeframes: [ ['08:00', '20:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['08:00', '20:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['08:00', '20:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['08:00', '20:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['08:00', '20:00'] ] }, sat: { - active: false, + active: false, timeframes: [ ['08:00', '17:00'] ] }, sun: { - active: false, + active: false, timeframes: [ ['08:00', '17:00'] ] }, }, public_holidays: { '2016-11-01' => { - 'active' => true, + 'active' => true, 'summary' => 'test 1', }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) sla = Sla.create_or_update( - name: 'test sla 1', - condition: {}, - calendar_id: calendar.id, + name: 'test sla 1', + condition: {}, + calendar_id: calendar.id, first_response_time: 60, - update_time: 120, - solution_time: nil, - updated_by_id: 1, - created_by_id: 1, + update_time: 120, + solution_time: nil, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) ticket = Ticket.find(ticket.id) @@ -2021,19 +2021,19 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket.close_escalation_at, 'ticket.close_escalation_at verify 1') article_agent = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'email').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'email').first, updated_by_id: 1, created_by_id: 1, - created_at: '2016-11-07 13:26:36 UTC', - updated_at: '2016-11-07 13:26:36 UTC', + created_at: '2016-11-07 13:26:36 UTC', + updated_at: '2016-11-07 13:26:36 UTC', ) Scheduler.worker(true) @@ -2045,46 +2045,46 @@ class TicketSlaTest < ActiveSupport::TestCase # set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 3:00-18:00 calendar.update!( - business_hours: { + business_hours: { mon: { - active: true, + active: true, timeframes: [ ['04:00', '20:00'] ] }, tue: { - active: true, + active: true, timeframes: [ ['04:00', '20:00'] ] }, wed: { - active: true, + active: true, timeframes: [ ['04:00', '20:00'] ] }, thu: { - active: true, + active: true, timeframes: [ ['04:00', '20:00'] ] }, fri: { - active: true, + active: true, timeframes: [ ['04:00', '20:00'] ] }, sat: { - active: false, + active: false, timeframes: [ ['04:00', '13:00'] ] }, sun: { - active: false, + active: false, timeframes: [ ['04:00', '17:00'] ] }, }, public_holidays: { '2016-11-01' => { - 'active' => true, + 'active' => true, 'summary' => 'test 1', }, }, - default: true, - ical_url: nil, - updated_by_id: 1, - created_by_id: 1, + default: true, + ical_url: nil, + updated_by_id: 1, + created_by_id: 1, ) Scheduler.worker(true) @@ -2108,31 +2108,31 @@ class TicketSlaTest < ActiveSupport::TestCase Setting.set('ticket_last_contact_behaviour', 'based_on_customer_reaction') ticket = Ticket.create!( - title: 'test #1 last_contact_customer_at', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), - created_at: '2018-05-01 13:56:21 UTC', - updated_at: '2018-05-01 13:56:21 UTC', + title: 'test #1 last_contact_customer_at', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), + created_at: '2018-05-01 13:56:21 UTC', + updated_at: '2018-05-01 13:56:21 UTC', updated_by_id: 1, created_by_id: 1, ) assert(ticket, 'ticket created') article1 = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'phone').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'phone').first, updated_by_id: 1, created_by_id: 1, - created_at: '2018-05-01 13:56:21 UTC', - updated_at: '2018-05-01 13:56:21 UTC', + created_at: '2018-05-01 13:56:21 UTC', + updated_at: '2018-05-01 13:56:21 UTC', ) ticket.reload @@ -2144,18 +2144,18 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket.close_at) article2 = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'phone').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'phone').first, updated_by_id: 1, created_by_id: 1, - created_at: '2018-05-01 14:56:21 UTC', - updated_at: '2018-05-01 14:56:21 UTC', + created_at: '2018-05-01 14:56:21 UTC', + updated_at: '2018-05-01 14:56:21 UTC', ) ticket = Ticket.find(ticket.id) @@ -2167,18 +2167,18 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket.close_at) article3 = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Customer').first, - type: Ticket::Article::Type.where(name: 'phone').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Customer').first, + type: Ticket::Article::Type.where(name: 'phone').first, updated_by_id: 1, created_by_id: 1, - created_at: '2018-05-01 15:56:21 UTC', - updated_at: '2018-05-01 15:56:21 UTC', + created_at: '2018-05-01 15:56:21 UTC', + updated_at: '2018-05-01 15:56:21 UTC', ) ticket.reload @@ -2190,18 +2190,18 @@ class TicketSlaTest < ActiveSupport::TestCase assert_nil(ticket.close_at) article4 = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.where(name: 'Agent').first, - type: Ticket::Article::Type.where(name: 'phone').first, + ticket_id: ticket.id, + from: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.where(name: 'Agent').first, + type: Ticket::Article::Type.where(name: 'phone').first, updated_by_id: 1, created_by_id: 1, - created_at: '2018-05-01 16:56:21 UTC', - updated_at: '2018-05-01 16:56:21 UTC', + created_at: '2018-05-01 16:56:21 UTC', + updated_at: '2018-05-01 16:56:21 UTC', ) ticket.reload diff --git a/test/unit/ticket_state_change_test.rb b/test/unit/ticket_state_change_test.rb index 882711951..5c545587f 100644 --- a/test/unit/ticket_state_change_test.rb +++ b/test/unit/ticket_state_change_test.rb @@ -5,26 +5,26 @@ class TicketStateChangeTest < ActiveSupport::TestCase test 'check if after reply ticket is open' do ticket1 = Ticket.create!( - title: 'com test 1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'com test 1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) assert(ticket1, 'ticket created') article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_customer_com-1@example.com', - to: 'some_zammad_com-1@example.com', - subject: 'com test 1', - message_id: 'some@id_com_1', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_customer_com-1@example.com', + to: 'some_zammad_com-1@example.com', + subject: 'com test 1', + message_id: 'some@id_com_1', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -38,15 +38,15 @@ class TicketStateChangeTest < ActiveSupport::TestCase ticket1.with_lock do ticket1.update!(state_id: Ticket::State.find_by(name: 'new').id) article2 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_zammad_com-1@example.com', - to: 'some_customer_com-1@example.com', - subject: 'com test 1', - message_id: 'some@id_com_2', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_zammad_com-1@example.com', + to: 'some_customer_com-1@example.com', + subject: 'com test 1', + message_id: 'some@id_com_2', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -63,26 +63,26 @@ class TicketStateChangeTest < ActiveSupport::TestCase test 'check if after reply ticket is closed' do ticket1 = Ticket.create!( - title: 'com test 1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'com test 1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) assert(ticket1, 'ticket created') article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_customer_com-1@example.com', - to: 'some_zammad_com-1@example.com', - subject: 'com test 1', - message_id: 'some@id_com_1', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_customer_com-1@example.com', + to: 'some_zammad_com-1@example.com', + subject: 'com test 1', + message_id: 'some@id_com_1', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -97,15 +97,15 @@ class TicketStateChangeTest < ActiveSupport::TestCase ticket1.update!(state_id: Ticket::State.find_by(name: 'closed').id) article2 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_zammad_com-1@example.com', - to: 'some_customer_com-1@example.com', - subject: 'com test 1', - message_id: 'some@id_com_2', - body: 'some message 123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_zammad_com-1@example.com', + to: 'some_customer_com-1@example.com', + subject: 'com test 1', + message_id: 'some@id_com_2', + body: 'some message 123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_state_test.rb b/test/unit/ticket_state_test.rb index 62170d897..8ac6fecb8 100644 --- a/test/unit/ticket_state_test.rb +++ b/test/unit/ticket_state_test.rb @@ -12,14 +12,14 @@ class TicketStateTest < ActiveSupport::TestCase # add new state state_new2 = Ticket::State.create_if_not_exists( - name: 'new 2', + name: 'new 2', state_type_id: Ticket::StateType.find_by(name: 'new').id, updated_by_id: 1, created_by_id: 1, ) state_follow_up2 = Ticket::State.create_if_not_exists( - name: 'open 2', + name: 'open 2', state_type_id: Ticket::StateType.find_by(name: 'open').id, updated_by_id: 1, created_by_id: 1, @@ -43,19 +43,19 @@ class TicketStateTest < ActiveSupport::TestCase # add new state state_new3 = Ticket::State.create_if_not_exists( - name: 'new 3', - state_type_id: Ticket::StateType.find_by(name: 'new').id, + name: 'new 3', + state_type_id: Ticket::StateType.find_by(name: 'new').id, default_create: true, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) state_follow_up3 = Ticket::State.create_if_not_exists( - name: 'open 3', - state_type_id: Ticket::StateType.find_by(name: 'open').id, + name: 'open 3', + state_type_id: Ticket::StateType.find_by(name: 'open').id, default_follow_up: true, - updated_by_id: 1, - created_by_id: 1, + updated_by_id: 1, + created_by_id: 1, ) # verify states diff --git a/test/unit/ticket_test.rb b/test/unit/ticket_test.rb index c880bd1ad..057058670 100644 --- a/test/unit/ticket_test.rb +++ b/test/unit/ticket_test.rb @@ -8,11 +8,11 @@ class TicketTest < ActiveSupport::TestCase test 'ticket create' do ticket = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -24,15 +24,15 @@ class TicketTest < ActiveSupport::TestCase # create inbound article #1 article_inbound1 = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_inbound1 😍😍😍', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_inbound1 😍😍😍', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -49,15 +49,15 @@ class TicketTest < ActiveSupport::TestCase # create inbound article #2 travel 2.seconds article_inbound2 = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_inbound2 😍😍😍', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_inbound2 😍😍😍', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -73,13 +73,13 @@ class TicketTest < ActiveSupport::TestCase # create note article article_note = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some person', - subject: "some\nnote", - body: "some\n message", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket.id, + from: 'some person', + subject: "some\nnote", + body: "some\n message", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -97,15 +97,15 @@ class TicketTest < ActiveSupport::TestCase # create outbound article travel 2.seconds article_outbound = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_recipient@example.com', - to: 'some_sender@example.com', - subject: 'some subject', - message_id: 'some@id2', - body: 'some message 2', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_recipient@example.com', + to: 'some_sender@example.com', + subject: 'some subject', + message_id: 'some@id2', + body: 'some message 2', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -120,15 +120,15 @@ class TicketTest < ActiveSupport::TestCase # create inbound article #3 article_inbound3 = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_inbound3 😍😍😍', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_inbound3 😍😍😍', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -145,15 +145,15 @@ class TicketTest < ActiveSupport::TestCase # create inbound article #4 travel 2.seconds article_inbound4 = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message article_inbound4 😍😍😍', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message article_inbound4 😍😍😍', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -197,13 +197,13 @@ class TicketTest < ActiveSupport::TestCase # delete article article_note = Ticket::Article.create!( - ticket_id: ticket.id, - from: 'some person', - subject: 'some note', - body: 'some message', - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket.id, + from: 'some person', + subject: 'some note', + body: 'some message', + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -223,11 +223,11 @@ class TicketTest < ActiveSupport::TestCase test 'ticket latest change' do ticket1 = Ticket.create!( - title: 'latest change 1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'latest change 1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -236,11 +236,11 @@ class TicketTest < ActiveSupport::TestCase travel 1.minute ticket2 = Ticket.create!( - title: 'latest change 2', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'latest change 2', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -272,12 +272,12 @@ class TicketTest < ActiveSupport::TestCase end ticket = Ticket.create!( - title: 'pending close test', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'pending close'), - pending_time: Time.zone.now - 60, - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'pending close test', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'pending close'), + pending_time: Time.zone.now - 60, + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -294,11 +294,11 @@ class TicketTest < ActiveSupport::TestCase test 'ticket subject' do ticket = Ticket.create!( - title: 'subject test 1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'subject test 1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -313,11 +313,11 @@ class TicketTest < ActiveSupport::TestCase Setting.set('ticket_hook_position', 'left') ticket = Ticket.create!( - title: 'subject test 1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'subject test 1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -332,11 +332,11 @@ class TicketTest < ActiveSupport::TestCase Setting.set('ticket_hook_position', 'none') ticket = Ticket.create!( - title: 'subject test 1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'subject test 1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -356,11 +356,11 @@ class TicketTest < ActiveSupport::TestCase Setting.set('ticket_number', 'Ticket::Number::Increment') ticket1 = Ticket.create!( - title: 'subject test 1234-1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'subject test 1234-1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -370,11 +370,11 @@ class TicketTest < ActiveSupport::TestCase Setting.set('ticket_number', 'Ticket::Number::Date') ticket1 = Ticket.create!( - title: 'subject test 1234-2', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'subject test 1234-2', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -388,11 +388,11 @@ class TicketTest < ActiveSupport::TestCase test 'article attachment helper 1' do ticket1 = Ticket.create!( - title: 'some article helper test1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some article helper test1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -400,26 +400,26 @@ class TicketTest < ActiveSupport::TestCase # create inbound article #1 article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message article helper test1
asdasd
', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message article helper test1
asdasd
', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) store1 = Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: 'content_file1_normally_should_be_an_image', - filename: 'some_file1.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article1.id, + data: 'content_file1_normally_should_be_an_image', + filename: 'some_file1.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938@zammad.example.com', @@ -428,11 +428,11 @@ class TicketTest < ActiveSupport::TestCase created_by_id: 1, ) store2 = Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: 'content_file2_normally_should_be_an_image', - filename: 'some_file2.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article1.id, + data: 'content_file2_normally_should_be_an_image', + filename: 'some_file2.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140939@zammad.example.com', @@ -441,11 +441,11 @@ class TicketTest < ActiveSupport::TestCase created_by_id: 1, ) store3 = Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: 'content_file3', - filename: 'some_file3.txt', - preferences: { + object: 'Ticket::Article', + o_id: article1.id, + data: 'content_file3', + filename: 'some_file3.txt', + preferences: { 'Content-Type' => 'text/stream', 'Mime-Type' => 'text/stream', 'Content-ID' => '15.274327094.99999@zammad.example.com', @@ -474,11 +474,11 @@ class TicketTest < ActiveSupport::TestCase test 'article attachment helper 2' do ticket1 = Ticket.create!( - title: 'some article helper test2', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'some article helper test2', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -486,26 +486,26 @@ class TicketTest < ActiveSupport::TestCase # create inbound article #1 article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message article helper test2
asdasdBeschreibung: Beschreibung: efqmLogo
', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message article helper test2
asdasdBeschreibung: Beschreibung: efqmLogo
', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) store1 = Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: 'content_file1_normally_should_be_an_image', - filename: 'some_file1.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article1.id, + data: 'content_file1_normally_should_be_an_image', + filename: 'some_file1.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140938@zammad.example.com', @@ -514,11 +514,11 @@ class TicketTest < ActiveSupport::TestCase created_by_id: 1, ) store2 = Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: 'content_file2_normally_should_be_an_image', - filename: 'some_file2.jpg', - preferences: { + object: 'Ticket::Article', + o_id: article1.id, + data: 'content_file2_normally_should_be_an_image', + filename: 'some_file2.jpg', + preferences: { 'Content-Type' => 'image/jpeg', 'Mime-Type' => 'image/jpeg', 'Content-ID' => '15.274327094.140939@zammad.example.com', @@ -527,11 +527,11 @@ class TicketTest < ActiveSupport::TestCase created_by_id: 1, ) store3 = Store.add( - object: 'Ticket::Article', - o_id: article1.id, - data: 'content_file3', - filename: 'some_file3.txt', - preferences: { + object: 'Ticket::Article', + o_id: article1.id, + data: 'content_file3', + filename: 'some_file3.txt', + preferences: { 'Content-Type' => 'text/stream', 'Mime-Type' => 'text/stream', 'Content-ID' => '15.274327094.99999@zammad.example.com', diff --git a/test/unit/ticket_trigger_extended_recursive_disabled_test.rb b/test/unit/ticket_trigger_extended_recursive_disabled_test.rb index 8729166fe..e8d8aa031 100644 --- a/test/unit/ticket_trigger_extended_recursive_disabled_test.rb +++ b/test/unit/ticket_trigger_extended_recursive_disabled_test.rb @@ -8,49 +8,49 @@ class TicketTriggerExtendedRecursiveDisabledTest < ActiveSupport::TestCase test 'recursive trigger' do trigger1 = Trigger.create!( - name: '1) set prio to 3 high', - condition: { - 'ticket.action' => { + name: '1) set prio to 3 high', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '2) set state to closed', - condition: { - 'ticket.action' => { + name: '2) set state to closed', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = 'From: me@example.com @@ -70,66 +70,66 @@ Some Text' test 'recursive trigger - loop test' do trigger1 = Trigger.create!( - name: '1) set prio to 3 high', - condition: { + name: '1) set prio to 3 high', + condition: { 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '2) set prio to 1 low', - condition: { + name: '2) set prio to 1 low', + condition: { 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create!( - name: '3) set prio to 3 high', - condition: { + name: '3) set prio to 3 high', + condition: { 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, + 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = 'From: me@example.com @@ -149,76 +149,76 @@ Some Text' test 'recursive trigger - 2 trigger will not trigger next trigger' do trigger1 = Trigger.create!( - name: '1) set prio to 3 high', - condition: { - 'ticket.action' => { + name: '1) set prio to 3 high', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '2) set state to open', - condition: { - 'ticket.action' => { + name: '2) set state to open', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create!( - name: '3) set state to closed', - condition: { - 'ticket.action' => { + name: '3) set state to closed', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'open').id.to_s, + 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = 'From: me@example.com @@ -239,72 +239,72 @@ Some Text' test 'recursive trigger - 2 trigger will trigger next trigger - case 1' do trigger1 = Trigger.create!( - name: '1) set state to closed', - condition: { - 'ticket.action' => { + name: '1) set state to closed', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'open').id.to_s, + 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '2) set prio to 3 high', - condition: { - 'ticket.action' => { + name: '2) set prio to 3 high', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create!( - name: '3) set state to open', - condition: { + name: '3) set state to open', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = 'From: me@example.com @@ -325,76 +325,76 @@ Some Text' test 'recursive trigger - 2 trigger will trigger next trigger - case 2' do trigger1 = Trigger.create!( - name: '1) set prio to 3 high', - condition: { - 'ticket.action' => { + name: '1) set prio to 3 high', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'closed').id.to_s, + 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '2) set state to closed', - condition: { - 'ticket.action' => { + name: '2) set state to closed', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'open').id.to_s, + 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create!( - name: '3) set state to open', - condition: { + name: '3) set state to open', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = 'From: me@example.com @@ -417,108 +417,108 @@ Some Text' test 'trigger based move and verify correct agent notifications' do group1 = Group.create!( - name: 'Group 1', - active: true, + name: 'Group 1', + active: true, email_address: EmailAddress.first, created_by_id: 1, updated_by_id: 1, ) group2 = Group.create!( - name: 'Group 2', - active: true, + name: 'Group 2', + active: true, email_address: EmailAddress.first, created_by_id: 1, updated_by_id: 1, ) group3 = Group.create!( - name: 'Group 3', - active: true, + name: 'Group 3', + active: true, email_address: EmailAddress.first, created_by_id: 1, updated_by_id: 1, ) roles = Role.where(name: 'Agent') user1 = User.create!( - login: 'trigger1@example.org', - firstname: 'trigger1', - lastname: 'trigger1', - email: 'trigger1@example.org', - password: 'some_pass', - active: true, - groups: [group1], - roles: roles, + login: 'trigger1@example.org', + firstname: 'trigger1', + lastname: 'trigger1', + email: 'trigger1@example.org', + password: 'some_pass', + active: true, + groups: [group1], + roles: roles, created_by_id: 1, updated_by_id: 1, ) user2 = User.create!( - login: 'trigger2@example.org', - firstname: 'trigger2', - lastname: 'trigger2', - email: 'trigger2@example.org', - password: 'some_pass', - active: true, - groups: [group2], - roles: roles, + login: 'trigger2@example.org', + firstname: 'trigger2', + lastname: 'trigger2', + email: 'trigger2@example.org', + password: 'some_pass', + active: true, + groups: [group2], + roles: roles, created_by_id: 1, updated_by_id: 1, ) # trigger, move ticket created in group1 into group3 and then into group2 trigger1 = Trigger.create_or_update( - name: '1 dispatch', - condition: { - 'ticket.action' => { + name: '1 dispatch', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.group_id' => { 'operator' => 'is', - 'value' => group3.id.to_s, + 'value' => group3.id.to_s, }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'ticket.group_id' => { 'value' => group2.id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create_or_update( - name: '2 dispatch', - condition: { - 'ticket.action' => { + name: '2 dispatch', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'ticket.group_id' => { 'value' => group3.id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: '123', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: '123', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -529,15 +529,15 @@ Some Text' assert_equal(ticket1.state.name, 'new') article_inbound1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -568,78 +568,78 @@ Some Text' test 'recursive trigger loop check' do trigger0 = Trigger.create!( - name: '000', - condition: { - 'ticket.action' => { + name: '000', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, + 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger1 = Trigger.create!( - name: '001', - condition: { - 'ticket.action' => { + name: '001', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '002', - condition: { - 'ticket.action' => { + name: '002', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) group1 = Group.find_by(name: 'Users') ticket1 = Ticket.create!( - title: '123', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: '123', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -650,15 +650,15 @@ Some Text' assert_equal(ticket1.state.name, 'new') article_inbound1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_trigger_extended_test.rb b/test/unit/ticket_trigger_extended_test.rb index 8322567f2..3c6c57ada 100644 --- a/test/unit/ticket_trigger_extended_test.rb +++ b/test/unit/ticket_trigger_extended_test.rb @@ -8,49 +8,49 @@ class TicketTriggerExtendedTest < ActiveSupport::TestCase test 'recursive trigger' do trigger1 = Trigger.create!( - name: '1) set prio to 3 high', - condition: { - 'ticket.action' => { + name: '1) set prio to 3 high', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '2) set state to closed', - condition: { - 'ticket.action' => { + name: '2) set state to closed', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = 'From: me@example.com @@ -70,66 +70,66 @@ Some Text' test 'recursive trigger - loop test' do trigger1 = Trigger.create!( - name: '1) set prio to 3 high', - condition: { + name: '1) set prio to 3 high', + condition: { 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '2) set prio to 1 low', - condition: { + name: '2) set prio to 1 low', + condition: { 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create!( - name: '3) set prio to 3 high', - condition: { + name: '3) set prio to 3 high', + condition: { 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, + 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = 'From: me@example.com @@ -149,76 +149,76 @@ Some Text' test 'recursive trigger - 2 trigger will not trigger next trigger' do trigger1 = Trigger.create!( - name: '1) set prio to 3 high', - condition: { - 'ticket.action' => { + name: '1) set prio to 3 high', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '2) set state to open', - condition: { - 'ticket.action' => { + name: '2) set state to open', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create!( - name: '3) set state to closed', - condition: { - 'ticket.action' => { + name: '3) set state to closed', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'open').id.to_s, + 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = 'From: me@example.com @@ -239,72 +239,72 @@ Some Text' test 'recursive trigger - 2 trigger will trigger next trigger - case 1' do trigger1 = Trigger.create!( - name: '1) set state to closed', - condition: { - 'ticket.action' => { + name: '1) set state to closed', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'open').id.to_s, + 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '2) set prio to 3 high', - condition: { - 'ticket.action' => { + name: '2) set prio to 3 high', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create!( - name: '3) set state to open', - condition: { + name: '3) set state to open', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = 'From: me@example.com @@ -325,76 +325,76 @@ Some Text' test 'recursive trigger - 2 trigger will trigger next trigger - case 2' do trigger1 = Trigger.create!( - name: '1) set prio to 3 high', - condition: { - 'ticket.action' => { + name: '1) set prio to 3 high', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'closed').id.to_s, + 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '2) set state to closed', - condition: { - 'ticket.action' => { + name: '2) set state to closed', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'open').id.to_s, + 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create!( - name: '3) set state to open', - condition: { + name: '3) set state to open', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'open').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) email_raw_string = 'From: me@example.com @@ -417,108 +417,108 @@ Some Text' test 'trigger based move and verify correct agent notifications' do group1 = Group.create!( - name: 'Group 1', - active: true, + name: 'Group 1', + active: true, email_address: EmailAddress.first, created_by_id: 1, updated_by_id: 1, ) group2 = Group.create!( - name: 'Group 2', - active: true, + name: 'Group 2', + active: true, email_address: EmailAddress.first, created_by_id: 1, updated_by_id: 1, ) group3 = Group.create!( - name: 'Group 3', - active: true, + name: 'Group 3', + active: true, email_address: EmailAddress.first, created_by_id: 1, updated_by_id: 1, ) roles = Role.where(name: 'Agent') user1 = User.create!( - login: 'trigger1@example.org', - firstname: 'trigger1', - lastname: 'trigger1', - email: 'trigger1@example.org', - password: 'some_pass', - active: true, - groups: [group1], - roles: roles, + login: 'trigger1@example.org', + firstname: 'trigger1', + lastname: 'trigger1', + email: 'trigger1@example.org', + password: 'some_pass', + active: true, + groups: [group1], + roles: roles, created_by_id: 1, updated_by_id: 1, ) user2 = User.create!( - login: 'trigger2@example.org', - firstname: 'trigger2', - lastname: 'trigger2', - email: 'trigger2@example.org', - password: 'some_pass', - active: true, - groups: [group2], - roles: roles, + login: 'trigger2@example.org', + firstname: 'trigger2', + lastname: 'trigger2', + email: 'trigger2@example.org', + password: 'some_pass', + active: true, + groups: [group2], + roles: roles, created_by_id: 1, updated_by_id: 1, ) # trigger, move ticket created in group1 into group3 and then into group2 trigger1 = Trigger.create_or_update( - name: '1 dispatch', - condition: { - 'ticket.action' => { + name: '1 dispatch', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.group_id' => { 'operator' => 'is', - 'value' => group3.id.to_s, + 'value' => group3.id.to_s, }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'ticket.group_id' => { 'value' => group2.id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create_or_update( - name: '2 dispatch', - condition: { - 'ticket.action' => { + name: '2 dispatch', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'ticket.group_id' => { 'value' => group3.id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: '123', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: '123', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -529,15 +529,15 @@ Some Text' assert_equal(ticket1.state.name, 'new') article_inbound1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -569,78 +569,78 @@ Some Text' test 'recursive trigger loop check' do Setting.set('ticket_trigger_recursive_max_loop', 2) trigger0 = Trigger.create!( - name: '000', - condition: { - 'ticket.action' => { + name: '000', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, + 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, }, }, - perform: { + perform: { 'ticket.state_id' => { 'value' => Ticket::State.lookup(name: 'closed').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger1 = Trigger.create!( - name: '001', - condition: { - 'ticket.action' => { + name: '001', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create!( - name: '002', - condition: { - 'ticket.action' => { + name: '002', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, + 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) group1 = Group.find_by(name: 'Users') ticket1 = Ticket.create!( - title: '123', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: '123', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -651,15 +651,15 @@ Some Text' assert_equal(ticket1.state.name, 'new') article_inbound1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -676,11 +676,11 @@ Some Text' Setting.set('ticket_trigger_recursive_max_loop', 3) ticket1 = Ticket.create!( - title: '123', - group: group1, - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: '123', + group: group1, + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -691,15 +691,15 @@ Some Text' assert_equal(ticket1.state.name, 'new') article_inbound1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -718,100 +718,100 @@ Some Text' test 'recursive trigger with auto responder' do group1 = Group.create!( - name: 'Group dispatch', - active: true, + name: 'Group dispatch', + active: true, created_by_id: 1, updated_by_id: 1, ) group2 = Group.create!( - name: 'Group with auto responder', - active: true, + name: 'Group with auto responder', + active: true, email_address: EmailAddress.first, created_by_id: 1, updated_by_id: 1, ) trigger1 = Trigger.create!( - name: "002 - move ticket to #{group2.name}", - condition: { - 'ticket.action' => { + name: "002 - move ticket to #{group2.name}", + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, - 'ticket.group_id' => { + 'ticket.group_id' => { 'operator' => 'is', - 'value' => group1.id.to_s, + 'value' => group1.id.to_s, }, 'ticket.organization_id' => { - 'operator' => 'is', + 'operator' => 'is', 'pre_condition' => 'specific', - 'value' => User.lookup(email: 'nicole.braun@zammad.org').organization_id.to_s, + 'value' => User.lookup(email: 'nicole.braun@zammad.org').organization_id.to_s, } }, - perform: { + perform: { 'ticket.group_id' => { 'value' => group2.id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create_or_update( - name: "001 auto reply for tickets in group #{group1.name}", - condition: { - 'ticket.action' => { + name: "001 auto reply for tickets in group #{group1.name}", + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, 'ticket.group_id' => { 'operator' => 'is not', - 'value' => group1.id.to_s, + 'value' => group1.id.to_s, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => "some text
\#{ticket.customer.lastname}
\#{ticket.title}
\#{article.body}", + 'body' => "some text
\#{ticket.customer.lastname}
\#{ticket.title}
\#{article.body}", 'recipient' => 'ticket_customer', - 'subject' => "Thanks for your inquiry (\#{ticket.title})!", + 'subject' => "Thanks for your inquiry (\#{ticket.title})!", }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk', + 'value' => 'aa, kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: group1, - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: group1, + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'web'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'web'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_trigger_recursive_disabled_test.rb b/test/unit/ticket_trigger_recursive_disabled_test.rb index a2ddc95ed..c821af298 100644 --- a/test/unit/ticket_trigger_recursive_disabled_test.rb +++ b/test/unit/ticket_trigger_recursive_disabled_test.rb @@ -8,170 +8,170 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '1 basic' do trigger1 = Trigger.create_or_update( - name: 'aaa loop check', - condition: { + name: 'aaa loop check', + condition: { 'article.subject' => { 'operator' => 'contains', - 'value' => 'Thanks for your inquiry', + 'value' => 'Thanks for your inquiry', }, }, - perform: { - 'ticket.tags' => { + perform: { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'should_not_loop', + 'value' => 'should_not_loop', }, 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk', + 'value' => 'aa, kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create_or_update( - name: 'auto tag 1', - condition: { - 'ticket.action' => { + name: 'auto tag 1', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'remove', - 'value' => 'kk', + 'value' => 'kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger4 = Trigger.create_or_update( - name: 'auto tag 2', - condition: { + name: 'auto tag 2', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'ticket.tags' => { 'operator' => 'add', - 'value' => 'abc', + 'value' => 'abc', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger5 = Trigger.create_or_update( - name: 'not matching', - condition: { + name: 'not matching', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'closed').id.to_s, + 'value' => Ticket::State.lookup(name: 'closed').id.to_s, } }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger6 = Trigger.create_or_update( - name: 'zzz last', - condition: { + name: 'zzz last', + condition: { 'article.subject' => { 'operator' => 'contains', - 'value' => 'some subject 1234', + 'value' => 'some subject 1234', }, }, - perform: { - 'ticket.tags' => { + perform: { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'article_create_trigger', + 'value' => 'article_create_trigger', }, 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -240,11 +240,11 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(%w[aa abc], ticket1.tag_list) ticket2 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -267,25 +267,25 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal([], ticket2.tag_list) ticket3 = Ticket.create!( - title: "some title\n äöüß3", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß3", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) assert(ticket3, 'ticket3 created') Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -321,16 +321,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('text/html', article3.content_type) Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject - not 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject - not 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -346,16 +346,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(%w[aa abc article_create_trigger], ticket3.tag_list) Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject NOT 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject NOT 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -371,16 +371,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(%w[aa abc article_create_trigger], ticket3.tag_list) Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -398,37 +398,37 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '2 actions - create' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'dasdasdasd', + 'body' => 'dasdasdasd', 'recipient' => 'ticket_customer', - 'subject' => 'asdasdas', + 'subject' => 'asdasdas', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) @@ -491,37 +491,37 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '2 actions - update' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'dasdasdasd', + 'body' => 'dasdasdasd', 'recipient' => 'ticket_customer', - 'subject' => 'asdasdas', + 'subject' => 'asdasdas', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) @@ -579,54 +579,54 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '3 auto replys' do roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'postmaster@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'postmaster@example.com', - password: 'customerpw', - active: true, - roles: roles, - updated_at: '2015-02-05 16:37:00', + login: 'postmaster@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'postmaster@example.com', + password: 'customerpw', + active: true, + roles: roles, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) customer2 = User.create_or_update( - login: 'ticket-auto-reply-customer2@example.com', - firstname: 'Trigger', - lastname: 'Customer2', - email: 'ticket-auto-reply-customer2@example.com', - password: 'customerpw', - active: true, + login: 'ticket-auto-reply-customer2@example.com', + firstname: 'Trigger', + lastname: 'Customer2', + email: 'ticket-auto-reply-customer2@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) trigger1 = Trigger.create_or_update( - name: 'auto reply - new ticket', - condition: { - 'ticket.action' => { + name: 'auto reply - new ticket', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is not', - 'value' => Ticket::State.lookup(name: 'closed').id, + 'value' => Ticket::State.lookup(name: 'closed').id, }, 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '

Your request (Ticket##{ticket.number}) has been received and will be reviewed by our support staff.

+ 'body' => '

Your request (Ticket##{ticket.number}) has been received and will be reviewed by our support staff.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -634,38 +634,38 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})', + 'subject' => 'Thanks for your inquiry (#{ticket.title})', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create_or_update( - name: 'auto reply (on follow up of tickets)', - condition: { - 'ticket.action' => { + name: 'auto reply (on follow up of tickets)', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '

Your follow up for (#{config.ticket_hook}##{ticket.number}) has been received and will be reviewed by our support staff.

+ 'body' => '

Your follow up for (#{config.ticket_hook}##{ticket.number}) has been received and will be reviewed by our support staff.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -673,37 +673,37 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your follow up (#{ticket.title})', + 'subject' => 'Thanks for your follow up (#{ticket.title})', }, }, - active: true, + active: true, created_by_id: 1, updated_by_id: 1, ) trigger3 = Trigger.create_or_update( - name: 'not matching', - condition: { - 'ticket.action' => { + name: 'not matching', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'closed').id.to_s, + 'value' => Ticket::State.lookup(name: 'closed').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => '2some text
#{ticket.customer.lastname}
#{ticket.title}', + 'body' => '2some text
#{ticket.customer.lastname}
#{ticket.title}', 'recipient' => 'ticket_customer', - 'subject' => '2Thanks for your inquiry (#{ticket.title})!', + 'subject' => '2Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # process mail without Precedence header @@ -733,15 +733,15 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(2, ticket_p.articles.count, 'ticket_p.articles verify') article_p = Ticket::Article.create!( - ticket_id: ticket_p.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket_p.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -753,15 +753,15 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(3, ticket_p.articles.count, 'ticket_p.articles verify') article_p = Ticket::Article.create!( - ticket_id: ticket_p.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket_p.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -773,15 +773,15 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(4, ticket_p.articles.count, 'ticket_p.articles verify') article_p = Ticket::Article.create!( - ticket_id: ticket_p.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket_p.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -804,15 +804,15 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase ticket_p.state = Ticket::State.lookup(name: 'open') ticket_p.save! article_p = Ticket::Article.create!( - ticket_id: ticket_p.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket_p.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -857,58 +857,58 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '4 has changed' do roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'postmaster@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'postmaster@example.com', - password: 'customerpw', - active: true, - roles: roles, - updated_at: '2015-02-05 16:37:00', + login: 'postmaster@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'postmaster@example.com', + password: 'customerpw', + active: true, + roles: roles, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) customer2 = User.create_or_update( - login: 'ticket-has-changed-customer2@example.com', - firstname: 'Trigger', - lastname: 'Customer2', - email: 'ticket-has-changed-customer2@example.com', - password: 'customerpw', - active: true, + login: 'ticket-has-changed-customer2@example.com', + firstname: 'Trigger', + lastname: 'Customer2', + email: 'ticket-has-changed-customer2@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'agent-has-changed@example.com', - firstname: 'Has Changed', - lastname: 'Agent1', - email: 'agent-has-changed@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'agent-has-changed@example.com', + firstname: 'Has Changed', + lastname: 'Agent1', + email: 'agent-has-changed@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) trigger1 = Trigger.create_or_update( - name: 'owner update - to customer', - condition: { + name: 'owner update - to customer', + condition: { 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', } }, - perform: { + perform: { 'notification.email' => { - 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.

+ 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -916,13 +916,13 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Owner has changed (#{ticket.title})', + 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # process mail without Precedence header @@ -958,22 +958,22 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('text/html', article_p.content_type) trigger1 = Trigger.create_or_update( - name: 'owner update - to customer', - condition: { - 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + name: 'owner update - to customer', + condition: { + 'ticket.owner_id' => { + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.

+ 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -981,13 +981,13 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Owner has changed (#{ticket.title})', + 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # process mail without Precedence header @@ -1039,26 +1039,26 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase # should trigger trigger1 = Trigger.create_or_update( - name: 'owner update - to customer', - condition: { - 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + name: 'owner update - to customer', + condition: { + 'ticket.owner_id' => { + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is not', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.

+ 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -1066,13 +1066,13 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Owner has changed (#{ticket.title})', + 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # process mail without Precedence header @@ -1123,22 +1123,22 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase # should not trigger trigger1 = Trigger.create_or_update( - name: 'owner update - to customer', - condition: { + name: 'owner update - to customer', + condition: { 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.

+ 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -1146,13 +1146,13 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Owner has changed (#{ticket.title})', + 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # process mail without Precedence header @@ -1173,62 +1173,62 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '5 notify owner' do trigger1 = Trigger.create_or_update( - name: 'aaa notify mail', - condition: { + name: 'aaa notify mail', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.all.pluck(:id), + 'value' => Ticket::State.all.pluck(:id), }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_owner', - 'subject' => 'CC NOTE (#{ticket.title})!', + 'subject' => 'CC NOTE (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - owner: agent, - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 123', + owner: agent, + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1245,16 +1245,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(1, ticket1.articles.count) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', - content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', + content_type: 'text/html', + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1263,41 +1263,41 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(3, ticket1.articles.count) trigger1 = Trigger.create_or_update( - name: 'aaa notify mail 2', - condition: { + name: 'aaa notify mail 2', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.all.pluck(:id), + 'value' => Ticket::State.all.pluck(:id), }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_owner', - 'subject' => 'CC NOTE (#{ticket.title})!', + 'subject' => 'CC NOTE (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', - content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', + content_type: 'text/html', + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1308,64 +1308,64 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '6 owner auto assignment' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { + name: 'aaa auto assignment', + condition: { 'ticket.owner_id' => { - 'operator' => 'is', - 'pre_condition' => 'not_set', - 'value' => '', + 'operator' => 'is', + 'pre_condition' => 'not_set', + 'value' => '', 'value_completion' => '', }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'ticket.owner_id' => { - 'pre_condition' => 'current_user.id', - 'value' => '', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', + title: 'test 123', #owner: agent, - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1381,16 +1381,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase UserInfo.current_user_id = agent.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1422,76 +1422,76 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '6.1 owner auto assignment based on organization' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { + name: 'aaa auto assignment', + condition: { 'ticket.organization_id' => { - 'operator' => 'is not', - 'pre_condition' => 'not_set', - 'value' => '', + 'operator' => 'is not', + 'pre_condition' => 'not_set', + 'value' => '', 'value_completion' => '', }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'ticket.owner_id' => { - 'pre_condition' => 'current_user.id', - 'value' => '', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) roles = Role.where(name: 'Agent') groups = Group.where(name: 'Users') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( - login: 'customer@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer@example.com', - password: 'customerpw', - vip: true, - active: true, - roles: roles, + login: 'customer@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer@example.com', + password: 'customerpw', + vip: true, + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - group: Group.lookup(name: 'Users'), - customer: customer, + title: 'test 123', + group: Group.lookup(name: 'Users'), + customer: customer, updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1509,16 +1509,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase UserInfo.current_user_id = agent.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1535,76 +1535,76 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '6.2 owner auto assignment based on organization' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { + name: 'aaa auto assignment', + condition: { 'ticket.organization_id' => { - 'operator' => 'is', - 'pre_condition' => 'not_set', - 'value' => '', + 'operator' => 'is', + 'pre_condition' => 'not_set', + 'value' => '', 'value_completion' => '', }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'ticket.owner_id' => { - 'pre_condition' => 'current_user.id', - 'value' => '', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( - login: 'customer@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer@example.com', - password: 'customerpw', - vip: true, - active: true, - roles: roles, + login: 'customer@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer@example.com', + password: 'customerpw', + vip: true, + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 123', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1622,16 +1622,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase UserInfo.current_user_id = agent.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1648,80 +1648,80 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '7 owner auto assignment' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { - 'ticket.owner_id' => { - 'operator' => 'is', - 'pre_condition' => 'not_set', - 'value' => '', + name: 'aaa auto assignment', + condition: { + 'ticket.owner_id' => { + 'operator' => 'is', + 'pre_condition' => 'not_set', + 'value' => '', 'value_completion' => '', }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Type.find_by(name: 'note'), + 'value' => Ticket::Article::Type.find_by(name: 'note'), }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.find_by(name: 'Agent'), + 'value' => Ticket::Article::Sender.find_by(name: 'Agent'), }, }, - perform: { + perform: { 'ticket.owner_id' => { - 'pre_condition' => 'current_user.id', - 'value' => '', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent2', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent2', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', + title: 'test 123', #owner: agent, - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1737,16 +1737,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase UserInfo.current_user_id = agent1.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1776,16 +1776,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase UserInfo.current_user_id = agent1.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1815,16 +1815,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase UserInfo.current_user_id = agent1.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1841,70 +1841,70 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '8 owner auto assignment' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { - 'ticket.owner_id' => { - 'operator' => 'is', - 'pre_condition' => 'not_set', - 'value' => '', + name: 'aaa auto assignment', + condition: { + 'ticket.owner_id' => { + 'operator' => 'is', + 'pre_condition' => 'not_set', + 'value' => '', 'value_completion' => '', }, 'ticket.priority_id' => { - 'operator' => 'has changed', - 'pre_condition' => '', - 'value' => '2', + 'operator' => 'has changed', + 'pre_condition' => '', + 'value' => '2', 'value_completion' => '', }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'ticket.owner_id' => { - 'pre_condition' => 'current_user.id', - 'value' => '', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', + title: 'test 123', #owner: agent, - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1920,16 +1920,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase UserInfo.current_user_id = agent.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1991,69 +1991,69 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '9 vip priority set' do trigger1 = Trigger.create_or_update( - name: 'aaa vip priority', - condition: { + name: 'aaa vip priority', + condition: { 'customer.vip' => { 'operator' => 'is', - 'value' => true, + 'value' => true, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.find_by(name: '3 high').id, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( - login: 'customer@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer@example.com', - password: 'customerpw', - vip: true, - active: true, - roles: roles, + login: 'customer@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer@example.com', + password: 'customerpw', + vip: true, + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - owner: agent, - customer: customer, - group: Group.lookup(name: 'Users'), + title: 'test 123', + owner: agent, + customer: customer, + group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2083,23 +2083,23 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase customer.save! ticket2 = Ticket.create!( - title: 'test 123', - owner: agent, - customer: customer, - group: Group.lookup(name: 'Users'), + title: 'test 123', + owner: agent, + customer: customer, + group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2129,71 +2129,71 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '10 owner auto assignment notify to customer' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { + name: 'aaa auto assignment', + condition: { 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => '', - 'value' => '2', + 'operator' => 'has changed', + 'pre_condition' => '', + 'value' => '2', 'value_completion' => '', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'NEW OWNER (#{ticket.title})!', + 'subject' => 'NEW OWNER (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'agent1@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent1@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( - login: 'agent2@example.com', - firstname: 'Trigger', - lastname: 'Agent2', - email: 'agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent2@example.com', + firstname: 'Trigger', + lastname: 'Agent2', + email: 'agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 123', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2256,81 +2256,81 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '11 notify to customer on public note' do trigger1 = Trigger.create_or_update( - name: 'aaa notify to customer on public note', - condition: { - 'article.internal' => { + name: 'aaa notify to customer on public note', + condition: { + 'article.internal' => { 'operator' => 'is', - 'value' => 'false', + 'value' => 'false', }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'note').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'UPDATE (#{ticket.title})!', + 'subject' => 'UPDATE (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( - login: 'customer@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer@example.com', - password: 'customerpw', - vip: true, - active: true, - roles: roles, + login: 'customer@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer@example.com', + password: 'customerpw', + vip: true, + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - owner: agent, - customer: customer, - group: Group.lookup(name: 'Users'), + title: 'test 123', + owner: agent, + customer: customer, + group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2348,15 +2348,15 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal([], ticket1.tag_list) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2373,15 +2373,15 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal([], ticket1.tag_list) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2400,15 +2400,15 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase ticket1.priority = Ticket::Priority.find_by(name: '3 high') ticket1.save! article = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2439,15 +2439,15 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal([], ticket1.tag_list) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2466,41 +2466,41 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '12 notify on owner change' do trigger1 = Trigger.create_or_update( - name: 'aaa notify to customer on public note', - condition: { + name: 'aaa notify to customer on public note', + condition: { 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'UPDATE (#{ticket.title})!', + 'subject' => 'UPDATE (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply (on new tickets)', - condition: { - 'ticket.action' => { + name: 'auto reply (on new tickets)', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is not', - 'value' => Ticket::State.lookup(name: 'closed').id, + 'value' => Ticket::State.lookup(name: 'closed').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, @@ -2508,12 +2508,12 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '
Your request (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.
+ 'body' => '
Your request (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.

To provide additional information, please reply to this email or click on the following link (for initial login, please request a new password): #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -2523,36 +2523,36 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase
Zammad, your customer support system
', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})', + 'subject' => 'Thanks for your inquiry (#{ticket.title})', }, }, - active: true, + active: true, created_by_id: 1, updated_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply (on follow up of tickets)', - condition: { - 'ticket.action' => { + name: 'auto reply (on follow up of tickets)', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '
Your follow up for (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.
+ 'body' => '
Your follow up for (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.

To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -2562,10 +2562,10 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase
Zammad, your customer support system
', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your follow up (#{ticket.title})', + 'subject' => 'Thanks for your follow up (#{ticket.title})', }, }, - active: true, + active: true, created_by_id: 1, updated_by_id: 1, ) @@ -2573,49 +2573,49 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( - login: 'customer@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer@example.com', - password: 'customerpw', - vip: true, - active: true, - roles: roles, + login: 'customer@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer@example.com', + password: 'customerpw', + vip: true, + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', + title: 'test 123', #owner: agent, - customer: customer, - group: Group.lookup(name: 'Users'), + customer: customer, + group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'web'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'web'), updated_by_id: 1, created_by_id: 1, ) @@ -2649,15 +2649,15 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal([], ticket1.tag_list) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'web'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'web'), updated_by_id: 1, created_by_id: 1, ) @@ -2695,71 +2695,71 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '1 empty condition should not create errors' do assert_raises(Exception) do trigger_empty = Trigger.create_or_update( - name: 'aaa loop check', - condition: { + name: 'aaa loop check', + condition: { 'ticket.number' => { 'operator' => 'contains', 'value' => '', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) end end test 'article_last_sender trigger -> reply_to' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient+from@example.com', - reply_to: 'some_recipient+reply_to@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient+from@example.com', + reply_to: 'some_recipient+reply_to@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2776,46 +2776,46 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test 'article_last_sender trigger -> from' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender+from@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender+from@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -2832,59 +2832,59 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test 'article_last_sender trigger -> origin_by_id' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'customer+origin_by_id@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer+origin_by_id@example.com', - password: 'customerpw', - active: true, - roles: roles, - updated_at: '2015-02-05 16:37:00', + login: 'customer+origin_by_id@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer+origin_by_id@example.com', + password: 'customerpw', + active: true, + roles: roles, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), - origin_by_id: customer1.id, + ticket_id: ticket1.id, + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), + origin_by_id: customer1.id, updated_by_id: 1, created_by_id: 1, ) @@ -2901,58 +2901,58 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test 'article_last_sender trigger -> created_by_id' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'customer+created_by_id@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer+created_by_id@example.com', - password: 'customerpw', - active: true, - roles: roles, - updated_at: '2015-02-05 16:37:00', + login: 'customer+created_by_id@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer+created_by_id@example.com', + password: 'customerpw', + active: true, + roles: roles, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: customer1.id, created_by_id: customer1.id, ) @@ -2969,60 +2969,60 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test 'multiple recipients owner_id, article_last_sender(reply_to) trigger' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => %w[ticket_owner article_last_sender], - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) admin = User.create_or_update( - login: 'admin+owner_recipient@example.com', - firstname: 'Role', - lastname: "Admin#{name}", - email: 'admin+owner_recipient@example.com', - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), - groups: Group.where(name: 'Users'), + login: 'admin+owner_recipient@example.com', + firstname: 'Role', + lastname: "Admin#{name}", + email: 'admin+owner_recipient@example.com', + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), + groups: Group.where(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), - owner_id: admin.id, + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), + owner_id: admin.id, updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient+from@example.com', - reply_to: 'some_recipient+reply_to@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient+from@example.com', + reply_to: 'some_recipient+reply_to@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3040,47 +3040,47 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test 'article_last_sender trigger -> invalid reply_to' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient+from@example.com', - reply_to: 'Blub blub blub some_recipient+reply_to@example', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient+from@example.com', + reply_to: 'Blub blub blub some_recipient+reply_to@example', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3094,55 +3094,55 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '2 loop check' do trigger1 = Trigger.create_or_update( - name: 'aaa loop check', - condition: { - 'ticket.state_id' => { + name: 'aaa loop check', + condition: { + 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.all.pluck(:id), + 'value' => Ticket::State.all.pluck(:id), }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: 'loop try 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'loop try 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3161,16 +3161,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(2, ticket1.articles.count) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3182,16 +3182,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[3].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3203,16 +3203,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[5].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3224,16 +3224,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[7].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3245,16 +3245,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[9].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3266,16 +3266,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[11].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3287,16 +3287,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[13].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3308,16 +3308,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[15].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3329,16 +3329,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[17].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3350,16 +3350,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[19].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3370,16 +3370,16 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('some_loop_sender@example.com', ticket1.articles[20].from) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3393,85 +3393,85 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '3 invalid condition' do trigger1 = Trigger.create_or_update( - name: 'aaa loop check', - condition: { + name: 'aaa loop check', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'ticket.tags' => { 'operator' => 'add', - 'value' => 'xxx', + 'value' => 'xxx', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger1.update_column(:condition, { - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.first_response_at' => { 'operator' => 'before (absolute)', - 'value' => 'invalid invalid 4', + 'value' => 'invalid invalid 4', }, }) assert_equal('invalid invalid 4', trigger1.condition['ticket.first_response_at']['value']) trigger2 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk', + 'value' => 'aa, kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3505,100 +3505,100 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test '4 tag based auto response' do trigger1 = Trigger.create_or_update( - name: '100 add tag if sender 1', - condition: { + name: '100 add tag if sender 1', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, - 'article.from' => { + 'article.from' => { 'operator' => 'contains', - 'value' => 'sender1', + 'value' => 'sender1', }, }, - perform: { + perform: { 'ticket.tags' => { 'operator' => 'add', - 'value' => 'sender1', + 'value' => 'sender1', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create_or_update( - name: '200 add tag if sender 2', - condition: { + name: '200 add tag if sender 2', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, - 'article.from' => { + 'article.from' => { 'operator' => 'contains', - 'value' => 'sender2', + 'value' => 'sender2', }, }, - perform: { + perform: { 'ticket.tags' => { 'operator' => 'add', - 'value' => 'sender2', + 'value' => 'sender2', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create_or_update( - name: '300 auto reply', - condition: { - 'ticket.action' => { + name: '300 auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { #'operator' => 'contains one not', 'operator' => 'contains all not', - 'value' => 'sender1, sender2', + 'value' => 'sender1, sender2', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'sender1@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'sender1@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3620,22 +3620,22 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(%w[sender1], ticket1.tag_list) ticket2 = Ticket.create!( - title: 'test 2', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 2', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'sender2@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket2.id, + from: 'sender2@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3659,23 +3659,23 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(%w[sender2], ticket2.tag_list) ticket3 = Ticket.create!( - title: 'test 3', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 3', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) assert(ticket3, 'ticket3 created') Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'sender0@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket3.id, + from: 'sender0@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3701,55 +3701,55 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test 'article.body' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, - 'article.body' => { + 'article.body' => { 'operator' => 'contains', - 'value' => 'hello', + 'value' => 'hello', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk', + 'value' => 'aa, kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note hello ', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note hello ', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3779,22 +3779,22 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('text/html', article1.content_type) ticket2 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3817,55 +3817,55 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(%w[], ticket2.tag_list) trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, - 'article.body' => { + 'article.body' => { 'operator' => 'contains not', - 'value' => 'hello', + 'value' => 'hello', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk', + 'value' => 'aa, kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket3 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note hello ', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note hello ', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3888,22 +3888,22 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal(%w[], ticket3.tag_list) ticket4 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket4.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note 2', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket4.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note 2', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3938,95 +3938,95 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase roles = Role.where(name: 'Agent') groups = Group.where(name: 'Users') agent1 = User.create_or_update( - login: 'agent-has-changed@example.com', - firstname: 'Has Changed', - lastname: 'Agent1', - email: 'agent-has-changed@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'agent-has-changed@example.com', + firstname: 'Has Changed', + lastname: 'Agent1', + email: 'agent-has-changed@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( - login: 'agent-has-changed2@example.com', - firstname: 'Has Changed', - lastname: 'Agent2', - email: 'agent-has-changed2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'agent-has-changed2@example.com', + firstname: 'Has Changed', + lastname: 'Agent2', + email: 'agent-has-changed2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) # multi tag trigger with changed owner trigger1 = Trigger.create_or_update( - name: 'change owner', - condition: { + name: 'change owner', + condition: { 'ticket.owner_id' => { 'operator' => 'has changed', }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'contains one not', - 'value' => 'nosendmail test123' + 'value' => 'nosendmail test123' } }, - perform: { - 'ticket.tags' => { + perform: { + 'ticket.tags' => { 'operator' => 'add', - 'value' => '123' + 'value' => '123' }, 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # single tag trigger with changed owner trigger2 = Trigger.create_or_update( - name: 'change owner', - condition: { + name: 'change owner', + condition: { 'ticket.owner_id' => { 'operator' => 'has changed', }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'contains one not', - 'value' => 'nosendmail2', + 'value' => 'nosendmail2', } }, - perform: { - 'ticket.tags' => { + perform: { + 'ticket.tags' => { 'operator' => 'add', - 'value' => '123' + 'value' => '123' }, 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) @@ -4040,9 +4040,9 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal([], ticket1.tag_list, 'ticket1.tag_list') ticket2 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) @@ -4136,48 +4136,48 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test 'trigger auto reply with umlaut in form' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'Sabine Schütz ', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note hello ', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'Sabine Schütz ', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note hello ', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -4210,28 +4210,28 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test 'trigger auto reply with 2 sender addresses in form' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1, article1, user, mail = Channel::EmailParser.new.process({}, File.read(Rails.root.join('test', 'data', 'mail', 'mail065.box'))) @@ -4251,28 +4251,28 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase test 'make sure attachments should be attached with content id' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}
', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}
', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1, article1, user, mail = Channel::EmailParser.new.process({}, File.read(Rails.root.join('test', 'data', 'mail', 'mail065.box'))) diff --git a/test/unit/ticket_trigger_test.rb b/test/unit/ticket_trigger_test.rb index c8563448f..26b6ae24f 100644 --- a/test/unit/ticket_trigger_test.rb +++ b/test/unit/ticket_trigger_test.rb @@ -8,170 +8,170 @@ class TicketTriggerTest < ActiveSupport::TestCase test '1 basic' do trigger1 = Trigger.create_or_update( - name: 'aaa loop check', - condition: { + name: 'aaa loop check', + condition: { 'article.subject' => { 'operator' => 'contains', - 'value' => 'Thanks for your inquiry', + 'value' => 'Thanks for your inquiry', }, }, - perform: { - 'ticket.tags' => { + perform: { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'should_not_loop', + 'value' => 'should_not_loop', }, 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - loop check - only once (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - loop check - only once (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk', + 'value' => 'aa, kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create_or_update( - name: 'auto tag 1', - condition: { - 'ticket.action' => { + name: 'auto tag 1', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'remove', - 'value' => 'kk', + 'value' => 'kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger4 = Trigger.create_or_update( - name: 'auto tag 2', - condition: { + name: 'auto tag 2', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'ticket.tags' => { 'operator' => 'add', - 'value' => 'abc', + 'value' => 'abc', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger5 = Trigger.create_or_update( - name: 'not matching', - condition: { + name: 'not matching', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'closed').id.to_s, + 'value' => Ticket::State.lookup(name: 'closed').id.to_s, } }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger6 = Trigger.create_or_update( - name: 'zzz last', - condition: { + name: 'zzz last', + condition: { 'article.subject' => { 'operator' => 'contains', - 'value' => 'some subject 1234', + 'value' => 'some subject 1234', }, }, - perform: { - 'ticket.tags' => { + perform: { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'article_create_trigger', + 'value' => 'article_create_trigger', }, 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -248,11 +248,11 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(%w[aa should_not_loop abc], ticket1.tag_list) ticket2 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), - state: Ticket::State.lookup(name: 'open'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), + state: Ticket::State.lookup(name: 'open'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -275,25 +275,25 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal([], ticket2.tag_list) ticket3 = Ticket.create!( - title: "some title\n äöüß3", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß3", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) assert(ticket3, 'ticket3 created') Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -335,16 +335,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('text/html', article4.content_type) Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject - not 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject - not 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -360,16 +360,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(%w[aa should_not_loop abc article_create_trigger], ticket3.tag_list) Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject NOT 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject NOT 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -385,16 +385,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(%w[aa should_not_loop abc article_create_trigger], ticket3.tag_list) Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -412,37 +412,37 @@ class TicketTriggerTest < ActiveSupport::TestCase test '2 actions - create' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'dasdasdasd', + 'body' => 'dasdasdasd', 'recipient' => 'ticket_customer', - 'subject' => 'asdasdas', + 'subject' => 'asdasdas', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) @@ -505,37 +505,37 @@ class TicketTriggerTest < ActiveSupport::TestCase test '2 actions - update' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'dasdasdasd', + 'body' => 'dasdasdasd', 'recipient' => 'ticket_customer', - 'subject' => 'asdasdas', + 'subject' => 'asdasdas', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) @@ -593,54 +593,54 @@ class TicketTriggerTest < ActiveSupport::TestCase test '3 auto replys' do roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'postmaster@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'postmaster@example.com', - password: 'customerpw', - active: true, - roles: roles, - updated_at: '2015-02-05 16:37:00', + login: 'postmaster@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'postmaster@example.com', + password: 'customerpw', + active: true, + roles: roles, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) customer2 = User.create_or_update( - login: 'ticket-auto-reply-customer2@example.com', - firstname: 'Trigger', - lastname: 'Customer2', - email: 'ticket-auto-reply-customer2@example.com', - password: 'customerpw', - active: true, + login: 'ticket-auto-reply-customer2@example.com', + firstname: 'Trigger', + lastname: 'Customer2', + email: 'ticket-auto-reply-customer2@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) trigger1 = Trigger.create_or_update( - name: 'auto reply - new ticket', - condition: { - 'ticket.action' => { + name: 'auto reply - new ticket', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is not', - 'value' => Ticket::State.lookup(name: 'closed').id, + 'value' => Ticket::State.lookup(name: 'closed').id, }, 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '

Your request (Ticket##{ticket.number}) has been received and will be reviewed by our support staff.

+ 'body' => '

Your request (Ticket##{ticket.number}) has been received and will be reviewed by our support staff.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -648,38 +648,38 @@ class TicketTriggerTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})', + 'subject' => 'Thanks for your inquiry (#{ticket.title})', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create_or_update( - name: 'auto reply (on follow up of tickets)', - condition: { - 'ticket.action' => { + name: 'auto reply (on follow up of tickets)', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '

Your follow up for (#{config.ticket_hook}##{ticket.number}) has been received and will be reviewed by our support staff.

+ 'body' => '

Your follow up for (#{config.ticket_hook}##{ticket.number}) has been received and will be reviewed by our support staff.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -687,37 +687,37 @@ class TicketTriggerTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your follow up (#{ticket.title})', + 'subject' => 'Thanks for your follow up (#{ticket.title})', }, }, - active: true, + active: true, created_by_id: 1, updated_by_id: 1, ) trigger3 = Trigger.create_or_update( - name: 'not matching', - condition: { - 'ticket.action' => { + name: 'not matching', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'closed').id.to_s, + 'value' => Ticket::State.lookup(name: 'closed').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => '2some text
#{ticket.customer.lastname}
#{ticket.title}', + 'body' => '2some text
#{ticket.customer.lastname}
#{ticket.title}', 'recipient' => 'ticket_customer', - 'subject' => '2Thanks for your inquiry (#{ticket.title})!', + 'subject' => '2Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # process mail without Precedence header @@ -747,15 +747,15 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(2, ticket_p.articles.count, 'ticket_p.articles verify') article_p = Ticket::Article.create!( - ticket_id: ticket_p.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket_p.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -767,15 +767,15 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(3, ticket_p.articles.count, 'ticket_p.articles verify') article_p = Ticket::Article.create!( - ticket_id: ticket_p.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket_p.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -787,15 +787,15 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(4, ticket_p.articles.count, 'ticket_p.articles verify') article_p = Ticket::Article.create!( - ticket_id: ticket_p.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket_p.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -818,15 +818,15 @@ class TicketTriggerTest < ActiveSupport::TestCase ticket_p.state = Ticket::State.lookup(name: 'open') ticket_p.save! article_p = Ticket::Article.create!( - ticket_id: ticket_p.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket_p.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -882,58 +882,58 @@ class TicketTriggerTest < ActiveSupport::TestCase test '4 has changed' do roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'postmaster@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'postmaster@example.com', - password: 'customerpw', - active: true, - roles: roles, - updated_at: '2015-02-05 16:37:00', + login: 'postmaster@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'postmaster@example.com', + password: 'customerpw', + active: true, + roles: roles, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) customer2 = User.create_or_update( - login: 'ticket-has-changed-customer2@example.com', - firstname: 'Trigger', - lastname: 'Customer2', - email: 'ticket-has-changed-customer2@example.com', - password: 'customerpw', - active: true, + login: 'ticket-has-changed-customer2@example.com', + firstname: 'Trigger', + lastname: 'Customer2', + email: 'ticket-has-changed-customer2@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'agent-has-changed@example.com', - firstname: 'Has Changed', - lastname: 'Agent1', - email: 'agent-has-changed@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'agent-has-changed@example.com', + firstname: 'Has Changed', + lastname: 'Agent1', + email: 'agent-has-changed@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) trigger1 = Trigger.create_or_update( - name: 'owner update - to customer', - condition: { + name: 'owner update - to customer', + condition: { 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', } }, - perform: { + perform: { 'notification.email' => { - 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.

+ 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -941,13 +941,13 @@ class TicketTriggerTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Owner has changed (#{ticket.title})', + 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # process mail without Precedence header @@ -983,22 +983,22 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('text/html', article_p.content_type) trigger1 = Trigger.create_or_update( - name: 'owner update - to customer', - condition: { - 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + name: 'owner update - to customer', + condition: { + 'ticket.owner_id' => { + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.

+ 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -1006,13 +1006,13 @@ class TicketTriggerTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Owner has changed (#{ticket.title})', + 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # process mail without Precedence header @@ -1064,26 +1064,26 @@ class TicketTriggerTest < ActiveSupport::TestCase # should trigger trigger1 = Trigger.create_or_update( - name: 'owner update - to customer', - condition: { - 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + name: 'owner update - to customer', + condition: { + 'ticket.owner_id' => { + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, 'ticket.priority_id' => { 'operator' => 'is', - 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, + 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is not', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.

+ 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -1091,13 +1091,13 @@ class TicketTriggerTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Owner has changed (#{ticket.title})', + 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # process mail without Precedence header @@ -1148,22 +1148,22 @@ class TicketTriggerTest < ActiveSupport::TestCase # should not trigger trigger1 = Trigger.create_or_update( - name: 'owner update - to customer', - condition: { + name: 'owner update - to customer', + condition: { 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.

+ 'body' => '

The owner of ticket (Ticket##{ticket.number}) has changed.


To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -1171,13 +1171,13 @@ class TicketTriggerTest < ActiveSupport::TestCase

Zammad, your customer support system

', 'recipient' => 'ticket_customer', - 'subject' => 'Owner has changed (#{ticket.title})', + 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # process mail without Precedence header @@ -1198,62 +1198,62 @@ class TicketTriggerTest < ActiveSupport::TestCase test '5 notify owner' do trigger1 = Trigger.create_or_update( - name: 'aaa notify mail', - condition: { + name: 'aaa notify mail', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.all.pluck(:id), + 'value' => Ticket::State.all.pluck(:id), }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_owner', - 'subject' => 'CC NOTE (#{ticket.title})!', + 'subject' => 'CC NOTE (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - owner: agent, - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 123', + owner: agent, + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1270,16 +1270,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(1, ticket1.articles.count) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', - content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', + content_type: 'text/html', + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1288,41 +1288,41 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(3, ticket1.articles.count) trigger1 = Trigger.create_or_update( - name: 'aaa notify mail 2', - condition: { + name: 'aaa notify mail 2', + condition: { 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.all.pluck(:id), + 'value' => Ticket::State.all.pluck(:id), }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_owner', - 'subject' => 'CC NOTE (#{ticket.title})!', + 'subject' => 'CC NOTE (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', - content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', + content_type: 'text/html', + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1333,64 +1333,64 @@ class TicketTriggerTest < ActiveSupport::TestCase test '6 owner auto assignment' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { + name: 'aaa auto assignment', + condition: { 'ticket.owner_id' => { - 'operator' => 'is', - 'pre_condition' => 'not_set', - 'value' => '', + 'operator' => 'is', + 'pre_condition' => 'not_set', + 'value' => '', 'value_completion' => '', }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'ticket.owner_id' => { - 'pre_condition' => 'current_user.id', - 'value' => '', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', + title: 'test 123', #owner: agent, - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1406,16 +1406,16 @@ class TicketTriggerTest < ActiveSupport::TestCase UserInfo.current_user_id = agent.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1447,76 +1447,76 @@ class TicketTriggerTest < ActiveSupport::TestCase test '6.1 owner auto assignment based on organization' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { + name: 'aaa auto assignment', + condition: { 'ticket.organization_id' => { - 'operator' => 'is not', - 'pre_condition' => 'not_set', - 'value' => '', + 'operator' => 'is not', + 'pre_condition' => 'not_set', + 'value' => '', 'value_completion' => '', }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'ticket.owner_id' => { - 'pre_condition' => 'current_user.id', - 'value' => '', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) roles = Role.where(name: 'Agent') groups = Group.where(name: 'Users') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( - login: 'customer@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer@example.com', - password: 'customerpw', - vip: true, - active: true, - roles: roles, + login: 'customer@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer@example.com', + password: 'customerpw', + vip: true, + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - group: Group.lookup(name: 'Users'), - customer: customer, + title: 'test 123', + group: Group.lookup(name: 'Users'), + customer: customer, updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1534,16 +1534,16 @@ class TicketTriggerTest < ActiveSupport::TestCase UserInfo.current_user_id = agent.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1560,76 +1560,76 @@ class TicketTriggerTest < ActiveSupport::TestCase test '6.2 owner auto assignment based on organization' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { + name: 'aaa auto assignment', + condition: { 'ticket.organization_id' => { - 'operator' => 'is', - 'pre_condition' => 'not_set', - 'value' => '', + 'operator' => 'is', + 'pre_condition' => 'not_set', + 'value' => '', 'value_completion' => '', }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'ticket.owner_id' => { - 'pre_condition' => 'current_user.id', - 'value' => '', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( - login: 'customer@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer@example.com', - password: 'customerpw', - vip: true, - active: true, - roles: roles, + login: 'customer@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer@example.com', + password: 'customerpw', + vip: true, + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 123', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1647,16 +1647,16 @@ class TicketTriggerTest < ActiveSupport::TestCase UserInfo.current_user_id = agent.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1673,80 +1673,80 @@ class TicketTriggerTest < ActiveSupport::TestCase test '7 owner auto assignment' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { - 'ticket.owner_id' => { - 'operator' => 'is', - 'pre_condition' => 'not_set', - 'value' => '', + name: 'aaa auto assignment', + condition: { + 'ticket.owner_id' => { + 'operator' => 'is', + 'pre_condition' => 'not_set', + 'value' => '', 'value_completion' => '', }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Type.find_by(name: 'note'), + 'value' => Ticket::Article::Type.find_by(name: 'note'), }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.find_by(name: 'Agent'), + 'value' => Ticket::Article::Sender.find_by(name: 'Agent'), }, }, - perform: { + perform: { 'ticket.owner_id' => { - 'pre_condition' => 'current_user.id', - 'value' => '', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent2', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent2', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', + title: 'test 123', #owner: agent, - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1762,16 +1762,16 @@ class TicketTriggerTest < ActiveSupport::TestCase UserInfo.current_user_id = agent1.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1801,16 +1801,16 @@ class TicketTriggerTest < ActiveSupport::TestCase UserInfo.current_user_id = agent1.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1840,16 +1840,16 @@ class TicketTriggerTest < ActiveSupport::TestCase UserInfo.current_user_id = agent1.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -1866,70 +1866,70 @@ class TicketTriggerTest < ActiveSupport::TestCase test '8 owner auto assignment' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { - 'ticket.owner_id' => { - 'operator' => 'is', - 'pre_condition' => 'not_set', - 'value' => '', + name: 'aaa auto assignment', + condition: { + 'ticket.owner_id' => { + 'operator' => 'is', + 'pre_condition' => 'not_set', + 'value' => '', 'value_completion' => '', }, 'ticket.priority_id' => { - 'operator' => 'has changed', - 'pre_condition' => '', - 'value' => '2', + 'operator' => 'has changed', + 'pre_condition' => '', + 'value' => '2', 'value_completion' => '', }, - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, }, - perform: { + perform: { 'ticket.owner_id' => { - 'pre_condition' => 'current_user.id', - 'value' => '', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', + title: 'test 123', #owner: agent, - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -1945,16 +1945,16 @@ class TicketTriggerTest < ActiveSupport::TestCase UserInfo.current_user_id = agent.id Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'update', - message_id: 'some@id', + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'update', + message_id: 'some@id', content_type: 'text/html', - body: 'update', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + body: 'update', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil @@ -2016,69 +2016,69 @@ class TicketTriggerTest < ActiveSupport::TestCase test '9 vip priority set' do trigger1 = Trigger.create_or_update( - name: 'aaa vip priority', - condition: { + name: 'aaa vip priority', + condition: { 'customer.vip' => { 'operator' => 'is', - 'value' => true, + 'value' => true, }, }, - perform: { + perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.find_by(name: '3 high').id, }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( - login: 'customer@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer@example.com', - password: 'customerpw', - vip: true, - active: true, - roles: roles, + login: 'customer@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer@example.com', + password: 'customerpw', + vip: true, + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - owner: agent, - customer: customer, - group: Group.lookup(name: 'Users'), + title: 'test 123', + owner: agent, + customer: customer, + group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2108,23 +2108,23 @@ class TicketTriggerTest < ActiveSupport::TestCase customer.save! ticket2 = Ticket.create!( - title: 'test 123', - owner: agent, - customer: customer, - group: Group.lookup(name: 'Users'), + title: 'test 123', + owner: agent, + customer: customer, + group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2154,71 +2154,71 @@ class TicketTriggerTest < ActiveSupport::TestCase test '10 owner auto assignment notify to customer' do trigger1 = Trigger.create_or_update( - name: 'aaa auto assignment', - condition: { + name: 'aaa auto assignment', + condition: { 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => '', - 'value' => '2', + 'operator' => 'has changed', + 'pre_condition' => '', + 'value' => '2', 'value_completion' => '', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'NEW OWNER (#{ticket.title})!', + 'subject' => 'NEW OWNER (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'agent1@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent1@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( - login: 'agent2@example.com', - firstname: 'Trigger', - lastname: 'Agent2', - email: 'agent2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent2@example.com', + firstname: 'Trigger', + lastname: 'Agent2', + email: 'agent2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 123', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2281,81 +2281,81 @@ class TicketTriggerTest < ActiveSupport::TestCase test '11 notify to customer on public note' do trigger1 = Trigger.create_or_update( - name: 'aaa notify to customer on public note', - condition: { - 'article.internal' => { + name: 'aaa notify to customer on public note', + condition: { + 'article.internal' => { 'operator' => 'is', - 'value' => 'false', + 'value' => 'false', }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'note').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'UPDATE (#{ticket.title})!', + 'subject' => 'UPDATE (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( - login: 'customer@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer@example.com', - password: 'customerpw', - vip: true, - active: true, - roles: roles, + login: 'customer@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer@example.com', + password: 'customerpw', + vip: true, + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', - owner: agent, - customer: customer, - group: Group.lookup(name: 'Users'), + title: 'test 123', + owner: agent, + customer: customer, + group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2373,15 +2373,15 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal([], ticket1.tag_list) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2398,15 +2398,15 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal([], ticket1.tag_list) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2425,15 +2425,15 @@ class TicketTriggerTest < ActiveSupport::TestCase ticket1.priority = Ticket::Priority.find_by(name: '3 high') ticket1.save! article = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2464,15 +2464,15 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal([], ticket1.tag_list) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: true, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: true, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2491,41 +2491,41 @@ class TicketTriggerTest < ActiveSupport::TestCase test '12 notify on owner change' do trigger1 = Trigger.create_or_update( - name: 'aaa notify to customer on public note', - condition: { + name: 'aaa notify to customer on public note', + condition: { 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', + 'operator' => 'has changed', + 'pre_condition' => 'current_user.id', + 'value' => '', 'value_completion' => '', } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'UPDATE (#{ticket.title})!', + 'subject' => 'UPDATE (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply (on new tickets)', - condition: { - 'ticket.action' => { + name: 'auto reply (on new tickets)', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, - 'ticket.state_id' => { + 'ticket.state_id' => { 'operator' => 'is not', - 'value' => Ticket::State.lookup(name: 'closed').id, + 'value' => Ticket::State.lookup(name: 'closed').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, @@ -2533,12 +2533,12 @@ class TicketTriggerTest < ActiveSupport::TestCase }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '
Your request (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.
+ 'body' => '
Your request (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.

To provide additional information, please reply to this email or click on the following link (for initial login, please request a new password): #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -2548,36 +2548,36 @@ class TicketTriggerTest < ActiveSupport::TestCase
Zammad, your customer support system
', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})', + 'subject' => 'Thanks for your inquiry (#{ticket.title})', }, }, - active: true, + active: true, created_by_id: 1, updated_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply (on follow up of tickets)', - condition: { - 'ticket.action' => { + name: 'auto reply (on follow up of tickets)', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'update', + 'value' => 'update', }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => '
Your follow up for (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.
+ 'body' => '
Your follow up for (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.

To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} @@ -2587,10 +2587,10 @@ class TicketTriggerTest < ActiveSupport::TestCase
Zammad, your customer support system
', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your follow up (#{ticket.title})', + 'subject' => 'Thanks for your follow up (#{ticket.title})', }, }, - active: true, + active: true, created_by_id: 1, updated_by_id: 1, ) @@ -2598,49 +2598,49 @@ class TicketTriggerTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( - login: 'agent@example.com', - firstname: 'Trigger', - lastname: 'Agent1', - email: 'agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'agent@example.com', + firstname: 'Trigger', + lastname: 'Agent1', + email: 'agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( - login: 'customer@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer@example.com', - password: 'customerpw', - vip: true, - active: true, - roles: roles, + login: 'customer@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer@example.com', + password: 'customerpw', + vip: true, + active: true, + roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 123', + title: 'test 123', #owner: agent, - customer: customer, - group: Group.lookup(name: 'Users'), + customer: customer, + group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'web'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'web'), updated_by_id: 1, created_by_id: 1, ) @@ -2674,15 +2674,15 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal([], ticket1.tag_list) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'web'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'web'), updated_by_id: 1, created_by_id: 1, ) @@ -2720,71 +2720,71 @@ class TicketTriggerTest < ActiveSupport::TestCase test '1 empty condition should not create errors' do assert_raises(Exception) do trigger_empty = Trigger.create_or_update( - name: 'aaa loop check', - condition: { + name: 'aaa loop check', + condition: { 'ticket.number' => { 'operator' => 'contains', 'value' => '', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) end end test 'article_last_sender trigger -> reply_to' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient+from@example.com', - reply_to: 'some_recipient+reply_to@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient+from@example.com', + reply_to: 'some_recipient+reply_to@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -2801,46 +2801,46 @@ class TicketTriggerTest < ActiveSupport::TestCase test 'article_last_sender trigger -> from' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender+from@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_sender+from@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -2857,59 +2857,59 @@ class TicketTriggerTest < ActiveSupport::TestCase test 'article_last_sender trigger -> origin_by_id' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'customer+origin_by_id@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer+origin_by_id@example.com', - password: 'customerpw', - active: true, - roles: roles, - updated_at: '2015-02-05 16:37:00', + login: 'customer+origin_by_id@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer+origin_by_id@example.com', + password: 'customerpw', + active: true, + roles: roles, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), - origin_by_id: customer1.id, + ticket_id: ticket1.id, + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), + origin_by_id: customer1.id, updated_by_id: 1, created_by_id: 1, ) @@ -2926,58 +2926,58 @@ class TicketTriggerTest < ActiveSupport::TestCase test 'article_last_sender trigger -> created_by_id' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: 'customer+created_by_id@example.com', - firstname: 'Trigger', - lastname: 'Customer1', - email: 'customer+created_by_id@example.com', - password: 'customerpw', - active: true, - roles: roles, - updated_at: '2015-02-05 16:37:00', + login: 'customer+created_by_id@example.com', + firstname: 'Trigger', + lastname: 'Customer1', + email: 'customer+created_by_id@example.com', + password: 'customerpw', + active: true, + roles: roles, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: customer1.id, created_by_id: customer1.id, ) @@ -2994,60 +2994,60 @@ class TicketTriggerTest < ActiveSupport::TestCase test 'multiple recipients owner_id, article_last_sender(reply_to) trigger' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => %w[ticket_owner article_last_sender], - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) admin = User.create_or_update( - login: 'admin+owner_recipient@example.com', - firstname: 'Role', - lastname: "Admin#{name}", - email: 'admin+owner_recipient@example.com', - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), - groups: Group.where(name: 'Users'), + login: 'admin+owner_recipient@example.com', + firstname: 'Role', + lastname: "Admin#{name}", + email: 'admin+owner_recipient@example.com', + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), + groups: Group.where(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), - owner_id: admin.id, + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), + owner_id: admin.id, updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient+from@example.com', - reply_to: 'some_recipient+reply_to@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient+from@example.com', + reply_to: 'some_recipient+reply_to@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3065,47 +3065,47 @@ class TicketTriggerTest < ActiveSupport::TestCase test 'article_last_sender trigger -> invalid reply_to' do trigger = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient+from@example.com', - reply_to: 'Blub blub blub some_recipient+reply_to@example', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient+from@example.com', + reply_to: 'Blub blub blub some_recipient+reply_to@example', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3119,55 +3119,55 @@ class TicketTriggerTest < ActiveSupport::TestCase test '2 loop check' do trigger1 = Trigger.create_or_update( - name: 'aaa loop check', - condition: { - 'ticket.state_id' => { + name: 'aaa loop check', + condition: { + 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.all.pluck(:id), + 'value' => Ticket::State.all.pluck(:id), }, 'article.sender_id' => { 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, + 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, - 'article.type_id' => { + 'article.type_id' => { 'operator' => 'is', - 'value' => [ + 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: 'loop try 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'loop try 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3186,16 +3186,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(2, ticket1.articles.count) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3207,16 +3207,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[3].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3228,16 +3228,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[5].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3249,16 +3249,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[7].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3270,16 +3270,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[9].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3291,16 +3291,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[11].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3312,16 +3312,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[13].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3333,16 +3333,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[15].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3354,16 +3354,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[17].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3375,16 +3375,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('nicole.braun@zammad.org', ticket1.articles[19].to) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3395,16 +3395,16 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('some_loop_sender@example.com', ticket1.articles[20].from) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_loop_sender@example.com', - to: 'some_loop_recipient@example.com', - subject: 'some subject 1234', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message note
new line', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'some_loop_sender@example.com', + to: 'some_loop_recipient@example.com', + subject: 'some subject 1234', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message note
new line', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3418,85 +3418,85 @@ class TicketTriggerTest < ActiveSupport::TestCase test '3 invalid condition' do trigger1 = Trigger.create_or_update( - name: 'aaa loop check', - condition: { + name: 'aaa loop check', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, }, - perform: { + perform: { 'ticket.tags' => { 'operator' => 'add', - 'value' => 'xxx', + 'value' => 'xxx', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger1.update_column(:condition, { - 'ticket.action' => { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.first_response_at' => { 'operator' => 'before (absolute)', - 'value' => 'invalid invalid 4', + 'value' => 'invalid invalid 4', }, }) assert_equal('invalid invalid 4', trigger1.condition['ticket.first_response_at']['value']) trigger2 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, } }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, 'ticket.priority_id' => { 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk', + 'value' => 'aa, kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3530,100 +3530,100 @@ class TicketTriggerTest < ActiveSupport::TestCase test '4 tag based auto response' do trigger1 = Trigger.create_or_update( - name: '100 add tag if sender 1', - condition: { + name: '100 add tag if sender 1', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, - 'article.from' => { + 'article.from' => { 'operator' => 'contains', - 'value' => 'sender1', + 'value' => 'sender1', }, }, - perform: { + perform: { 'ticket.tags' => { 'operator' => 'add', - 'value' => 'sender1', + 'value' => 'sender1', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger2 = Trigger.create_or_update( - name: '200 add tag if sender 2', - condition: { + name: '200 add tag if sender 2', + condition: { 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, - 'article.from' => { + 'article.from' => { 'operator' => 'contains', - 'value' => 'sender2', + 'value' => 'sender2', }, }, - perform: { + perform: { 'ticket.tags' => { 'operator' => 'add', - 'value' => 'sender2', + 'value' => 'sender2', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) trigger3 = Trigger.create_or_update( - name: '300 auto reply', - condition: { - 'ticket.action' => { + name: '300 auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, - 'ticket.tags' => { + 'ticket.tags' => { #'operator' => 'contains one not', 'operator' => 'contains all not', - 'value' => 'sender1, sender2', + 'value' => 'sender1, sender2', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'sender1@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'sender1@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3645,22 +3645,22 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(%w[sender1], ticket1.tag_list) ticket2 = Ticket.create!( - title: 'test 2', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 2', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'sender2@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket2.id, + from: 'sender2@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3684,23 +3684,23 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(%w[sender2], ticket2.tag_list) ticket3 = Ticket.create!( - title: 'test 3', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 3', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) assert(ticket3, 'ticket3 created') Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'sender0@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket3.id, + from: 'sender0@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -3726,55 +3726,55 @@ class TicketTriggerTest < ActiveSupport::TestCase test 'article.body' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, - 'article.body' => { + 'article.body' => { 'operator' => 'contains', - 'value' => 'hello', + 'value' => 'hello', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk', + 'value' => 'aa, kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note hello ', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note hello ', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3804,22 +3804,22 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('text/html', article1.content_type) ticket2 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket2.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket2.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3842,55 +3842,55 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(%w[], ticket2.tag_list) trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, - 'article.body' => { + 'article.body' => { 'operator' => 'contains not', - 'value' => 'hello', + 'value' => 'hello', }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'aa, kk', + 'value' => 'aa, kk', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket3 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket3.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note hello ', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket3.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note hello ', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3913,22 +3913,22 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(%w[], ticket3.tag_list) ticket4 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket4.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note 2', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket4.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note 2', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) @@ -3963,95 +3963,95 @@ class TicketTriggerTest < ActiveSupport::TestCase roles = Role.where(name: 'Agent') groups = Group.where(name: 'Users') agent1 = User.create_or_update( - login: 'agent-has-changed@example.com', - firstname: 'Has Changed', - lastname: 'Agent1', - email: 'agent-has-changed@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'agent-has-changed@example.com', + firstname: 'Has Changed', + lastname: 'Agent1', + email: 'agent-has-changed@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( - login: 'agent-has-changed2@example.com', - firstname: 'Has Changed', - lastname: 'Agent2', - email: 'agent-has-changed2@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'agent-has-changed2@example.com', + firstname: 'Has Changed', + lastname: 'Agent2', + email: 'agent-has-changed2@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) # multi tag trigger with changed owner trigger1 = Trigger.create_or_update( - name: 'change owner', - condition: { + name: 'change owner', + condition: { 'ticket.owner_id' => { 'operator' => 'has changed', }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'contains one not', - 'value' => 'nosendmail test123' + 'value' => 'nosendmail test123' } }, - perform: { - 'ticket.tags' => { + perform: { + 'ticket.tags' => { 'operator' => 'add', - 'value' => '123' + 'value' => '123' }, 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) # single tag trigger with changed owner trigger2 = Trigger.create_or_update( - name: 'change owner', - condition: { + name: 'change owner', + condition: { 'ticket.owner_id' => { 'operator' => 'has changed', }, - 'ticket.tags' => { + 'ticket.tags' => { 'operator' => 'contains one not', - 'value' => 'nosendmail2', + 'value' => 'nosendmail2', } }, - perform: { - 'ticket.tags' => { + perform: { + 'ticket.tags' => { 'operator' => 'add', - 'value' => '123' + 'value' => '123' }, 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - 1234 check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) @@ -4065,9 +4065,9 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal([], ticket1.tag_list, 'ticket1.tag_list') ticket2 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) @@ -4161,48 +4161,48 @@ class TicketTriggerTest < ActiveSupport::TestCase test 'trigger auto reply with umlaut in form' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: 'test 1', - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: 'test 1', + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'Sabine Schütz ', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: 'some message note hello ', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket1.id, + from: 'Sabine Schütz ', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: 'some message note hello ', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -4235,28 +4235,28 @@ class TicketTriggerTest < ActiveSupport::TestCase test 'trigger auto reply with 2 sender addresses in form' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1, article1, user, mail = Channel::EmailParser.new.process({}, File.read(Rails.root.join('test', 'data', 'mail', 'mail065.box'))) @@ -4276,28 +4276,28 @@ class TicketTriggerTest < ActiveSupport::TestCase test 'make sure attachments should be attached with content id' do trigger1 = Trigger.create_or_update( - name: 'auto reply', - condition: { - 'ticket.action' => { + name: 'auto reply', + condition: { + 'ticket.action' => { 'operator' => 'is', - 'value' => 'create', + 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', - 'value' => Ticket::State.lookup(name: 'new').id.to_s, + 'value' => Ticket::State.lookup(name: 'new').id.to_s, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}
', + 'body' => 'some text
#{ticket.customer.lastname}
#{ticket.title}
#{article.body}
', 'recipient' => 'article_last_sender', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1, article1, user, mail = Channel::EmailParser.new.process({}, File.read(Rails.root.join('test', 'data', 'mail', 'mail065.box'))) @@ -4319,35 +4319,35 @@ class TicketTriggerTest < ActiveSupport::TestCase # Issue #1316 - 'organization is not X' conditions break triggers test 'NOT IN predicates handle NULL values' do customer = User.create!( - email: 'issue_1316_test_user@zammad.org', + email: 'issue_1316_test_user@zammad.org', created_by_id: 1, updated_by_id: 1, ) Trigger.create_or_update( - name: 'auto reply (condition: organization-is-not)', - condition: { + name: 'auto reply (condition: organization-is-not)', + condition: { 'ticket.organization_id' => { 'operator' => 'is not', - 'value' => Organization.first.id.to_s, + 'value' => Organization.first.id.to_s, }, }, - perform: { + perform: { 'notification.email' => { - 'body' => 'Lorem ipsum dolor', + 'body' => 'Lorem ipsum dolor', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry (#{ticket.title})!', }, }, - active: true, + active: true, created_by_id: 1, updated_by_id: 1, ) ticket = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: customer, + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: customer, updated_by_id: 1, created_by_id: 1, ) @@ -4369,46 +4369,46 @@ class TicketTriggerTest < ActiveSupport::TestCase test 'trigger when there is an article body contains matched values' do trigger1 = Trigger.create_or_update( - name: 'detect message body', - condition: { + name: 'detect message body', + condition: { 'article.body' => { 'operator' => 'contains', - 'value' => 'some message', + 'value' => 'some message', }, }, - perform: { - 'ticket.tags' => { + perform: { + 'ticket.tags' => { 'operator' => 'add', - 'value' => 'tag1, tag2', + 'value' => 'tag1, tag2', }, 'notification.email' => { - 'body' => 'some lala', + 'body' => 'some lala', 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', + 'subject' => 'Thanks for your inquiry - loop check (#{ticket.title})!', }, }, disable_notification: true, - active: true, - created_by_id: 1, - updated_by_id: 1, + active: true, + created_by_id: 1, + updated_by_id: 1, ) ticket1 = Ticket.create!( - title: "some title\n äöüß", - group: Group.lookup(name: 'Users'), - customer: User.lookup(email: 'nicole.braun@zammad.org'), + title: "some title\n äöüß", + group: Group.lookup(name: 'Users'), + customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) article1 = Ticket::Article.create!( - ticket_id: ticket1.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject', - message_id: 'some@id', - body: "some message note\nnew line", - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Agent'), - type: Ticket::Article::Type.find_by(name: 'note'), + ticket_id: ticket1.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject', + message_id: 'some@id', + body: "some message note\nnew line", + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Agent'), + type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/ticket_xss_test.rb b/test/unit/ticket_xss_test.rb index fa8a0a1ef..a48f29da5 100644 --- a/test/unit/ticket_xss_test.rb +++ b/test/unit/ticket_xss_test.rb @@ -3,11 +3,11 @@ require 'test_helper' class TicketXssTest < ActiveSupport::TestCase test 'xss via model' do ticket = Ticket.create( - title: 'test 123 ', - group: Group.lookup(name: 'Users'), - customer_id: 2, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: 'test 123 ', + group: Group.lookup(name: 'Users'), + customer_id: 2, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -18,48 +18,48 @@ class TicketXssTest < ActiveSupport::TestCase assert_equal('new', ticket.state.name, 'ticket.state verify') article1 = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject ', - message_id: 'some@id', - content_type: 'text/html', - body: '', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject ', + message_id: 'some@id', + content_type: 'text/html', + body: '', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) assert_equal('alert("XSS!");', article1.body, 'article1.body verify - inbound') article2 = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject ', - message_id: 'some@id', - content_type: 'text/html', - body: 'please tell me this doesn\'t work: ', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject ', + message_id: 'some@id', + content_type: 'text/html', + body: 'please tell me this doesn\'t work: ', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) assert_equal('please tell me this doesn\'t work: alert("XSS!");', article2.body, 'article2.body verify - inbound') article3 = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject ', - message_id: 'some@id', - content_type: 'text/html', - body: 'please tell me this doesn\'t work: ada
LINKaaABC', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject ', + message_id: 'some@id', + content_type: 'text/html', + body: 'please tell me this doesn\'t work: ada
LINKaaABC', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -68,48 +68,48 @@ class TicketXssTest < ActiveSupport::TestCase LINKaaABC
", article3.body, 'article3.body verify - inbound') article4 = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject ', - message_id: 'some@id', - content_type: 'text/html', - body: 'please tell me this doesn\'t work: alal', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject ', + message_id: 'some@id', + content_type: 'text/html', + body: 'please tell me this doesn\'t work: alal', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) assert_equal("please tell me this doesn't work: alal", article4.body, 'article4.body verify - inbound') article5 = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject ', - message_id: 'some@id', - content_type: 'text/plain', - body: 'please tell me this doesn\'t work: ada
LINKaaABC', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject ', + message_id: 'some@id', + content_type: 'text/plain', + body: 'please tell me this doesn\'t work: ada
LINKaaABC', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) assert_equal('please tell me this doesn\'t work: ada
LINKaaABC', article5.body, 'article5.body verify - inbound') article6 = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject ', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message article helper test1
asdasd
', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject ', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message article helper test1
asdasd
', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -118,16 +118,16 @@ LINK', article6.body, 'article6.body verify - inbound') article7 = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject ', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message article helper test1
asdasd
', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject ', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message article helper test1
asdasd
', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) @@ -136,16 +136,16 @@ LINK
', article7.body, 'article7.body verify - inbound') article8 = Ticket::Article.create( - ticket_id: ticket.id, - from: 'some_sender@example.com', - to: 'some_recipient@example.com', - subject: 'some subject ', - message_id: 'some@id', - content_type: 'text/html', - body: 'some message article helper test1 abc 123123', - internal: false, - sender: Ticket::Article::Sender.find_by(name: 'Customer'), - type: Ticket::Article::Type.find_by(name: 'email'), + ticket_id: ticket.id, + from: 'some_sender@example.com', + to: 'some_recipient@example.com', + subject: 'some subject ', + message_id: 'some@id', + content_type: 'text/html', + body: 'some message article helper test1 abc 123123', + internal: false, + sender: Ticket::Article::Sender.find_by(name: 'Customer'), + type: Ticket::Article::Type.find_by(name: 'email'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/token_test.rb b/test/unit/token_test.rb index 36eb6ec31..b3889a0b2 100644 --- a/test/unit/token_test.rb +++ b/test/unit/token_test.rb @@ -6,14 +6,14 @@ class TokenTest < ActiveSupport::TestCase groups = Group.all roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'token-agent1@example.com', - firstname: 'Token', - lastname: 'Agent1', - email: 'token-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + login: 'token-agent1@example.com', + firstname: 'Token', + lastname: 'Agent1', + email: 'token-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, updated_by_id: 1, created_by_id: 1, ) @@ -21,25 +21,25 @@ class TokenTest < ActiveSupport::TestCase # invalid token user = Token.check( action: 'PasswordReset', - name: '1NV4L1D', + name: '1NV4L1D', ) assert_not(user) # generate fresh token token = Token.create( - action: 'PasswordReset', + action: 'PasswordReset', user_id: agent1.id, ) assert(token) assert_nil(token.persistent) user = Token.check( action: 'PasswordReset_NotExisting', - name: token.name, + name: token.name, ) assert_not(user) user = Token.check( action: 'PasswordReset', - name: token.name, + name: token.name, ) assert(user) assert_equal('Token', user.firstname) @@ -48,27 +48,27 @@ class TokenTest < ActiveSupport::TestCase # two days but not persistent token = Token.create( - action: 'PasswordReset', - user_id: agent1.id, + action: 'PasswordReset', + user_id: agent1.id, created_at: 2.days.ago, persistent: false, ) user = Token.check( action: 'PasswordReset', - name: token.name, + name: token.name, ) assert_not(user) # two days but persistent token = Token.create( - action: 'iCal', - user_id: agent1.id, + action: 'iCal', + user_id: agent1.id, created_at: 2.days.ago, persistent: true, ) user = Token.check( action: 'iCal', - name: token.name, + name: token.name, ) assert(user) assert_equal('Token', user.firstname) @@ -86,38 +86,38 @@ class TokenTest < ActiveSupport::TestCase } ) user = Token.check( - action: 'api', - name: token.name, + action: 'api', + name: token.name, permission: 'admin.session', ) assert_not(user) user = Token.check( - action: 'api', - name: token.name, + action: 'api', + name: token.name, permission: 'admin', ) assert_not(user) user = Token.check( - action: 'api', - name: token.name, + action: 'api', + name: token.name, permission: 'ticket', ) assert_not(user) user = Token.check( - action: 'api', - name: token.name, + action: 'api', + name: token.name, permission: 'ticket.agent.sub', ) assert(user) user = Token.check( - action: 'api', - name: token.name, + action: 'api', + name: token.name, permission: 'admin_not_extisting', ) assert_not(user) user = Token.check( - action: 'api', - name: token.name, + action: 'api', + name: token.name, permission: 'ticket.agent', ) assert(user) @@ -126,8 +126,8 @@ class TokenTest < ActiveSupport::TestCase assert_equal('token-agent1@example.com', user.email) user = Token.check( - action: 'api', - name: token.name, + action: 'api', + name: token.name, permission: ['ticket.agent', 'not_existing'], ) assert(user) diff --git a/test/unit/trigger_assets_test.rb b/test/unit/trigger_assets_test.rb index 68ce45587..62065b110 100644 --- a/test/unit/trigger_assets_test.rb +++ b/test/unit/trigger_assets_test.rb @@ -7,34 +7,34 @@ class TriggerAssetsTest < ActiveSupport::TestCase roles = Role.where(name: %w[Customer]) user1 = User.create_or_update( - login: 'assets_trigger1@example.org', + login: 'assets_trigger1@example.org', firstname: 'assets_trigger1', - lastname: 'assets_trigger1', - email: 'assets_trigger1@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_trigger1', + email: 'assets_trigger1@example.org', + password: 'some_pass', + active: true, + roles: roles, ) user2 = User.create_or_update( - login: 'assets_trigger2@example.org', + login: 'assets_trigger2@example.org', firstname: 'assets_trigger2', - lastname: 'assets_trigger2', - email: 'assets_trigger2@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_trigger2', + email: 'assets_trigger2@example.org', + password: 'some_pass', + active: true, + roles: roles, ) user3 = User.create_or_update( - login: 'assets_trigger3@example.org', + login: 'assets_trigger3@example.org', firstname: 'assets_trigger3', - lastname: 'assets_trigger3', - email: 'assets_trigger3@example.org', - password: 'some_pass', - active: true, - roles: roles, + lastname: 'assets_trigger3', + email: 'assets_trigger3@example.org', + password: 'some_pass', + active: true, + roles: roles, ) group1 = Group.create_or_update( - name: 'group1_trigger', + name: 'group1_trigger', active: true, ) @@ -42,20 +42,20 @@ class TriggerAssetsTest < ActiveSupport::TestCase ticket_state2 = Ticket::State.find_by(name: 'open') ticket_priority2 = Ticket::Priority.find_by(name: '2 normal') trigger = Trigger.create_or_update( - name: 'my trigger', - condition: { + name: 'my trigger', + condition: { 'ticket.state_id' => { operator: 'is', - value: [ ticket_state1.id ], + value: [ ticket_state1.id ], }, 'ticket.owner_id' => { - operator: 'is', - pre_condition: 'specific', - value: user1.id, + operator: 'is', + pre_condition: 'specific', + value: user1.id, value_completion: 'John Smith ' }, }, - perform: { + perform: { 'ticket.group_id' => { value: group1.id.to_s, }, diff --git a/test/unit/user_assets_test.rb b/test/unit/user_assets_test.rb index b4f172790..b0b88f634 100644 --- a/test/unit/user_assets_test.rb +++ b/test/unit/user_assets_test.rb @@ -6,49 +6,49 @@ class UserAssetsTest < ActiveSupport::TestCase roles = Role.where(name: %w[Agent Admin]) groups = Group.all org1 = Organization.create_or_update( - name: 'some user org', + name: 'some user org', updated_by_id: 1, created_by_id: 1, ) user1 = User.create_or_update( - login: 'assets1@example.org', - firstname: 'assets1', - lastname: 'assets1', - email: 'assets1@example.org', - password: 'some_pass', - active: true, - updated_by_id: 1, - created_by_id: 1, + login: 'assets1@example.org', + firstname: 'assets1', + lastname: 'assets1', + email: 'assets1@example.org', + password: 'some_pass', + active: true, + updated_by_id: 1, + created_by_id: 1, organization_id: org1.id, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) user2 = User.create_or_update( - login: 'assets2@example.org', - firstname: 'assets2', - lastname: 'assets2', - email: 'assets2@example.org', - password: 'some_pass', - active: true, + login: 'assets2@example.org', + firstname: 'assets2', + lastname: 'assets2', + email: 'assets2@example.org', + password: 'some_pass', + active: true, updated_by_id: 1, created_by_id: 1, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) user3 = User.create_or_update( - login: 'assets3@example.org', - firstname: 'assets3', - lastname: 'assets3', - email: 'assets3@example.org', - password: 'some_pass', - active: true, + login: 'assets3@example.org', + firstname: 'assets3', + lastname: 'assets3', + email: 'assets3@example.org', + password: 'some_pass', + active: true, updated_by_id: user1.id, created_by_id: user2.id, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) user3 = User.find(user3.id) assets = user3.assets({}) diff --git a/test/unit/user_csv_import_test.rb b/test/unit/user_csv_import_test.rb index 8bc3e0016..3b1cb1266 100644 --- a/test/unit/user_csv_import_test.rb +++ b/test/unit/user_csv_import_test.rb @@ -19,11 +19,11 @@ class UserCsvImportTest < ActiveSupport::TestCase test 'empty payload' do csv_string = '' result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_nil(result[:records]) @@ -32,11 +32,11 @@ class UserCsvImportTest < ActiveSupport::TestCase csv_string = "login;firstname;lastname;email;active;\n" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert(result[:records].blank?) @@ -47,11 +47,11 @@ class UserCsvImportTest < ActiveSupport::TestCase test 'verify required lookup headers' do csv_string = "firstname;lastname;active;\nfirstname-simple-import1;lastname-simple-import1;;true\nfirstname-simple-import2;lastname-simple-import2;false\n" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal('failed', result[:result]) @@ -63,11 +63,11 @@ class UserCsvImportTest < ActiveSupport::TestCase count = User.count csv_string = "login;firstname;lastname;email;active;\nuser-simple-IMPORT1;firstname-simple-import1;lastname-simple-import1;user-simple-IMPORT1@example.com ;true\nuser-simple-import2;firstname-simple-import2;lastname-simple-import2;user-simple-import2@example.com;false\n" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(2, result[:records].count) @@ -80,11 +80,11 @@ class UserCsvImportTest < ActiveSupport::TestCase assert_nil(User.find_by(login: 'user-simple-import2')) result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(2, result[:records].count) @@ -109,11 +109,11 @@ class UserCsvImportTest < ActiveSupport::TestCase assert_equal(user2.active, false) result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(2, result[:records].count) @@ -146,11 +146,11 @@ class UserCsvImportTest < ActiveSupport::TestCase csv_string = "login;firstname;lastname;email;active;\n ;firstname-simple-import1;lastname-simple-import1;user-simple-IMPORT1@example.com ;true\n user-simple-import2\t;firstname-simple-import2;lastname-simple-import2;;false\n" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(2, result[:records].count) @@ -186,11 +186,11 @@ class UserCsvImportTest < ActiveSupport::TestCase csv_string = "id;login;firstname;lastname;email;active;\n999999999;user-simple-invalid_id-import1;firstname-simple-import1;lastname-simple-import1;user-simple-invalid_id-import1@example.com;true\n;user-simple-invalid_id-import2;firstname-simple-import2;lastname-simple-import2;user-simple-invalid_id-import2@example.com;false\n" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(1, result[:errors].count) @@ -201,11 +201,11 @@ class UserCsvImportTest < ActiveSupport::TestCase assert_nil(User.find_by(login: 'user-simple-invalid_id-import2')) result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(1, result[:records].count) @@ -228,11 +228,11 @@ class UserCsvImportTest < ActiveSupport::TestCase csv_string = "id;login;firstname;lastname;email;active;\n1;user-simple-readonly_id-import1;firstname-simple-import1;lastname-simple-import1;user-simple-readonly_id-import1@example.com;true\n;user-simple-readonly_id-import2;firstname-simple-import2;lastname-simple-import2;user-simple-readonly_id-import2@example.com;false\n" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(1, result[:errors].count) @@ -243,11 +243,11 @@ class UserCsvImportTest < ActiveSupport::TestCase assert_nil(User.find_by(login: 'user-simple-readonly_id-import2')) result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(1, result[:records].count) @@ -270,22 +270,22 @@ class UserCsvImportTest < ActiveSupport::TestCase UserInfo.current_user_id = 1 admin = User.create_or_update( - login: 'admin1@example.com', + login: 'admin1@example.com', firstname: 'Admin', - lastname: '1', - email: 'admin1@example.com', - password: 'agentpw', - active: true, - roles: Role.where(name: 'Admin'), + lastname: '1', + email: 'admin1@example.com', + password: 'agentpw', + active: true, + roles: Role.where(name: 'Admin'), ) csv_string = "login;firstname;lastname;email;roles;\nuser-role-import1;firstname-role-import1;lastname-role-import1;user-role-import1@example.com;Customer;\nuser-role-import2;firstname-role-import2;lastname-role-import2;user-role-import2@example.com;Agent\n;;;;Admin" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) @@ -296,11 +296,11 @@ class UserCsvImportTest < ActiveSupport::TestCase assert_nil(User.find_by(login: 'user-role-import2')) result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) @@ -331,14 +331,14 @@ class UserCsvImportTest < ActiveSupport::TestCase csv_string = "login;firstname;lastname;email\nuser-simple-import-fixed1;firstname-simple-import-fixed1;lastname-simple-import-fixed1;user-simple-import-fixed1@example.com\nuser-simple-import-fixed2;firstname-simple-import-fixed2;lastname-simple-import-fixed2;user-simple-import-fixed2@example.com\n" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, fixed_params: { note: 'some note', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(2, result[:records].count) @@ -348,14 +348,14 @@ class UserCsvImportTest < ActiveSupport::TestCase assert_nil(User.find_by(login: 'user-simple-import-fixed2')) result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, fixed_params: { note: 'some note', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(2, result[:records].count) @@ -385,11 +385,11 @@ class UserCsvImportTest < ActiveSupport::TestCase csv_string = "login;firstname;lastname;email\nuser-duplicate-import1;firstname-duplicate-import1;firstname-duplicate-import1;user-duplicate-import1@example.com\nuser-duplicate-import2;firstname-duplicate-import2;firstname-duplicate-import2;user-duplicate-import2@example.com\nuser-duplicate-import2;firstname-duplicate-import3;firstname-duplicate-import3;user-duplicate-import3@example.com" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(3, result[:records].count) @@ -400,11 +400,11 @@ class UserCsvImportTest < ActiveSupport::TestCase assert_nil(User.find_by(login: 'user-duplicate-import3')) result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(3, result[:records].count) @@ -422,11 +422,11 @@ class UserCsvImportTest < ActiveSupport::TestCase csv_string = "login;firstname2;lastname;email\nuser-invalid-import1;firstname-invalid-import1;firstname-invalid-import1;user-invalid-import1@example.com\nuser-invalid-import2;firstname-invalid-import2;firstname-invalid-import2;user-invalid-import2@example.com\n" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(2, result[:errors].count) @@ -438,11 +438,11 @@ class UserCsvImportTest < ActiveSupport::TestCase assert_nil(User.find_by(login: 'user-invalid-import2')) result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(2, result[:errors].count) @@ -458,11 +458,11 @@ class UserCsvImportTest < ActiveSupport::TestCase csv_string = "login;firstname;lastname;email;organization\nuser-reference-import1;firstname-reference-import1;firstname-reference-import1;user-reference-import1@example.com;organization-reference-import1\nuser-reference-import2;firstname-reference-import2;firstname-reference-import2;user-reference-import2@example.com;organization-reference-import2\nuser-reference-import3;firstname-reference-import3;firstname-reference-import3;user-reference-import3@example.com;Zammad Foundation\n" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(2, result[:errors].count) @@ -474,11 +474,11 @@ class UserCsvImportTest < ActiveSupport::TestCase assert_equal("Line 2: No lookup value found for 'organization': \"organization-reference-import2\"", result[:errors][1]) result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(2, result[:errors].count) @@ -495,11 +495,11 @@ class UserCsvImportTest < ActiveSupport::TestCase orgaization2 = Organization.create_if_not_exists(name: 'organization-reference-import2') result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, + try: true, ) assert_equal(true, result[:try]) assert_equal(0, result[:errors].count) @@ -509,11 +509,11 @@ class UserCsvImportTest < ActiveSupport::TestCase assert(User.find_by(login: 'user-reference-import3')) result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: false, + try: false, ) assert_equal(false, result[:try]) assert_equal(0, result[:errors].count) @@ -534,12 +534,12 @@ class UserCsvImportTest < ActiveSupport::TestCase test 'simple import with delete' do csv_string = "login;firstname;lastname;email\nuser-simple-import-fixed1;firstname-simple-import-fixed1;lastname-simple-import-fixed1;user-simple-import-fixed1@example.com\nuser-simple-import-fixed2;firstname-simple-import-fixed2;lastname-simple-import-fixed2;user-simple-import-fixed2@example.com\n" result = User.csv_import( - string: csv_string, + string: csv_string, parse_params: { col_sep: ';', }, - try: true, - delete: true, + try: true, + delete: true, ) assert_equal(true, result[:try]) diff --git a/test/unit/user_device_test.rb b/test/unit/user_device_test.rb index 8c6561208..1511df694 100644 --- a/test/unit/user_device_test.rb +++ b/test/unit/user_device_test.rb @@ -8,25 +8,25 @@ class UserDeviceTest < ActiveSupport::TestCase groups = Group.all roles = Role.where(name: 'Agent') @agent = User.create_or_update( - login: 'user-device-agent@example.com', + login: 'user-device-agent@example.com', firstname: 'UserDevice', - lastname: 'Agent', - email: 'user-device-agent@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, + lastname: 'Agent', + email: 'user-device-agent@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, ) roles = Role.where(name: 'Customer') @customer = User.create_or_update( - login: 'user-device-customer@example.com', + login: 'user-device-customer@example.com', firstname: 'UserDevice', - lastname: 'Customer', - email: 'user-device-customer@example.com', - password: 'customerpw', - active: true, - roles: roles, + lastname: 'Customer', + email: 'user-device-customer@example.com', + password: 'customerpw', + active: true, + roles: roles, ) end diff --git a/test/unit/user_mail_delivery_failed_test.rb b/test/unit/user_mail_delivery_failed_test.rb index 2ff9e0b9f..749e6e2fd 100644 --- a/test/unit/user_mail_delivery_failed_test.rb +++ b/test/unit/user_mail_delivery_failed_test.rb @@ -7,13 +7,13 @@ class UserMailDeliveryFailedTest < ActiveSupport::TestCase roles = Role.where(name: 'Customer') @customer1 = User.create_or_update( - login: 'user-mail-delivery-failed-customer1@example.com', + login: 'user-mail-delivery-failed-customer1@example.com', firstname: 'UserOutOfOffice', - lastname: 'Customer1', - email: 'user-mail-delivery-failed-customer1@example.com', - password: 'agentpw', - active: true, - roles: roles, + lastname: 'Customer1', + email: 'user-mail-delivery-failed-customer1@example.com', + password: 'agentpw', + active: true, + roles: roles, ) end diff --git a/test/unit/user_out_of_office_test.rb b/test/unit/user_out_of_office_test.rb index b60487162..af4e3c212 100644 --- a/test/unit/user_out_of_office_test.rb +++ b/test/unit/user_out_of_office_test.rb @@ -8,37 +8,37 @@ class UserOutOfOfficeTest < ActiveSupport::TestCase groups = Group.all roles = Role.where(name: 'Agent') @agent1 = User.create!( - login: 'user-out_of_office-agent1@example.com', - firstname: 'UserOutOfOffice', - lastname: 'Agent1', - email: 'user-out_of_office-agent1@example.com', - password: 'agentpw', - active: true, + login: 'user-out_of_office-agent1@example.com', + firstname: 'UserOutOfOffice', + lastname: 'Agent1', + email: 'user-out_of_office-agent1@example.com', + password: 'agentpw', + active: true, out_of_office: false, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) @agent2 = User.create!( - login: 'user-out_of_office-agent2@example.com', - firstname: 'UserOutOfOffice', - lastname: 'Agent2', - email: 'user-out_of_office-agent2@example.com', - password: 'agentpw', - active: true, + login: 'user-out_of_office-agent2@example.com', + firstname: 'UserOutOfOffice', + lastname: 'Agent2', + email: 'user-out_of_office-agent2@example.com', + password: 'agentpw', + active: true, out_of_office: false, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) @agent3 = User.create!( - login: 'user-out_of_office-agent3@example.com', - firstname: 'UserOutOfOffice', - lastname: 'Agent3', - email: 'user-out_of_office-agent3@example.com', - password: 'agentpw', - active: true, + login: 'user-out_of_office-agent3@example.com', + firstname: 'UserOutOfOffice', + lastname: 'Agent3', + email: 'user-out_of_office-agent3@example.com', + password: 'agentpw', + active: true, out_of_office: false, - roles: roles, - groups: groups, + roles: roles, + groups: groups, ) end diff --git a/test/unit/user_ref_object_touch_test.rb b/test/unit/user_ref_object_touch_test.rb index d366da5f4..76bdad455 100644 --- a/test/unit/user_ref_object_touch_test.rb +++ b/test/unit/user_ref_object_touch_test.rb @@ -7,59 +7,59 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'user-ref-object-update-agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'user-ref-object-update-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'user-ref-object-update-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'user-ref-object-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') organization1 = Organization.create_if_not_exists( - name: 'Ref Object Update Org', - updated_at: '2015-02-05 16:37:00', + name: 'Ref Object Update Org', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) customer1 = User.create_or_update( - login: 'user-ref-object-update-customer1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'user-ref-object-update-customer1@example.com', - password: 'customerpw', - active: true, + login: 'user-ref-object-update-customer1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'user-ref-object-update-customer1@example.com', + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer2 = User.create_or_update( - login: 'user-ref-object-update-customer2@example.com', - firstname: 'Notification', - lastname: 'Agent2', - email: 'user-ref-object-update-customer2@example.com', - password: 'customerpw', - active: true, + login: 'user-ref-object-update-customer2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'user-ref-object-update-customer2@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) ticket = Ticket.create( - title: "some title1\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: customer1.id, - owner_id: agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "some title1\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) @@ -117,75 +117,75 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: 'user-ref-object-update-agent1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'user-ref-object-update-agent1@example.com', - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - updated_at: '2015-02-05 16:37:00', + login: 'user-ref-object-update-agent1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'user-ref-object-update-agent1@example.com', + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') organization1 = Organization.create_if_not_exists( - name: 'Ref Object Update Org (not updated)', - updated_at: '2015-02-05 16:37:00', + name: 'Ref Object Update Org (not updated)', + updated_at: '2015-02-05 16:37:00', updated_by_id: 1, created_by_id: 1, ) customer1 = User.create_or_update( - login: 'user-ref-object-update-customer1@example.com', - firstname: 'Notification', - lastname: 'Agent1', - email: 'user-ref-object-update-customer1@example.com', - password: 'customerpw', - active: true, + login: 'user-ref-object-update-customer1@example.com', + firstname: 'Notification', + lastname: 'Agent1', + email: 'user-ref-object-update-customer1@example.com', + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) customer2 = User.create_or_update( - login: 'user-ref-object-update-customer2@example.com', - firstname: 'Notification', - lastname: 'Agent2', - email: 'user-ref-object-update-customer2@example.com', - password: 'customerpw', - active: true, + login: 'user-ref-object-update-customer2@example.com', + firstname: 'Notification', + lastname: 'Agent2', + email: 'user-ref-object-update-customer2@example.com', + password: 'customerpw', + active: true, organization_id: nil, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) (1..100).each do |count| User.create_or_update( - login: "user-ref-object-update-customer3-#{count}@example.com", - firstname: 'Notification', - lastname: 'Agent2', - email: "user-ref-object-update-customer3-#{count}@example.com", - password: 'customerpw', - active: true, + login: "user-ref-object-update-customer3-#{count}@example.com", + firstname: 'Notification', + lastname: 'Agent2', + email: "user-ref-object-update-customer3-#{count}@example.com", + password: 'customerpw', + active: true, organization_id: organization1.id, - roles: roles, - updated_at: '2015-02-05 16:37:00', - updated_by_id: 1, - created_by_id: 1, + roles: roles, + updated_at: '2015-02-05 16:37:00', + updated_by_id: 1, + created_by_id: 1, ) end ticket = Ticket.create( - title: "some title1\n äöüß", - group: Group.lookup(name: 'Users'), - customer_id: customer1.id, - owner_id: agent1.id, - state: Ticket::State.lookup(name: 'new'), - priority: Ticket::Priority.lookup(name: '2 normal'), + title: "some title1\n äöüß", + group: Group.lookup(name: 'Users'), + customer_id: customer1.id, + owner_id: agent1.id, + state: Ticket::State.lookup(name: 'new'), + priority: Ticket::Priority.lookup(name: '2 normal'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 2ae981c96..33e2bc88d 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -4,257 +4,257 @@ class UserTest < ActiveSupport::TestCase test 'user' do tests = [ { - name: '#1 - simple create', - create: { - firstname: 'Firstname', - lastname: 'Lastname', - email: 'some@example.com', - login: 'some@example.com', + name: '#1 - simple create', + create: { + firstname: 'Firstname', + lastname: 'Lastname', + email: 'some@example.com', + login: 'some@example.com', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Firstname', - lastname: 'Lastname', - image: nil, - fullname: 'Firstname Lastname', - email: 'some@example.com', - login: 'some@example.com', + lastname: 'Lastname', + image: nil, + fullname: 'Firstname Lastname', + email: 'some@example.com', + login: 'some@example.com', }, }, { - name: '#2 - simple create - no lastname', - create: { - firstname: 'Firstname Lastname', - lastname: '', - email: 'some@example.com', - login: 'some@example.com', + name: '#2 - simple create - no lastname', + create: { + firstname: 'Firstname Lastname', + lastname: '', + email: 'some@example.com', + login: 'some@example.com', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Firstname', - lastname: 'Lastname', - image: nil, - email: 'some@example.com', - login: 'some@example.com', + lastname: 'Lastname', + image: nil, + email: 'some@example.com', + login: 'some@example.com', }, }, { - name: '#3 - simple create - no firstname', - create: { - firstname: '', - lastname: 'Firstname Lastname', - email: 'some@example.com', - login: 'some@example.com', + name: '#3 - simple create - no firstname', + create: { + firstname: '', + lastname: 'Firstname Lastname', + email: 'some@example.com', + login: 'some@example.com', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Firstname', - lastname: 'Lastname', - image: nil, - email: 'some@example.com', - login: 'some@example.com', + lastname: 'Lastname', + image: nil, + email: 'some@example.com', + login: 'some@example.com', }, }, { - name: '#4 - simple create - nil as lastname', - create: { - firstname: 'Firstname Lastname', - lastname: '', - email: 'some@example.com', - login: 'some@example.com', + name: '#4 - simple create - nil as lastname', + create: { + firstname: 'Firstname Lastname', + lastname: '', + email: 'some@example.com', + login: 'some@example.com', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Firstname', - lastname: 'Lastname', - image: nil, - email: 'some@example.com', - login: 'some@example.com', + lastname: 'Lastname', + image: nil, + email: 'some@example.com', + login: 'some@example.com', }, }, { - name: '#5 - simple create - no lastname, firstname with ","', - create: { - firstname: 'Lastname, Firstname', - lastname: '', - email: 'some@example.com', - login: 'some@example.com', + name: '#5 - simple create - no lastname, firstname with ","', + create: { + firstname: 'Lastname, Firstname', + lastname: '', + email: 'some@example.com', + login: 'some@example.com', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Firstname', - lastname: 'Lastname', - email: 'some@example.com', - login: 'some@example.com', + lastname: 'Lastname', + email: 'some@example.com', + login: 'some@example.com', }, }, { - name: '#6 - simple create - no lastname/firstname', - create: { - firstname: '', - lastname: '', - email: 'firstname.lastname@example.com', - login: 'login-1', + name: '#6 - simple create - no lastname/firstname', + create: { + firstname: '', + lastname: '', + email: 'firstname.lastname@example.com', + login: 'login-1', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Firstname', - lastname: 'Lastname', - fullname: 'Firstname Lastname', - email: 'firstname.lastname@example.com', - login: 'login-1', + lastname: 'Lastname', + fullname: 'Firstname Lastname', + email: 'firstname.lastname@example.com', + login: 'login-1', }, }, { - name: '#7 - simple create - no lastname/firstnam', - create: { - firstname: '', - lastname: '', - email: 'FIRSTNAME.lastname@example.com', - login: 'login-2', + name: '#7 - simple create - no lastname/firstnam', + create: { + firstname: '', + lastname: '', + email: 'FIRSTNAME.lastname@example.com', + login: 'login-2', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Firstname', - lastname: 'Lastname', - email: 'firstname.lastname@example.com', - login: 'login-2', + lastname: 'Lastname', + email: 'firstname.lastname@example.com', + login: 'login-2', }, }, { - name: '#8 - simple create - nill as fristname and lastname', - create: { - firstname: '', - lastname: '', - email: 'FIRSTNAME.lastname@example.com', - login: 'login-3', + name: '#8 - simple create - nill as fristname and lastname', + create: { + firstname: '', + lastname: '', + email: 'FIRSTNAME.lastname@example.com', + login: 'login-3', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Firstname', - lastname: 'Lastname', - email: 'firstname.lastname@example.com', - login: 'login-3', + lastname: 'Lastname', + email: 'firstname.lastname@example.com', + login: 'login-3', }, }, { - name: '#9 - update with avatar check', - create: { - firstname: 'Bob', - lastname: 'Smith', - email: 'bob.smith@example.com', - login: 'login-4', + name: '#9 - update with avatar check', + create: { + firstname: 'Bob', + lastname: 'Smith', + email: 'bob.smith@example.com', + login: 'login-4', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Bob', - lastname: 'Smith', - image: nil, - email: 'bob.smith@example.com', - login: 'login-4', + lastname: 'Smith', + image: nil, + email: 'bob.smith@example.com', + login: 'login-4', }, - update: { + update: { email: 'unit-test1@znuny.com', }, update_verify: { firstname: 'Bob', - lastname: 'Smith', - image: 'a11ed3970e6d3a680527d6f3f075ff89', + lastname: 'Smith', + image: 'a11ed3970e6d3a680527d6f3f075ff89', image_md5: 'a11ed3970e6d3a680527d6f3f075ff89', - email: 'unit-test1@znuny.com', - login: 'login-4', + email: 'unit-test1@znuny.com', + login: 'login-4', } }, { - name: '#10 - update create with avatar check', - create: { - firstname: 'Bob', - lastname: 'Smith', - email: 'unit-test2@znuny.com', - login: 'login-5', + name: '#10 - update create with avatar check', + create: { + firstname: 'Bob', + lastname: 'Smith', + email: 'unit-test2@znuny.com', + login: 'login-5', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Bob', - lastname: 'Smith', - image: 'd76099edb79f39624b35187873184e3c', + lastname: 'Smith', + image: 'd76099edb79f39624b35187873184e3c', image_md5: 'd76099edb79f39624b35187873184e3c', - email: 'unit-test2@znuny.com', - login: 'login-5', + email: 'unit-test2@znuny.com', + login: 'login-5', }, - update: { + update: { email: 'unit-test1@znuny.com', }, update_verify: { firstname: 'Bob', - lastname: 'Smith', - image: 'a11ed3970e6d3a680527d6f3f075ff89', + lastname: 'Smith', + image: 'a11ed3970e6d3a680527d6f3f075ff89', image_md5: 'a11ed3970e6d3a680527d6f3f075ff89', - email: 'unit-test1@znuny.com', - login: 'login-5', + email: 'unit-test1@znuny.com', + login: 'login-5', } }, { - name: '#11 - update create with login/email check', - create: { - firstname: '', - lastname: '', - email: 'caoyaoewfzfw@21222cn.com', + name: '#11 - update create with login/email check', + create: { + firstname: '', + lastname: '', + email: 'caoyaoewfzfw@21222cn.com', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: '', - lastname: '', - fullname: 'caoyaoewfzfw@21222cn.com', - email: 'caoyaoewfzfw@21222cn.com', - login: 'caoyaoewfzfw@21222cn.com', + lastname: '', + fullname: 'caoyaoewfzfw@21222cn.com', + email: 'caoyaoewfzfw@21222cn.com', + login: 'caoyaoewfzfw@21222cn.com', }, - update: { + update: { email: 'caoyaoewfzfw@212224cn.com', }, update_verify: { firstname: '', - lastname: '', - email: 'caoyaoewfzfw@212224cn.com', - fullname: 'caoyaoewfzfw@212224cn.com', - login: 'caoyaoewfzfw@212224cn.com', + lastname: '', + email: 'caoyaoewfzfw@212224cn.com', + fullname: 'caoyaoewfzfw@212224cn.com', + login: 'caoyaoewfzfw@212224cn.com', } }, { - name: '#12 - update create with login/email check', - create: { - firstname: 'Firstname', - lastname: 'Lastname', - email: 'some_tEst11@example.com', + name: '#12 - update create with login/email check', + create: { + firstname: 'Firstname', + lastname: 'Lastname', + email: 'some_tEst11@example.com', updated_by_id: 1, created_by_id: 1, }, create_verify: { firstname: 'Firstname', - lastname: 'Lastname', - fullname: 'Firstname Lastname', - email: 'some_test11@example.com', + lastname: 'Lastname', + fullname: 'Firstname Lastname', + email: 'some_test11@example.com', }, - update: { + update: { email: 'some_Test11-1@example.com', }, update_verify: { firstname: 'Firstname', - lastname: 'Lastname', - email: 'some_test11-1@example.com', - fullname: 'Firstname Lastname', - login: 'some_test11-1@example.com', + lastname: 'Lastname', + email: 'some_test11-1@example.com', + fullname: 'Firstname Lastname', + login: 'some_test11-1@example.com', } }, ] @@ -314,12 +314,12 @@ class UserTest < ActiveSupport::TestCase name = "#{Time.zone.now.to_i}-#{rand(999_999_999_999)}" email = "customer_email#{name}@example.com" customer = User.create!( - firstname: 'Role', - lastname: "Customer#{name}", - email: " #{email} ", - password: 'customerpw', - active: true, - roles: Role.where(name: %w[Customer]), + firstname: 'Role', + lastname: "Customer#{name}", + email: " #{email} ", + password: 'customerpw', + active: true, + roles: Role.where(name: %w[Customer]), updated_by_id: 1, created_by_id: 1, ) @@ -330,12 +330,12 @@ class UserTest < ActiveSupport::TestCase name = "#{Time.zone.now.to_i}-#{rand(999_999_999_999)}" email = "customer_email#{name}@example.com" customer = User.create!( - firstname: "\u{00a0}\u{00a0}Role", - lastname: "Customer#{name} \u{00a0}", - email: "\u{00a0}#{email}\u{00a0}", - password: 'customerpw', - active: true, - roles: Role.where(name: %w[Customer]), + firstname: "\u{00a0}\u{00a0}Role", + lastname: "Customer#{name} \u{00a0}", + email: "\u{00a0}#{email}\u{00a0}", + password: 'customerpw', + active: true, + roles: Role.where(name: %w[Customer]), updated_by_id: 1, created_by_id: 1, ) @@ -348,12 +348,12 @@ class UserTest < ActiveSupport::TestCase name = "#{Time.zone.now.to_i}-#{rand(999_999_999_999)}" email = "customer_email#{name}@example.com" customer = User.create!( - firstname: "\u{200B}\u{200B}Role", - lastname: "Customer#{name} \u{200B}", - email: "\u{200B}#{email}\u{200B}", - password: 'customerpw', - active: true, - roles: Role.where(name: %w[Customer]), + firstname: "\u{200B}\u{200B}Role", + lastname: "Customer#{name} \u{200B}", + email: "\u{200B}#{email}\u{200B}", + password: 'customerpw', + active: true, + roles: Role.where(name: %w[Customer]), updated_by_id: 1, created_by_id: 1, ) @@ -366,12 +366,12 @@ class UserTest < ActiveSupport::TestCase name = "#{Time.zone.now.to_i}-#{rand(999_999_999_999)}" email = "customer_email#{name}@example.com" customer = User.create!( - firstname: "\u{200B}\u{200B}Role\u{00a0}", - lastname: "\u{00a0}\u{00a0}Customer#{name} \u{200B}", - email: "\u{200B}#{email}\u{200B}", - password: 'customerpw', - active: true, - roles: Role.where(name: %w[Customer]), + firstname: "\u{200B}\u{200B}Role\u{00a0}", + lastname: "\u{00a0}\u{00a0}Customer#{name} \u{200B}", + email: "\u{200B}#{email}\u{200B}", + password: 'customerpw', + active: true, + roles: Role.where(name: %w[Customer]), updated_by_id: 1, created_by_id: 1, ) @@ -384,12 +384,12 @@ class UserTest < ActiveSupport::TestCase name = "#{Time.zone.now.to_i}-#{rand(999_999_999_999)}" email = "customer_email#{name}@example.com" customer = User.create!( - firstname: "\u{200a}\u{200b}\u{202F}\u{205F}Role\u{2007}\u{2008}", - lastname: "\u{00a0}\u{00a0}Customer#{name}\u{3000}\u{FEFF}\u{2000}", - email: "\u{200B}#{email}\u{200B}\u{2007}\u{2008}", - password: 'customerpw', - active: true, - roles: Role.where(name: %w[Customer]), + firstname: "\u{200a}\u{200b}\u{202F}\u{205F}Role\u{2007}\u{2008}", + lastname: "\u{00a0}\u{00a0}Customer#{name}\u{3000}\u{FEFF}\u{2000}", + email: "\u{200B}#{email}\u{200B}\u{2007}\u{2008}", + password: 'customerpw', + active: true, + roles: Role.where(name: %w[Customer]), updated_by_id: 1, created_by_id: 1, ) @@ -406,13 +406,13 @@ class UserTest < ActiveSupport::TestCase login = "admin-role_without_email#{name}@example.com" email = "admin-role_without_email#{name}@example.com" admin = User.create_or_update( - login: login, - firstname: 'Role', - lastname: "Admin#{name}", + login: login, + firstname: 'Role', + lastname: "Admin#{name}", #email: "", - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -444,13 +444,13 @@ class UserTest < ActiveSupport::TestCase login = "admin-role_without_email#{name}" email = "admin-role_without_email#{name}@example.com" admin = User.create_or_update( - login: login, - firstname: 'Role', - lastname: "Admin#{name}", + login: login, + firstname: 'Role', + lastname: "Admin#{name}", #email: "", - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -480,13 +480,13 @@ class UserTest < ActiveSupport::TestCase email1 = "admin1-role_without_email#{name}@example.com" admin1 = User.create!( - login: email1, - firstname: 'Role', - lastname: "Admin1#{name}", - email: email1, - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: email1, + firstname: 'Role', + lastname: "Admin1#{name}", + email: email1, + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -496,13 +496,13 @@ class UserTest < ActiveSupport::TestCase assert_raises(Exceptions::UnprocessableEntity) do User.create!( - login: "#{email1}-1", - firstname: 'Role', - lastname: "Admin1#{name}", - email: email1, - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: "#{email1}-1", + firstname: 'Role', + lastname: "Admin1#{name}", + email: email1, + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -510,12 +510,12 @@ class UserTest < ActiveSupport::TestCase email2 = "admin2-role_without_email#{name}@example.com" admin2 = User.create!( - firstname: 'Role', - lastname: "Admin2#{name}", - email: email2, - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + firstname: 'Role', + lastname: "Admin2#{name}", + email: email2, + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -538,13 +538,13 @@ class UserTest < ActiveSupport::TestCase email1 = "admin1-role_without_email#{name}@example.com" admin1 = User.create!( - login: email1, - firstname: 'Role', - lastname: "Admin1#{name}", - email: email1, - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: email1, + firstname: 'Role', + lastname: "Admin1#{name}", + email: email1, + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -553,13 +553,13 @@ class UserTest < ActiveSupport::TestCase assert_equal(admin1.email, email1) admin2 = User.create!( - login: "#{email1}-1", - firstname: 'Role', - lastname: "Admin1#{name}", - email: email1, - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: "#{email1}-1", + firstname: 'Role', + lastname: "Admin1#{name}", + email: email1, + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -572,24 +572,24 @@ class UserTest < ActiveSupport::TestCase test 'ensure roles' do name = rand(999_999_999) admin = User.create_or_update( - login: "admin-role#{name}@example.com", - firstname: 'Role', - lastname: "Admin#{name}", - email: "admin-role#{name}@example.com", - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: "admin-role#{name}@example.com", + firstname: 'Role', + lastname: "Admin#{name}", + email: "admin-role#{name}@example.com", + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) customer1 = User.create_or_update( - login: "user-ensure-role1-#{name}@example.com", - firstname: 'Role', - lastname: "Customer#{name}", - email: "user-ensure-role1-#{name}@example.com", - password: 'customerpw', - active: true, + login: "user-ensure-role1-#{name}@example.com", + firstname: 'Role', + lastname: "Customer#{name}", + email: "user-ensure-role1-#{name}@example.com", + password: 'customerpw', + active: true, updated_by_id: 1, created_by_id: 1, ) @@ -611,13 +611,13 @@ class UserTest < ActiveSupport::TestCase customer1.destroy! customer2 = User.create_or_update( - login: "user-ensure-role2-#{name}@example.com", - firstname: 'Role', - lastname: "Customer#{name}", - email: "user-ensure-role2-#{name}@example.com", - password: 'customerpw', - roles: roles, - active: true, + login: "user-ensure-role2-#{name}@example.com", + firstname: 'Role', + lastname: "Customer#{name}", + email: "user-ensure-role2-#{name}@example.com", + password: 'customerpw', + roles: roles, + active: true, updated_by_id: 1, created_by_id: 1, ) @@ -640,13 +640,13 @@ class UserTest < ActiveSupport::TestCase customer2.destroy! customer3 = User.create_or_update( - login: "user-ensure-role2-#{name}@example.com", - firstname: 'Role', - lastname: "Customer#{name}", - email: "user-ensure-role2-#{name}@example.com", - password: 'customerpw', - roles: roles, - active: true, + login: "user-ensure-role2-#{name}@example.com", + firstname: 'Role', + lastname: "Customer#{name}", + email: "user-ensure-role2-#{name}@example.com", + password: 'customerpw', + roles: roles, + active: true, updated_by_id: 1, created_by_id: 1, ) @@ -679,15 +679,15 @@ class UserTest < ActiveSupport::TestCase groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: "agent-default-preferences#{name}@example.com", - firstname: 'Preferences', - lastname: "Agent#{name}", - email: "agent-default-preferences#{name}@example.com", - password: 'agentpw', - active: true, - roles: roles, - groups: groups, - preferences: { + login: "agent-default-preferences#{name}@example.com", + firstname: 'Preferences', + lastname: "Agent#{name}", + email: "agent-default-preferences#{name}@example.com", + password: 'agentpw', + active: true, + roles: roles, + groups: groups, + preferences: { locale: 'de-de', }, updated_by_id: 1, @@ -704,14 +704,14 @@ class UserTest < ActiveSupport::TestCase roles = Role.where(name: 'Customer') customer1 = User.create_or_update( - login: "customer-default-preferences#{name}@example.com", - firstname: 'Preferences', - lastname: "Customer#{name}", - email: "customer-default-preferences#{name}@example.com", - password: 'customerpw', - active: true, - roles: roles, - preferences: { + login: "customer-default-preferences#{name}@example.com", + firstname: 'Preferences', + lastname: "Customer#{name}", + email: "customer-default-preferences#{name}@example.com", + password: 'customerpw', + active: true, + roles: roles, + preferences: { locale: 'de-de', }, updated_by_id: 1, @@ -737,74 +737,74 @@ class UserTest < ActiveSupport::TestCase test 'permission' do test_role_1 = Role.create_or_update( - name: 'Test1', - note: 'To configure your system.', - preferences: { + name: 'Test1', + note: 'To configure your system.', + preferences: { not: ['Test3'], }, updated_by_id: 1, created_by_id: 1 ) test_role_2 = Role.create_or_update( - name: 'Test2', - note: 'To work on Tickets.', - preferences: { + name: 'Test2', + note: 'To work on Tickets.', + preferences: { not: ['Test3'], }, updated_by_id: 1, created_by_id: 1 ) test_role_3 = Role.create_or_update( - name: 'Test3', - note: 'People who create Tickets ask for help.', - preferences: { + name: 'Test3', + note: 'People who create Tickets ask for help.', + preferences: { not: %w[Test1 Test2], }, updated_by_id: 1, created_by_id: 1 ) test_role_4 = Role.create_or_update( - name: 'Test4', - note: 'Access the report area.', - preferences: {}, + name: 'Test4', + note: 'Access the report area.', + preferences: {}, created_by_id: 1, updated_by_id: 1, ) name = rand(999_999_999) assert_raises(RuntimeError) do User.create_or_update( - login: "customer-role#{name}@example.com", - firstname: 'Role', - lastname: "Customer#{name}", - email: "customer-role#{name}@example.com", - password: 'customerpw', - active: true, - roles: [test_role_1, test_role_3], + login: "customer-role#{name}@example.com", + firstname: 'Role', + lastname: "Customer#{name}", + email: "customer-role#{name}@example.com", + password: 'customerpw', + active: true, + roles: [test_role_1, test_role_3], updated_by_id: 1, created_by_id: 1, ) end assert_raises(RuntimeError) do User.create_or_update( - login: "customer-role#{name}@example.com", - firstname: 'Role', - lastname: "Customer#{name}", - email: "customer-role#{name}@example.com", - password: 'customerpw', - active: true, - roles: [test_role_2, test_role_3], + login: "customer-role#{name}@example.com", + firstname: 'Role', + lastname: "Customer#{name}", + email: "customer-role#{name}@example.com", + password: 'customerpw', + active: true, + roles: [test_role_2, test_role_3], updated_by_id: 1, created_by_id: 1, ) end user1 = User.create_or_update( - login: "customer-role#{name}@example.com", - firstname: 'Role', - lastname: "Customer#{name}", - email: "customer-role#{name}@example.com", - password: 'customerpw', - active: true, - roles: [test_role_1, test_role_2], + login: "customer-role#{name}@example.com", + firstname: 'Role', + lastname: "Customer#{name}", + email: "customer-role#{name}@example.com", + password: 'customerpw', + active: true, + roles: [test_role_1, test_role_2], updated_by_id: 1, created_by_id: 1, ) @@ -813,13 +813,13 @@ class UserTest < ActiveSupport::TestCase assert_not(user1.role_ids.include?(test_role_3.id)) assert_not(user1.role_ids.include?(test_role_4.id)) user1 = User.create_or_update( - login: "customer-role#{name}@example.com", - firstname: 'Role', - lastname: "Customer#{name}", - email: "customer-role#{name}@example.com", - password: 'customerpw', - active: true, - roles: [test_role_1, test_role_4], + login: "customer-role#{name}@example.com", + firstname: 'Role', + lastname: "Customer#{name}", + email: "customer-role#{name}@example.com", + password: 'customerpw', + active: true, + roles: [test_role_1, test_role_4], updated_by_id: 1, created_by_id: 1, ) @@ -829,26 +829,26 @@ class UserTest < ActiveSupport::TestCase assert(user1.role_ids.include?(test_role_4.id)) assert_raises(RuntimeError) do User.create_or_update( - login: "customer-role#{name}@example.com", - firstname: 'Role', - lastname: "Customer#{name}", - email: "customer-role#{name}@example.com", - password: 'customerpw', - active: true, - roles: [test_role_1, test_role_3], + login: "customer-role#{name}@example.com", + firstname: 'Role', + lastname: "Customer#{name}", + email: "customer-role#{name}@example.com", + password: 'customerpw', + active: true, + roles: [test_role_1, test_role_3], updated_by_id: 1, created_by_id: 1, ) end assert_raises(RuntimeError) do User.create_or_update( - login: "customer-role#{name}@example.com", - firstname: 'Role', - lastname: "Customer#{name}", - email: "customer-role#{name}@example.com", - password: 'customerpw', - active: true, - roles: [test_role_2, test_role_3], + login: "customer-role#{name}@example.com", + firstname: 'Role', + lastname: "Customer#{name}", + email: "customer-role#{name}@example.com", + password: 'customerpw', + active: true, + roles: [test_role_2, test_role_3], updated_by_id: 1, created_by_id: 1, ) @@ -864,37 +864,37 @@ class UserTest < ActiveSupport::TestCase name = rand(999_999_999) admin_count = User.with_permissions('admin').count admin = User.create_or_update( - login: "admin-role#{name}@example.com", - firstname: 'Role', - lastname: "Admin#{name}", - email: "admin-role#{name}@example.com", - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: "admin-role#{name}@example.com", + firstname: 'Role', + lastname: "Admin#{name}", + email: "admin-role#{name}@example.com", + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) agent_count = User.with_permissions('ticket.agent').count agent = User.create_or_update( - login: "agent-role#{name}@example.com", - firstname: 'Role', - lastname: "Agent#{name}", - email: "agent-role#{name}@example.com", - password: 'agentpw', - active: true, - roles: Role.where(name: 'Agent'), + login: "agent-role#{name}@example.com", + firstname: 'Role', + lastname: "Agent#{name}", + email: "agent-role#{name}@example.com", + password: 'agentpw', + active: true, + roles: Role.where(name: 'Agent'), updated_by_id: 1, created_by_id: 1, ) customer_count = User.with_permissions('ticket.customer').count customer = User.create_or_update( - login: "customer-role#{name}@example.com", - firstname: 'Role', - lastname: "Customer#{name}", - email: "customer-role#{name}@example.com", - password: 'customerpw', - active: true, - roles: Role.where(name: 'Customer'), + login: "customer-role#{name}@example.com", + firstname: 'Role', + lastname: "Customer#{name}", + email: "customer-role#{name}@example.com", + password: 'customerpw', + active: true, + roles: Role.where(name: 'Customer'), updated_by_id: 1, created_by_id: 1, ) @@ -941,39 +941,39 @@ class UserTest < ActiveSupport::TestCase # create two admin users random = rand(999_999_999) admin1 = User.create_or_update( - login: "1admin-role#{random}@example.com", - firstname: 'Role', - lastname: "Admin#{random}", - email: "admin-role#{random}@example.com", - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: "1admin-role#{random}@example.com", + firstname: 'Role', + lastname: "Admin#{random}", + email: "admin-role#{random}@example.com", + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) random = rand(999_999_999) admin2 = User.create_or_update( - login: "2admin-role#{random}@example.com", - firstname: 'Role', - lastname: "Admin#{random}", - email: "admin-role#{random}@example.com", - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: "2admin-role#{random}@example.com", + firstname: 'Role', + lastname: "Admin#{random}", + email: "admin-role#{random}@example.com", + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) random = rand(999_999_999) admin3 = User.create_or_update( - login: "2admin-role#{random}@example.com", - firstname: 'Role', - lastname: "Admin#{random}", - email: "admin-role#{random}@example.com", - password: 'adminpw', - active: true, - roles: Role.where(name: %w[Admin Agent]), + login: "2admin-role#{random}@example.com", + firstname: 'Role', + lastname: "Admin#{random}", + email: "admin-role#{random}@example.com", + password: 'adminpw', + active: true, + roles: Role.where(name: %w[Admin Agent]), updated_by_id: 1, created_by_id: 1, ) @@ -1021,33 +1021,33 @@ class UserTest < ActiveSupport::TestCase test 'only valid agent in group permission check' do name = rand(999_999_999) group = Group.create!( - name: "ValidAgentGroupPermission-#{name}", - active: true, + name: "ValidAgentGroupPermission-#{name}", + active: true, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Agent') agent1 = User.create_or_update( - login: "agent-default-vaild_agent_group_permission-1#{name}@example.com", - firstname: 'vaild_agent_group_permission-1', - lastname: "Agent#{name}", - email: "agent-default-vaild_agent_group_permission-1#{name}@example.com", - password: 'agentpw', - active: true, - roles: roles, - groups: [group], + login: "agent-default-vaild_agent_group_permission-1#{name}@example.com", + firstname: 'vaild_agent_group_permission-1', + lastname: "Agent#{name}", + email: "agent-default-vaild_agent_group_permission-1#{name}@example.com", + password: 'agentpw', + active: true, + roles: roles, + groups: [group], updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( - login: "agent-default-vaild_agent_group_permission-2#{name}@example.com", - firstname: 'vaild_agent_group_permission-2', - lastname: "Agent#{name}", - email: "agent-default-vaild_agent_group_permission-2#{name}@example.com", - password: 'agentpw', - active: true, - roles: roles, - groups: [group], + login: "agent-default-vaild_agent_group_permission-2#{name}@example.com", + firstname: 'vaild_agent_group_permission-2', + lastname: "Agent#{name}", + email: "agent-default-vaild_agent_group_permission-2#{name}@example.com", + password: 'agentpw', + active: true, + roles: roles, + groups: [group], updated_by_id: 1, created_by_id: 1, ) @@ -1067,14 +1067,14 @@ class UserTest < ActiveSupport::TestCase test 'preferences[:notification_sound][:enabled] value check' do roles = Role.where(name: 'Agent') agent1 = User.create!( - login: "agent-default-preferences-1#{name}@example.com", - firstname: 'vaild_agent_group_permission-1', - lastname: "Agent#{name}", - email: "agent-default-preferences-1#{name}@example.com", - password: 'agentpw', - active: true, - roles: roles, - preferences: { + login: "agent-default-preferences-1#{name}@example.com", + firstname: 'vaild_agent_group_permission-1', + lastname: "Agent#{name}", + email: "agent-default-preferences-1#{name}@example.com", + password: 'agentpw', + active: true, + roles: roles, + preferences: { notification_sound: { enabled: true, } @@ -1085,14 +1085,14 @@ class UserTest < ActiveSupport::TestCase assert_equal(true, agent1.preferences[:notification_sound][:enabled]) agent2 = User.create!( - login: "agent-default-preferences-2#{name}@example.com", - firstname: 'vaild_agent_group_permission-2', - lastname: "Agent#{name}", - email: "agent-default-preferences-2#{name}@example.com", - password: 'agentpw', - active: true, - roles: roles, - preferences: { + login: "agent-default-preferences-2#{name}@example.com", + firstname: 'vaild_agent_group_permission-2', + lastname: "Agent#{name}", + email: "agent-default-preferences-2#{name}@example.com", + password: 'agentpw', + active: true, + roles: roles, + preferences: { notification_sound: { enabled: false, } @@ -1103,14 +1103,14 @@ class UserTest < ActiveSupport::TestCase assert_equal(false, agent2.preferences[:notification_sound][:enabled]) agent3 = User.create!( - login: "agent-default-preferences-3#{name}@example.com", - firstname: 'vaild_agent_group_permission-3', - lastname: "Agent#{name}", - email: "agent-default-preferences-3#{name}@example.com", - password: 'agentpw', - active: true, - roles: roles, - preferences: { + login: "agent-default-preferences-3#{name}@example.com", + firstname: 'vaild_agent_group_permission-3', + lastname: "Agent#{name}", + email: "agent-default-preferences-3#{name}@example.com", + password: 'agentpw', + active: true, + roles: roles, + preferences: { notification_sound: { enabled: true, } @@ -1125,14 +1125,14 @@ class UserTest < ActiveSupport::TestCase assert_equal(false, agent3.preferences[:notification_sound][:enabled]) agent4 = User.create!( - login: "agent-default-preferences-4#{name}@example.com", - firstname: 'vaild_agent_group_permission-4', - lastname: "Agent#{name}", - email: "agent-default-preferences-4#{name}@example.com", - password: 'agentpw', - active: true, - roles: roles, - preferences: { + login: "agent-default-preferences-4#{name}@example.com", + firstname: 'vaild_agent_group_permission-4', + lastname: "Agent#{name}", + email: "agent-default-preferences-4#{name}@example.com", + password: 'agentpw', + active: true, + roles: roles, + preferences: { notification_sound: { enabled: false, } @@ -1153,14 +1153,14 @@ class UserTest < ActiveSupport::TestCase assert_raises(Exceptions::UnprocessableEntity) do User.create!( - login: "agent-default-preferences-5#{name}@example.com", - firstname: 'vaild_agent_group_permission-5', - lastname: "Agent#{name}", - email: "agent-default-preferences-5#{name}@example.com", - password: 'agentpw', - active: true, - roles: roles, - preferences: { + login: "agent-default-preferences-5#{name}@example.com", + firstname: 'vaild_agent_group_permission-5', + lastname: "Agent#{name}", + email: "agent-default-preferences-5#{name}@example.com", + password: 'agentpw', + active: true, + roles: roles, + preferences: { notification_sound: { enabled: 'invalid string', } @@ -1174,14 +1174,14 @@ class UserTest < ActiveSupport::TestCase test 'cleanup references on destroy' do agent1 = User.create!( - login: "agent-cleanup_check-1#{name}@example.com", - firstname: 'vaild_agent_group_permission-1', - lastname: "Agent#{name}", - email: "agent-cleanup_check-1#{name}@example.com", - password: 'agentpw', - active: true, - roles: Role.where(name: 'Agent'), - groups: Group.all, + login: "agent-cleanup_check-1#{name}@example.com", + firstname: 'vaild_agent_group_permission-1', + lastname: "Agent#{name}", + email: "agent-cleanup_check-1#{name}@example.com", + password: 'agentpw', + active: true, + roles: Role.where(name: 'Agent'), + groups: Group.all, updated_by_id: 1, created_by_id: 1, ) @@ -1214,44 +1214,44 @@ class UserTest < ActiveSupport::TestCase assert_equal(1, OnlineNotification.where(user_id: agent1_id).count) Authorization.create!( - user: agent1, - uid: '123', + user: agent1, + uid: '123', username: '123', provider: 'some', - token: 'token', - secret: 'secret', + token: 'token', + secret: 'secret', ) assert_equal(1, Authorization.where(user_id: agent1_id).count) Cti::CallerId.maybe_add( caller_id: '49123456789', - comment: 'Hairdresser Bob Smith, San Francisco', #optional - level: 'maybe', # known|maybe - user_id: agent1_id, # optional - object: 'Ticket', - o_id: 1, + comment: 'Hairdresser Bob Smith, San Francisco', #optional + level: 'maybe', # known|maybe + user_id: agent1_id, # optional + object: 'Ticket', + o_id: 1, ) assert_equal(1, Cti::CallerId.where(user_id: agent1_id).count) Taskbar.create!( client_id: 123, - key: 'Ticket-1', - callback: 'TicketZoom', - params: { + key: 'Ticket-1', + callback: 'TicketZoom', + params: { id: 1, }, - state: {}, - user_id: agent1_id, - prio: 1, - notify: false, + state: {}, + user_id: agent1_id, + prio: 1, + notify: false, ) assert_equal(1, Taskbar.where(user_id: agent1_id).count) ticket1 = Ticket.create!( - title: 'test 1234-1', - group: Group.lookup(name: 'Users'), - customer_id: 2, - owner_id: 2, + title: 'test 1234-1', + group: Group.lookup(name: 'Users'), + customer_id: 2, + owner_id: 2, updated_by_id: 1, created_by_id: 1, ) @@ -1262,17 +1262,17 @@ class UserTest < ActiveSupport::TestCase Token.create!(action: 'api', user_id: agent1_id) StatsStore.add( - object: 'User', - o_id: agent1_id, - key: 'some_key', - data: { A: 1, B: 2 }, - created_at: Time.zone.now, + object: 'User', + o_id: agent1_id, + key: 'some_key', + data: { A: 1, B: 2 }, + created_at: Time.zone.now, created_by_id: 1, ) item = StatsStore.search( object: 'User', - o_id: agent1_id, - key: 'some_key', + o_id: agent1_id, + key: 'some_key', ) assert(item) @@ -1290,29 +1290,29 @@ class UserTest < ActiveSupport::TestCase assert_equal(0, Token.where(user_id: agent1_id).count) item = StatsStore.search( object: 'User', - o_id: agent1_id, - key: 'some_key', + o_id: agent1_id, + key: 'some_key', ) assert_nil(item) end test 'adding group drops cache' do agent1 = User.create!( - login: "agent-cleanup_check-1#{name}@example.com", - firstname: 'vaild_agent_group_permission-1', - lastname: "Agent#{name}", - email: "agent-cleanup_check-1#{name}@example.com", - password: 'agentpw', - active: true, - roles: Role.where(name: 'Agent'), - groups: Group.all, + login: "agent-cleanup_check-1#{name}@example.com", + firstname: 'vaild_agent_group_permission-1', + lastname: "Agent#{name}", + email: "agent-cleanup_check-1#{name}@example.com", + password: 'agentpw', + active: true, + roles: Role.where(name: 'Agent'), + groups: Group.all, updated_by_id: 1, created_by_id: 1, ) group1 = Group.create_or_update( - name: "GroupWithoutPermission-#{rand(9_999_999_999)}", - active: true, + name: "GroupWithoutPermission-#{rand(9_999_999_999)}", + active: true, updated_by_id: 1, created_by_id: 1, )