fat_free_crm 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fat_free_crm might be problematic. Click here for more details.

Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/fat_free_crm.js +3 -0
  3. data/app/assets/config/manifest.js +1 -3
  4. data/app/controllers/admin/field_groups_controller.rb +0 -2
  5. data/app/controllers/admin/tags_controller.rb +1 -1
  6. data/app/controllers/admin/users_controller.rb +1 -1
  7. data/app/controllers/application_controller.rb +11 -0
  8. data/app/controllers/comments_controller.rb +2 -0
  9. data/app/controllers/emails_controller.rb +2 -0
  10. data/app/controllers/entities/accounts_controller.rb +3 -1
  11. data/app/controllers/entities/campaigns_controller.rb +3 -1
  12. data/app/controllers/entities/contacts_controller.rb +3 -1
  13. data/app/controllers/entities/leads_controller.rb +4 -2
  14. data/app/controllers/entities/opportunities_controller.rb +3 -1
  15. data/app/controllers/entities_controller.rb +2 -0
  16. data/app/controllers/home_controller.rb +2 -0
  17. data/app/controllers/lists_controller.rb +2 -0
  18. data/app/controllers/tasks_controller.rb +3 -1
  19. data/app/controllers/users_controller.rb +2 -0
  20. data/app/models/fields/custom_field.rb +2 -2
  21. data/app/models/observers/entity_observer.rb +1 -1
  22. data/app/models/polymorphic/comment.rb +1 -1
  23. data/app/models/setting.rb +4 -5
  24. data/app/models/users/user.rb +1 -1
  25. data/bin/bundle +108 -2
  26. data/bin/rails +3 -3
  27. data/bin/rake +2 -2
  28. data/bin/setup +12 -15
  29. data/config/application.rb +9 -4
  30. data/config/boot.rb +3 -5
  31. data/config/cable.yml +10 -0
  32. data/config/database.yml +26 -0
  33. data/config/environment.rb +4 -3
  34. data/config/environments/development.rb +47 -14
  35. data/config/environments/production.rb +17 -15
  36. data/config/environments/test.rb +19 -9
  37. data/config/initializers/action_mailer.rb +1 -0
  38. data/config/initializers/content_security_policy.rb +21 -26
  39. data/config/initializers/custom_field_ransack_translations.rb +1 -0
  40. data/config/initializers/filter_parameter_logging.rb +6 -2
  41. data/config/initializers/inflections.rb +4 -4
  42. data/config/initializers/permissions_policy.rb +12 -0
  43. data/config/storage.yml +5 -5
  44. data/db/demo/field_groups.yml +2 -1
  45. data/db/migrate/20230526212613_convert_to_active_storage.rb +27 -11
  46. data/db/schema.rb +107 -105
  47. data/lib/fat_free_crm/callback.rb +2 -3
  48. data/lib/fat_free_crm/mail_processor/dropbox.rb +1 -1
  49. data/lib/fat_free_crm/version.rb +1 -1
  50. data/public/avatars/User/2/large_rails.png +0 -0
  51. data/public/avatars/User/2/medium_rails.png +0 -0
  52. data/public/avatars/User/2/original_rails.png +0 -0
  53. data/public/avatars/User/2/small_rails.png +0 -0
  54. data/public/avatars/User/2/thumb_rails.png +0 -0
  55. data/public/avatars/User/3/large_rails.png +0 -0
  56. data/public/avatars/User/3/medium_rails.png +0 -0
  57. data/public/avatars/User/3/original_rails.png +0 -0
  58. data/public/avatars/User/3/small_rails.png +0 -0
  59. data/public/avatars/User/3/thumb_rails.png +0 -0
  60. data/public/avatars/User/4/large_rails.png +0 -0
  61. data/public/avatars/User/4/medium_rails.png +0 -0
  62. data/public/avatars/User/4/original_rails.png +0 -0
  63. data/public/avatars/User/4/small_rails.png +0 -0
  64. data/public/avatars/User/4/thumb_rails.png +0 -0
  65. data/public/avatars/User/6/large_rails.png +0 -0
  66. data/public/avatars/User/6/medium_rails.png +0 -0
  67. data/public/avatars/User/6/original_rails.png +0 -0
  68. data/public/avatars/User/6/small_rails.png +0 -0
  69. data/public/avatars/User/6/thumb_rails.png +0 -0
  70. data/public/avatars/User/7/large_rails.png +0 -0
  71. data/public/avatars/User/7/medium_rails.png +0 -0
  72. data/public/avatars/User/7/original_rails.png +0 -0
  73. data/public/avatars/User/7/small_rails.png +0 -0
  74. data/public/avatars/User/7/thumb_rails.png +0 -0
  75. metadata +64 -16
  76. data/config/initializers/new_framework_defaults_6_0.rb +0 -46
