diff --git a/.rubocop.yml b/.rubocop.yml index 673f19f..5fa131f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,7 +4,7 @@ Rails: Enabled: true AllCops: - TargetRubyVersion: 2.2 + TargetRubyVersion: 2.3 TargetRailsVersion: 5.2 Metrics/AbcSize: @@ -47,6 +47,9 @@ Performance/ChainArrayAllocation: Style/AutoResourceCleanup: Enabled: true +Style/FrozenStringLiteralComment: + Enabled: false + Style/Documentation: Enabled: false diff --git a/.travis.yml b/.travis.yml index 6167ffa..5a826f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: ruby rvm: + - 2.5.3 - 2.4.5 - 2.3.8 - - 2.2.10 env: - REDMINE_VER=4.0-stable DB=postgresql diff --git a/CHANGELOG.md b/CHANGELOG.md index ab4f861..aea29fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========= +1.0.5 +----- + +- ruby 2.3.x or newer is required + + 1.0.4 ----- diff --git a/README.md b/README.md index c66fc68..6174479 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Requirements ------------ * Redmine version >= 3.0.0 -* Ruby version >= 2.2.10 +* Ruby version >= 2.3.0 Installation diff --git a/app/models/messenger.rb b/app/models/messenger.rb index 578fe20..7683021 100644 --- a/app/models/messenger.rb +++ b/app/models/messenger.rb @@ -29,7 +29,7 @@ class Messenger username = Messenger.textfield_for_project(options[:project], :messenger_username) params[:username] = username if username.present? - params[:attachments] = [options[:attachment]] if options[:attachment] && options[:attachment].any? + params[:attachments] = [options[:attachment]] if options[:attachment]&.any? icon = Messenger.textfield_for_project(options[:project], :messenger_icon) if icon.present? diff --git a/init.rb b/init.rb index eb71ac6..5c215ae 100644 --- a/init.rb +++ b/init.rb @@ -1,3 +1,5 @@ +raise "\n\033[31mredmine_messenger requires ruby 2.3 or newer. Please update your ruby version.\033[0m" if RUBY_VERSION < '2.3' + require 'redmine' require 'redmine_messenger' @@ -7,7 +9,7 @@ Redmine::Plugin.register :redmine_messenger do url 'https://github.com/alphanodes/redmine_messenger' author_url 'https://alphanodes.com/' description 'Messenger integration for Slack, Discord, Rocketchat and Mattermost support' - version '1.0.4' + version '1.0.5' requires_redmine version_or_higher: '3.0.0' diff --git a/lib/redmine_messenger/patches/issue_patch.rb b/lib/redmine_messenger/patches/issue_patch.rb index 25164bb..73dca00 100644 --- a/lib/redmine_messenger/patches/issue_patch.rb +++ b/lib/redmine_messenger/patches/issue_patch.rb @@ -35,7 +35,7 @@ module RedmineMessenger short: true } end - if RedmineMessenger.setting?(:display_watchers) && watcher_users.count > 0 + if RedmineMessenger.setting?(:display_watchers) && watcher_users.count.positive? attachment[:fields] << { title: I18n.t(:field_watcher), value: ERB::Util.html_escape(watcher_users.join(', ')),