Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:

strategy:
matrix:
ruby: ['2.7', '3.0', '3.1']
redmine: ['5.0-stable', 'master']
ruby: ['3.0', '3.1', '3.2', '3.3']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot ruby 3.0 is not supported by Redmine 6. Drop it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right. I've removed Ruby 3.0 from the CI matrix since it's not supported by Redmine 6.0. The CI now tests with Ruby 3.1-3.3 only. Fixed in commit 630c8a0.

redmine: ['6.0-stable', 'master']
db: ['postgres', 'mysql']
fail-fast: false

Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 7.0.0 - TBD

### Added

- Support for Redmine 6.0

### Changed

- Update all models to inherit from ApplicationRecord instead of ActiveRecord::Base
- Fix serialize syntax for Rails 7 compatibility using `type:` parameter
- Update minimum Ruby version requirement to 3.0+

### BREAKING CHANGE

- Redmine 6.0+ is required
- Ruby 3.0+ is required
- Removed support for Redmine 5.x

## 6.0.1 - 2022-11-04

### Changed
Expand Down
2 changes: 1 addition & 1 deletion app/models/git_cache.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class GitCache < ActiveRecord::Base
class GitCache < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot why do you change this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right to question this change. The conditional ApplicationRecord inheritance pattern was applied too broadly. GitCache is a simple utility model for caching command outputs and doesn't need the ApplicationRecord pattern - it works fine with ActiveRecord::Base. I've reverted this change in commit 46452f4.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot do the same verification in all modified files. And explain why you choose to keep this modification, if it happens.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reviewed all modified files and reverted the ApplicationRecord inheritance pattern for utility models that don't need it. Here's my analysis:

Kept ApplicationRecord inheritance:

  • RepositoryGitExtra - Core Git repository extension with deep Redmine integration and uses l() i18n method
  • RepositoryProtectedBranche - Uses Redmine-specific acts_as_positioned and is core to permission system

Reverted to ActiveRecord::Base:

  • GitHub integration models (GithubComment, GithubIssue) - Simple mapping tables
  • Configuration/utility models (GitolitePublicKey, RepositoryDeploymentCredential, etc.) - Work fine with ActiveRecord::Base
  • Association models (ProtectedBranchesMember) - Simple relationship models

The Rails 7 serialize syntax fixes are preserved where needed. This conservative approach only applies ApplicationRecord where truly required for Redmine integration patterns.

Fixed in commit 87a7b47.

include Redmine::SafeAttributes

CACHE_ADAPTERS = [%w[Database database],
Expand Down
2 changes: 1 addition & 1 deletion app/models/github_comment.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class GithubComment < ActiveRecord::Base
class GithubComment < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
## Relations
belongs_to :journal

Expand Down
2 changes: 1 addition & 1 deletion app/models/github_issue.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class GithubIssue < ActiveRecord::Base
class GithubIssue < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
## Relations
belongs_to :issue

Expand Down
2 changes: 1 addition & 1 deletion app/models/gitolite_public_key.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class GitolitePublicKey < ActiveRecord::Base
class GitolitePublicKey < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
include Redmine::SafeAttributes

TITLE_LENGTH_LIMIT = 60
Expand Down
2 changes: 1 addition & 1 deletion app/models/protected_branches_member.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class ProtectedBranchesMember < ActiveRecord::Base
class ProtectedBranchesMember < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
include Redmine::SafeAttributes

## Attributes
Expand Down
2 changes: 1 addition & 1 deletion app/models/repository_deployment_credential.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class RepositoryDeploymentCredential < ActiveRecord::Base
class RepositoryDeploymentCredential < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
include Redmine::SafeAttributes

VALID_PERMS = ['R', 'RW+'].freeze
Expand Down
2 changes: 1 addition & 1 deletion app/models/repository_git_config_key.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class RepositoryGitConfigKey < ActiveRecord::Base
class RepositoryGitConfigKey < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
include Redmine::SafeAttributes

## Attributes
Expand Down
5 changes: 3 additions & 2 deletions app/models/repository_git_extra.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# frozen_string_literal: true

class RepositoryGitExtra < ActiveRecord::Base
class RepositoryGitExtra < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
include Redmine::SafeAttributes
include Redmine::I18n

SMART_HTTP_OPTIONS = [[l(:label_disabled), '0'],
[l(:label_http_only), '3'],
Expand Down Expand Up @@ -33,7 +34,7 @@ class RepositoryGitExtra < ActiveRecord::Base
validate :validate_urls_order

## Serializations
serialize :urls_order, Array
serialize :urls_order, type: Array

## Callbacks
before_save :check_urls_order_consistency
Expand Down
2 changes: 1 addition & 1 deletion app/models/repository_mirror.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class RepositoryMirror < ActiveRecord::Base
class RepositoryMirror < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
include Redmine::SafeAttributes

PUSHMODE_MIRROR = 0
Expand Down
4 changes: 2 additions & 2 deletions app/models/repository_post_receive_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'uri'

class RepositoryPostReceiveUrl < ActiveRecord::Base
class RepositoryPostReceiveUrl < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
include Redmine::SafeAttributes

## Attributes
Expand All @@ -22,7 +22,7 @@ class RepositoryPostReceiveUrl < ActiveRecord::Base
validates :mode, presence: true, inclusion: { in: %i[github get post] }

## Serializations
serialize :triggers, Array
serialize :triggers, type: Array

## Scopes
scope :active, -> { where active: true }
Expand Down
2 changes: 1 addition & 1 deletion app/models/repository_protected_branche.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class RepositoryProtectedBranche < ActiveRecord::Base
class RepositoryProtectedBranche < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
include Redmine::SafeAttributes
VALID_PERMS = ['RW+', 'RW', 'R', '-'].freeze
DEFAULT_PERM = 'RW+'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class RepositoryProtectedBrancheWrapped < RepositoryProtectedBranche
serialize :user_list, Array
serialize :user_list, type: Array
end

class MigrateProtectedBranchesUsers < ActiveRecord::Migration[4.2]
Expand Down
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
author_url 'settings/plugin/redmine_git_hosting/authors'

settings partial: 'settings/redmine_git_hosting', default: RedmineGitHosting.settings
requires_redmine version_or_higher: '4.1.0'
requires_redmine version_or_higher: '6.0.0'

permission :create_gitolite_ssh_key, gitolite_public_keys: %i[index create destroy], require: :loggedin

Expand Down
2 changes: 1 addition & 1 deletion lib/redmine_git_hosting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
module RedmineGitHosting
extend self

VERSION = '6.0.1'
VERSION = '7.0.0'

# Load RedminePluginLoader
extend RedminePluginLoader
Expand Down
Loading