@@ -7,35 +7,59 @@
7
7
  #------------------------------------------------------------------------------
8
8
  if defined?(FatFreeCRM::Application)
9
9
  FatFreeCRM::Application.configure do
10
- # Settings specified here will take precedence over those in config/application.rb
11
- config.eager_load = false
10
+ # Settings specified here will take precedence over those in config/application.rb.
12
11
 
13
- # In the development environment your application's code is reloaded on
14
- # every request. This slows down response time but is perfect for development
12
+ # In the development environment your application's code is reloaded any time
13
+ # it changes. This slows down response time but is perfect for development
15
14
  # since you don't have to restart the web server when you make code changes.
16
15
  config.cache_classes = false
17
16
 
18
- config.assets.quiet = true
17
+ # Do not eager load code on boot.
18
+ config.eager_load = false
19
+
20
+ # Show full error reports.
21
+ config.consider_all_requests_local = true
22
+
23
+ # Enable server timing
24
+ config.server_timing = true
19
25
 
20
- # Show full error reports and disable caching
21
- config.consider_all_requests_local = true
22
- config.action_controller.perform_caching = false
26
+ # Enable/disable caching. By default caching is disabled.
27
+ # Run rails dev:cache to toggle caching.
28
+ if Rails.root.join("tmp/caching-dev.txt").exist?
29
+ config.action_controller.perform_caching = true
30
+ config.action_controller.enable_fragment_cache_logging = true
31
+
32
+ config.cache_store = :memory_store
33
+ config.public_file_server.headers = {
34
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
35
+ }
36
+ else
37
+ config.action_controller.perform_caching = false
38
+
39
+ config.cache_store = :null_store
40
+ end
41
+
42
+ # Store uploaded files on the local file system (see config/storage.yml for options).
43
+ config.active_storage.service = :local
23
44
 
24
45
  config.action_mailer.delivery_method = :file
25
46
  config.action_mailer.default_url_options = { host: 'localhost:3000' }
26
47
 
27
- # Don't care if the mailer can't send
48
+ # Don't care if the mailer can't send.
28
49
  config.action_mailer.raise_delivery_errors = false
29
50
 
30
- # Print deprecation notices to the Rails logger
51
+ # Print deprecation notices to the Rails logger.
31
52
  config.active_support.deprecation = :log
32
53
 
33
54
  # Only use best-standards-support built into browsers
34
55
  # config.action_dispatch.best_standards_support = :builtin
35
56
 
36
- # Raise an error on page load if there are pending migrations
57
+ # Raise an error on page load if there are pending migrations.
37
58
  config.active_record.migration_error = :page_load
38
59
 
60
+ # Highlight code that triggered database queries in logs.
61
+ config.active_record.verbose_query_logs = true
62
+
39
63
  # Expands the lines which load the assets
40
64
  config.assets.debug = true
41
65
 
@@ -43,12 +67,21 @@ if defined?(FatFreeCRM::Application)
43
67
  # yet still be able to expire them through the digest params.
44
68
  config.assets.digest = true
45
69
 
70
+ # Suppress logger output for asset requests.
71
+ config.assets.quiet = true
72
+
73
+ # Raises error for missing translations.
74
+ # config.i18n.raise_on_missing_translations = true
75
+
76
+ # Annotate rendered view with file names.
77
+ # config.action_view.annotate_rendered_view_with_filenames = true
78
+
79
+ # Uncomment if you wish to allow Action Cable access from any origin.
80
+ # config.action_cable.disable_request_forgery_protection = true
81
+
46
82
  # Adds additional error checking when serving assets at runtime.
47
83
  # Checks for improperly declared sprockets dependencies.
48
84
  # Raises helpful error messages.
49
85
  config.assets.raise_runtime_errors = true
50
-
51
- # Store files locally.
52
- config.active_storage.service = :local
53
86
  end
54
87
  end
@@ -7,15 +7,19 @@
7
7
  #------------------------------------------------------------------------------
8
8
  if defined?(FatFreeCRM::Application)
9
9
  FatFreeCRM::Application.configure do
10
- # Settings specified here will take precedence over those in config/application.rb
11
- config.eager_load = true
10
+ # Settings specified here will take precedence over those in config/application.rb.
12
11
 
13
- # Code is not reloaded between requests
12
+ # Code is not reloaded between requests.
14
13
  config.cache_classes = true
