From 9a9a23933ccc10773913788b5bfc6b7a165a5e6f Mon Sep 17 00:00:00 2001 From: Kevin Porras Date: Mon, 30 Nov 2020 14:18:03 -0600 Subject: [PATCH 1/4] Make migrations compatible with Redmine 4. --- db/migrate/001_create_app_notifications.rb | 2 +- db/migrate/002_update_users.rb | 2 +- db/migrate/003_update_users2.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/migrate/001_create_app_notifications.rb b/db/migrate/001_create_app_notifications.rb index d0aaf1f..3bf7dee 100644 --- a/db/migrate/001_create_app_notifications.rb +++ b/db/migrate/001_create_app_notifications.rb @@ -1,4 +1,4 @@ -class CreateAppNotifications < ActiveRecord::Migration +class CreateAppNotifications < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] def change create_table :app_notifications do |t| t.datetime :created_on diff --git a/db/migrate/002_update_users.rb b/db/migrate/002_update_users.rb index 792d7a5..51ecf07 100644 --- a/db/migrate/002_update_users.rb +++ b/db/migrate/002_update_users.rb @@ -1,4 +1,4 @@ -class UpdateUsers < ActiveRecord::Migration +class UpdateUsers < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] def self.up change_table :users do |t| t.column :app_notification, :boolean, :default => false diff --git a/db/migrate/003_update_users2.rb b/db/migrate/003_update_users2.rb index 614f655..e44abe1 100644 --- a/db/migrate/003_update_users2.rb +++ b/db/migrate/003_update_users2.rb @@ -1,4 +1,4 @@ -class UpdateUsers2 < ActiveRecord::Migration +class UpdateUsers2 < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] def self.up change_table :users do |t| t.column :app_notification_desktop, :boolean, :default => false From 62d697aba09c567dc4adad2739c9da3ae50c1181 Mon Sep 17 00:00:00 2001 From: Kevin Porras Date: Mon, 30 Nov 2020 14:18:22 -0600 Subject: [PATCH 2/4] Update code to remove alias_method_chain. --- lib/app_notifications_account_patch.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/app_notifications_account_patch.rb b/lib/app_notifications_account_patch.rb index 3bac0e6..54a3482 100644 --- a/lib/app_notifications_account_patch.rb +++ b/lib/app_notifications_account_patch.rb @@ -7,7 +7,8 @@ def self.included(base) # :nodoc: base.class_eval do unloadable # Send unloadable so it will not be unloaded in development - alias_method_chain :account, :in_app_option + alias_method :account_without_in_app_option, :account + alias_method :account, :account_with_in_app_option end end From c8497306ad9516d9d900301b96b4efed61d60338 Mon Sep 17 00:00:00 2001 From: Kevin Porras Date: Mon, 30 Nov 2020 14:18:43 -0600 Subject: [PATCH 3/4] Update function should pass id instead of full entity. --- app/controllers/app_notifications_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/app_notifications_controller.rb b/app/controllers/app_notifications_controller.rb index a782975..f8c3064 100644 --- a/app/controllers/app_notifications_controller.rb +++ b/app/controllers/app_notifications_controller.rb @@ -34,7 +34,7 @@ def index def view @notification = AppNotification.find(params[:id]) if @notification.recipient == User.current - AppNotification.update(@notification, :viewed => true) + AppNotification.update(@notification.id, :viewed => true) if request.xhr? if @notification.is_edited? render :partial => 'issues/issue_edit', :formats => [:html], :locals => { :notification => @notification, :journal => @notification.journal } From 524ac079cebde000769bef56bde35d18d1980141 Mon Sep 17 00:00:00 2001 From: Kevin Porras Date: Mon, 30 Nov 2020 14:19:11 -0600 Subject: [PATCH 4/4] Remove Gemfile and Gemfile.lock files. --- Gemfile | 5 ----- Gemfile.lock | 36 ------------------------------------ 2 files changed, 41 deletions(-) delete mode 100644 Gemfile delete mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 319dfe8..0000000 --- a/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -gem 'faye' - -group :test do - gem "factory_girl", "~> 4.0" -end \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 98083fb..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,36 +0,0 @@ -GEM - specs: - addressable (2.3.6) - cookiejar (0.3.2) - em-http-request (1.1.2) - addressable (>= 2.3.4) - cookiejar - em-socksify (>= 0.3) - eventmachine (>= 1.0.3) - http_parser.rb (>= 0.6.0) - em-socksify (0.3.0) - eventmachine (>= 1.0.0.beta.4) - eventmachine (1.0.4) - faye (1.1.0) - cookiejar (>= 0.3.0) - em-http-request (>= 0.3.0) - eventmachine (>= 0.12.0) - faye-websocket (>= 0.9.1) - multi_json (>= 1.0.0) - rack (>= 1.0.0) - websocket-driver (>= 0.5.1) - faye-websocket (0.9.2) - eventmachine (>= 0.12.0) - websocket-driver (>= 0.5.1) - http_parser.rb (0.6.0) - multi_json (1.10.1) - rack (1.5.2) - websocket-driver (0.5.1) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.1) - -PLATFORMS - ruby - -DEPENDENCIES - faye