mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
rubocop safe autocorrect all except Rails/WhereRange
This commit is contained in:
@@ -43,7 +43,7 @@ module Members
|
||||
sortable_columns :name, :mail, :status
|
||||
|
||||
def apply_sort(model)
|
||||
apply_member_scopes super(model)
|
||||
apply_member_scopes super
|
||||
end
|
||||
|
||||
def apply_member_scopes(model)
|
||||
|
||||
@@ -128,7 +128,7 @@ module Members
|
||||
end
|
||||
|
||||
def apply_filters(params, query)
|
||||
super(params, query)
|
||||
super
|
||||
filter_shares(query, params[:shared_role_id]) if params.key?(:shared_role_id)
|
||||
|
||||
query
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
class RowComponent < ApplicationComponent
|
||||
attr_reader :table
|
||||
|
||||
def initialize(row:, table:, **options)
|
||||
super(row, **options)
|
||||
def initialize(row:, table:, **)
|
||||
super(row, **)
|
||||
@table = table
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ module Settings
|
||||
def breadcrumb_items
|
||||
[{ href: admin_index_path, text: t("label_administration") },
|
||||
{ href: admin_settings_project_custom_fields_path, text: t("label_project_plural") },
|
||||
{ href: admin_settings_project_custom_fields_path, text: t("settings.project_attributes.heading") },
|
||||
{ href: admin_settings_project_custom_fields_path, text: t("settings.project_attributes.heading") },
|
||||
t("settings.project_attributes.new.heading")]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,7 +59,7 @@ class UserFilterComponent < IndividualPrincipalBaseFilterComponent
|
||||
protected
|
||||
|
||||
def apply_filters(params, query)
|
||||
super(params, query)
|
||||
super
|
||||
filter_status query, status_param(params)
|
||||
|
||||
query
|
||||
|
||||
@@ -36,7 +36,7 @@ module CustomActions
|
||||
end
|
||||
|
||||
def initialize(model, user = nil)
|
||||
super(model, user)
|
||||
super
|
||||
end
|
||||
|
||||
attribute :name
|
||||
|
||||
@@ -63,10 +63,10 @@ module Versions
|
||||
true
|
||||
else
|
||||
case s
|
||||
when 'system'
|
||||
when "system"
|
||||
# Only admin users can set a systemwide sharing
|
||||
user.admin?
|
||||
when 'hierarchy', 'tree'
|
||||
when "hierarchy", "tree"
|
||||
# Only users allowed to manage versions of the root project can
|
||||
# set sharing to hierarchy or tree
|
||||
model.project.nil? || user.allowed_in_project?(:manage_versions, model.project.root)
|
||||
@@ -83,7 +83,7 @@ module Versions
|
||||
if wiki
|
||||
wiki.pages
|
||||
else
|
||||
WikiPage.where('1=0')
|
||||
WikiPage.where("1=0")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class Admin::BackupsController < ApplicationController
|
||||
include ActionView::Helpers::TagHelper
|
||||
include BackupHelper
|
||||
|
||||
layout 'admin'
|
||||
layout "admin"
|
||||
|
||||
before_action :check_enabled
|
||||
before_action :authorize_global
|
||||
@@ -65,7 +65,7 @@ class Admin::BackupsController < ApplicationController
|
||||
rescue StandardError => e
|
||||
token_reset_failed! e
|
||||
ensure
|
||||
redirect_to action: 'show'
|
||||
redirect_to action: "show"
|
||||
end
|
||||
|
||||
def delete_token
|
||||
@@ -73,7 +73,7 @@ class Admin::BackupsController < ApplicationController
|
||||
|
||||
flash[:info] = t("backup.text_token_deleted")
|
||||
|
||||
redirect_to action: 'show'
|
||||
redirect_to action: "show"
|
||||
end
|
||||
|
||||
def default_breadcrumb
|
||||
@@ -105,16 +105,16 @@ class Admin::BackupsController < ApplicationController
|
||||
|
||||
def token_reset_flash_message(token)
|
||||
[
|
||||
t('my.access_token.notice_reset_token', type: 'Backup'),
|
||||
t("my.access_token.notice_reset_token", type: "Backup"),
|
||||
content_tag(:strong, token.plain_value),
|
||||
t('my.access_token.token_value_warning')
|
||||
t("my.access_token.token_value_warning")
|
||||
]
|
||||
end
|
||||
|
||||
def token_reset_failed!(error)
|
||||
Rails.logger.error "Failed to reset user ##{current_user.id}'s Backup token: #{error}"
|
||||
|
||||
flash[:error] = t('my.access_token.failed_to_reset_token', error: error.message)
|
||||
flash[:error] = t("my.access_token.failed_to_reset_token", error: error.message)
|
||||
end
|
||||
|
||||
def may_include_attachments?
|
||||
|
||||
@@ -89,7 +89,7 @@ module Accounts::CurrentUser
|
||||
def current_autologin_user
|
||||
return unless Setting::Autologin.enabled?
|
||||
|
||||
autologin_cookie_name = OpenProject::Configuration['autologin_cookie_name']
|
||||
autologin_cookie_name = OpenProject::Configuration["autologin_cookie_name"]
|
||||
autologin_token = cookies[autologin_cookie_name]
|
||||
return unless autologin_token
|
||||
|
||||
@@ -105,7 +105,7 @@ module Accounts::CurrentUser
|
||||
end
|
||||
|
||||
def current_rss_key_user
|
||||
if params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action])
|
||||
if params[:format] == "atom" && params[:key] && accept_key_auth_actions.include?(params[:action])
|
||||
# RSS key authentication does not start a session
|
||||
User.find_by_rss_key(params[:key])
|
||||
end
|
||||
@@ -183,8 +183,8 @@ module Accounts::CurrentUser
|
||||
|
||||
format.any(:xml, :js, :json) do
|
||||
head :unauthorized,
|
||||
'X-Reason' => 'login needed',
|
||||
'WWW-Authenticate' => auth_header
|
||||
"X-Reason" => "login needed",
|
||||
"WWW-Authenticate" => auth_header
|
||||
end
|
||||
|
||||
format.all { head :not_acceptable }
|
||||
|
||||
@@ -48,7 +48,7 @@ class WorkPackages::BulkController < ApplicationController
|
||||
|
||||
if @call.success?
|
||||
flash[:notice] = t(:notice_successful_update)
|
||||
redirect_back_or_default(controller: '/work_packages', action: :index, project_id: @project)
|
||||
redirect_back_or_default(controller: "/work_packages", action: :index, project_id: @project)
|
||||
else
|
||||
flash[:error] = bulk_error_message(@work_packages, @call)
|
||||
setup_edit
|
||||
@@ -75,7 +75,7 @@ class WorkPackages::BulkController < ApplicationController
|
||||
associated: WorkPackage.associated_classes_to_address_before_destruction_of(@work_packages) }
|
||||
end
|
||||
format.json do
|
||||
render json: { error_message: 'Clean up of associated objects required' }, status: 420
|
||||
render json: { error_message: "Clean up of associated objects required" }, status: 420
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -125,6 +125,6 @@ class WorkPackages::BulkController < ApplicationController
|
||||
def transform_attributes(attributes)
|
||||
Hash(attributes)
|
||||
.compact_blank
|
||||
.transform_values { |v| Array(v).include?('none') ? '' : v }
|
||||
.transform_values { |v| Array(v).include?("none") ? "" : v }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,11 +32,11 @@ module SearchHelper
|
||||
|
||||
return nil unless split_text.length > 1 || text_on_not_found
|
||||
|
||||
result = ''
|
||||
result = ""
|
||||
split_text.each_with_index do |words, i|
|
||||
if result.length > 1200
|
||||
# maximum length of the preview reached
|
||||
result << '...'
|
||||
result << "..."
|
||||
break
|
||||
end
|
||||
|
||||
@@ -83,7 +83,7 @@ module SearchHelper
|
||||
def notes_anchor(event)
|
||||
version = event.version.to_i
|
||||
|
||||
version > 1 ? "note-#{version - 1}" : ''
|
||||
version > 1 ? "note-#{version - 1}" : ""
|
||||
end
|
||||
|
||||
def with_notes_anchor(event, tokens)
|
||||
@@ -100,8 +100,8 @@ module SearchHelper
|
||||
|
||||
def current_scope
|
||||
params[:scope] ||
|
||||
('subprojects' unless @project.nil? || @project.descendants.active.empty?) ||
|
||||
('current_project' unless @project.nil?)
|
||||
("subprojects" unless @project.nil? || @project.descendants.active.empty?) ||
|
||||
("current_project" unless @project.nil?)
|
||||
end
|
||||
|
||||
def link_to_previous_search_page(pagination_previous_date)
|
||||
@@ -109,7 +109,7 @@ module SearchHelper
|
||||
@search_params.merge(previous: 1,
|
||||
project_id: @project.try(:identifier),
|
||||
offset: pagination_previous_date.to_r.to_s),
|
||||
class: 'navigate-left')
|
||||
class: "navigate-left")
|
||||
end
|
||||
|
||||
def link_to_next_search_page(pagination_next_date)
|
||||
@@ -117,20 +117,20 @@ module SearchHelper
|
||||
@search_params.merge(previous: nil,
|
||||
project_id: @project.try(:identifier),
|
||||
offset: pagination_next_date.to_r.to_s),
|
||||
class: 'navigate-right')
|
||||
class: "navigate-right")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def attachment_fulltexts(event)
|
||||
only_if_tsv_supported(event) do
|
||||
Attachment.where(id: event.attachment_ids).pluck(:fulltext).join(' ')
|
||||
Attachment.where(id: event.attachment_ids).pluck(:fulltext).join(" ")
|
||||
end
|
||||
end
|
||||
|
||||
def attachment_filenames(event)
|
||||
only_if_tsv_supported(event) do
|
||||
event.attachments&.map(&:filename)&.join(' ')
|
||||
event.attachments&.map(&:filename)&.join(" ")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -142,7 +142,7 @@ module SearchHelper
|
||||
|
||||
def token_span(tokens, words)
|
||||
t = (tokens.index(words.downcase) || 0) % 4
|
||||
content_tag('span', h(words), class: "search-highlight token-#{t}")
|
||||
content_tag("span", h(words), class: "search-highlight token-#{t}")
|
||||
end
|
||||
|
||||
def abbreviated_text(words)
|
||||
@@ -154,11 +154,11 @@ module SearchHelper
|
||||
formatted_words
|
||||
end
|
||||
|
||||
if words[0] == ' '
|
||||
if words[0] == " "
|
||||
abbreviated_words = " #{abbreviated_words}"
|
||||
end
|
||||
|
||||
if words[-1] == ' ' && words.length > 1
|
||||
if words[-1] == " " && words.length > 1
|
||||
abbreviated_words = "#{abbreviated_words} "
|
||||
end
|
||||
|
||||
|
||||
@@ -115,7 +115,6 @@ module UsersHelper
|
||||
end
|
||||
|
||||
def change_user_status_links(user)
|
||||
|
||||
build_change_user_status_action(user) do |title, name|
|
||||
link_to title,
|
||||
change_status_user_path(user,
|
||||
|
||||
@@ -85,7 +85,7 @@ module WorkPackagesHelper
|
||||
if package.closed? && !options[:no_hidden]
|
||||
parts[:hidden_link] << content_tag(:span,
|
||||
I18n.t(:label_closed_work_packages),
|
||||
class: 'hidden-for-sighted')
|
||||
class: "hidden-for-sighted")
|
||||
end
|
||||
|
||||
# Suffix part
|
||||
@@ -109,12 +109,12 @@ module WorkPackagesHelper
|
||||
|
||||
# combining
|
||||
|
||||
prefix = parts[:prefix].join(' ')
|
||||
suffix = parts[:suffix].join(' ')
|
||||
link = parts[:link].join(' ').strip
|
||||
prefix = parts[:prefix].join(" ")
|
||||
suffix = parts[:suffix].join(" ")
|
||||
link = parts[:link].join(" ").strip
|
||||
hidden_link = parts[:hidden_link].join
|
||||
title = parts[:title].join(' ')
|
||||
css_class = parts[:css_class].join(' ')
|
||||
title = parts[:title].join(" ")
|
||||
css_class = parts[:css_class].join(" ")
|
||||
|
||||
# Determine path or url
|
||||
work_package_link =
|
||||
@@ -125,8 +125,8 @@ module WorkPackagesHelper
|
||||
end
|
||||
|
||||
if options[:all_link]
|
||||
link_text = [prefix, link].reject(&:empty?).join(' - ')
|
||||
link_text = [link_text, suffix].reject(&:empty?).join(': ')
|
||||
link_text = [prefix, link].reject(&:empty?).join(" - ")
|
||||
link_text = [link_text, suffix].reject(&:empty?).join(": ")
|
||||
link_text = [hidden_link, link_text].reject(&:empty?).join
|
||||
|
||||
link_to(link_text.html_safe,
|
||||
@@ -141,8 +141,8 @@ module WorkPackagesHelper
|
||||
title:,
|
||||
class: css_class)
|
||||
|
||||
[[prefix, html_link].reject(&:empty?).join(' - '),
|
||||
suffix].reject(&:empty?).join(': ')
|
||||
[[prefix, html_link].reject(&:empty?).join(" - "),
|
||||
suffix].reject(&:empty?).join(": ")
|
||||
end.html_safe
|
||||
end
|
||||
|
||||
@@ -158,41 +158,41 @@ module WorkPackagesHelper
|
||||
end
|
||||
|
||||
def send_notification_option(checked = false)
|
||||
content_tag(:label, for: 'send_notification', class: 'form--label-with-check-box') do
|
||||
(content_tag 'span', class: 'form--check-box-container' do
|
||||
boxes = hidden_field_tag('send_notification', '0', id: nil)
|
||||
content_tag(:label, for: "send_notification", class: "form--label-with-check-box") do
|
||||
(content_tag "span", class: "form--check-box-container" do
|
||||
boxes = hidden_field_tag("send_notification", "0", id: nil)
|
||||
|
||||
boxes += check_box_tag('send_notification',
|
||||
'1',
|
||||
boxes += check_box_tag("send_notification",
|
||||
"1",
|
||||
checked,
|
||||
class: 'form--check-box')
|
||||
class: "form--check-box")
|
||||
boxes
|
||||
end) + I18n.t('notifications.send_notifications')
|
||||
end) + I18n.t("notifications.send_notifications")
|
||||
end
|
||||
end
|
||||
|
||||
# Returns a string of css classes that apply to the issue
|
||||
def work_package_css_classes(work_package)
|
||||
s = 'work_package preview-trigger'.html_safe
|
||||
s = "work_package preview-trigger".html_safe
|
||||
s << " status-#{work_package.status.position}" if work_package.status
|
||||
s << " priority-#{work_package.priority.position}" if work_package.priority
|
||||
s << ' closed' if work_package.closed?
|
||||
s << ' overdue' if work_package.overdue?
|
||||
s << ' child' if work_package.child?
|
||||
s << ' parent' unless work_package.leaf?
|
||||
s << ' created-by-me' if User.current.logged? && work_package.author_id == User.current.id
|
||||
s << ' assigned-to-me' if User.current.logged? && work_package.assigned_to_id == User.current.id
|
||||
s << " closed" if work_package.closed?
|
||||
s << " overdue" if work_package.overdue?
|
||||
s << " child" if work_package.child?
|
||||
s << " parent" unless work_package.leaf?
|
||||
s << " created-by-me" if User.current.logged? && work_package.author_id == User.current.id
|
||||
s << " assigned-to-me" if User.current.logged? && work_package.assigned_to_id == User.current.id
|
||||
s
|
||||
end
|
||||
|
||||
def work_package_associations_to_address(associated)
|
||||
ret = ''.html_safe
|
||||
ret = "".html_safe
|
||||
|
||||
ret += content_tag(:p, I18n.t(:text_destroy_with_associated), class: 'bold')
|
||||
ret += content_tag(:p, I18n.t(:text_destroy_with_associated), class: "bold")
|
||||
|
||||
ret += content_tag(:ul) do
|
||||
associated.inject(''.html_safe) do |list, associated_class|
|
||||
list += content_tag(:li, associated_class.model_name.human, class: 'decorated')
|
||||
associated.inject("".html_safe) do |list, associated_class|
|
||||
list += content_tag(:li, associated_class.model_name.human, class: "decorated")
|
||||
|
||||
list
|
||||
end
|
||||
@@ -202,8 +202,8 @@ module WorkPackagesHelper
|
||||
end
|
||||
|
||||
def back_url_is_wp_show?
|
||||
route = Rails.application.routes.recognize_path(params[:back_url] || request.env['HTTP_REFERER'])
|
||||
route[:controller] == 'work_packages' && route[:action] == 'index' && route[:state]&.match?(/^\d+/)
|
||||
route = Rails.application.routes.recognize_path(params[:back_url] || request.env["HTTP_REFERER"])
|
||||
route[:controller] == "work_packages" && route[:action] == "index" && route[:state]&.match?(/^\d+/)
|
||||
end
|
||||
|
||||
def last_work_package_note(work_package)
|
||||
@@ -228,7 +228,7 @@ module WorkPackagesHelper
|
||||
|
||||
def protected_work_packages_columns_options
|
||||
work_packages_columns_options
|
||||
.select { |column| column[:id] == 'id' || column[:id] == 'subject' }
|
||||
.select { |column| column[:id] == "id" || column[:id] == "subject" }
|
||||
end
|
||||
|
||||
private
|
||||
@@ -239,8 +239,8 @@ module WorkPackagesHelper
|
||||
if description_lines[lines - 1] && work_package.description.to_s.lines.to_a.size > lines
|
||||
description_lines[lines - 1].strip!
|
||||
|
||||
while !description_lines[lines - 1].end_with?('...')
|
||||
description_lines[lines - 1] = description_lines[lines - 1] + '.'
|
||||
while !description_lines[lines - 1].end_with?("...")
|
||||
description_lines[lines - 1] = description_lines[lines - 1] + "."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -248,7 +248,7 @@ module WorkPackagesHelper
|
||||
empty_element_tag
|
||||
else
|
||||
::OpenProject::TextFormatting::Renderer.format_text(
|
||||
description_lines.join(''),
|
||||
description_lines.join(""),
|
||||
object: work_package,
|
||||
attribute: :description,
|
||||
no_nesting: true
|
||||
@@ -267,12 +267,12 @@ module WorkPackagesHelper
|
||||
h(work_package.assigned_to.name).to_s
|
||||
end
|
||||
|
||||
[responsible, assignee].compact.join('<br>').html_safe
|
||||
[responsible, assignee].compact.join("<br>").html_safe
|
||||
end
|
||||
|
||||
def link_to_work_package_css_classes(package, options)
|
||||
classes = ['work_package']
|
||||
classes << 'closed' if package.closed?
|
||||
classes = ["work_package"]
|
||||
classes << "closed" if package.closed?
|
||||
classes << options[:class].to_s
|
||||
|
||||
classes
|
||||
|
||||
@@ -43,7 +43,7 @@ class WorkPackageMailer < ApplicationMailer
|
||||
references journal
|
||||
|
||||
send_localized_mail(recipient) do
|
||||
I18n.t(:'mail.mention.subject',
|
||||
I18n.t(:"mail.mention.subject",
|
||||
user_name: author.name,
|
||||
id: @work_package.id,
|
||||
subject: @work_package.subject)
|
||||
@@ -75,13 +75,13 @@ class WorkPackageMailer < ApplicationMailer
|
||||
end
|
||||
|
||||
def set_work_package_headers(work_package)
|
||||
open_project_headers 'Project' => work_package.project.identifier,
|
||||
'WorkPackage-Id' => work_package.id,
|
||||
'WorkPackage-Author' => work_package.author.login,
|
||||
'Type' => 'WorkPackage'
|
||||
open_project_headers "Project" => work_package.project.identifier,
|
||||
"WorkPackage-Id" => work_package.id,
|
||||
"WorkPackage-Author" => work_package.author.login,
|
||||
"Type" => "WorkPackage"
|
||||
|
||||
if work_package.assigned_to
|
||||
open_project_headers 'WorkPackage-Assignee' => work_package.assigned_to.login
|
||||
open_project_headers "WorkPackage-Assignee" => work_package.assigned_to.login
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -108,7 +108,7 @@ class Activities::BaseActivityProvider
|
||||
end
|
||||
|
||||
def event_datetime(event)
|
||||
event['event_datetime'].is_a?(String) ? DateTime.parse(event['event_datetime']) : event['event_datetime']
|
||||
event["event_datetime"].is_a?(String) ? DateTime.parse(event["event_datetime"]) : event["event_datetime"]
|
||||
end
|
||||
|
||||
def event_type(_event_data)
|
||||
@@ -128,12 +128,12 @@ class Activities::BaseActivityProvider
|
||||
# reference table is different from 'project_id' #
|
||||
#############################################################################
|
||||
def project_id_reference_field
|
||||
'project_id'
|
||||
"project_id"
|
||||
end
|
||||
|
||||
def activitied_type
|
||||
class_name = self.class.name.demodulize
|
||||
class_name.gsub('ActivityProvider', '').constantize
|
||||
class_name.gsub("ActivityProvider", "").constantize
|
||||
end
|
||||
|
||||
protected
|
||||
@@ -174,11 +174,11 @@ class Activities::BaseActivityProvider
|
||||
|
||||
def event_params(event_data)
|
||||
params = { provider: self,
|
||||
event_id: event_data['event_id'],
|
||||
event_description: event_data['event_description'],
|
||||
author_id: event_data['author_id'].to_i,
|
||||
journable_id: event_data['journable_id'],
|
||||
project_id: event_data['project_id'].to_i }
|
||||
event_id: event_data["event_id"],
|
||||
event_description: event_data["event_description"],
|
||||
author_id: event_data["author_id"].to_i,
|
||||
journable_id: event_data["journable_id"],
|
||||
project_id: event_data["project_id"].to_i }
|
||||
|
||||
%i[event_name event_title event_type event_description event_datetime event_path event_url].each do |a|
|
||||
params[a] = send(a, event_data) if self.class.method_defined? a
|
||||
@@ -190,12 +190,12 @@ class Activities::BaseActivityProvider
|
||||
end
|
||||
|
||||
def event_projection
|
||||
[[:id, 'event_id'],
|
||||
[:created_at, 'event_datetime'],
|
||||
[:user_id, 'author_id'],
|
||||
[:notes, 'event_description'],
|
||||
[:version, 'version'],
|
||||
[:journable_id, 'journable_id']].map do |column, alias_name|
|
||||
[[:id, "event_id"],
|
||||
[:created_at, "event_datetime"],
|
||||
[:user_id, "author_id"],
|
||||
[:notes, "event_description"],
|
||||
[:version, "version"],
|
||||
[:journable_id, "journable_id"]].map do |column, alias_name|
|
||||
journals_table[column].as(alias_name)
|
||||
end
|
||||
end
|
||||
@@ -281,7 +281,7 @@ class Activities::BaseActivityProvider
|
||||
|
||||
def event_name(event)
|
||||
@event_names ||= {}
|
||||
@event_names[event_type(event)] ||= I18n.t(event_type(event).underscore, scope: 'events')
|
||||
@event_names[event_type(event)] ||= I18n.t(event_type(event).underscore, scope: "events")
|
||||
end
|
||||
|
||||
def url_helpers
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
include ::OpenProject::Acts::Watchable
|
||||
include ::OpenProject::Acts::Favorable
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
# See COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require 'digest/md5'
|
||||
require "digest/md5"
|
||||
|
||||
class Attachment < ApplicationRecord
|
||||
enum status: {
|
||||
@@ -38,7 +38,7 @@ class Attachment < ApplicationRecord
|
||||
}.freeze, _prefix: true
|
||||
|
||||
belongs_to :container, polymorphic: true
|
||||
belongs_to :author, class_name: 'User'
|
||||
belongs_to :author, class_name: "User"
|
||||
|
||||
validates :author, :content_type, :filesize, :status, presence: true
|
||||
validates :description, length: { maximum: 255 }
|
||||
@@ -65,7 +65,7 @@ class Attachment < ApplicationRecord
|
||||
acts_as_journalized
|
||||
acts_as_event title: -> { file.name },
|
||||
url: (Proc.new do |o|
|
||||
{ controller: '/attachments', action: 'download', id: o.id, filename: o.filename }
|
||||
{ controller: "/attachments", action: "download", id: o.id, filename: o.filename }
|
||||
end)
|
||||
|
||||
mount_uploader :file, OpenProject::Configuration.file_uploader
|
||||
@@ -108,7 +108,7 @@ class Attachment < ApplicationRecord
|
||||
end
|
||||
|
||||
def content_disposition(include_filename: true)
|
||||
disposition = inlineable? ? 'inline' : 'attachment'
|
||||
disposition = inlineable? ? "inline" : "attachment"
|
||||
|
||||
if include_filename
|
||||
"#{disposition}; filename=#{filename}"
|
||||
@@ -160,7 +160,7 @@ class Attachment < ApplicationRecord
|
||||
alias :image? :is_image?
|
||||
|
||||
def is_pdf?
|
||||
content_type == 'application/pdf'
|
||||
content_type == "application/pdf"
|
||||
end
|
||||
|
||||
def is_text?
|
||||
@@ -194,7 +194,7 @@ class Attachment < ApplicationRecord
|
||||
end
|
||||
|
||||
def filename
|
||||
attributes['file'] || super
|
||||
attributes["file"] || super
|
||||
end
|
||||
|
||||
##
|
||||
|
||||
@@ -43,7 +43,7 @@ class Queries::Days::DayQuery
|
||||
# If there are multiple filters with custom from clause (currently not possible),
|
||||
# the first one is applied and the rest is ignored.
|
||||
def apply_filters(scope)
|
||||
scope = super(scope)
|
||||
scope = super
|
||||
from_clause_filter = filters.find(&:from)
|
||||
scope = scope.from(from_clause_filter.from) if from_clause_filter
|
||||
scope
|
||||
|
||||
@@ -27,19 +27,18 @@
|
||||
#++
|
||||
|
||||
class Queries::WorkPackages::Selects::WorkPackageSelect
|
||||
attr_accessor :highlightable
|
||||
attr_accessor :highlightable,
|
||||
:name,
|
||||
:sortable_join,
|
||||
:summable,
|
||||
:default_order,
|
||||
:association
|
||||
alias_method :highlightable?, :highlightable
|
||||
|
||||
attr_reader :groupable,
|
||||
:sortable,
|
||||
:displayable
|
||||
|
||||
attr_accessor :name,
|
||||
:sortable_join,
|
||||
:summable,
|
||||
:default_order,
|
||||
:association
|
||||
|
||||
attr_writer :null_handling,
|
||||
:summable_select,
|
||||
:summable_work_packages_select
|
||||
|
||||
+1
-1
@@ -190,7 +190,7 @@ class Query < ApplicationRecord
|
||||
end
|
||||
|
||||
def filter_for(field)
|
||||
filter = (filters || []).detect { |f| f.field.to_s == field.to_s } || super(field)
|
||||
filter = (filters || []).detect { |f| f.field.to_s == field.to_s } || super
|
||||
|
||||
filter.context = self
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ module Query::Highlighting
|
||||
if difference.any?
|
||||
errors.add(:highlighted_attributes,
|
||||
I18n.t(:error_attribute_not_highlightable,
|
||||
attributes: difference.map(&:to_s).map(&:capitalize).join(', ')))
|
||||
attributes: difference.map(&:to_s).map(&:capitalize).join(", ")))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class Repository::Git < Repository
|
||||
end
|
||||
|
||||
def self.permitted_params(params)
|
||||
super(params).merge(params.permit(:path_encoding))
|
||||
super.merge(params.permit(:path_encoding))
|
||||
end
|
||||
|
||||
def self.supported_types
|
||||
|
||||
@@ -54,7 +54,7 @@ class Repository::Subversion < Repository
|
||||
end
|
||||
|
||||
def self.permitted_params(params)
|
||||
super(params).merge(params.permit(:login, :password))
|
||||
super.merge(params.permit(:login, :password))
|
||||
end
|
||||
|
||||
def self.supported_types
|
||||
|
||||
@@ -96,7 +96,7 @@ module WorkPackage::PDFExport::Gantt
|
||||
|
||||
GanttDataPageGroup = Struct.new(:index, :entry_ids, :pages) do
|
||||
def initialize(*args)
|
||||
super(*args)
|
||||
super
|
||||
pages.each { |page| page.group = self }
|
||||
end
|
||||
end
|
||||
@@ -104,7 +104,7 @@ module WorkPackage::PDFExport::Gantt
|
||||
GanttDataPage = Struct.new(:index, :entry_ids, :header_cells, :rows, :columns,
|
||||
:text_column, :width, :height, :header_row_height, :group, :lines) do
|
||||
def initialize(*args)
|
||||
super(*args)
|
||||
super
|
||||
rows.each { |row| row.page = self }
|
||||
columns.each { |column| column.page = self }
|
||||
self.lines = []
|
||||
|
||||
@@ -82,7 +82,7 @@ class WorkPackage::PDFExport::WorkPackageToPdf < Exports::Exporter
|
||||
def title
|
||||
# <project>_<type>_<ID>_<subject><YYYY-MM-DD>_<HH-MM>.pdf
|
||||
build_pdf_filename([work_package.project, work_package.type,
|
||||
"##{work_package.id}", work_package.subject].join('_'))
|
||||
"##{work_package.id}", work_package.subject].join("_"))
|
||||
end
|
||||
|
||||
def with_images?
|
||||
|
||||
@@ -31,7 +31,7 @@ module BasicData
|
||||
self.seed_data_model_key = "project_roles"
|
||||
|
||||
def update_permissions_with_modules_data(role_data)
|
||||
super(role_data)
|
||||
super
|
||||
|
||||
role_data["permissions"] += OpenProject::AccessControl.public_permissions.map(&:name)
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ module BaseServices
|
||||
end
|
||||
|
||||
def persist(service_result)
|
||||
service_result = super(service_result)
|
||||
service_result = super
|
||||
|
||||
unless destroy(service_result.result)
|
||||
service_result.errors = service_result.result.errors
|
||||
|
||||
@@ -31,7 +31,7 @@ module BaseServices
|
||||
protected
|
||||
|
||||
def persist(service_result)
|
||||
service_result = super(service_result)
|
||||
service_result = super
|
||||
|
||||
unless service_result.result.save
|
||||
service_result.errors = service_result.result.errors
|
||||
|
||||
@@ -35,7 +35,7 @@ class CustomActions::UpdateService < CustomActions::BaseService
|
||||
self.user = user
|
||||
end
|
||||
|
||||
def call(attributes:, &block)
|
||||
super(attributes:, action:, &block)
|
||||
def call(attributes:, &)
|
||||
super(attributes:, action:, &)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -46,7 +46,7 @@ module Grids
|
||||
end
|
||||
|
||||
def initialize(user:, source:, contract_class: ::EmptyContract)
|
||||
super(user:, source:, contract_class:)
|
||||
super
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
@@ -40,7 +40,7 @@ class Members::DeleteService < BaseServices::Delete
|
||||
protected
|
||||
|
||||
def after_perform(service_call)
|
||||
super(service_call).tap do |call|
|
||||
super.tap do |call|
|
||||
member = call.result
|
||||
|
||||
cleanup_for_group(member)
|
||||
|
||||
@@ -48,7 +48,7 @@ class Notifications::CreateFromModelService
|
||||
MENTION_GROUP_TAG_ID_PATTERN,
|
||||
MENTION_GROUP_HASH_ID_PATTERN]
|
||||
.map { |pattern| "(?:#{pattern})" }
|
||||
.join('|').freeze
|
||||
.join("|").freeze
|
||||
|
||||
# Skip looking for mentions in quoted lines completely.
|
||||
# We need to allow an optional single white space before the ">", because the `#text_for_mentions`
|
||||
@@ -264,7 +264,7 @@ class Notifications::CreateFromModelService
|
||||
end
|
||||
end
|
||||
|
||||
potential_text.gsub(QUOTED_LINES_PATTERN, '')
|
||||
potential_text.gsub(QUOTED_LINES_PATTERN, "")
|
||||
end
|
||||
|
||||
def mentioned_ids
|
||||
|
||||
@@ -38,7 +38,7 @@ module OAuthClients
|
||||
|
||||
def after_validate(params, contract_call)
|
||||
OAuthClient.where(integration: params[:integration]).delete_all
|
||||
super(params, contract_call)
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,13 +30,13 @@ class Roles::DeleteService < BaseServices::Delete
|
||||
def persist(service_result)
|
||||
# after destroy permissions can not be reached
|
||||
@permissions = model.permissions
|
||||
super(service_result)
|
||||
super
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def after_perform(service_call)
|
||||
super(service_call).tap do |_call|
|
||||
super.tap do |_call|
|
||||
::OpenProject::Notifications.send(
|
||||
::OpenProject::Events::ROLE_DESTROYED,
|
||||
permissions: @permissions
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
module Roles
|
||||
class SetAttributesService < ::BaseServices::SetAttributes
|
||||
def set_attributes(params)
|
||||
super(params)
|
||||
super
|
||||
|
||||
if model.is_a?(ProjectRole)
|
||||
model.permissions += OpenProject::AccessControl.public_permissions.map(&:name)
|
||||
|
||||
@@ -36,7 +36,7 @@ module Users
|
||||
def persist(call)
|
||||
new_user = call.result
|
||||
|
||||
return super(call) unless new_user.invited?
|
||||
return super unless new_user.invited?
|
||||
|
||||
# As we're basing on the user's mail, this parameter is required
|
||||
# before we're able to validate the contract or user
|
||||
|
||||
@@ -37,7 +37,7 @@ module Users
|
||||
def set_attributes(params)
|
||||
self.pref = params.delete(:pref)
|
||||
|
||||
super(params)
|
||||
super
|
||||
end
|
||||
|
||||
def validate_and_result
|
||||
|
||||
@@ -41,7 +41,7 @@ module Users
|
||||
end
|
||||
|
||||
def persist(service_result)
|
||||
service_result = super(service_result)
|
||||
service_result = super
|
||||
|
||||
if service_result.success?
|
||||
service_result.success = model.pref.save
|
||||
|
||||
@@ -40,7 +40,7 @@ class WorkPackageMembers::DeleteService < BaseServices::Delete
|
||||
protected
|
||||
|
||||
def after_perform(service_call)
|
||||
super(service_call).tap do |call|
|
||||
super.tap do |call|
|
||||
work_package_member = call.result
|
||||
|
||||
cleanup_for_group(work_package_member)
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
xml.instruct!
|
||||
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||||
xml.title title
|
||||
xml.link "rel" => "self", "href" => url_for(format: 'atom', key: User.current.rss_key, only_path: false)
|
||||
xml.link "rel" => "self", "href" => url_for(format: "atom", key: User.current.rss_key, only_path: false)
|
||||
xml.link "rel" => "alternate", "href" => home_url(only_path: false)
|
||||
xml.id url_for(controller: '/homescreen', action: :index, only_path: false)
|
||||
xml.id url_for(controller: "/homescreen", action: :index, only_path: false)
|
||||
xml.updated((journals.first ? journals.first.created_at : Time.now).xmlschema)
|
||||
xml.author { xml.name Setting.app_title.to_s }
|
||||
journals.each do |change|
|
||||
@@ -39,7 +39,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||||
xml.entry do
|
||||
xml.title "#{work_package.project.name} - #{work_package.type.name} ##{work_package.id}: #{work_package.subject}"
|
||||
xml.link "rel" => "alternate", "href" => work_package_url(work_package)
|
||||
xml.id url_for(controller: '/work_packages', action: 'show', id: work_package, journal_id: change,
|
||||
xml.id url_for(controller: "/work_packages", action: "show", id: work_package, journal_id: change,
|
||||
only_path: false)
|
||||
xml.updated change.created_at.xmlschema
|
||||
xml.author do
|
||||
@@ -47,12 +47,12 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||||
xml.email(change.user.mail) if change.user.is_a?(User) && change.user.mail.present? && change.user.pref.can_expose_mail?
|
||||
end
|
||||
xml.content "type" => "html" do
|
||||
xml.text! '<ul>'
|
||||
xml.text! "<ul>"
|
||||
change.details.each do |detail|
|
||||
change_content = change.render_detail(detail, html: true)
|
||||
xml.text!(content_tag(:li, change_content)) if change_content.present?
|
||||
end
|
||||
xml.text! '</ul>'
|
||||
xml.text! "</ul>"
|
||||
xml.text! format_text(change, :notes, only_path: false) if change.notes.present?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,7 +61,7 @@ class ApplicationJob < ActiveJob::Base
|
||||
if value.is_a?(Symbol)
|
||||
super(priority_number(value))
|
||||
else
|
||||
super(value)
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
# See COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require 'tempfile'
|
||||
require 'zip'
|
||||
require "tempfile"
|
||||
require "zip"
|
||||
|
||||
class BackupJob < ApplicationJob
|
||||
include OpenProject::PostgresEnvironment
|
||||
@@ -135,21 +135,21 @@ class BackupJob < ApplicationJob
|
||||
File.open(file_name) do |file|
|
||||
call = Attachments::CreateService
|
||||
.bypass_whitelist(user:)
|
||||
.call(container: backup, filename: file_name, file:, description: 'OpenProject backup')
|
||||
.call(container: backup, filename: file_name, file:, description: "OpenProject backup")
|
||||
|
||||
call.on_success do
|
||||
download_url = ::API::V3::Utilities::PathHelper::ApiV3Path.attachment_content(call.result.id)
|
||||
|
||||
upsert_status(
|
||||
status: :success,
|
||||
message: I18n.t('export.succeeded'),
|
||||
message: I18n.t("export.succeeded"),
|
||||
payload: download_payload(download_url)
|
||||
)
|
||||
end
|
||||
|
||||
call.on_failure do
|
||||
upsert_status status: :failure,
|
||||
message: I18n.t('export.failed', message: call.message)
|
||||
message: I18n.t("export.failed", message: call.message)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -253,7 +253,7 @@ class BackupJob < ApplicationJob
|
||||
end
|
||||
|
||||
def failure!(error: nil)
|
||||
msg = I18n.t 'backup.failed'
|
||||
msg = I18n.t "backup.failed"
|
||||
|
||||
upsert_status(
|
||||
status: :failure,
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
# Until then, a synchronous process is more failsafe.
|
||||
class SCM::CreateRemoteRepositoryJob < SCM::RemoteRepositoryJob
|
||||
def perform(repository)
|
||||
super(repository)
|
||||
super
|
||||
|
||||
response = send_request(repository_request.merge(action: :create))
|
||||
repository.root_url = response["path"]
|
||||
|
||||
@@ -32,7 +32,7 @@ class SCM::RelocateRepositoryJob < SCM::RemoteRepositoryJob
|
||||
queue_with_priority :below_normal
|
||||
|
||||
def perform(repository)
|
||||
super(repository)
|
||||
super
|
||||
|
||||
if repository.class.manages_remote?
|
||||
relocate_remote
|
||||
|
||||
+16
-17
@@ -26,12 +26,12 @@
|
||||
# See COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require_relative 'boot'
|
||||
require_relative "boot"
|
||||
|
||||
require 'rails/all'
|
||||
require 'active_support'
|
||||
require 'active_support/dependencies'
|
||||
require 'core_extensions'
|
||||
require "rails/all"
|
||||
require "active_support"
|
||||
require "active_support/dependencies"
|
||||
require "core_extensions"
|
||||
require "view_component"
|
||||
require "primer/view_components/engine"
|
||||
|
||||
@@ -39,7 +39,7 @@ require "primer/view_components/engine"
|
||||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(*Rails.groups(:opf_plugins))
|
||||
|
||||
require_relative '../lib_static/open_project/configuration'
|
||||
require_relative "../lib_static/open_project/configuration"
|
||||
|
||||
module OpenProject
|
||||
class Application < Rails::Application
|
||||
@@ -104,8 +104,8 @@ module OpenProject
|
||||
if: lambda { |_env, _code, headers, _body|
|
||||
# Firefox fails to properly decode gzip attachments
|
||||
# We thus avoid deflating if sending gzip already.
|
||||
content_type = headers['Content-Type']
|
||||
content_type != 'application/x-gzip'
|
||||
content_type = headers["Content-Type"]
|
||||
content_type != "application/x-gzip"
|
||||
}
|
||||
|
||||
config.middleware.use Rack::Attack
|
||||
@@ -115,14 +115,14 @@ module OpenProject
|
||||
|
||||
# Add lookbook preview paths when enabled
|
||||
if OpenProject::Configuration.lookbook_enabled?
|
||||
config.paths.add Primer::ViewComponents::Engine.root.join('app/components').to_s, eager_load: true
|
||||
config.paths.add Primer::ViewComponents::Engine.root.join("app/components").to_s, eager_load: true
|
||||
config.paths.add Rails.root.join("lookbook/previews").to_s, eager_load: true
|
||||
config.paths.add Primer::ViewComponents::Engine.root.join('previews').to_s, eager_load: true
|
||||
config.paths.add Primer::ViewComponents::Engine.root.join("previews").to_s, eager_load: true
|
||||
end
|
||||
|
||||
# Constants in lib_static should only be loaded once and never be unloaded.
|
||||
# That directory contains configurations and patches to rails core functionality.
|
||||
config.autoload_once_paths << Rails.root.join('lib_static').to_s
|
||||
config.autoload_once_paths << Rails.root.join("lib_static").to_s
|
||||
|
||||
# Configure the relative url root to be whatever the configuration is set to.
|
||||
# This allows for setting the root either via config file or via environment variable.
|
||||
@@ -130,7 +130,7 @@ module OpenProject
|
||||
# than `config.exceptions_app = routes`. Otherwise Rails.application.routes.url_helpers
|
||||
# will not have configured prefix.
|
||||
# Read https://github.com/rails/rails/issues/42243 for some details.
|
||||
config.relative_url_root = OpenProject::Configuration['rails_relative_url_root']
|
||||
config.relative_url_root = OpenProject::Configuration["rails_relative_url_root"]
|
||||
|
||||
# Use our own error rendering for prettier error pages
|
||||
config.exceptions_app = routes
|
||||
@@ -167,7 +167,7 @@ module OpenProject
|
||||
I18n.backend.class.send(:include, I18n::Backend::Cascade)
|
||||
|
||||
# Configure the default encoding used in templates for Ruby 1.9.
|
||||
config.encoding = 'utf-8'
|
||||
config.encoding = "utf-8"
|
||||
|
||||
# Enable escaping HTML in JSON.
|
||||
config.active_support.escape_html_entities_in_json = true
|
||||
@@ -208,14 +208,13 @@ module OpenProject
|
||||
|
||||
# Load any local configuration that is kept out of source control
|
||||
# (e.g. patches).
|
||||
if File.exist?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
|
||||
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
|
||||
if File.exist?(File.join(File.dirname(__FILE__), "additional_environment.rb"))
|
||||
instance_eval File.read(File.join(File.dirname(__FILE__), "additional_environment.rb"))
|
||||
end
|
||||
|
||||
# initialize variable for register plugin tests
|
||||
config.plugins_to_test_paths = []
|
||||
|
||||
|
||||
config.active_job.queue_adapter = :good_job
|
||||
|
||||
config.good_job.retry_on_unhandled_error = false
|
||||
@@ -236,7 +235,7 @@ module OpenProject
|
||||
# Return false instead of self when enqueuing is aborted from a callback.
|
||||
# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
|
||||
|
||||
config.log_level = OpenProject::Configuration['log_level'].to_sym
|
||||
config.log_level = OpenProject::Configuration["log_level"].to_sym
|
||||
|
||||
# Enable the Rails 7 cache format
|
||||
config.active_support.cache_format_version = 7.0
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
# In development and non-eager loaded mode, we need to register the acts_as_watchable models manually
|
||||
# as no eager loading takes place
|
||||
Rails.application.config.after_initialize do
|
||||
OpenProject::Acts::Watchable::Registry
|
||||
.add(WorkPackage, Message, Forum, News, Meeting, Wiki, WikiPage)
|
||||
OpenProject::Acts::Watchable::Registry
|
||||
.add(WorkPackage, Message, Forum, News, Meeting, Wiki, WikiPage)
|
||||
end
|
||||
|
||||
@@ -79,5 +79,4 @@ OpenProject::CustomFieldFormat.map do |fields|
|
||||
label: nil,
|
||||
order: 11,
|
||||
formatter: "CustomValue::EmptyStrategy")
|
||||
|
||||
end
|
||||
|
||||
@@ -29,12 +29,15 @@ class CreateGoodJobs < ActiveRecord::Migration[7.0]
|
||||
end
|
||||
|
||||
add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: :index_good_jobs_on_scheduled_at
|
||||
add_index :good_jobs, [:queue_name, :scheduled_at], where: "(finished_at IS NULL)", name: :index_good_jobs_on_queue_name_and_scheduled_at
|
||||
add_index :good_jobs, [:active_job_id, :created_at], name: :index_good_jobs_on_active_job_id_and_created_at
|
||||
add_index :good_jobs, :concurrency_key, where: "(finished_at IS NULL)", name: :index_good_jobs_on_concurrency_key_when_unfinished
|
||||
add_index :good_jobs, [:cron_key, :created_at], name: :index_good_jobs_on_cron_key_and_created_at
|
||||
add_index :good_jobs, [:cron_key, :cron_at], name: :index_good_jobs_on_cron_key_and_cron_at, unique: true
|
||||
add_index :good_jobs, %i[queue_name scheduled_at], where: "(finished_at IS NULL)",
|
||||
name: :index_good_jobs_on_queue_name_and_scheduled_at
|
||||
add_index :good_jobs, %i[active_job_id created_at], name: :index_good_jobs_on_active_job_id_and_created_at
|
||||
add_index :good_jobs, :concurrency_key, where: "(finished_at IS NULL)",
|
||||
name: :index_good_jobs_on_concurrency_key_when_unfinished
|
||||
add_index :good_jobs, %i[cron_key created_at], name: :index_good_jobs_on_cron_key_and_created_at
|
||||
add_index :good_jobs, %i[cron_key cron_at], name: :index_good_jobs_on_cron_key_and_cron_at, unique: true
|
||||
add_index :good_jobs, [:active_job_id], name: :index_good_jobs_on_active_job_id
|
||||
add_index :good_jobs, [:finished_at], where: "retried_good_job_id IS NULL AND finished_at IS NOT NULL", name: :index_good_jobs_jobs_on_finished_at
|
||||
add_index :good_jobs, [:finished_at], where: "retried_good_job_id IS NULL AND finished_at IS NOT NULL",
|
||||
name: :index_good_jobs_jobs_on_finished_at
|
||||
end
|
||||
end
|
||||
|
||||
+4
-3
@@ -12,8 +12,9 @@ class CreateIndexGoodJobsJobsOnPriorityCreatedAtWhenUnfinished < ActiveRecord::M
|
||||
end
|
||||
end
|
||||
|
||||
add_index :good_jobs, [:priority, :created_at], order: { priority: "DESC NULLS LAST", created_at: :asc },
|
||||
where: "finished_at IS NULL", name: :index_good_jobs_jobs_on_priority_created_at_when_unfinished,
|
||||
algorithm: :concurrently
|
||||
add_index :good_jobs, %i[priority created_at], order: { priority: "DESC NULLS LAST", created_at: :asc },
|
||||
where: "finished_at IS NULL",
|
||||
name: :index_good_jobs_jobs_on_priority_created_at_when_unfinished,
|
||||
algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ class CreateGoodJobExecutions < ActiveRecord::Migration[7.0]
|
||||
t.datetime :finished_at
|
||||
t.text :error
|
||||
|
||||
t.index [:active_job_id, :created_at], name: :index_good_job_executions_on_active_job_id_and_created_at
|
||||
t.index %i[active_job_id created_at], name: :index_good_job_executions_on_active_job_id_and_created_at
|
||||
end
|
||||
|
||||
change_table :good_jobs do |t|
|
||||
|
||||
@@ -7,12 +7,15 @@ class RecreateGoodJobCronIndexesWithConditional < ActiveRecord::Migration[7.0]
|
||||
reversible do |dir|
|
||||
dir.up do
|
||||
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at_cond)
|
||||
add_index :good_jobs, [:cron_key, :created_at], where: "(cron_key IS NOT NULL)",
|
||||
name: :index_good_jobs_on_cron_key_and_created_at_cond, algorithm: :concurrently
|
||||
add_index :good_jobs, %i[cron_key created_at], where: "(cron_key IS NOT NULL)",
|
||||
name: :index_good_jobs_on_cron_key_and_created_at_cond,
|
||||
algorithm: :concurrently
|
||||
end
|
||||
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_cron_at_cond)
|
||||
add_index :good_jobs, [:cron_key, :cron_at], where: "(cron_key IS NOT NULL)", unique: true,
|
||||
name: :index_good_jobs_on_cron_key_and_cron_at_cond, algorithm: :concurrently
|
||||
add_index :good_jobs, %i[cron_key cron_at], where: "(cron_key IS NOT NULL)",
|
||||
unique: true,
|
||||
name: :index_good_jobs_on_cron_key_and_cron_at_cond,
|
||||
algorithm: :concurrently
|
||||
end
|
||||
|
||||
if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at)
|
||||
@@ -25,12 +28,13 @@ class RecreateGoodJobCronIndexesWithConditional < ActiveRecord::Migration[7.0]
|
||||
|
||||
dir.down do
|
||||
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at)
|
||||
add_index :good_jobs, [:cron_key, :created_at],
|
||||
name: :index_good_jobs_on_cron_key_and_created_at, algorithm: :concurrently
|
||||
add_index :good_jobs, %i[cron_key created_at], name: :index_good_jobs_on_cron_key_and_created_at,
|
||||
algorithm: :concurrently
|
||||
end
|
||||
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_cron_at)
|
||||
add_index :good_jobs, [:cron_key, :cron_at], unique: true,
|
||||
name: :index_good_jobs_on_cron_key_and_cron_at, algorithm: :concurrently
|
||||
add_index :good_jobs, %i[cron_key cron_at], unique: true,
|
||||
name: :index_good_jobs_on_cron_key_and_cron_at,
|
||||
algorithm: :concurrently
|
||||
end
|
||||
|
||||
if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at_cond)
|
||||
|
||||
@@ -12,13 +12,12 @@ class EnableRequiredProjectCustomFieldsInAllProjects < ActiveRecord::Migration[7
|
||||
.group_by(&:first)
|
||||
.transform_values { |values| values.map(&:last) }
|
||||
.reduce([]) do |acc, (project_id, custom_field_ids)|
|
||||
missing_custom_field_ids = required_custom_field_ids - custom_field_ids
|
||||
|
||||
missing_custom_field_ids = required_custom_field_ids - custom_field_ids
|
||||
|
||||
acc + missing_custom_field_ids.map do |custom_field_id|
|
||||
{ project_id: , custom_field_id: }
|
||||
acc + missing_custom_field_ids.map do |custom_field_id|
|
||||
{ project_id:, custom_field_id: }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ProjectCustomFieldProjectMapping.insert_all!(missing_custom_field_attributes)
|
||||
end
|
||||
|
||||
@@ -35,8 +35,10 @@ class CreateGoodJobLabelsIndex < ActiveRecord::Migration[7.1]
|
||||
reversible do |dir|
|
||||
dir.up do
|
||||
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_labels)
|
||||
add_index :good_jobs, :labels, using: :gin, where: "(labels IS NOT NULL)",
|
||||
name: :index_good_jobs_on_labels, algorithm: :concurrently
|
||||
add_index :good_jobs, :labels, using: :gin,
|
||||
where: "(labels IS NOT NULL)",
|
||||
name: :index_good_jobs_on_labels,
|
||||
algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -40,8 +40,9 @@ class CreateIndexGoodJobJobsForCandidateLookup < ActiveRecord::Migration[7.1]
|
||||
end
|
||||
end
|
||||
|
||||
add_index :good_jobs, [:priority, :created_at], order: { priority: "ASC NULLS LAST", created_at: :asc },
|
||||
where: "finished_at IS NULL", name: :index_good_job_jobs_for_candidate_lookup,
|
||||
algorithm: :concurrently
|
||||
add_index :good_jobs, %i[priority created_at], order: { priority: "ASC NULLS LAST", created_at: :asc },
|
||||
where: "finished_at IS NULL",
|
||||
name: :index_good_job_jobs_for_candidate_lookup,
|
||||
algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2024 the OpenProject GmbH
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License version 3.
|
||||
#
|
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
# Copyright (C) 2010-2013 the ChiliProject Team
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# See COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2024 the OpenProject GmbH
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License version 3.
|
||||
#
|
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
# Copyright (C) 2010-2013 the ChiliProject Team
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# See COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
class EnableUnaccentExtension < ActiveRecord::Migration[7.1]
|
||||
def up
|
||||
ActiveRecord::Base.connection.execute("CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA pg_catalog;")
|
||||
rescue StandardError => e
|
||||
raise unless e.message.include?("unaccent")
|
||||
class EnableUnaccentExtension < ActiveRecord::Migration[7.1]
|
||||
def up
|
||||
ActiveRecord::Base.connection.execute("CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA pg_catalog;")
|
||||
rescue StandardError => e
|
||||
raise unless e.message.include?("unaccent")
|
||||
|
||||
raise <<~MESSAGE
|
||||
\e[33mWARNING:\e[0m Could not find or enable the `unaccent` extension for PostgreSQL.
|
||||
This is needed for filtering users with accents, please install the postgresql-contrib module
|
||||
for your PostgreSQL installation and re-run this migration.
|
||||
raise <<~MESSAGE
|
||||
\e[33mWARNING:\e[0m Could not find or enable the `unaccent` extension for PostgreSQL.
|
||||
This is needed for filtering users with accents, please install the postgresql-contrib module
|
||||
for your PostgreSQL installation and re-run this migration.
|
||||
|
||||
Read more about the contrib module at `https://www.postgresql.org/docs/current/contrib.html`.
|
||||
MESSAGE
|
||||
end
|
||||
|
||||
def down
|
||||
ActiveRecord::Base.connection.execute("DROP EXTENSION IF EXISTS unaccent CASCADE;")
|
||||
end
|
||||
Read more about the contrib module at `https://www.postgresql.org/docs/current/contrib.html`.
|
||||
MESSAGE
|
||||
end
|
||||
|
||||
def down
|
||||
ActiveRecord::Base.connection.execute("DROP EXTENSION IF EXISTS unaccent CASCADE;")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ module API
|
||||
base.extend ClassMethods
|
||||
end
|
||||
|
||||
def from_hash(hash, *args)
|
||||
def from_hash(hash, *)
|
||||
return super unless hash && hash["_links"]
|
||||
|
||||
copied_hash = hash.deep_dup
|
||||
@@ -52,7 +52,7 @@ module API
|
||||
copied_hash[name] = fragment
|
||||
end
|
||||
|
||||
super(copied_hash, *args)
|
||||
super(copied_hash, *)
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
||||
@@ -33,7 +33,7 @@ module API
|
||||
code 401
|
||||
|
||||
def initialize(message = I18n.t("api_v3.errors.code_401"))
|
||||
super(message)
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ module API
|
||||
code 415
|
||||
|
||||
def initialize(message)
|
||||
super(message)
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,7 +47,7 @@ module API
|
||||
def create(model, **args)
|
||||
meta = args.delete(:meta)
|
||||
|
||||
super(model, **args).tap do |instance|
|
||||
super.tap do |instance|
|
||||
instance.meta = meta
|
||||
end
|
||||
end
|
||||
|
||||
@@ -95,13 +95,13 @@ module API
|
||||
property.merge!(render_filter: filter)
|
||||
end
|
||||
|
||||
def from_hash(hash, *args)
|
||||
def from_hash(hash, *)
|
||||
# Prevent entries in _embedded from overriding anything in the _links section
|
||||
copied_hash = hash.deep_dup
|
||||
|
||||
copied_hash.delete("_embedded")
|
||||
|
||||
super(copied_hash, *args)
|
||||
super(copied_hash, *)
|
||||
end
|
||||
|
||||
def contract?(represented)
|
||||
@@ -126,8 +126,8 @@ module API
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def create_class(*args)
|
||||
new_class = super(*args)
|
||||
def create_class(*)
|
||||
new_class = super
|
||||
|
||||
new_class.send(:include, ::API::Utilities::PayloadRepresenter)
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ module API
|
||||
module Activities
|
||||
class ActivitiesAPI < ::API::OpenProjectAPI
|
||||
resources :activities do
|
||||
route_param :id, type: Integer, desc: 'Activity ID' do
|
||||
route_param :id, type: Integer, desc: "Activity ID" do
|
||||
after_validation do
|
||||
@activity = Journal.find(declared_params[:id])
|
||||
|
||||
@@ -41,7 +41,7 @@ module API
|
||||
end
|
||||
|
||||
get &::API::V3::Utilities::Endpoints::Show.new(model: ::Journal,
|
||||
api_name: 'Activity',
|
||||
api_name: "Activity",
|
||||
instance_generator: ->(*) { @activity })
|
||||
.mount
|
||||
|
||||
@@ -50,7 +50,7 @@ module API
|
||||
end
|
||||
|
||||
patch &::API::V3::Utilities::Endpoints::Update.new(model: ::Journal,
|
||||
api_name: 'Activity',
|
||||
api_name: "Activity",
|
||||
instance_generator: ->(*) { @activity },
|
||||
params_modifier: ->(*) {
|
||||
{ notes: declared_params[:comment] }
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
# See COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require 'api/v3/activities/activity_representer'
|
||||
require "api/v3/activities/activity_representer"
|
||||
|
||||
module API
|
||||
module V3
|
||||
@@ -58,7 +58,7 @@ module API
|
||||
.new(user: current_user,
|
||||
work_package: @work_package)
|
||||
.call(params[:comment][:raw],
|
||||
send_notifications: !(params.has_key?(:notify) && params[:notify] == 'false'))
|
||||
send_notifications: !(params.has_key?(:notify) && params[:notify] == "false"))
|
||||
|
||||
if call.success?
|
||||
Activities::ActivityRepresenter.new(call.result, current_user:)
|
||||
|
||||
@@ -79,9 +79,9 @@ module API
|
||||
|
||||
def _type
|
||||
if represented.noop? || represented.notes.present?
|
||||
'Activity::Comment'
|
||||
"Activity::Comment"
|
||||
else
|
||||
'Activity'
|
||||
"Activity"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ module API
|
||||
:attachments,
|
||||
type: Boolean,
|
||||
default: true,
|
||||
desc: 'Whether or not to include attachments (default: true)'
|
||||
desc: "Whether or not to include attachments (default: true)"
|
||||
)
|
||||
end
|
||||
post do
|
||||
|
||||
@@ -32,10 +32,7 @@ module API
|
||||
module Schemas
|
||||
class MembershipSchemaRepresenter < ::API::Decorators::SchemaRepresenter
|
||||
def initialize(represented, self_link: nil, current_user: nil, form_embedded: false)
|
||||
super(represented,
|
||||
self_link:,
|
||||
current_user:,
|
||||
form_embedded:)
|
||||
super
|
||||
end
|
||||
|
||||
schema :id,
|
||||
|
||||
@@ -34,7 +34,7 @@ module API
|
||||
include ::API::Utilities::PayloadRepresenter
|
||||
|
||||
def initialize(model)
|
||||
super(model)
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ module API
|
||||
def initialize(filters, ...)
|
||||
filters = filters.reject { ::Queries::Register.excluded_filters.include?(_1.class) }
|
||||
|
||||
super(filters, ...)
|
||||
super
|
||||
end
|
||||
|
||||
def model_self_link(model)
|
||||
|
||||
@@ -35,10 +35,7 @@ module API
|
||||
module Schemas
|
||||
class QuerySchemaRepresenter < ::API::Decorators::SchemaRepresenter
|
||||
def initialize(represented, self_link: nil, current_user: nil, form_embedded: false)
|
||||
super(represented,
|
||||
self_link:,
|
||||
current_user:,
|
||||
form_embedded:)
|
||||
super
|
||||
end
|
||||
|
||||
def self.filters_schema
|
||||
|
||||
@@ -36,10 +36,7 @@ module API
|
||||
custom_field_injector type: :schema_representer
|
||||
|
||||
def initialize(represented, self_link: nil, current_user: nil, form_embedded: false)
|
||||
super(represented,
|
||||
self_link:,
|
||||
current_user:,
|
||||
form_embedded:)
|
||||
super
|
||||
end
|
||||
|
||||
schema :id,
|
||||
|
||||
@@ -77,9 +77,9 @@ module API
|
||||
Representable::Binding::Map.new(super.select { |bind| rendered_properties.include?(bind.name) })
|
||||
end
|
||||
|
||||
def compile_links_for(configs, *args)
|
||||
def compile_links_for(configs, *)
|
||||
super(configs.select { |config| rendered_properties_for_links.include?(config.first[:rel]) },
|
||||
*args)
|
||||
*)
|
||||
end
|
||||
|
||||
def rendered_properties
|
||||
|
||||
@@ -293,9 +293,9 @@ module OpenProject::Plugins
|
||||
OpenProject::Activity.register(event_type, options)
|
||||
end
|
||||
|
||||
def add_cron_jobs(&block)
|
||||
def add_cron_jobs
|
||||
config.to_prepare do
|
||||
Rails.application.config.good_job.cron.merge!(block.call)
|
||||
Rails.application.config.good_job.cron.merge!(yield)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ module OpenProject::TextFormatting
|
||||
autolink_context = default_autolink_options.merge context.fetch(:autolink, {})
|
||||
return doc if autolink_context[:enabled] == false
|
||||
|
||||
::Rinku.auto_link(html, :all, "class=\"#{autolink_context[:classes]}\" rel=\"noopener noreferrer\"", nil, Rinku::AUTOLINK_SHORT_DOMAINS)
|
||||
::Rinku.auto_link(html, :all, "class=\"#{autolink_context[:classes]}\" rel=\"noopener noreferrer\"", nil,
|
||||
Rinku::AUTOLINK_SHORT_DOMAINS)
|
||||
end
|
||||
|
||||
def default_autolink_options
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
module OpenProject::TextFormatting
|
||||
module Filters
|
||||
class SyntaxHighlightFilter < HTML::Pipeline::SyntaxHighlightFilter
|
||||
def initialize(*args)
|
||||
super(*args)
|
||||
def initialize(*)
|
||||
super
|
||||
|
||||
@formatter = highlighter_class
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ module OpenProject::TextFormatting
|
||||
attr_reader :headings, :ids
|
||||
|
||||
def initialize(doc, context = nil, result = nil)
|
||||
super(doc, context, result)
|
||||
super
|
||||
@headings ||= doc.css("h1, h2, h3, h4, h5, h6")
|
||||
@ids = Set.new
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ module Primer
|
||||
options.reverse_merge(
|
||||
component: "opce-autocompleter",
|
||||
resource: "work_packages",
|
||||
searchKey: "subjectOrId",
|
||||
searchKey: "subjectOrId"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -123,7 +123,7 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilder
|
||||
(label + container_wrap_field(input, :date_picker, options))
|
||||
end
|
||||
|
||||
def radio_button(field, value, options = {}, *args)
|
||||
def radio_button(field, value, options = {}, *)
|
||||
options[:class] = Array(options[:class]) + %w(form--radio-button)
|
||||
|
||||
input_options, label_options = extract_from options
|
||||
@@ -134,7 +134,7 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilder
|
||||
end
|
||||
|
||||
label = label_for_field(field, label_options)
|
||||
input = super(field, value, input_options, *args)
|
||||
input = super(field, value, input_options, *)
|
||||
|
||||
(label + container_wrap_field(input, "radio-button", options))
|
||||
end
|
||||
|
||||
@@ -47,6 +47,7 @@ module OpenProject
|
||||
# as it's used to identify whether a user can actually favorite the object.
|
||||
def acts_as_favorable
|
||||
return if included_modules.include?(::OpenProject::Acts::Favorable::InstanceMethods)
|
||||
|
||||
OpenProject::Acts::Favorable::Registry.add(self)
|
||||
|
||||
class_eval do
|
||||
|
||||
@@ -114,10 +114,10 @@ module OpenProject
|
||||
active_scope = Principal.not_locked.user
|
||||
|
||||
allowed_scope = if project.public?
|
||||
User.allowed(self.class.acts_as_watchable_permission, project)
|
||||
else
|
||||
User.allowed_members_on_work_package(self.class.acts_as_watchable_permission, self)
|
||||
end
|
||||
User.allowed(self.class.acts_as_watchable_permission, project)
|
||||
else
|
||||
User.allowed_members_on_work_package(self.class.acts_as_watchable_permission, self)
|
||||
end
|
||||
|
||||
active_scope.where(id: allowed_scope)
|
||||
end
|
||||
|
||||
@@ -77,8 +77,8 @@ module Acts::Journalized
|
||||
module ClassMethods
|
||||
# Overrides the +journaled+ method to first define the +journaled?+ class method before
|
||||
# deferring to the original +journaled+.
|
||||
def acts_as_journalized(*args)
|
||||
super(*args)
|
||||
def acts_as_journalized(*)
|
||||
super
|
||||
|
||||
class << self
|
||||
def journaled?
|
||||
|
||||
@@ -30,7 +30,6 @@ module OpenProject
|
||||
module Common
|
||||
# @logical_path OpenProject/Common
|
||||
class AutocompletePreview < Lookbook::Preview
|
||||
|
||||
# @display min_height 250px
|
||||
def decorated
|
||||
render_with_template
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
|
||||
module OmniAuth
|
||||
class FlexibleBuilder < Builder
|
||||
def use(middleware, *args, &)
|
||||
def use(middleware, *, &)
|
||||
middleware.extend FlexibleStrategyClass
|
||||
super(middleware, *args, &)
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -91,7 +91,7 @@ module OmniAuth
|
||||
|
||||
module FlexibleStrategyClass
|
||||
def new(app, *args, &)
|
||||
super(app, *args, &).tap do |strategy|
|
||||
super.tap do |strategy|
|
||||
strategy.extend FlexibleStrategy
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require 'omniauth-saml'
|
||||
require "omniauth-saml"
|
||||
module OpenProject
|
||||
module AuthSaml
|
||||
def self.configuration
|
||||
@@ -26,10 +26,10 @@ module OpenProject
|
||||
end
|
||||
|
||||
def self.settings_from_config
|
||||
if OpenProject::Configuration['saml'].present?
|
||||
if OpenProject::Configuration["saml"].present?
|
||||
Rails.logger.info("[auth_saml] Registering saml integration from configuration.yml")
|
||||
|
||||
OpenProject::Configuration['saml']
|
||||
OpenProject::Configuration["saml"]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,8 +47,8 @@ module OpenProject
|
||||
include OpenProject::Plugins::ActsAsOpEngine
|
||||
extend OpenProject::Plugins::AuthPlugin
|
||||
|
||||
register 'openproject-auth_saml',
|
||||
author_url: 'https://github.com/finnlabs/openproject-auth_saml',
|
||||
register "openproject-auth_saml",
|
||||
author_url: "https://github.com/finnlabs/openproject-auth_saml",
|
||||
bundled: true,
|
||||
settings: { default: { "providers" => nil } }
|
||||
|
||||
@@ -78,8 +78,8 @@ module OpenProject
|
||||
end
|
||||
end
|
||||
|
||||
initializer 'auth_saml.configuration' do
|
||||
::Settings::Definition.add 'saml',
|
||||
initializer "auth_saml.configuration" do
|
||||
::Settings::Definition.add "saml",
|
||||
default: nil,
|
||||
format: :hash,
|
||||
writable: false
|
||||
|
||||
@@ -35,7 +35,7 @@ module OpenProject::Backlogs::Burndown
|
||||
|
||||
raise "Unsupported unit '#{@unit}'" unless %i[points hours].include? @unit
|
||||
|
||||
super(*args)
|
||||
super
|
||||
end
|
||||
|
||||
attr_reader :unit, :name
|
||||
|
||||
@@ -32,7 +32,7 @@ module OpenProject::Backlogs::Burndown
|
||||
@collect = args.pop
|
||||
@sprint = args.pop
|
||||
@project = args.pop
|
||||
super(*args)
|
||||
super
|
||||
end
|
||||
|
||||
attr_reader :collect, :sprint, :project
|
||||
|
||||
@@ -39,7 +39,7 @@ module OpenProject::Backlogs::Mixins
|
||||
def find_sti_class(type_name)
|
||||
type_name = to_s if type_name == "WorkPackage"
|
||||
|
||||
super(type_name)
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ module OpenProject::Backlogs::Patches::PermittedParamsPatch
|
||||
|
||||
module InstanceMethods
|
||||
def update_work_package(args = {})
|
||||
permitted_params = super(args)
|
||||
permitted_params = super
|
||||
|
||||
backlogs_params = params.require(:work_package).permit(:story_points)
|
||||
permitted_params.merge!(backlogs_params)
|
||||
|
||||
@@ -35,7 +35,7 @@ module Bim::Bcf
|
||||
# snapshot base64 data must not get stored
|
||||
service_result.result.json_viewpoint["snapshot"]&.delete("snapshot_data")
|
||||
|
||||
super(service_result)
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ module OpenProject::Bim::BcfXml
|
||||
class Exporter < ::WorkPackage::Exports::QueryExporter
|
||||
def initialize(object, options = {})
|
||||
object.add_filter("bcf_issue_associated", "=", ["t"])
|
||||
super(object, options)
|
||||
super
|
||||
end
|
||||
|
||||
def current_user
|
||||
|
||||
@@ -42,7 +42,7 @@ module OpenProject::Bim::Patches::TypePatch
|
||||
private
|
||||
|
||||
def default_attribute?(active_cfs, key)
|
||||
super(active_cfs, key) && key != "bcf_thumbnail"
|
||||
super && key != "bcf_thumbnail"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ module Boards
|
||||
end
|
||||
|
||||
def before_perform(params, _service_result)
|
||||
return super(params, _service_result) if no_widgets_initially?
|
||||
return super if no_widgets_initially?
|
||||
|
||||
create_query_result = create_query(params)
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ module TimeEntries::Scopes
|
||||
|
||||
def visible_work_packages(user)
|
||||
WorkPackage.allowed_to(user, :log_own_time).or(
|
||||
WorkPackage.where(project_id: Project.allowed_to(User.current, :log_time)))
|
||||
WorkPackage.where(project_id: Project.allowed_to(User.current, :log_time))
|
||||
)
|
||||
end
|
||||
|
||||
def not_ongoing
|
||||
|
||||
@@ -60,7 +60,7 @@ module Gantt
|
||||
|
||||
menu_item(
|
||||
params,
|
||||
I18n.t("js.queries.#{query_key.to_s}"),
|
||||
I18n.t("js.queries.#{query_key}")
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
+3
-1
@@ -57,7 +57,9 @@ RSpec.describe OpenProject::GithubIntegration::Services::UpsertGithubUser do
|
||||
end
|
||||
|
||||
it "updates the github user" do
|
||||
expect { upsert }.to change { github_user.reload.github_avatar_url }.from("https://github.com/test_user/old_avatar.jpg").to("https://github.com/test_user/avatar.jpg")
|
||||
expect { upsert }.to change { github_user.reload.github_avatar_url }
|
||||
.from("https://github.com/test_user/old_avatar.jpg")
|
||||
.to("https://github.com/test_user/avatar.jpg")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,10 +32,7 @@ module API
|
||||
module Schemas
|
||||
class GridSchemaRepresenter < ::API::Decorators::SchemaRepresenter
|
||||
def initialize(represented, self_link: nil, current_user: nil, form_embedded: false)
|
||||
super(represented,
|
||||
self_link:,
|
||||
current_user:,
|
||||
form_embedded:)
|
||||
super
|
||||
end
|
||||
|
||||
schema :id,
|
||||
|
||||
@@ -34,7 +34,7 @@ class Grids::SetAttributesService < BaseServices::SetAttributes
|
||||
def set_attributes(attributes)
|
||||
widget_attributes = attributes.delete(:widgets)
|
||||
|
||||
ret = super(attributes)
|
||||
ret = super
|
||||
|
||||
update_widgets(widget_attributes)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ module LdapGroups
|
||||
def map_to_users(sync_group, entries)
|
||||
create_missing!(entries) if sync_group.sync_users
|
||||
|
||||
User.where('LOWER(login) IN (?)', entries.keys.map(&:downcase))
|
||||
User.where("LOWER(login) IN (?)", entries.keys.map(&:downcase))
|
||||
end
|
||||
|
||||
##
|
||||
@@ -129,7 +129,7 @@ module LdapGroups
|
||||
# Get the memberof filter to use for querying members
|
||||
def memberof_filter(group)
|
||||
# memberOf filter to identify member entries of the group
|
||||
filter = Net::LDAP::Filter.eq('memberOf', group.dn)
|
||||
filter = Net::LDAP::Filter.eq("memberOf", group.dn)
|
||||
|
||||
# Add the LDAP auth source own filter if present
|
||||
if ldap.filter_string.present?
|
||||
|
||||
@@ -60,7 +60,7 @@ module Meetings
|
||||
}
|
||||
}
|
||||
else
|
||||
super(filter)
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -47,11 +47,14 @@ class MeetingAgendaItem::MeetingForm < ApplicationForm
|
||||
.where("meetings.start_time + (interval '1 hour' * meetings.duration) >= ?", Time.zone.now)
|
||||
.includes(:project)
|
||||
.find_each do |meeting|
|
||||
select.option(
|
||||
label: "#{meeting.project.name}: #{meeting.title} #{format_date(meeting.start_time)} #{format_time(meeting.start_time, false)}",
|
||||
value: meeting.id
|
||||
)
|
||||
end
|
||||
select.option(
|
||||
label: "#{meeting.project.name}: " \
|
||||
"#{meeting.title} " \
|
||||
"#{format_date(meeting.start_time)} " \
|
||||
"#{format_time(meeting.start_time, false)}",
|
||||
value: meeting.id
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ module Meetings
|
||||
protected
|
||||
|
||||
def instance(params)
|
||||
|
||||
# Setting the #type as attributes will not work
|
||||
# as the STI instance is not changed without using e.g., +becomes!+
|
||||
case params.delete(:type)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user