15
14
 
16
- # Full error reports are enabled, since this is an internal application.
15
+ # Eager load code on boot. This eager loads most of Rails and
16
+ # your application in memory, allowing both threaded web servers
17
+ # and those relying on copy on write to perform better.
18
+ # Rake tasks automatically ignore this option for performance.
19
+ config.eager_load = true
20
+
21
+ # Full error reports are disabled and caching is turned on.
17
22
  config.consider_all_requests_local = false
18
- # Caching is turned on
19
23
  config.action_controller.perform_caching = true
20
24
 
21
25
  # Disable Rails's static asset server (Apache or nginx will already do this)
@@ -24,29 +28,27 @@ if defined?(FatFreeCRM::Application)
24
28
  # Compress JavaScripts and CSS
25
29
  config.assets.compress = true
26
30
 
27
- # Don't fallback to assets pipeline if a precompiled asset is missed
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
28
32
  config.assets.compile = false
29
33
 
30
34
  # Generate digests for assets URLs
31
35
  config.assets.digest = true
32
36
 
33
- # Defaults to Rails.root.join("public/assets")
34
- # config.assets.manifest = YOUR_PATH
35
-
36
- # Specifies the header that your server uses for sending files
37
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
38
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
37
+ # Specifies the header that your server uses for sending files.
38
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
39
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
39
40
 
40
41
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
41
42
  # config.force_ssl = true
42
43
 
43
- # See everything in the log (default is :info)
44
+ # Include generic and useful information about system operation, but avoid logging too much
45
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
44
46
  config.log_level = :info
45
47
 
46
48
  # Use a different logger for distributed setups
47
49
  # config.logger = SyslogLogger.new
48
50
 
49
- # Use a different cache store in production
51
+ # Use a different cache store in production.
50
52
  # config.cache_store = :mem_cache_store
51
53
 
52
54
  # Enable serving of images, stylesheets, and JavaScripts from an asset server
@@ -56,7 +58,7 @@ if defined?(FatFreeCRM::Application)
56
58
  # config.assets.precompile += %w( search.js )
57
59
 
58
60
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
59
- # the I18n.default_locale when a translation can not be found)
61
+ # the I18n.default_locale when a translation cannot be found).
60
62
  config.i18n.fallbacks = true
61
63
 
62
64
  # Send deprecation notices to registered listeners
@@ -7,29 +7,33 @@
7
7
  #------------------------------------------------------------------------------
8
8
  if defined?(FatFreeCRM::Application)
9
9
  FatFreeCRM::Application.configure do
10
+ # Settings specified here will take precedence over those in config/application.rb.
11
+
10
12
  # The test environment is used exclusively to run your application's
11
13
  # test suite. You never need to work with it otherwise. Remember that
12
14
  # your test database is "scratch space" for the test suite and is wiped
13
15
  # and recreated between test runs. Don't rely on the data there!
16
+ # Turn false under Spring and add config.action_view.cache_template_loading = true.
14
17
  config.cache_classes = true
15
18
 
16
- # Do not eager load code on boot. This avoids loading your whole application
17
- # just for the purpose of running a single test. If you are using a tool that
18
- # preloads Rails for running tests, you may have to set it to true.
19
- config.eager_load = false
19
+ # Eager loading loads your whole application. When running a single test locally,
20
+ # this probably isn't necessary. It's a good idea to do in a continuous integration
21
+ # system, or in some way before deploying your code.
22
+ config.eager_load = ENV["CI"].present?
20
23
 
21
- # Configure static file server for tests with Cache-Control for performance.
24
+ # Configure public file server for tests with Cache-Control for performance.
22
25
  config.public_file_server.enabled = true
23
26
  config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
24
27
 
25
- # Show full error reports and disable caching
28
+ # Show full error reports and disable caching.
26
29
  config.consider_all_requests_local = true
27
30
  config.action_controller.perform_caching = false
31
+ config.cache_store = :null_store
28
32
 
29
- # Raise exceptions instead of rendering exception templates
33
+ # Raise exceptions instead of rendering exception templates.
30
34
  config.action_dispatch.show_exceptions = false
31
35
 
32
- # Disable request forgery protection in test environment
36
+ # Disable request forgery protection in test environment.
33
37
  config.action_controller.allow_forgery_protection = false
34
38
 
35
39
  # Tell Action Mailer not to deliver emails to the real world.
@@ -43,7 +47,7 @@ if defined?(FatFreeCRM::Application)
43
47
  # Randomize the order test cases are executed.
44
48
  config.active_support.test_order = :random
