Merge remote-tracking branch 'origin/dev' into implementation/50915-send-an-email-with-the-information-and-how-to-fix-it

This commit is contained in:
Andreas Pfohl
2024-03-22 09:05:45 +01:00
4775 changed files with 70414 additions and 68196 deletions
+2 -1
View File
@@ -5,5 +5,6 @@
21a696ef9b170e14ad2daf53364a4c2113822c2f
# Update copyright information for 2023
c795874f7f281297bbd3bad2fdb58b24cb4ce624
# switch to double quotes in most changed files with a lot of quotes
# switch to double quotes
5c72ea0046a6b5230bf456f55a296ed6fd579535
9e4934cd0a468f46d8f0fc0f11ebc2d4216f789c
+3
View File
@@ -78,6 +78,9 @@ jobs:
env:
OPENPROJECT_CROWDIN_PROJECT: ${{ secrets.OPENPROJECT_CROWDINV2_PROJECT }}
OPENPROJECT_CROWDIN_API_KEY: ${{ secrets.OPENPROJECT_CROWDINV2_API_KEY }}
- name: "Fix root key in Portuguese crowdin translation files"
run: |
script/i18n/fix_crowdin_pt_language_root_key
- name: "Commit translations"
run: |
git config user.name "OpenProject Actions CI"
+48 -8
View File
@@ -21,7 +21,41 @@ env:
REGISTRY_IMAGE: openproject/community
jobs:
extract_version:
runs-on: ubuntu-latest
steps:
- name: Extract version
id: extract_version
run: |
if [[ ${{ github.event_name }} == 'push' ]]; then
TAG_REF=${GITHUB_REF#refs/tags/}
CHECKOUT_REF=$GITHUB_REF
elif [[ ${{ github.event_name }} == 'schedule' ]]; then
TAG_REF=dev
CHECKOUT_REF=refs/heads/dev
elif [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
TAG_REF=${{ inputs.tag }}
CHECKOUT_REF=${{ inputs.tag }}
else
echo "Unsupported event"
exit 1
fi
if [ -z "$TAG_REF" ] || [ -z "$CHECKOUT_REF" ]; then
echo "No TAG_REF or CHECKOUT_REF set. Aborting"
exit 1
fi
VERSION=${TAG_REF#v}
echo "Version: $VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "checkout_ref=$CHECKOUT_REF" >> "$GITHUB_OUTPUT"
outputs:
version: ${{ steps.extract_version.outputs.version }}
checkout_ref: ${{ steps.extract_version.outputs.checkout_ref }}
build:
needs:
- extract_version
if: github.repository == 'opf/openproject'
runs-on: runs-on,runner=8cpu-linux,family=m7i+m7a,run-id=${{ github.run_id }}
strategy:
@@ -61,7 +95,7 @@ jobs:
echo "No TAG_REF or CHECKOUT_REF set. Aborting"
exit 1
fi
VERSION=${TAG_REF#v}
echo "Version: $VERSION"
echo "::set-output name=version::$VERSION"
@@ -87,8 +121,13 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
context: git
labels: |
io.artifacthub.package.readme-url=https://www.openproject.org/docs/installation-and-operations/installation/docker/
org.opencontainers.image.documentation=https://www.openproject.org/docs/
org.opencontainers.image.vendor=OpenProject GmbH
tags: |
type=semver,pattern={{version}},value=${{ steps.extract_version.outputs.version }}
type=semver,pattern={{version}},value=${{ needs.extract_version.outputs.version }}
images: |
${{ env.REGISTRY_IMAGE }}
- name: Build image
@@ -150,6 +189,7 @@ jobs:
matrix:
target: [slim, all-in-one]
needs:
- extract_version
- build
steps:
- name: Download digests
@@ -171,16 +211,16 @@ jobs:
with:
images: ${{ env.REGISTRY_IMAGE }}
labels: |
io.artifacthub.package.readme-url="https://www.openproject.org/docs/installation-and-operations/installation/docker/"
org.opencontainers.image.documentation="https://www.openproject.org/docs/"
org.opencontainers.image.vendor="OpenProject GmbH"
io.artifacthub.package.readme-url=https://www.openproject.org/docs/installation-and-operations/installation/docker/
org.opencontainers.image.documentation=https://www.openproject.org/docs/
org.opencontainers.image.vendor=OpenProject GmbH
flavor: |
latest=false
suffix=${{ steps.set_suffix.outputs.suffix }}
tags: |
type=semver,pattern={{version}},value=${{ steps.extract_version.outputs.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.extract_version.outputs.version }}
type=semver,pattern={{major}},value=${{ steps.extract_version.outputs.version }}
type=semver,pattern={{version}},value=${{ needs.extract_version.outputs.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.extract_version.outputs.version }}
type=semver,pattern={{major}},value=${{ needs.extract_version.outputs.version }}
type=raw,value=dev,priority=200,enable={{is_default_branch}}
- name: Login to Docker Hub
uses: docker/login-action@v2
+2 -2
View File
@@ -36,7 +36,7 @@ ruby File.read(".ruby-version").strip
gem "actionpack-xml_parser", "~> 2.0.0"
gem "activemodel-serializers-xml", "~> 1.0.1"
gem "activerecord-import", "~> 1.5.0"
gem "activerecord-import", "~> 1.6.0"
gem "activerecord-session_store", "~> 2.1.0"
gem "ox"
gem "rails", "~> 7.1.3"
@@ -124,7 +124,7 @@ gem "multi_json", "~> 1.15.0"
gem "oj", "~> 3.16.0"
gem "daemons"
gem "good_job", "~> 3.26.1" # update should be done manually in sync with saas-openproject version.
gem "good_job", "= 3.26.2" # update should be done manually in sync with saas-openproject version.
gem "rack-protection", "~> 3.2.0"
+14 -14
View File
@@ -299,7 +299,7 @@ GEM
activemodel (= 7.1.3.2)
activesupport (= 7.1.3.2)
timeout (>= 0.4.0)
activerecord-import (1.5.1)
activerecord-import (1.6.0)
activerecord (>= 4.2)
activerecord-nulldb-adapter (1.0.1)
activerecord (>= 5.2.0, < 7.2)
@@ -339,7 +339,7 @@ GEM
airbrake-ruby (6.2.2)
rbtree3 (~> 0.6)
android_key_attestation (0.3.0)
appsignal (3.6.2)
appsignal (3.6.3)
rack
ast (2.4.2)
attr_required (1.0.2)
@@ -380,7 +380,7 @@ GEM
thread_safe (~> 0.3, >= 0.3.1)
base64 (0.2.0)
bcrypt (3.1.20)
better_html (2.0.2)
better_html (2.1.1)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
@@ -513,7 +513,7 @@ GEM
erblint-github (1.0.1)
erubi (1.12.0)
escape_utils (1.3.0)
et-orbi (1.2.7)
et-orbi (1.2.9)
tzinfo
eventmachine (1.2.7)
eventmachine_httpserver (0.2.1)
@@ -537,7 +537,7 @@ GEM
websocket-driver (>= 0.6, < 0.8)
ffi (1.16.3)
flamegraph (0.9.5)
fog-aws (3.21.1)
fog-aws (3.22.0)
fog-core (~> 2.1)
fog-json (~> 1.1)
fog-xml (~> 0.1)
@@ -570,14 +570,14 @@ GEM
i18n (>= 0.7)
multi_json
request_store (>= 1.0)
good_job (3.26.1)
good_job (3.26.2)
activejob (>= 6.0.0)
activerecord (>= 6.0.0)
concurrent-ruby (>= 1.0.2)
fugit (>= 1.1)
railties (>= 6.0.0)
thor (>= 0.14.1)
google-apis-core (0.14.0)
google-apis-core (0.14.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 1.9)
httpclient (>= 2.8.1, < 3.a)
@@ -658,9 +658,9 @@ GEM
bindata
faraday (~> 2.0)
faraday-follow_redirects
json-schema (4.1.1)
json-schema (4.2.0)
addressable (>= 2.8)
json_schemer (2.2.0)
json_schemer (2.2.1)
base64
bigdecimal
hana (~> 1.3)
@@ -847,7 +847,7 @@ GEM
puma (>= 5.0, < 7)
raabro (1.4.0)
racc (1.7.3)
rack (2.2.8.1)
rack (2.2.9)
rack-accept (0.4.5)
rack (>= 0.4)
rack-attack (6.7.0)
@@ -919,7 +919,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rbtree3 (0.7.1)
rdoc (6.6.2)
rdoc (6.6.3.1)
psych (>= 4.0.0)
recaptcha (5.16.0)
redcarpet (3.6.0)
@@ -1032,7 +1032,7 @@ GEM
websocket (~> 1.0)
semantic (1.6.1)
shoulda-context (2.0.0)
shoulda-matchers (6.1.0)
shoulda-matchers (6.2.0)
activesupport (>= 5.2.0)
signet (0.19.0)
addressable (~> 2.8)
@@ -1160,7 +1160,7 @@ PLATFORMS
DEPENDENCIES
actionpack-xml_parser (~> 2.0.0)
activemodel-serializers-xml (~> 1.0.1)
activerecord-import (~> 1.5.0)
activerecord-import (~> 1.6.0)
activerecord-nulldb-adapter (~> 1.0.0)
activerecord-session_store (~> 2.1.0)
acts_as_list (~> 1.1.0)
@@ -1214,7 +1214,7 @@ DEPENDENCIES
friendly_id (~> 5.5.0)
fuubar (~> 2.5.0)
gon (~> 6.4.0)
good_job (~> 3.26.1)
good_job (= 3.26.2)
google-apis-gmail_v1
googleauth
grape (~> 2.0.0)
+2 -2
View File
@@ -30,9 +30,9 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('config/application', __dir__)
require File.expand_path("config/application", __dir__)
Rails.application.load_rake_tasks
Rake::Task[:default].clear
task default: 'test:suite:run'
task default: "test:suite:run"
+1 -1
View File
@@ -29,7 +29,7 @@
#++
class Activities::DaysComponent < ViewComponent::Base
def initialize(events:, current_project: nil, display_user: true, header_tag: 'h3', activity_page: nil)
def initialize(events:, current_project: nil, display_user: true, header_tag: "h3", activity_page: nil)
super()
@events = events
@current_project = current_project
+5 -5
View File
@@ -33,7 +33,7 @@ class AddButtonComponent < ApplicationComponent
options :current_project
def render?
raise 'Implement the conditions for which the component should render or not'
raise "Implement the conditions for which the component should render or not"
end
def dynamic_path
@@ -45,7 +45,7 @@ class AddButtonComponent < ApplicationComponent
end
def li_css_class
'toolbar-item'
"toolbar-item"
end
def title
@@ -55,7 +55,7 @@ class AddButtonComponent < ApplicationComponent
def label
content_tag(:span,
label_text,
class: 'button--text')
class: "button--text")
end
def aria_label
@@ -71,10 +71,10 @@ class AddButtonComponent < ApplicationComponent
end
def link_css_class
'button -primary'
"button -primary"
end
def icon
helpers.op_icon('button--icon icon-add')
helpers.op_icon("button--icon icon-add")
end
end
@@ -45,7 +45,7 @@ module Admin
delegate :filename, to: :attachment
def attached_to
description = attachment.description.present? ? "(#{attachment.description})" : ''
description = attachment.description.present? ? "(#{attachment.description})" : ""
text = "#{container_name} #{attachment.container_id} #{description}"
case container
when Message
@@ -83,9 +83,9 @@ module Admin
def delete_link
helpers.link_to(
helpers.op_icon('icon icon-delete'),
{ controller: '/admin/attachments/quarantined_attachments', action: :destroy, id: model },
title: I18n.t('antivirus_scan.quarantined_attachments.delete'),
helpers.op_icon("icon icon-delete"),
{ controller: "/admin/attachments/quarantined_attachments", action: :destroy, id: model },
title: I18n.t("antivirus_scan.quarantined_attachments.delete"),
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure), disable_with: I18n.t(:label_loading) }
)
@@ -44,10 +44,10 @@ module Admin
def headers
[
['filename', { caption: Attachment.human_attribute_name(:filename) }],
['attached_to', { caption: I18n.t('antivirus_scan.quarantined_attachments.container') }],
['author', { caption: Attachment.human_attribute_name(:author) }],
['created_at', { caption: Attachment.human_attribute_name(:created_at) }]
["filename", { caption: Attachment.human_attribute_name(:filename) }],
["attached_to", { caption: I18n.t("antivirus_scan.quarantined_attachments.container") }],
["author", { caption: Attachment.human_attribute_name(:author) }],
["created_at", { caption: Attachment.human_attribute_name(:created_at) }]
]
end
end
@@ -41,7 +41,7 @@ module CustomActions
delegate :description, to: :action
def sort
helpers.reorder_links('custom_action', { action: 'update', id: action }, method: :put)
helpers.reorder_links("custom_action", { action: "update", id: action }, method: :put)
end
def button_links
@@ -53,7 +53,7 @@ module CustomActions
def edit_link
link_to(
helpers.op_icon('icon icon-edit'),
helpers.op_icon("icon icon-edit"),
helpers.edit_custom_action_path(action),
title: t(:button_edit)
)
@@ -61,7 +61,7 @@ module CustomActions
def delete_link
link_to(
helpers.op_icon('icon icon-delete'),
helpers.op_icon("icon icon-delete"),
helpers.custom_action_path(action),
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure) },
@@ -36,18 +36,18 @@ module CustomActions
def headers
[
['name', { caption: CustomAction.human_attribute_name(:name) }],
['description', { caption: CustomAction.human_attribute_name(:description) }],
['sort', { caption: I18n.t(:label_sort) }]
["name", { caption: CustomAction.human_attribute_name(:name) }],
["description", { caption: CustomAction.human_attribute_name(:description) }],
["sort", { caption: I18n.t(:label_sort) }]
]
end
def inline_create_link
link_to new_custom_action_path,
aria: { label: t('custom_actions.new') },
class: 'wp-inline-create--add-link',
title: t('custom_actions.new') do
helpers.op_icon('icon icon-add')
aria: { label: t("custom_actions.new") },
class: "wp-inline-create--add-link",
title: t("custom_actions.new") do
helpers.op_icon("icon icon-add")
end
end
end
+2 -2
View File
@@ -51,7 +51,7 @@ module Enumerations
end
def sort
helpers.reorder_links('enumeration', { action: 'move', id: enumeration }, method: :post)
helpers.reorder_links("enumeration", { action: "move", id: enumeration }, method: :post)
end
def button_links
@@ -62,7 +62,7 @@ module Enumerations
def delete_link
helpers.link_to(
helpers.op_icon('icon icon-delete'),
helpers.op_icon("icon icon-delete"),
helpers.enumeration_path(enumeration),
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure) },
@@ -44,13 +44,13 @@ module Enumerations
def headers
[
['name', { caption: Enumeration.human_attribute_name(:name) }],
['is_default', { caption: Enumeration.human_attribute_name(:is_default) }],
['active', { caption: Enumeration.human_attribute_name(:active) }],
['sort', { caption: I18n.t(:label_sort) }]
["name", { caption: Enumeration.human_attribute_name(:name) }],
["is_default", { caption: Enumeration.human_attribute_name(:is_default) }],
["active", { caption: Enumeration.human_attribute_name(:active) }],
["sort", { caption: I18n.t(:label_sort) }]
].tap do |default|
if with_colors
default.insert 3, ['color', { caption: Enumeration.human_attribute_name(:color) }]
default.insert 3, ["color", { caption: Enumeration.human_attribute_name(:color) }]
end
end
end
@@ -62,10 +62,10 @@ module Enumerations
def inline_create_link
link_to new_enumeration_path(type: rows.name),
aria: { label: t(:label_enumeration_new) },
class: 'wp-inline-create--add-link',
data: { 'test-selector': "create-enumeration-#{rows.name.underscore.dasherize}" },
class: "wp-inline-create--add-link",
data: { "test-selector": "create-enumeration-#{rows.name.underscore.dasherize}" },
title: t(:label_enumeration_new) do
helpers.op_icon('icon icon-add')
helpers.op_icon("icon icon-add")
end
end
end
@@ -52,25 +52,25 @@ class IndividualPrincipalBaseFilterComponent < ApplicationComponent
def filter_name(query, name)
if name.present?
query.where(:any_name_attribute, '~', name)
query.where(:any_name_attribute, "~", name)
end
end
def filter_group(query, group_id)
if group_id.present?
query.where(:group, '=', group_id)
query.where(:group, "=", group_id)
end
end
def filter_role(query, role_id)
if role_id.present?
query.where(:role_id, '=', role_id)
query.where(:role_id, "=", role_id)
end
end
def filter_project(query, project_id)
if project_id.present?
query.where(:project_id, '=', project_id)
query.where(:project_id, "=", project_id)
end
end
@@ -33,7 +33,7 @@ module LdapAuthSources
def name
content = link_to model.name, edit_ldap_auth_source_path(model)
if model.seeded_from_env?
content += helpers.op_icon('icon icon-info2', title: I18n.t(:label_seeded_from_env_warning))
content += helpers.op_icon("icon icon-info2", title: I18n.t(:label_seeded_from_env_warning))
end
content
@@ -54,17 +54,17 @@ module LdapAuthSources
end
def test_link
link_to t(:button_test), { controller: 'ldap_auth_sources', action: 'test_connection', id: model }
link_to t(:button_test), { controller: "ldap_auth_sources", action: "test_connection", id: model }
end
def delete_link
return if users > 0
link_to I18n.t(:button_delete),
{ controller: 'ldap_auth_sources', id: model.id, action: :destroy },
{ controller: "ldap_auth_sources", id: model.id, action: :destroy },
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure) },
class: 'icon icon-delete',
class: "icon icon-delete",
title: I18n.t(:button_delete)
end
end
@@ -46,17 +46,17 @@ module LdapAuthSources
def inline_create_link
link_to(new_ldap_auth_source_path,
class: 'budget-add-row wp-inline-create--add-link',
class: "budget-add-row wp-inline-create--add-link",
title: I18n.t(:label_ldap_auth_source_new)) do
helpers.op_icon('icon icon-add')
helpers.op_icon("icon icon-add")
end
end
def headers
[
['name', { caption: LdapAuthSource.human_attribute_name('name') }],
['host', { caption: LdapAuthSource.human_attribute_name('host') }],
['users', { caption: I18n.t(:label_user_plural) }]
["name", { caption: LdapAuthSource.human_attribute_name("name") }],
["host", { caption: LdapAuthSource.human_attribute_name("host") }],
["users", { caption: I18n.t(:label_user_plural) }]
]
end
end
@@ -41,20 +41,20 @@ class Members::IndexPageHeaderComponent < ApplicationComponent
def add_button_data_attributes
attributes = {
'members-form-target': 'addMemberButton',
action: 'members-form#showAddMemberForm',
'test-selector': 'member-add-button'
"members-form-target": "addMemberButton",
action: "members-form#showAddMemberForm",
"test-selector": "member-add-button"
}
attributes['trigger-initially'] = "true" if params[:show_add_members]
attributes["trigger-initially"] = "true" if params[:show_add_members]
attributes
end
def filter_button_data_attributes
{
'members-form-target': 'filterMemberButton',
action: 'members-form#toggleMemberFilter'
"members-form-target": "filterMemberButton",
action: "members-form#toggleMemberFilter"
}
end
end
@@ -41,7 +41,7 @@ module Members
id: "#{row.roles_css_id}-form",
class: row.toggle_item_class_name,
style: "display:none",
data: { 'members-form-target': 'membershipEditForm' }
data: { "members-form-target": "membershipEditForm" }
}
end
+13 -13
View File
@@ -30,7 +30,7 @@
module Members
class UserFilterComponent < ::UserFilterComponent
ALL_SHARED_FILTER_KEY = 'all'
ALL_SHARED_FILTER_KEY = "all"
def initially_visible?
false
@@ -52,12 +52,12 @@ module Members
# Adapts the user filter counts to count members as opposed to users.
def extra_user_status_options
{
all: status_members_query('all').count,
blocked: status_members_query('blocked').count,
active: status_members_query('active').count,
invited: status_members_query('invited').count,
registered: status_members_query('registered').count,
locked: status_members_query('locked').count
all: status_members_query("all").count,
blocked: status_members_query("blocked").count,
active: status_members_query("active").count,
invited: status_members_query("invited").count,
registered: status_members_query("registered").count,
locked: status_members_query("locked").count
}
end
@@ -89,7 +89,7 @@ module Members
.order(builtin: :asc)
.map { |role| [mapped_shared_role_name(role), role.id] }
share_options.unshift([I18n.t('members.filters.all_shares'), ALL_SHARED_FILTER_KEY])
share_options.unshift([I18n.t("members.filters.all_shares"), ALL_SHARED_FILTER_KEY])
end
def builtin_share_roles
@@ -103,11 +103,11 @@ module Members
def mapped_shared_role_name(role)
case role.builtin
when Role::BUILTIN_WORK_PACKAGE_VIEWER
I18n.t('work_package.sharing.permissions.view')
I18n.t("work_package.sharing.permissions.view")
when Role::BUILTIN_WORK_PACKAGE_COMMENTER
I18n.t('work_package.sharing.permissions.comment')
I18n.t("work_package.sharing.permissions.comment")
when Role::BUILTIN_WORK_PACKAGE_EDITOR
I18n.t('work_package.sharing.permissions.edit')
I18n.t("work_package.sharing.permissions.edit")
else
role.name
end
@@ -121,9 +121,9 @@ module Members
.where(builtin: builtin_share_roles)
.pluck(:id)
query.where(:role_id, '=', ids.uniq)
query.where(:role_id, "=", ids.uniq)
elsif role_id.to_i > 0
query.where(:role_id, '=', role_id.to_i)
query.where(:role_id, "=", role_id.to_i)
end
end
@@ -47,20 +47,20 @@ module OAuth
def confidential
if application.confidential?
helpers.op_icon 'icon icon-checkmark'
helpers.op_icon "icon icon-checkmark"
end
end
def redirect_uri
urls = application.redirect_uri.split("\n")
safe_join urls, '<br/>'.html_safe
safe_join urls, "<br/>".html_safe
end
def client_credentials
if user_id = application.client_credentials_user_id
helpers.link_to_user User.find(user_id)
else
'-'
"-"
end
end
@@ -51,10 +51,10 @@ module OAuth
def inline_create_link
link_to new_oauth_application_path,
aria: { label: t('oauth.application.new') },
class: 'wp-inline-create--add-link',
title: t('oauth.application.new') do
helpers.op_icon('icon icon-add')
aria: { label: t("oauth.application.new") },
class: "wp-inline-create--add-link",
title: t("oauth.application.new") do
helpers.op_icon("icon icon-add")
end
end
@@ -64,11 +64,11 @@ module OAuth
def headers
[
['name', { caption: ::Doorkeeper::Application.human_attribute_name(:name) }],
['owner', { caption: ::Doorkeeper::Application.human_attribute_name(:owner) }],
['client_credentials', { caption: I18n.t('oauth.client_credentials') }],
['redirect_uri', { caption: ::Doorkeeper::Application.human_attribute_name(:redirect_uri) }],
['confidential', { caption: ::Doorkeeper::Application.human_attribute_name(:confidential) }]
["name", { caption: ::Doorkeeper::Application.human_attribute_name(:name) }],
["owner", { caption: ::Doorkeeper::Application.human_attribute_name(:owner) }],
["client_credentials", { caption: I18n.t("oauth.client_credentials") }],
["redirect_uri", { caption: ::Doorkeeper::Application.human_attribute_name(:redirect_uri) }],
["confidential", { caption: ::Doorkeeper::Application.human_attribute_name(:confidential) }]
]
end
end
@@ -32,7 +32,7 @@ module OpenProject
VALID_TYPES = %i[seconds minutes hours days weeks months years].freeze
attr_reader :duration, :abbreviated, :separator
def initialize(duration, type = :seconds, separator: ', ', abbreviated: false, **args)
def initialize(duration, type = :seconds, separator: ", ", abbreviated: false, **args)
super
@duration = parse_duration(duration, type)
@@ -40,7 +40,7 @@ module PlaceholderUsers
# Filter for active placeholders
# to skip to-be-deleted users
query.where(:status, '=', :active)
query.where(:status, "=", :active)
end
end
@@ -47,10 +47,10 @@ module PlaceholderUsers
def delete_link
if helpers.can_delete_placeholder_user?(placeholder_user, User.current)
link_to deletion_info_placeholder_user_path(placeholder_user) do
helpers.tooltip_tag I18n.t('placeholder_users.delete_tooltip'), icon: 'icon-delete'
helpers.tooltip_tag I18n.t("placeholder_users.delete_tooltip"), icon: "icon-delete"
end
else
helpers.tooltip_tag I18n.t('placeholder_users.right_to_manage_members_missing'), icon: 'icon-help2'
helpers.tooltip_tag I18n.t("placeholder_users.right_to_manage_members_missing"), icon: "icon-help2"
end
end
@@ -43,7 +43,7 @@ module PlaceholderUsers
def header_options(name)
options = { caption: PlaceholderUser.human_attribute_name(name) }
options[:default_order] = 'desc' if desc_by_default.include? name
options[:default_order] = "desc" if desc_by_default.include? name
options
end
@@ -29,9 +29,9 @@
# ++
class Projects::ConfigureViewModalComponent < ApplicationComponent
MODAL_ID = 'op-project-list-configure-dialog'
COLUMN_FORM_ID = 'op-project-list-configure-columns-form'
COLUMN_HTML_NAME = 'columns'
MODAL_ID = "op-project-list-configure-dialog"
COLUMN_FORM_ID = "op-project-list-configure-columns-form"
COLUMN_HTML_NAME = "columns"
options :query
@@ -29,7 +29,7 @@
# ++
class Projects::DeleteListModalComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
MODAL_ID = 'op-project-list-delete-dialog'
MODAL_ID = "op-project-list-delete-dialog"
options :query
end
@@ -29,7 +29,7 @@
# ++
class Projects::ExportListModalComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
MODAL_ID = 'op-project-list-export-dialog'
MODAL_ID = "op-project-list-export-dialog"
options :query
end
+27 -27
View File
@@ -39,7 +39,7 @@ module Projects
# Hierarchy cell is just a placeholder
def hierarchy
''
""
end
def column_value(column)
@@ -56,10 +56,10 @@ module Projects
cf = column.custom_field
custom_value = project.formatted_custom_value_for(cf)
if cf.field_format == 'text' && custom_value.present?
if cf.field_format == "text" && custom_value.present?
render OpenProject::Common::AttributeComponent.new("dialog-#{project.id}-cf-#{cf.id}", cf.name, custom_value.html_safe) # rubocop:disable Rails/OutputSafety
elsif custom_value.is_a?(Array)
safe_join(Array(custom_value).compact_blank, ', ')
safe_join(Array(custom_value).compact_blank, ", ")
else
custom_value
end
@@ -74,20 +74,20 @@ module Projects
end
def required_disk_space
return '' unless project.required_disk_space.to_i > 0
return "" unless project.required_disk_space.to_i > 0
number_to_human_size(project.required_disk_space, precision: 2)
end
def name
content = content_tag(:i, '', class: "projects-table--hierarchy-icon")
content = content_tag(:i, "", class: "projects-table--hierarchy-icon")
if project.archived?
content << ' '
content << content_tag(:span, I18n.t('project.archive.archived'), class: 'archived-label')
content << " "
content << content_tag(:span, I18n.t("project.archive.archived"), class: "archived-label")
end
content << ' '
content << " "
content << helpers.link_to_project(project, {}, {}, false)
content
end
@@ -95,13 +95,13 @@ module Projects
def project_status
return nil unless user_can_view_project?
content = ''.html_safe
content = "".html_safe
status_code = project.status_code
if status_code
classes = helpers.project_status_css_class(status_code)
content << content_tag(:span, '', class: "project-status--bulb -inline #{classes}")
content << content_tag(:span, "", class: "project-status--bulb -inline #{classes}")
content << content_tag(:span, helpers.project_status_name(status_code), class: "project-status--name #{classes}")
end
@@ -113,7 +113,7 @@ module Projects
if project.status_explanation.present? && project.status_explanation
render OpenProject::Common::AttributeComponent.new("dialog-#{project.id}-status-explanation",
I18n.t('activerecord.attributes.project.status_explanation'),
I18n.t("activerecord.attributes.project.status_explanation"),
project.status_explanation)
end
end
@@ -123,7 +123,7 @@ module Projects
if project.description.present?
render OpenProject::Common::AttributeComponent.new("dialog-#{project.id}-description",
I18n.t('activerecord.attributes.project.description'),
I18n.t("activerecord.attributes.project.description"),
project.description)
end
end
@@ -149,11 +149,11 @@ module Projects
end
def project_css_classes
s = ' project '.html_safe
s = " project ".html_safe
s << ' root' if project.root?
s << ' child' if project.child?
s << (project.leaf? ? ' leaf' : ' parent')
s << " root" if project.root?
s << " child" if project.child?
s << (project.leaf? ? " leaf" : " parent")
s
end
@@ -169,7 +169,7 @@ module Projects
"project-long-text-container"
elsif custom_field_column?(column)
cf = column.custom_field
formattable = cf.field_format == 'text' ? ' project-long-text-container' : ''
formattable = cf.field_format == "text" ? " project-long-text-container" : ""
"format-#{cf.field_format}#{formattable}"
end
end
@@ -188,17 +188,17 @@ module Projects
if User.current.allowed_in_project?(:add_subprojects, project)
[t(:label_subproject_new),
new_project_path(parent_id: project.id),
{ class: 'icon-context icon-add',
{ class: "icon-context icon-add",
title: t(:label_subproject_new) }]
end
end
def more_menu_settings_item
if User.current.allowed_in_project?({ controller: '/projects/settings/general', action: 'show', project_id: project.id },
if User.current.allowed_in_project?({ controller: "/projects/settings/general", action: "show", project_id: project.id },
project)
[t(:label_project_settings),
project_settings_general_path(project),
{ class: 'icon-context icon-settings',
{ class: "icon-context icon-settings",
title: t(:label_project_settings) }]
end
end
@@ -207,8 +207,8 @@ module Projects
if User.current.allowed_in_project?(:view_project_activity, project)
[
t(:label_project_activity),
project_activity_index_path(project, event_types: ['project_attributes']),
{ class: 'icon-context icon-checkmark',
project_activity_index_path(project, event_types: ["project_attributes"]),
{ class: "icon-context icon-checkmark",
title: t(:label_project_activity) }
]
end
@@ -218,9 +218,9 @@ module Projects
if User.current.allowed_in_project?(:archive_project, project) && project.active?
[t(:button_archive),
project_archive_path(project, status: params[:status]),
{ data: { confirm: t('project.archive.are_you_sure', name: project.name) },
{ data: { confirm: t("project.archive.are_you_sure", name: project.name) },
method: :post,
class: 'icon-context icon-locked',
class: "icon-context icon-locked",
title: t(:button_archive) }]
end
end
@@ -230,7 +230,7 @@ module Projects
[t(:button_unarchive),
project_archive_path(project, status: params[:status]),
{ method: :delete,
class: 'icon-context icon-unlocked',
class: "icon-context icon-unlocked",
title: t(:button_unarchive) }]
end
end
@@ -239,7 +239,7 @@ module Projects
if User.current.allowed_in_project?(:copy_projects, project) && !project.archived?
[t(:button_copy),
copy_project_path(project),
{ class: 'icon-context icon-copy',
{ class: "icon-context icon-copy",
title: t(:button_copy) }]
end
end
@@ -248,7 +248,7 @@ module Projects
if User.current.admin
[t(:button_delete),
confirm_destroy_project_path(project),
{ class: 'icon-context icon-delete',
{ class: "icon-context icon-delete",
title: t(:button_delete) }]
end
end
+6 -6
View File
@@ -48,7 +48,7 @@ module Projects
end
def table_id
'project-table'
"project-table"
end
##
@@ -80,13 +80,13 @@ module Projects
def deactivate_class_on_lft_sort
if sorted_by_lft?
'spot-link_inactive'
"spot-link_inactive"
end
end
def href_only_when_not_sort_lft
unless sorted_by_lft?
projects_path(sortBy: JSON::dump([['lft', 'asc']]))
projects_path(sortBy: JSON::dump([["lft", "asc"]]))
end
end
@@ -96,9 +96,9 @@ module Projects
data:
{
controller: "params-from-query",
'application-target': "dynamic",
'params-from-query-allowed-value': '["query_id"]',
'params-from-query-all-anchors-value': "true"
"application-target": "dynamic",
"params-from-query-allowed-value": '["query_id"]',
"params-from-query-all-anchors-value": "true"
}
}
end
+1 -1
View File
@@ -70,7 +70,7 @@ class RowComponent < ApplicationComponent
def checkmark(condition)
if condition
helpers.op_icon 'icon icon-checkmark'
helpers.op_icon "icon icon-checkmark"
end
end
end
@@ -79,7 +79,7 @@ module Settings
private
def time_zone_option(canonical_zone, zones)
zone_names = zones.map(&:name).join(', ')
zone_names = zones.map(&:name).join(", ")
[
"(UTC#{ActiveSupport::TimeZone.seconds_to_utc_offset(canonical_zone.base_utc_offset)}) #{zone_names}",
canonical_zone.identifier
+3 -3
View File
@@ -59,8 +59,8 @@ module Statuses
end
def sort
helpers.reorder_links 'status',
{ action: 'update', id: status },
helpers.reorder_links "status",
{ action: "update", id: status },
method: :patch
end
@@ -72,7 +72,7 @@ module Statuses
def delete_link
link_to(
helpers.op_icon('icon icon-delete'),
helpers.op_icon("icon icon-delete"),
status_path(status),
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure) },
+2 -2
View File
@@ -45,9 +45,9 @@ module Statuses
def inline_create_link
link_to new_status_path,
aria: { label: t(:label_work_package_status_new) },
class: 'wp-inline-create--add-link',
class: "wp-inline-create--add-link",
title: t(:label_work_package_status_new) do
helpers.op_icon('icon icon-add')
helpers.op_icon("icon icon-add")
end
end
+1 -1
View File
@@ -174,7 +174,7 @@ class TableComponent < ApplicationComponent
end
def initial_order
initial_sort_correlation.join(' ')
initial_sort_correlation.join(" ")
end
def paginated?
+8 -8
View File
@@ -35,20 +35,20 @@ class UserFilterComponent < IndividualPrincipalBaseFilterComponent
# or the default status to be filtered by (all)
# if no status is given.
def status_param(params)
params[:status].presence || 'all'
params[:status].presence || "all"
end
def filter_status(query, status)
return unless status && status != 'all'
return unless status && status != "all"
case status
when 'blocked'
query.where(:blocked, '=', :blocked)
when 'active'
query.where(:status, '=', status.to_sym)
query.where(:blocked, '!', :blocked)
when "blocked"
query.where(:blocked, "=", :blocked)
when "active"
query.where(:status, "=", status.to_sym)
query.where(:blocked, "!", :blocked)
else
query.where(:status, '=', status.to_sym)
query.where(:status, "=", status.to_sym)
end
end
@@ -45,22 +45,22 @@ module Users
def is_current # rubocop:disable Naming/PredicateName
if current?
helpers.op_icon 'icon-yes'
helpers.op_icon "icon-yes"
end
end
def device
token_data[:platform] || I18n.t('users.sessions.unknown_os')
token_data[:platform] || I18n.t("users.sessions.unknown_os")
end
def browser
name = token_data[:browser] || 'unknown browser'
name = token_data[:browser] || "unknown browser"
version = token_data[:browser_version]
"#{name} #{version ? "(Version #{version})" : ''}"
end
def platform
token_data[:platform] || 'unknown platform'
token_data[:platform] || "unknown platform"
end
def expires_on
@@ -76,9 +76,9 @@ module Users
return if current?
link_to(
helpers.op_icon('icon icon-delete'),
{ controller: '/my/auto_login_tokens', action: 'destroy', id: token.id },
class: 'button--link',
helpers.op_icon("icon icon-delete"),
{ controller: "/my/auto_login_tokens", action: "destroy", id: token.id },
class: "button--link",
role: :button,
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure), disable_with: I18n.t(:label_loading) },
@@ -41,10 +41,10 @@ module Users
def headers
[
[:is_current, { caption: I18n.t('users.sessions.current') }],
[:browser, { caption: I18n.t('users.sessions.browser') }],
[:device, { caption: I18n.t('users.sessions.device') }],
[:expires_on, { caption: I18n.t('attributes.expires_at') }]
[:is_current, { caption: I18n.t("users.sessions.current") }],
[:browser, { caption: I18n.t("users.sessions.browser") }],
[:device, { caption: I18n.t("users.sessions.device") }],
[:expires_on, { caption: I18n.t("attributes.expires_at") }]
]
end
end
+1 -1
View File
@@ -32,7 +32,7 @@ module Users
include AvatarHelper
include OpPrimer::ComponentHelpers
def initialize(user:, show_name: true, link: true, size: 'default', classes: '', title: nil, name_classes: '')
def initialize(user:, show_name: true, link: true, size: "default", classes: "", title: nil, name_classes: "")
super
@user = user
@@ -48,27 +48,27 @@ module Users
def is_current # rubocop:disable Naming/PredicateName
if current?
helpers.op_icon 'icon-yes'
helpers.op_icon "icon-yes"
end
end
def device
session_data[:platform] || I18n.t('users.sessions.unknown_os')
session_data[:platform] || I18n.t("users.sessions.unknown_os")
end
def browser
name = session_data[:browser] || 'unknown browser'
name = session_data[:browser] || "unknown browser"
version = session_data[:browser_version]
"#{name} #{version ? "(Version #{version})" : ''}"
end
def platform
session_data[:platform] || 'unknown platform'
session_data[:platform] || "unknown platform"
end
def updated_at
if current?
I18n.t('users.sessions.current')
I18n.t("users.sessions.current")
else
helpers.format_time session.updated_at
end
@@ -82,9 +82,9 @@ module Users
return if current?
link_to(
helpers.op_icon('icon icon-delete'),
{ controller: '/my/sessions', action: 'destroy', id: session },
class: 'button--link',
helpers.op_icon("icon icon-delete"),
{ controller: "/my/sessions", action: "destroy", id: session },
class: "button--link",
role: :button,
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure), disable_with: I18n.t(:label_loading) },
@@ -41,10 +41,10 @@ module Users
def headers
[
[:is_current, { caption: I18n.t('users.sessions.current') }],
[:browser, { caption: I18n.t('users.sessions.browser') }],
[:device, { caption: I18n.t('users.sessions.device') }],
[:updated_at, { caption: I18n.t('attributes.updated_at') }]
[:is_current, { caption: I18n.t("users.sessions.current") }],
[:browser, { caption: I18n.t("users.sessions.browser") }],
[:device, { caption: I18n.t("users.sessions.device") }],
[:updated_at, { caption: I18n.t("attributes.updated_at") }]
]
end
end
+1 -1
View File
@@ -46,7 +46,7 @@ module Users
def header_options(name)
options = { caption: User.human_attribute_name(name) }
options[:default_order] = 'desc' if desc_by_default.include? name
options[:default_order] = "desc" if desc_by_default.include? name
options
end
+9 -9
View File
@@ -75,11 +75,11 @@ module Versions
end
def wiki_page
return '' if wiki_page_title.blank? || version.project.wiki.nil?
return "" if wiki_page_title.blank? || version.project.wiki.nil?
helpers.link_to_if_authorized(wiki_page_title,
controller: '/wiki',
action: 'show',
controller: "/wiki",
action: "show",
project_id: version.project,
id: wiki_page_title) || h(wiki_page_title)
end
@@ -97,20 +97,20 @@ module Versions
def edit_link
return unless version.project == table.project
helpers.link_to_if_authorized '',
{ controller: '/versions', action: 'edit', id: version },
class: 'icon icon-edit',
helpers.link_to_if_authorized "",
{ controller: "/versions", action: "edit", id: version },
class: "icon icon-edit",
title: t(:button_edit)
end
def delete_link
return unless version.project == table.project
helpers.link_to_if_authorized '',
{ controller: '/versions', action: 'destroy', id: version },
helpers.link_to_if_authorized "",
{ controller: "/versions", action: "destroy", id: version },
data: { confirm: t(:text_are_you_sure) },
method: :delete,
class: 'icon icon-delete',
class: "icon icon-delete",
title: t(:button_delete)
end
+1 -1
View File
@@ -49,7 +49,7 @@ module Versions
end
def wiki_page_header_options
['wiki_page_title', { caption: WikiPage.model_name.human }]
["wiki_page_title", { caption: WikiPage.model_name.human }]
end
end
end
@@ -34,15 +34,15 @@ module WorkPackages
module DisplayableRoles
def options
[
{ label: I18n.t('work_package.sharing.permissions.edit'),
{ label: I18n.t("work_package.sharing.permissions.edit"),
value: Role::BUILTIN_WORK_PACKAGE_EDITOR,
description: I18n.t('work_package.sharing.permissions.edit_description') },
{ label: I18n.t('work_package.sharing.permissions.comment'),
description: I18n.t("work_package.sharing.permissions.edit_description") },
{ label: I18n.t("work_package.sharing.permissions.comment"),
value: Role::BUILTIN_WORK_PACKAGE_COMMENTER,
description: I18n.t('work_package.sharing.permissions.comment_description') },
{ label: I18n.t('work_package.sharing.permissions.view'),
description: I18n.t("work_package.sharing.permissions.comment_description") },
{ label: I18n.t("work_package.sharing.permissions.view"),
value: Role::BUILTIN_WORK_PACKAGE_VIEWER,
description: I18n.t('work_package.sharing.permissions.view_description') }
description: I18n.t("work_package.sharing.permissions.view_description") }
]
end
end
@@ -55,39 +55,39 @@ module WorkPackages
end
def insert_target_modifier_id
'op-share-wp-active-shares'
"op-share-wp-active-shares"
end
def blankslate_config
@blankslate_config ||= {}.tap do |config|
if params[:filters].blank?
config[:icon] = :people
config[:heading_text] = I18n.t('work_package.sharing.text_empty_state_header')
config[:description_text] = I18n.t('work_package.sharing.text_empty_state_description')
config[:heading_text] = I18n.t("work_package.sharing.text_empty_state_header")
config[:description_text] = I18n.t("work_package.sharing.text_empty_state_description")
else
config[:icon] = :search
config[:heading_text] = I18n.t('work_package.sharing.text_empty_search_header')
config[:description_text] = I18n.t('work_package.sharing.text_empty_search_description')
config[:heading_text] = I18n.t("work_package.sharing.text_empty_search_header")
config[:description_text] = I18n.t("work_package.sharing.text_empty_search_description")
end
end
end
def type_filter_options
[
{ label: I18n.t('work_package.sharing.filter.project_member'),
value: { principal_type: 'User', project_member: true } },
{ label: I18n.t('work_package.sharing.filter.not_project_member'),
value: { principal_type: 'User', project_member: false } },
{ label: I18n.t('work_package.sharing.filter.project_group'),
value: { principal_type: 'Group', project_member: true } },
{ label: I18n.t('work_package.sharing.filter.not_project_group'),
value: { principal_type: 'Group', project_member: false } }
{ label: I18n.t("work_package.sharing.filter.project_member"),
value: { principal_type: "User", project_member: true } },
{ label: I18n.t("work_package.sharing.filter.not_project_member"),
value: { principal_type: "User", project_member: false } },
{ label: I18n.t("work_package.sharing.filter.project_group"),
value: { principal_type: "Group", project_member: true } },
{ label: I18n.t("work_package.sharing.filter.not_project_group"),
value: { principal_type: "Group", project_member: false } }
]
end
def type_filter_option_active?(_option)
principal_type_filter_value = current_filter_value(params[:filters], 'principal_type')
project_member_filter_value = current_filter_value(params[:filters], 'also_project_member')
principal_type_filter_value = current_filter_value(params[:filters], "principal_type")
project_member_filter_value = current_filter_value(params[:filters], "also_project_member")
return false if principal_type_filter_value.nil? || project_member_filter_value.nil?
@@ -100,7 +100,7 @@ module WorkPackages
end
def role_filter_option_active?(_option)
role_filter_value = current_filter_value(params[:filters], 'role_id')
role_filter_value = current_filter_value(params[:filters], "role_id")
return false if role_filter_value.nil?
@@ -122,7 +122,7 @@ module WorkPackages
end
def apply_role_filter(_option)
current_role_filter_value = current_filter_value(params[:filters], 'role_id')
current_role_filter_value = current_filter_value(params[:filters], "role_id")
filter = []
if _option.nil? && current_role_filter_value.present?
@@ -141,8 +141,8 @@ module WorkPackages
end
def apply_type_filter(_option)
current_type_filter_value = current_filter_value(params[:filters], 'principal_type')
current_member_filter_value = current_filter_value(params[:filters], 'also_project_member')
current_type_filter_value = current_filter_value(params[:filters], "principal_type")
current_member_filter_value = current_filter_value(params[:filters], "also_project_member")
filter = []
if _option.nil? && current_type_filter_value.present? && current_member_filter_value.present?
@@ -173,7 +173,7 @@ module WorkPackages
return nil if filters.nil?
given_filters = JSON.parse(filters).find { |key| key.key?(filter_key) }
given_filters ? given_filters[filter_key]['values'].first : nil
given_filters ? given_filters[filter_key]["values"].first : nil
end
end
end
@@ -54,7 +54,7 @@ module WorkPackages
end
def wrapper_uniq_by
share.id || @system_arguments.dig(:data, :'test-selector')
share.id || @system_arguments.dig(:data, :"test-selector")
end
private
@@ -77,8 +77,8 @@ module WorkPackages
def form_inputs(role_id)
[].tap do |inputs|
inputs << { name: 'role_ids[]', value: role_id }
inputs << { name: 'filters', value: params[:filters] } if params[:filters]
inputs << { name: "role_ids[]", value: role_id }
inputs << { name: "filters", value: params[:filters] } if params[:filters]
end
end
end
@@ -60,9 +60,9 @@ module WorkPackages
def grid_css_classes
if sharing_manageable?
'op-share-wp-modal-body--user-row_manageable'
"op-share-wp-modal-body--user-row_manageable"
else
'op-share-wp-modal-body--user-row'
"op-share-wp-modal-body--user-row"
end
end
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'model_contract'
require "model_contract"
module Attachments
module ValidateReplacements
@@ -49,9 +49,9 @@ module Authentication
end
def validate_auth_hash_not_expired
return unless auth_hash['timestamp']
return unless auth_hash["timestamp"]
if auth_hash['timestamp'] < Time.now - 30.minutes
if auth_hash["timestamp"] < Time.now - 30.minutes
errors.add(:base, I18n.t(:error_omniauth_registration_timed_out))
end
end
@@ -32,9 +32,9 @@ module AssignableCustomFieldValues
included do
def assignable_custom_field_values(custom_field)
case custom_field.field_format
when 'list'
when "list"
custom_field.possible_values
when 'version'
when "version"
assignable_versions(only_open: !custom_field.allow_non_open_versions?)
end
end
+1 -1
View File
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'model_contract'
require "model_contract"
# Contract for create (c) and update (u)
module CustomActions
+1 -1
View File
@@ -36,7 +36,7 @@ module Groups
def type_is_group
unless model.type == Group.name
errors.add(:type, 'Type and class mismatch')
errors.add(:type, "Type and class mismatch")
end
end
end
+1 -1
View File
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require_relative 'base_contract'
require_relative "base_contract"
##
# Model contract for AR records that
@@ -39,7 +39,7 @@ module PlaceholderUsers
def type_is_placeholder_user
unless model.type == PlaceholderUser.name
errors.add(:type, 'Type and class mismatch')
errors.add(:type, "Type and class mismatch")
end
end
end
+1 -1
View File
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'queries/base_contract'
require "queries/base_contract"
module Queries
class CopyContract < BaseContract
@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'queries/create_contract'
require "queries/create_contract"
module Queries
class GlobalCreateContract < CreateContract
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'queries/base_contract'
require "queries/base_contract"
module Queries
class ICalSharingContract < BaseContract
+1 -1
View File
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'queries/base_contract'
require "queries/base_contract"
module Queries
class UpdateContract < BaseContract
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'queries/base_contract'
require "queries/base_contract"
module Queries
class UpdateFormContract < BaseContract
+1 -1
View File
@@ -57,7 +57,7 @@ module Relations
def validate_nodes_relatable
if (model.from_id_changed? || model.to_id_changed?) &&
WorkPackage.relatable(model.from, model.relation_type, ignored_relation: model).where(id: model.to_id).empty?
errors.add :base, I18n.t(:'activerecord.errors.messages.circular_dependency')
errors.add :base, I18n.t(:"activerecord.errors.messages.circular_dependency")
end
end
+1 -1
View File
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'relations/base_contract'
require "relations/base_contract"
module Relations
class CreateContract < BaseContract
+2 -2
View File
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'model_contract'
require "model_contract"
module Types
class BaseContract < ::ModelContract
@@ -93,7 +93,7 @@ module Types
if key.is_a?(String) && valid_attributes.exclude?(key)
errors.add(
:attribute_groups,
I18n.t('activerecord.errors.models.type.attributes.attribute_groups.attribute_unknown_name',
I18n.t("activerecord.errors.models.type.attributes.attribute_groups.attribute_unknown_name",
attribute: key)
)
end
@@ -81,7 +81,7 @@ module UserPreferences
if time_zones.length == 1
time_zones.first
else
time_zones.detect { |tz| tz.tzinfo.name.include?(tz.name.tr(' ', '_')) }
time_zones.detect { |tz| tz.tzinfo.name.include?(tz.name.tr(" ", "_")) }
end
end
end
@@ -109,7 +109,7 @@ module UserPreferences
end
def full_hour_reminder_time
unless model.daily_reminders[:times].all? { |time| time.end_with?('00:00+00:00') }
unless model.daily_reminders[:times].all? { |time| time.end_with?("00:00+00:00") }
errors.add :daily_reminders, :full_hour
end
end
+1 -1
View File
@@ -64,7 +64,7 @@ module Users
def reduce_writable_attributes(attributes)
super.tap do |writable|
writable << 'password' if password_writable?
writable << "password" if password_writable?
end
end
+1 -1
View File
@@ -76,7 +76,7 @@ module Users
def type_is_user
unless model.type == User.name
errors.add(:type, 'Type and class mismatch')
errors.add(:type, "Type and class mismatch")
end
end
end
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'work_packages/create_contract'
require "work_packages/create_contract"
# Can be used to copy all of a project's work packages. As the
# work packages can be old, some of the validations that would
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'work_packages/base_contract'
require "work_packages/base_contract"
module WorkPackages
class CreateContract < BaseContract
@@ -64,7 +64,7 @@ module WorkPackages
def attributes_changed_by_user
# lock version is initialized by AR itself
super - ['lock_version']
super - ["lock_version"]
end
end
end
+15 -15
View File
@@ -42,7 +42,7 @@ class AccountController < ApplicationController
before_action :check_auth_source_sso_failure, only: :auth_source_sso_failed
before_action :check_internal_login_enabled, only: :internal_login
layout 'no_menu'
layout "no_menu"
# Login request and validation
def login
@@ -58,7 +58,7 @@ class AccountController < ApplicationController
end
def internal_login
render 'account/login'
render "account/login"
end
# Log out current user and redirect to welcome page
@@ -88,12 +88,12 @@ class AccountController < ApplicationController
if call.success?
@token.destroy
redirect_to action: 'login'
redirect_to action: "login"
return
end
end
render template: 'account/password_recovery'
render template: "account/password_recovery"
elsif request.post?
mail = params[:mail]
user = User.find_by_mail(mail) if mail.present?
@@ -120,7 +120,7 @@ class AccountController < ApplicationController
if token.save
UserMailer.password_lost(token).deliver_later
flash[:notice] = I18n.t(:notice_account_lost_email_sent)
redirect_to action: 'login', back_url: home_url
redirect_to action: "login", back_url: home_url
nil
end
end
@@ -235,7 +235,7 @@ class AccountController < ApplicationController
if omniauth_direct_login?
direct_login user
elsif OpenProject::Configuration.disable_password_login?
flash[:notice] = I18n.t('account.omniauth_login')
flash[:notice] = I18n.t("account.omniauth_login")
redirect_to signin_path
else
@@ -249,7 +249,7 @@ class AccountController < ApplicationController
ldap_auth_source_id: user.ldap_auth_source_id
}
flash[:notice] = I18n.t('account.auth_source_login', login: user.login).html_safe
flash[:notice] = I18n.t("account.auth_source_login", login: user.login).html_safe
redirect_to signin_path(username: user.login)
end
@@ -283,7 +283,7 @@ class AccountController < ApplicationController
flash.now[:error] = I18n.t(:error_auth_source_sso_failed, value: failure[:login]) +
": " + String(flash.now[:error])
render action: 'login', back_url: failure[:back_url]
render action: "login", back_url: failure[:back_url]
end
private
@@ -470,11 +470,11 @@ class AccountController < ApplicationController
def onthefly_creation_failed(user, auth_source_options = {})
@user = user
session[:auth_source_registration] = auth_source_options unless auth_source_options.empty?
render action: 'register'
render action: "register"
end
def self_registration_disabled
flash[:error] = I18n.t('account.error_self_registration_disabled')
flash[:error] = I18n.t("account.error_self_registration_disabled")
redirect_to signin_url
end
@@ -489,18 +489,18 @@ class AccountController < ApplicationController
# Log an attempt to log in to an account in "registered" state and show a flash message.
def account_not_activated(flash_now: true)
flash_error_message(log_reason: 'NOT ACTIVATED', flash_now:) do
flash_error_message(log_reason: "NOT ACTIVATED", flash_now:) do
if Setting::SelfRegistration.by_email?
'account.error_inactive_activation_by_mail'
"account.error_inactive_activation_by_mail"
else
'account.error_inactive_manual_activation'
"account.error_inactive_manual_activation"
end
end
end
def invited_account_not_activated(_user)
flash_error_message(log_reason: 'invited, NOT ACTIVATED', flash_now: false) do
'account.error_inactive_activation_by_mail'
flash_error_message(log_reason: "invited, NOT ACTIVATED", flash_now: false) do
"account.error_inactive_activation_by_mail"
end
end
+3 -3
View File
@@ -75,7 +75,7 @@ class ActivitiesController < ApplicationController
end
def verify_activities_module_activated
render_403 if @project && !@project.module_enabled?('activity')
render_403 if @project && !@project.module_enabled?("activity")
end
def determine_date_range
@@ -101,7 +101,7 @@ class ActivitiesController < ApplicationController
elsif params[:with_subprojects].nil?
session[:activity][:with_subprojects]
else
params[:with_subprojects] == '1'
params[:with_subprojects] == "1"
end
end
@@ -136,7 +136,7 @@ class ActivitiesController < ApplicationController
end
def set_current_activity_page
@activity_page = @project ? "projects/#{@project.identifier}" : 'all'
@activity_page = @project ? "projects/#{@project.identifier}" : "all"
end
def set_session
@@ -29,7 +29,7 @@
module Admin
module Attachments
class QuarantinedAttachmentsController < ApplicationController
layout 'admin'
layout "admin"
before_action :require_admin
before_action :find_quarantined_attachments
@@ -45,14 +45,14 @@ module Admin
create_journal(container,
User.system,
I18n.t('antivirus_scan.deleted_by_admin', filename: @attachment.filename))
I18n.t("antivirus_scan.deleted_by_admin", filename: @attachment.filename))
flash[:notice] = t(:notice_successful_delete)
redirect_to action: :index
end
def default_breadcrumb
t('antivirus_scan.quarantined_attachments.title')
t("antivirus_scan.quarantined_attachments.title")
end
def show_local_breadcrumb
@@ -37,7 +37,7 @@ module Admin::Settings
end
def default_breadcrumb
t(:'menus.admin.aggregation')
t(:"menus.admin.aggregation")
end
def show_local_breadcrumb
@@ -31,7 +31,7 @@ module Admin::Settings
menu_item :attachments_settings
def default_breadcrumb
t(:'attributes.attachments')
t(:"attributes.attachments")
end
def settings_params
@@ -48,7 +48,7 @@ module Admin::Settings
if start_of_week.present? ^ start_of_year.present?
flash[:error] = I18n.t(
'settings.date_format.first_date_of_week_and_year_set',
"settings.date_format.first_date_of_week_and_year_set",
first_week_setting_name: I18n.t(:setting_first_week_of_year),
day_of_week_setting_name: I18n.t(:setting_start_of_week)
)
@@ -39,7 +39,7 @@ module Admin::Settings
end
def default_breadcrumb
t(:'menus.admin.mail_notification')
t(:"menus.admin.mail_notification")
end
def show_local_breadcrumb
@@ -47,7 +47,7 @@ module Admin::Settings
def settings_params
super.tap do |settings|
if settings["consent_required"] == '1' && params['toggle_consent_time'] == '1'
if settings["consent_required"] == "1" && params["toggle_consent_time"] == "1"
settings["consent_time"] = Time.zone.now.iso8601
end
end
@@ -34,7 +34,7 @@ module Admin::Settings
before_action :check_clamav, only: %i[update], if: -> { scan_enabled? }
def default_breadcrumb
t('settings.antivirus.title')
t("settings.antivirus.title")
end
def av_form
@@ -52,7 +52,7 @@ module Admin::Settings
private
def require_ee
render('upsale') unless EnterpriseToken.allows_to?(:virus_scanning)
render("upsale") unless EnterpriseToken.allows_to?(:virus_scanning)
end
def mark_unscanned_attachments
@@ -60,7 +60,7 @@ module Admin::Settings
end
def check_clamav
return if params.dig(:settings, :antivirus_scan_mode) == 'disabled'
return if params.dig(:settings, :antivirus_scan_mode) == "disabled"
service = ::Attachments::ClamAVService.new(params[:settings][:antivirus_scan_mode].to_sym,
params[:settings][:antivirus_scan_target])
@@ -68,12 +68,12 @@ module Admin::Settings
service.ping
rescue StandardError => e
Rails.logger.error { "Failed to check availability of ClamAV: #{e.message}" }
flash[:error] = t(:'settings.antivirus.clamav_ping_failed')
flash[:error] = t(:"settings.antivirus.clamav_ping_failed")
redirect_to action: :show
end
def scan_enabled?
Setting.antivirus_scan_mode != :disabled || params.dig(:settings, :antivirus_scan_mode) != 'disabled'
Setting.antivirus_scan_mode != :disabled || params.dig(:settings, :antivirus_scan_mode) != "disabled"
end
def success_callback(_call)
@@ -87,7 +87,7 @@ module Admin::Settings
end
def rescan_files
flash[:notice] = t('settings.antivirus.remaining_rescanned_files',
flash[:notice] = t("settings.antivirus.remaining_rescanned_files",
file_count: t(:label_x_files, count: Attachment.status_uploaded.count))
Attachment.status_uploaded.update_all(status: :rescan)
@@ -96,8 +96,8 @@ module Admin::Settings
end
def remaining_quarantine_warning
flash[:info] = t('settings.antivirus.remaining_quarantined_files_html',
link: helpers.link_to(t('antivirus_scan.quarantined_attachments.title'),
flash[:info] = t("settings.antivirus.remaining_quarantined_files_html",
link: helpers.link_to(t("antivirus_scan.quarantined_attachments.title"),
admin_quarantined_attachments_path),
file_count: t(:label_x_files, count: Attachment.status_quarantined.count))
redirect_to action: :show
@@ -37,7 +37,7 @@ module Admin::Settings
def failure_callback(call)
@modified_non_working_days = modified_non_working_days_for(call.result)
flash[:error] = call.message || I18n.t(:notice_internal_server_error)
render action: 'show'
render action: "show"
end
protected
+3 -3
View File
@@ -28,7 +28,7 @@
module Admin
class SettingsController < ApplicationController
layout 'admin'
layout "admin"
before_action :require_admin
before_action :find_plugin, only: %i[show_plugin update_plugin]
@@ -99,12 +99,12 @@ module Admin
def success_callback(_call)
flash[:notice] = t(:notice_successful_update)
redirect_to action: 'show', tab: params[:tab]
redirect_to action: "show", tab: params[:tab]
end
def failure_callback(call)
flash[:error] = call.message || I18n.t(:notice_internal_server_error)
redirect_to action: 'show', tab: params[:tab]
redirect_to action: "show", tab: params[:tab]
end
end
end
+13 -13
View File
@@ -25,10 +25,10 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
require 'open3'
require "open3"
class AdminController < ApplicationController
layout 'admin'
layout "admin"
before_action :require_admin, except: %i[index]
before_action :authorize_global, only: %i[index]
@@ -53,7 +53,7 @@ class AdminController < ApplicationController
end
def projects
redirect_to controller: 'projects', action: 'index'
redirect_to controller: "projects", action: "index"
end
def plugins
@@ -91,9 +91,9 @@ class AdminController < ApplicationController
def default_breadcrumb
case params[:action]
when 'plugins'
when "plugins"
t(:label_plugins)
when 'info'
when "info"
t(:label_information)
end
end
@@ -111,12 +111,12 @@ class AdminController < ApplicationController
def plaintext_extraction_checks
if OpenProject::Database.allows_tsv?
[
[:'extraction.available.pdftotext', Plaintext::PdfHandler.available?],
[:'extraction.available.unrtf', Plaintext::RtfHandler.available?],
[:'extraction.available.catdoc', Plaintext::DocHandler.available?],
[:'extraction.available.xls2csv', Plaintext::XlsHandler.available?],
[:'extraction.available.catppt', Plaintext::PptHandler.available?],
[:'extraction.available.tesseract', Plaintext::ImageHandler.available?]
[:"extraction.available.pdftotext", Plaintext::PdfHandler.available?],
[:"extraction.available.unrtf", Plaintext::RtfHandler.available?],
[:"extraction.available.catdoc", Plaintext::DocHandler.available?],
[:"extraction.available.xls2csv", Plaintext::XlsHandler.available?],
[:"extraction.available.catppt", Plaintext::PptHandler.available?],
[:"extraction.available.tesseract", Plaintext::ImageHandler.available?]
]
else
[]
@@ -124,11 +124,11 @@ class AdminController < ApplicationController
end
def image_conversion_checks
[[:'image_conversion.imagemagick', image_conversion_libs_available?]]
[[:"image_conversion.imagemagick", image_conversion_libs_available?]]
end
def image_conversion_libs_available?
Open3.capture2e('convert', '-version').first.include?('ImageMagick')
Open3.capture2e("convert", "-version").first.include?("ImageMagick")
rescue StandardError
false
end
+2 -2
View File
@@ -32,13 +32,13 @@ class AngularController < ApplicationController
def empty_layout
# Frontend will handle rendering
# but we will need to render with layout
render html: '', layout: 'angular/angular'
render html: "", layout: "angular/angular"
end
def notifications_layout
# Frontend will handle rendering
# but we will need to render with notification specific layout
render html: '', layout: 'angular/notifications'
render html: "", layout: "angular/notifications"
end
def login_back_url_params
+3 -3
View File
@@ -1,5 +1,5 @@
class AnnouncementsController < ApplicationController
layout 'admin'
layout "admin"
before_action :require_admin
@@ -15,7 +15,7 @@ class AnnouncementsController < ApplicationController
flash[:notice] = t(:notice_successful_update)
end
redirect_to action: 'edit'
redirect_to action: "edit"
end
private
@@ -29,6 +29,6 @@ class AnnouncementsController < ApplicationController
end
def announcement_params
params.require(:announcement).permit('text', 'show_until', 'active')
params.require(:announcement).permit("text", "show_until", "active")
end
end
+30 -30
View File
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'uri'
require 'cgi'
require "uri"
require "cgi"
require 'doorkeeper/dashboard_helper'
require "doorkeeper/dashboard_helper"
class ApplicationController < ActionController::Base
class_attribute :_model_object
@@ -51,7 +51,7 @@ class ApplicationController < ActionController::Base
include AdditionalUrlHelpers
include OpenProjectErrorHelper
layout 'base'
layout "base"
protect_from_forgery
# CSRF protection prevents two things. It prevents an attacker from using a
@@ -74,7 +74,7 @@ class ApplicationController < ActionController::Base
# Thus, we show an error message unless the request probably is an API
# request.
def handle_unverified_request
cookies.delete(OpenProject::Configuration['autologin_cookie_name'])
cookies.delete(OpenProject::Configuration["autologin_cookie_name"])
self.logged_user = nil
# Don't render an error message for requests that appear to be API requests.
@@ -105,7 +105,7 @@ class ApplicationController < ActionController::Base
# Check whether user have cookies enabled, otherwise they'll only be
# greeted with the CSRF error upon login.
message = I18n.t(:error_token_authenticity)
message << (' ' + I18n.t(:error_cookie_missing)) if openproject_cookie_missing?
message << (" " + I18n.t(:error_cookie_missing)) if openproject_cookie_missing?
log_csrf_failure
@@ -148,7 +148,7 @@ class ApplicationController < ActionController::Base
def default_url_options(_options = {})
{
layout: params['layout'],
layout: params["layout"],
protocol: Setting.protocol
}
end
@@ -159,7 +159,7 @@ class ApplicationController < ActionController::Base
# https://websecuritytool.codeplex.com/wikipage?title=Checks#http-cache-control-header-no-store
# http://stackoverflow.com/questions/711418/how-to-prevent-browser-page-caching-in-rails
def set_cache_buster
if OpenProject::Configuration['disable_browser_cache']
if OpenProject::Configuration["disable_browser_cache"]
response.cache_control.merge!(
max_age: 0,
public: false,
@@ -179,7 +179,7 @@ class ApplicationController < ActionController::Base
# Checks if the session cookie is missing.
# This is useful only on a second request
def openproject_cookie_missing?
request.cookies[OpenProject::Configuration['session_cookie_name']].nil?
request.cookies[OpenProject::Configuration["session_cookie_name"]].nil?
end
helper_method :openproject_cookie_missing?
@@ -187,8 +187,8 @@ class ApplicationController < ActionController::Base
##
# Create CSRF issue
def log_csrf_failure
message = 'CSRF validation error'
message << ' (No session cookie present)' if openproject_cookie_missing?
message = "CSRF validation error"
message << " (No session cookie present)" if openproject_cookie_missing?
op_handle_error message, reference: :csrf_validation_failed
end
@@ -208,7 +208,7 @@ class ApplicationController < ActionController::Base
# replaces all invalid characters with #
def escape_for_logging(string)
# only allow numbers, ASCII letters, space and the following characters: @.-"'!?=/
string.gsub(/[^0-9a-zA-Z@._\-"'!?=\/ ]{1}/, '#')
string.gsub(/[^0-9a-zA-Z@._\-"'!?=\/ ]{1}/, "#")
end
def reset_i18n_fallbacks
@@ -228,7 +228,7 @@ class ApplicationController < ActionController::Base
user = RequestStore[:current_user] ||
(session[:authenticated_user_id].present? && User.find_by(id: session[:authenticated_user_id])) ||
User.anonymous
SetLocalizationService.new(user, request.env['HTTP_ACCEPT_LANGUAGE']).call
SetLocalizationService.new(user, request.env["HTTP_ACCEPT_LANGUAGE"]).call
end
def deny_access(not_found: false)
@@ -413,7 +413,7 @@ class ApplicationController < ActionController::Base
associated = find_belongs_to_chained_objects(associations, model_object)
associated.each do |a|
instance_variable_set('@' + a.class.to_s.downcase, a)
instance_variable_set("@" + a.class.to_s.downcase, a)
end
rescue ActiveRecord::RecordNotFound
render_404
@@ -452,7 +452,7 @@ class ApplicationController < ActionController::Base
def find_work_packages
@work_packages = WorkPackage.includes(:project)
.where(id: params[:work_package_id] || params[:ids])
.order('id ASC')
.order("id ASC")
fail ActiveRecord::RecordNotFound if @work_packages.empty?
@projects = @work_packages.filter_map(&:project).uniq
@@ -479,7 +479,7 @@ class ApplicationController < ActionController::Base
end
def back_url
params[:back_url] || request.env['HTTP_REFERER']
params[:back_url] || request.env["HTTP_REFERER"]
end
def redirect_back_or_default(default, use_escaped = true)
@@ -497,7 +497,7 @@ class ApplicationController < ActionController::Base
#
# @return [boolean, string] name of the layout to use or false for no layout
def use_layout
request.xhr? ? false : 'no_menu'
request.xhr? ? false : "no_menu"
end
def render_feed(items, options = {})
@@ -505,7 +505,7 @@ class ApplicationController < ActionController::Base
@items = @items.sort { |x, y| y.event_datetime <=> x.event_datetime }
@items = @items.slice(0, Setting.feeds_limit.to_i)
@title = options[:title] || Setting.app_title
render template: 'common/feed', layout: false, content_type: 'application/atom+xml'
render template: "common/feed", layout: false, content_type: "application/atom+xml"
end
def self.accept_key_auth(*actions)
@@ -519,7 +519,7 @@ class ApplicationController < ActionController::Base
# Returns a string that can be used as filename value in Content-Disposition header
def filename_for_content_disposition(name)
%r{(MSIE|Trident)}.match?(request.env['HTTP_USER_AGENT']) ? ERB::Util.url_encode(name) : name
%r{(MSIE|Trident)}.match?(request.env["HTTP_USER_AGENT"]) ? ERB::Util.url_encode(name) : name
end
def api_request?
@@ -534,8 +534,8 @@ class ApplicationController < ActionController::Base
def api_key_from_request
if params[:key].present?
params[:key]
elsif request.headers['X-OpenProject-API-Key'].present?
request.headers['X-OpenProject-API-Key']
elsif request.headers["X-OpenProject-API-Key"].present?
request.headers["X-OpenProject-API-Key"]
end
end
@@ -550,10 +550,10 @@ class ApplicationController < ActionController::Base
def render_validation_errors(object)
options = { status: :unprocessable_entity, layout: false }
errors = case params[:format]
when 'xml'
when "xml"
{ xml: object.errors }
when 'json'
{ json: { 'errors' => object.errors } } # ActiveResource client compliance
when "json"
{ json: { "errors" => object.errors } } # ActiveResource client compliance
else
fail "Unknown format #{params[:format]} in #render_validation_errors"
end
@@ -566,7 +566,7 @@ class ApplicationController < ActionController::Base
def default_template(action_name = self.action_name)
if api_request?
begin
return view_paths.find_template(default_template_name(action_name), 'api')
return view_paths.find_template(default_template_name(action_name), "api")
rescue ::ActionView::MissingTemplate
# the api template was not found
# fallback to the default behaviour
@@ -584,7 +584,7 @@ class ApplicationController < ActionController::Base
def default_breadcrumb
label = "label_#{controller_name.singularize}"
I18n.t(label + '_plural',
I18n.t(label + "_plural",
default: label.to_sym)
end
@@ -607,8 +607,8 @@ class ApplicationController < ActionController::Base
if session_expired?
self.logged_user = nil
flash[:warning] = I18n.t('notice_forced_logout', ttl_time: Setting.session_ttl)
redirect_to(controller: '/account', action: 'login', back_url: login_back_url)
flash[:warning] = I18n.t("notice_forced_logout", ttl_time: Setting.session_ttl)
redirect_to(controller: "/account", action: "login", back_url: login_back_url)
end
session[:updated_at] = Time.now
end
@@ -623,7 +623,7 @@ class ApplicationController < ActionController::Base
def stop_if_feeds_disabled
if feed_request? && !Setting.feeds_enabled?
render_404(message: I18n.t('label_disabled'))
render_404(message: I18n.t("label_disabled"))
end
end
@@ -649,7 +649,7 @@ class ApplicationController < ActionController::Base
else
url_params = params.permit(:action, :id, :project_id, :controller)
unless url_params[:controller].to_s.starts_with?('/')
unless url_params[:controller].to_s.starts_with?("/")
url_params[:controller] = "/#{url_params[:controller]}"
end
@@ -27,7 +27,7 @@
#++
class AttributeHelpTextsController < ApplicationController
layout 'admin'
layout "admin"
menu_item :attribute_help_texts
before_action :authorize_global
@@ -56,8 +56,8 @@ class AttributeHelpTextsController < ApplicationController
redirect_to attribute_help_texts_path(tab: call.result.attribute_scope)
else
@attribute_help_text = call.result
flash[:error] = call.message || I18n.t('notice_internal_server_error')
render action: 'new'
flash[:error] = call.message || I18n.t("notice_internal_server_error")
render action: "new"
end
end
@@ -70,8 +70,8 @@ class AttributeHelpTextsController < ApplicationController
flash[:notice] = t(:notice_successful_update)
redirect_to attribute_help_texts_path(tab: @attribute_help_text.attribute_scope)
else
flash[:error] = call.message || I18n.t('notice_internal_server_error')
render action: 'edit'
flash[:error] = call.message || I18n.t("notice_internal_server_error")
render action: "edit"
end
end
@@ -88,10 +88,10 @@ class AttributeHelpTextsController < ApplicationController
protected
def default_breadcrumb
if action_name == 'index'
t('attribute_help_texts.label_plural')
if action_name == "index"
t("attribute_help_texts.label_plural")
else
ActionController::Base.helpers.link_to(t('attribute_help_texts.label_plural'), attribute_help_texts_path)
ActionController::Base.helpers.link_to(t("attribute_help_texts.label_plural"), attribute_help_texts_path)
end
end
@@ -122,7 +122,7 @@ class AttributeHelpTextsController < ApplicationController
end
def find_type_scope
name = params.fetch(:name, 'WorkPackage')
name = params.fetch(:name, "WorkPackage")
submodule = AttributeHelpText.available_types.find { |mod| mod == name }
if submodule.nil?
+2 -2
View File
@@ -70,7 +70,7 @@ class CategoriesController < ApplicationController
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to project_settings_categories_path(@project)
else
render action: 'edit'
render action: "edit"
end
end
@@ -82,7 +82,7 @@ class CategoriesController < ApplicationController
redirect_to project_settings_categories_path(@project)
return
elsif params[:todo]
reassign_to = @project.categories.find_by(id: params[:reassign_to_id]) if params[:todo] == 'reassign'
reassign_to = @project.categories.find_by(id: params[:reassign_to_id]) if params[:todo] == "reassign"
@category.destroy(reassign_to)
redirect_to project_settings_categories_path(@project)
return
+4 -4
View File
@@ -29,7 +29,7 @@
class ColorsController < ApplicationController
before_action :require_admin_unless_readonly_api_request
layout 'admin'
layout "admin"
menu_item :colors
@@ -68,7 +68,7 @@ class ColorsController < ApplicationController
redirect_to colors_path
else
flash.now[:error] = I18n.t(:error_color_could_not_be_saved)
render action: 'new'
render action: "new"
end
end
@@ -80,7 +80,7 @@ class ColorsController < ApplicationController
redirect_to colors_path
else
flash.now[:error] = I18n.t(:error_color_could_not_be_saved)
render action: 'edit'
render action: "edit"
end
end
@@ -102,7 +102,7 @@ class ColorsController < ApplicationController
protected
def default_breadcrumb
if action_name == 'index'
if action_name == "index"
t(:label_color_plural)
else
ActionController::Base.helpers.link_to(t(:label_color_plural), colors_path)
@@ -65,7 +65,7 @@ module Accounts::AuthenticationStages
else
flash[:error] = I18n.t(
:notice_auth_stage_wrong_stage,
expected: stage || '(none)',
expected: stage || "(none)",
actual: params[:stage]
)
@@ -119,7 +119,7 @@ module Accounts::AuthenticationStages
session[:back_url] ||= params[:back_url]
# Remember the autologin cookie decision
session[:autologin_requested] = params[:autologin] == '1'
session[:autologin_requested] = params[:autologin] == "1"
stages
end
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'uri'
require "uri"
##
# Intended to be used by the AccountController to handle omniauth logins
@@ -47,10 +47,10 @@ module Accounts::OmniauthLogin
end
def omniauth_login
params[:back_url] = request.env['omniauth.origin'] if remember_back_url?
params[:back_url] = request.env["omniauth.origin"] if remember_back_url?
# Extract auth info and perform check / login or activate user
auth_hash = request.env['omniauth.auth']
auth_hash = request.env["omniauth.auth"]
handle_omniauth_authentication(auth_hash)
end
@@ -75,7 +75,7 @@ module Accounts::OmniauthLogin
# Avoid remembering the back_url if we're coming from the login page
def remember_back_url?
provided_back_url = request.env['omniauth.origin']
provided_back_url = request.env["omniauth.origin"]
return if provided_back_url.blank?
account_routes = /\/(login|account)/
@@ -84,7 +84,7 @@ module Accounts::OmniauthLogin
def show_error(error)
flash[:error] = error
redirect_to action: 'login'
redirect_to action: "login"
end
def register_via_omniauth(session, user_attributes)
@@ -93,7 +93,7 @@ module Accounts::OmniauthLogin
def handle_omniauth_authentication(auth_hash, user_params: nil)
call = ::Authentication::OmniauthService
.new(strategy: request.env['omniauth.strategy'], auth_hash:, controller: self)
.new(strategy: request.env["omniauth.strategy"], auth_hash:, controller: self)
.call(user_params)
if call.success?
@@ -34,7 +34,7 @@ module Accounts::UserConsent
def consent
if user_consent_required? && consenting_user&.consent_expired?
render 'account/consent'
render "account/consent"
else
consent_finished
end
@@ -51,12 +51,12 @@ module Accounts::UserConsent
end
def decline_consent
message = I18n.t('consent.decline_warning_message') + "\n"
message = I18n.t("consent.decline_warning_message") + "\n"
message <<
if Setting.consent_decline_mail.present?
I18n.t('consent.contact_this_mail_address', mail_address: Setting.consent_decline_mail)
I18n.t("consent.contact_this_mail_address", mail_address: Setting.consent_decline_mail)
else
I18n.t('consent.contact_your_administrator')
I18n.t("consent.contact_your_administrator")
end
flash[:error] = message
@@ -77,7 +77,7 @@ module Accounts::UserConsent
end
def reject_consent!
flash[:error] = I18n.t('consent.failure_message')
flash[:error] = I18n.t("consent.failure_message")
redirect_to authentication_stage_failure_path :consent
end
end
@@ -70,7 +70,7 @@ module Accounts::UserPasswordChange
return
end
flash_error_message(log_reason: 'invalid credentials', flash_now:) do
flash_error_message(log_reason: "invalid credentials", flash_now:) do
if Setting.brute_force_block_after_failed_logins.to_i > 0
:notice_account_invalid_credentials_or_blocked
else
@@ -83,7 +83,7 @@ module Accounts::UserPasswordChange
flash[:error] = message unless message.nil?
@user = user
@username = user.login
render 'my/password', locals: { show_user_name: }
render "my/password", locals: { show_user_name: }
end
##
@@ -91,15 +91,15 @@ module Accounts::UserPasswordChange
def redirect_if_password_change_not_allowed(user)
if user and not user.change_password_allowed?
logger.warn "Password change for user '#{user}' forced, but user is not allowed " +
'to change password'
"to change password"
flash[:error] = I18n.t(:notice_can_t_change_password)
redirect_to action: 'login'
redirect_to action: "login"
return true
end
false
end
def flash_error_message(log_reason: '', flash_now: true)
def flash_error_message(log_reason: "", flash_now: true)
flash_hash = flash_now ? flash.now : flash
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} " \
+1 -1
View File
@@ -103,7 +103,7 @@ module AuthSourceSSO
def extract_from_header(value)
if header_secret.present?
valid_secret = value.end_with?(":#{header_secret}")
login = value.gsub(/:#{Regexp.escape(header_secret)}\z/, '')
login = value.gsub(/:#{Regexp.escape(header_secret)}\z/, "")
[login, valid_secret]
else
+1 -1
View File
@@ -36,7 +36,7 @@ module Layout
elsif @project
true
else
'no_menu'
"no_menu"
end
end
+1 -1
View File
@@ -88,7 +88,7 @@ module MemberHelper
return array if array.blank?
each_comma_separated(array) do |elem|
elem.to_s.split(',')
elem.to_s.split(",")
end
end
+2 -2
View File
@@ -30,11 +30,11 @@ module UserInvitation
module Events
class << self
def user_invited
'user_invited'
"user_invited"
end
def user_reinvited
'user_reinvited'
"user_reinvited"
end
end
end
+9 -9
View File
@@ -35,7 +35,7 @@ class CustomActionsController < ApplicationController
before_action :find_model_object, only: %i(edit update destroy)
before_action :pad_params, only: %i(create update)
layout 'admin'
layout "admin"
def index
@custom_actions = CustomAction.order_by_position
@@ -86,12 +86,12 @@ class CustomActionsController < ApplicationController
return if EnterpriseToken.allows_to?(:custom_actions)
if request.get?
render template: 'common/upsale',
render template: "common/upsale",
locals: {
feature_title: I18n.t('custom_actions.upsale.title'),
feature_description: I18n.t('custom_actions.upsale.description'),
feature_reference: 'custom_actions_admin',
feature_video: 'enterprise/custom-actions.mp4'
feature_title: I18n.t("custom_actions.upsale.title"),
feature_description: I18n.t("custom_actions.upsale.description"),
feature_reference: "custom_actions_admin",
feature_video: "enterprise/custom-actions.mp4"
}
else
render_403
@@ -110,10 +110,10 @@ class CustomActionsController < ApplicationController
end
def default_breadcrumb
if action_name == 'index'
t('custom_actions.plural')
if action_name == "index"
t("custom_actions.plural")
else
ActionController::Base.helpers.link_to(t('custom_actions.plural'), custom_actions_path)
ActionController::Base.helpers.link_to(t("custom_actions.plural"), custom_actions_path)
end
end
+2 -2
View File
@@ -27,7 +27,7 @@
#++
class CustomStylesController < ApplicationController
layout 'admin'
layout "admin"
menu_item :custom_style
before_action :require_admin,
@@ -154,7 +154,7 @@ class CustomStylesController < ApplicationController
def options_for_theme_select
options = OpenProject::CustomStyles::ColorThemes.themes.pluck(:theme)
unless @current_theme.present?
options << [t('admin.custom_styles.color_theme_custom'), '',
options << [t("admin.custom_styles.color_theme_custom"), "",
{ selected: true, disabled: true }]
end
+1 -1
View File
@@ -28,7 +28,7 @@
class EnterprisesController < ApplicationController
include EnterpriseTrialHelper
layout 'admin'
layout "admin"
menu_item :enterprise
before_action :chargebee_content_security_policy
+8 -8
View File
@@ -27,7 +27,7 @@
#++
class EnumerationsController < ApplicationController
layout 'admin'
layout "admin"
before_action :require_admin
before_action :find_enumeration, only: %i[edit update move destroy]
@@ -56,9 +56,9 @@ class EnumerationsController < ApplicationController
if @enumeration.save
flash[:notice] = I18n.t(:notice_successful_create)
redirect_to action: 'index', type: @enumeration.type
redirect_to action: "index", type: @enumeration.type
else
render action: 'new'
render action: "new"
end
end
@@ -70,7 +70,7 @@ class EnumerationsController < ApplicationController
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to enumerations_path(type: @enumeration.type)
else
render action: 'edit'
render action: "edit"
end
end
@@ -78,12 +78,12 @@ class EnumerationsController < ApplicationController
if !@enumeration.in_use?
# No associated objects
@enumeration.destroy
redirect_to action: 'index'
redirect_to action: "index"
return
elsif params[:reassign_to_id]
if reassign_to = @enumeration.class.find_by(id: params[:reassign_to_id])
@enumeration.destroy(reassign_to)
redirect_to action: 'index'
redirect_to action: "index"
return
end
end
@@ -96,14 +96,14 @@ class EnumerationsController < ApplicationController
redirect_to enumerations_path
else
flash.now[:error] = I18n.t(:error_type_could_not_be_saved)
render action: 'edit'
render action: "edit"
end
end
protected
def default_breadcrumb
if action_name == 'index'
if action_name == "index"
t(:label_enumerations)
else
ActionController::Base.helpers.link_to(t(:label_enumerations), enumerations_path)
+1 -1
View File
@@ -26,6 +26,6 @@ class ErrorsController < ActionController::Base
end
def use_layout
'only_logo'
"only_logo"
end
end

Some files were not shown because too many files have changed in this diff Show More