45
49
 
46
- # Print deprecation notices to the stderr
50
+ # Print deprecation notices to the stderr.
47
51
  config.active_support.deprecation = :stderr
48
52
 
49
53
  # Store uploaded files on the local file system in a temporary directory
@@ -52,6 +56,12 @@ if defined?(FatFreeCRM::Application)
52
56
  config.action_mailer.perform_caching = false
53
57
  # Raises error for missing translations
54
58
  # config.action_view.raise_on_missing_translations = true
59
+
60
+ # Raises error for missing translations.
61
+ # config.i18n.raise_on_missing_translations = true
62
+
63
+ # Annotate rendered view with file names.
64
+ # config.action_view.annotate_rendered_view_with_filenames = true
55
65
  end
56
66
 
57
67
  # Optionally load 'awesome_print' for debugging in development mode.
@@ -10,6 +10,7 @@
10
10
  # ActionMailer is setup in test mode later on
11
11
  #
12
12
  unless Rails.env.test?
13
+ require './app/models/setting'
13
14
 
14
15
  smtp_settings = Setting.smtp || {}
15
16
 
@@ -1,31 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
  # Be sure to restart your server when you modify this file.
3
3
 
4
- # Define an application-wide content security policy
5
- # For further information see the following documentation
6
- # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
4
+ # Define an application-wide content security policy.
5
+ # See the Securing Rails Applications Guide for more information:
6
+ # https://guides.rubyonrails.org/security.html#content-security-policy-header
7
7
 
8
- # Rails.application.config.content_security_policy do |policy|
9
- # policy.default_src :self, :https
10
- # policy.font_src :self, :https, :data
11
- # policy.img_src :self, :https, :data
12
- # policy.object_src :none
13
- # policy.script_src :self, :https
14
- # policy.style_src :self, :https
15
- # # If you are using webpack-dev-server then specify webpack-dev-server host
16
- # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
17
-
18
- # # Specify URI for violation reports
19
- # # policy.report_uri "/csp-violation-report-endpoint"
8
+ # Rails.application.configure do
9
+ # config.content_security_policy do |policy|
10
+ # policy.default_src :self, :https
11
+ # policy.font_src :self, :https, :data
12
+ # policy.img_src :self, :https, :data
13
+ # policy.object_src :none
14
+ # policy.script_src :self, :https
15
+ # policy.style_src :self, :https
16
+ # # Specify URI for violation reports
17
+ # # policy.report_uri "/csp-violation-report-endpoint"
18
+ # end
19
+ #
20
+ # # Generate session nonces for permitted importmap and inline scripts
21
+ # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
22
+ # config.content_security_policy_nonce_directives = %w(script-src)
23
+ #
24
+ # # Report violations without enforcing the policy.
25
+ # # config.content_security_policy_report_only = true
20
26
  # end
21
-
22
- # If you are using UJS then enable automatic nonce generation
23
- # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
24
-
25
- # Set the nonce only to specific directives
26
- # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
27
-
28
- # Report CSP violations to a specified URI
29
- # For further information see the following documentation:
30
- # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
31
- # Rails.application.config.content_security_policy_report_only = true
@@ -6,6 +6,7 @@
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
8
  # Load field names for custom fields, for Ransack search
9
+ require './app/models/setting'
9
10
  if Setting.database_and_table_exists?
10
11
  Rails.application.config.after_initialize do
11
12
  I18n.backend.load_translations
@@ -2,5 +2,9 @@
2
2
 
3
3
  # Be sure to restart your server when you modify this file.
4
4
 
5
- # Configure sensitive parameters which will be filtered from the log file.
6
- Rails.application.config.filter_parameters += [:password]
5
+ # Configure parameters to be filtered from the log file. Use this to limit dissemination of
6
+ # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
7
+ # notations and behaviors.
8
+ Rails.application.config.filter_parameters += %i[
9
+ passw secret token _key crypt salt certificate otp ssn
10
+ ]
@@ -5,13 +5,13 @@
5
5
  # are locale specific, and you may define rules for as many different
6
6
  # locales as you wish. All of these examples are active by default:
7
7
  # ActiveSupport::Inflector.inflections(:en) do |inflect|
8
- # inflect.plural /^(ox)$/i, '\1en'
9
- # inflect.singular /^(ox)en/i, '\1'
10
- # inflect.irregular 'person', 'people'
8
+ # inflect.plural /^(ox)$/i, "\\1en"
9
+ # inflect.singular /^(ox)en/i, "\\1"
10
+ # inflect.irregular "person", "people"
11
11
  # inflect.uncountable %w( fish sheep )
12
12
  # end
13
13
 
14
14
  # These inflection rules are supported but not enabled by default:
15
15
  # ActiveSupport::Inflector.inflections(:en) do |inflect|
16
- # inflect.acronym 'RESTful'
16
+ # inflect.acronym "RESTful"
17
17
  # end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ # Define an application-wide HTTP permissions policy. For further
3
+ # information see https://developers.google.com/web/updates/2018/06/feature-policy
4
+ #
5
+ # Rails.application.config.permissions_policy do |f|
6
+ # f.camera :none
7
+ # f.gyroscope :none
8
+ # f.microphone :none
9
+ # f.usb :none
10
+ # f.fullscreen :self
11
+ # f.payment :self, "https://secure.example.com"
12
+ # end
data/config/storage.yml CHANGED
@@ -6,27 +6,27 @@ local:
6
6
  service: Disk
7
7
  root: <%= Rails.root.join("storage") %>
8
8
 
9
- # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
9
+ # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
10
  # amazon:
11
11
  # service: S3
12
12
  # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
13
  # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
14
  # region: us-east-1
15
- # bucket: your_own_bucket
15
+ # bucket: your_own_bucket-<%= Rails.env %>
16
16
 
17
17
  # Remember not to checkin your GCS keyfile to a repository
18
18
  # google:
19
19
  # service: GCS
20
20
  # project: your_project
21
21
  # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
- # bucket: your_own_bucket
22
+ # bucket: your_own_bucket-<%= Rails.env %>
23
23
 
24
- # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
24
+ # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
25
  # microsoft:
26
26
  # service: AzureStorage
27
27
  # storage_account_name: your_account_name
28
28
  # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
- # container: your_container_name
29
+ # container: your_container_name-<%= Rails.env %>
30
30
 
31
31
  # mirror:
32
32
  # service: Mirror
@@ -10,5 +10,6 @@ field_group_<%= i %>:
10
10
  id : <%= i %>
11
11
  klass_name : <%= klasses[i-1] %>
12
12
  name : "Extra"
13
- position : 1
13
+ position : 1,
14
+ label : "Extra"
14
15
  <% end %>
@@ -15,17 +15,33 @@ class ConvertToActiveStorage < ActiveRecord::Migration[5.2]
15
15
  'LASTVAL()'
16
16
  end
17
17
 
18
- ActiveRecord::Base.connection.raw_connection.prepare(<<-SQL)
19
- INSERT INTO active_storage_blobs (
20
- `key`, filename, content_type, metadata, byte_size, checksum, created_at
21
- ) VALUES (?, ?, ?, '{}', ?, ?, ?)
22
- SQL
23
-
24
- ActiveRecord::Base.connection.raw_connection.prepare(<<-SQL)
25
- INSERT INTO active_storage_attachments (
26
- name, record_type, record_id, blob_id, created_at
27
- ) VALUES (?, ?, ?, #{get_blob_id}, ?)
28
- SQL
18
+ ActiveRecord::Base.connection.raw_connection.then do |conn|
19
+ if conn.is_a?(PG::Connection)
20
+ conn.prepare('active_storage_blobs', <<-SQL)
21
+ INSERT INTO active_storage_blobs (
22
+ key, filename, content_type, metadata, byte_size, checksum, created_at
23
+ ) VALUES ($1, $2, $3, '{}', $4, $5, $6)
24
+ SQL
25
+
26
+ conn.prepare('active_storage_attachments', <<-SQL)
27
+ INSERT INTO active_storage_attachments (
28
+ name, record_type, record_id, blob_id, created_at
29
+ ) VALUES ($1, $2, $3, #{get_blob_id}, $4)
30
+ SQL
31
+ else
32
+ conn.raw_connection.prepare(<<-SQL)
33
+ INSERT INTO active_storage_blobs (
34
+ `key`, filename, content_type, metadata, byte_size, checksum, created_at
35
+ ) VALUES (?, ?, ?, '{}', ?, ?, ?)
36
+ SQL
37
+
38
+ conn.raw_connection.prepare(<<-SQL)
39
+ INSERT INTO active_storage_attachments (
40
+ name, record_type, record_id, blob_id, created_at
41
+ ) VALUES (?, ?, ?, #{get_blob_id}, ?)
42
+ SQL
43
+ end
44
+ end
29
45
 
30
46
  Rails.application.eager_load!
31
47
  models = ActiveRecord::Base.descendants.reject { |model| model.abstract_class? || model == ActionMailbox::InboundEmail || model == ActionText::RichText }