Skip to content

Commit

Permalink
Release OpenProject 10.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Jun 30, 2020
2 parents 633e577 + fc3c853 commit b2998d0
Show file tree
Hide file tree
Showing 173 changed files with 630 additions and 697 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Docker
on:
# Scheduled workflows run on the latest commit on the default or base branch
schedule:
- cron: '20 2 * * *' # Daily at 02:20

push:
tags:
- v*
jobs:
publish:
# restrict this job to base repo for now
if: github.repository == 'opf/openproject'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Publish to registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: openproject/community-test
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tag_semver: true
cache: ${{ github.event_name != 'schedule' }}
2 changes: 0 additions & 2 deletions .pkgr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ targets:
- catdoc
debian-10:
<<: *debian9
ubuntu-14.04:
<<: *debian9
ubuntu-16.04:
<<: *debian9
ubuntu-18.04:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ gem 'aws-sdk-core', '~> 3.91.0'
# File upload via fog + screenshots on travis
gem 'aws-sdk-s3', '~> 1.61.0'

gem 'openproject-token', '~> 2.0'
gem 'openproject-token', '~> 2.1.2'

gem 'plaintext', '~> 0.3.2'

Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ GEM
validate_email
validate_url
webfinger (>= 1.0.1)
openproject-token (2.0)
openproject-token (2.1.2)
activemodel
parallel (1.19.1)
parallel_tests (2.32.0)
Expand Down Expand Up @@ -1062,7 +1062,7 @@ DEPENDENCIES
openproject-pdf_export!
openproject-recaptcha!
openproject-reporting!
openproject-token (~> 2.0)
openproject-token (~> 2.1.2)
openproject-translations!
openproject-two_factor_authentication!
openproject-webhooks!
Expand Down
32 changes: 17 additions & 15 deletions app/models/custom_field/order_statements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,16 @@ def coalesce_select_custom_value_as_string
# COALESCE is here to make sure that blank and NULL values are sorted equally
[
<<-SQL
COALESCE(#{select_custom_value_as_string}, '')
COALESCE(#{select_custom_value_as_string}, '')
SQL
]
end

def select_custom_value_as_string
<<-SQL
(SELECT cv_sort.value FROM #{CustomValue.table_name} cv_sort
WHERE cv_sort.customized_type='#{self.class.customized_class.name}'
AND cv_sort.customized_id=#{self.class.customized_class.table_name}.id
AND cv_sort.custom_field_id=#{id} LIMIT 1)
WHERE #{cv_sort_only_custom_field_condition_sql}
LIMIT 1)
SQL
end

Expand All @@ -109,8 +108,7 @@ def select_custom_option_position
(SELECT co_sort.position FROM #{CustomOption.table_name} co_sort
LEFT JOIN #{CustomValue.table_name} cv_sort
ON co_sort.id = CAST(cv_sort.value AS decimal(60,3))
WHERE cv_sort.custom_field_id=#{id}
AND cv_sort.customized_id=#{self.class.customized_class.table_name}.id
WHERE #{cv_sort_only_custom_field_condition_sql}
LIMIT 1
)
SQL
Expand All @@ -119,9 +117,7 @@ def select_custom_option_position
def select_custom_values_as_group
<<-SQL
COALESCE((SELECT string_agg(cv_sort.value, '.') FROM #{CustomValue.table_name} cv_sort
WHERE cv_sort.customized_type='#{self.class.customized_class.name}'
AND cv_sort.customized_id=#{self.class.customized_class.table_name}.id
AND cv_sort.custom_field_id=#{id}
WHERE #{cv_sort_only_custom_field_condition_sql}
AND cv_sort.value IS NOT NULL), '')
SQL
end
Expand All @@ -131,18 +127,14 @@ def select_custom_values_joined_options_as_group
COALESCE((SELECT string_agg(co_sort.value, '.' ORDER BY co_sort.position ASC) FROM #{CustomOption.table_name} co_sort
LEFT JOIN #{CustomValue.table_name} cv_sort
ON cv_sort.value IS NOT NULL AND co_sort.id = cv_sort.value::numeric
WHERE cv_sort.customized_type='#{self.class.customized_class.name}'
AND cv_sort.customized_id=#{self.class.customized_class.table_name}.id
AND cv_sort.custom_field_id=#{id}), '')
WHERE #{cv_sort_only_custom_field_condition_sql}), '')
SQL
end

def select_custom_value_as_decimal
<<-SQL
(SELECT CAST(cv_sort.value AS decimal(60,3)) FROM #{CustomValue.table_name} cv_sort
WHERE cv_sort.customized_type='#{self.class.customized_class.name}'
AND cv_sort.customized_id=#{self.class.customized_class.table_name}.id
AND cv_sort.custom_field_id=#{id}
WHERE #{cv_sort_only_custom_field_condition_sql}
AND cv_sort.value <> ''
AND cv_sort.value IS NOT NULL
LIMIT 1)
Expand All @@ -164,4 +156,14 @@ def order_by_version_sql(column)
LIMIT 1)
SQL
end

private

def cv_sort_only_custom_field_condition_sql
<<-SQL
cv_sort.customized_type='#{self.class.customized_class.name}'
AND cv_sort.customized_id=#{self.class.customized_class.table_name}.id
AND cv_sort.custom_field_id=#{id}
SQL
end
end
7 changes: 7 additions & 0 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ class Project < ApplicationRecord
validates :name,
presence: true,
length: { maximum: 255 }

before_validation :remove_white_spaces_from_project_name

# TODO: we temporarily disable this validation because it leads to failed tests
# it implicitly assumes a db:seed-created standard type to be present and currently
# neither development nor deployment setups are prepared for this
Expand Down Expand Up @@ -573,4 +576,8 @@ def shared_versions_base_scope
.includes(:project)
.references(:projects)
end

def remove_white_spaces_from_project_name
self.name = name.squish unless self.name.nil?
end
end
10 changes: 6 additions & 4 deletions app/services/groups/add_users_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def add_to_user_and_projects_cte
SELECT members.project_id AS project_id,
members.user_id AS user_id,
members.id AS member_id,
member_roles.role_id AS role_id
member_roles.role_id AS role_id,
member_roles.id AS member_role_id
FROM #{MemberRole.table_name} member_roles
JOIN #{Member.table_name} members
ON members.id = member_roles.member_id AND members.user_id = :group_id
Expand All @@ -103,12 +104,13 @@ def add_to_user_and_projects_cte
-- even if they already exist as members (e.g., added individually) to ensure we add all roles
-- to mark that we reset the created_at date since replacing the member
ON CONFLICT(project_id, user_id) DO UPDATE SET created_on = CURRENT_TIMESTAMP
RETURNING id, user_id
RETURNING id, user_id, project_id
)
-- copy the member roles of the group
INSERT INTO #{MemberRole.table_name} (member_id, role_id, inherited_from)
SELECT new_members.id, group_roles.role_id, group_roles.member_id
FROM group_roles, new_members
SELECT new_members.id, group_roles.role_id, group_roles.member_role_id
FROM group_roles
JOIN new_members ON group_roles.project_id = new_members.project_id
-- Ignore if the role was already inserted by us
ON CONFLICT DO NOTHING
SQL
Expand Down
30 changes: 30 additions & 0 deletions config/initializers/log_slow_sql_queries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
OpenProject::Application.configure do
config.after_initialize do
slow_sql_threshold = OpenProject::Configuration.sql_slow_query_threshold.to_i
return if slow_sql_threshold == 0

ActiveSupport::Notifications.subscribe("sql.active_record") do |_name, start, finish, _id, data|
# Skip transaction that may be blocked
next if data[:sql].match(/BEGIN|COMMIT/)

# Skip smaller durations
duration = ((finish - start) * 1000).round(4)
next if duration <= slow_sql_threshold

payload = {
duration: duration,
time: start.iso8601,
cached: !!data[:cache],
sql: data[:sql],
}

sql_log_string = data[:sql].strip.gsub(/(^([\s]+)?$\n)/, "")
OpenProject.logger.warn "Encountered slow SQL (#{payload[:duration]} ms): #{sql_log_string}",
payload: payload,
# Hash of the query for reference/fingerprinting
reference: Digest::SHA1.hexdigest(data[:sql])
rescue StandardError => e
OpenProject.logger.error "Failed to record slow SQL query: #{e}"
end
end
end
9 changes: 0 additions & 9 deletions config/locales/crowdin/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ ar:
types: "الأنواع"
versions: "الإصدارات"
work_packages: "مجموعات العمل"
templated: 'Template project'
projects/status:
code: 'الحالة'
explanation: 'Status description'
Expand Down Expand Up @@ -490,7 +489,6 @@ ar:
parent_work_package: "الجذر"
priority: "الأولوية"
progress: "التقدم (%)"
schedule_manually: "Schedule manually"
spent_hours: "الوقت المستهلك"
spent_time: "الوقت المستهلك"
subproject: "مشروع فرعي"
Expand Down Expand Up @@ -900,7 +898,6 @@ ar:
- "تشرين الأول"
- "تشرين الثاني"
- "كانون الأول"
abbr_week: 'Wk'
day_names:
- "الأحد"
- "الاثنين"
Expand Down Expand Up @@ -2031,12 +2028,6 @@ ar:
warning_one: وسيكون أعضاء المشروع إلى نقل مستودعات للمشروع.
warning_two: لن تعد تعمل الارتباطات الموجودة في المشروع.
title: تغيير معرف المشروع
template:
copying: >
Your project is being created from the selected template project. You will be notified by mail as soon as the project is available.
use_template: 'Use template'
make_template: 'Set as template'
remove_from_templates: 'Remove from templates'
archive:
are_you_sure: "هل أنت متأكد من أنك تريد أرشفة المشروع '%{name}'؟"
archived: "Archived"
Expand Down
9 changes: 0 additions & 9 deletions config/locales/crowdin/bg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ bg:
types: "Видове"
versions: "Версии"
work_packages: "Работен пакет"
templated: 'Template project'
projects/status:
code: 'Състояние'
explanation: 'Status description'
Expand Down Expand Up @@ -486,7 +485,6 @@ bg:
parent_work_package: "Горна категория"
priority: "Приоритет"
progress: "Прогрес (%)"
schedule_manually: "Schedule manually"
spent_hours: "Отработено време"
spent_time: "Отработено време"
subproject: "Подпроект"
Expand Down Expand Up @@ -884,7 +882,6 @@ bg:
- "окт"
- "ное"
- "Декември"
abbr_week: 'Wk'
day_names:
- "Неделя"
- "Понеделник"
Expand Down Expand Up @@ -1947,12 +1944,6 @@ bg:
warning_one: Members of the project will have to relocate the project's repositories.
warning_two: Existing links to the project will no longer work.
title: Change the project's identifier
template:
copying: >
Your project is being created from the selected template project. You will be notified by mail as soon as the project is available.
use_template: 'Use template'
make_template: 'Set as template'
remove_from_templates: 'Remove from templates'
archive:
are_you_sure: "Наистина ли искате да архивирате на проекта \"%{name}\"?"
archived: "Archived"
Expand Down
9 changes: 0 additions & 9 deletions config/locales/crowdin/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ ca:
types: "Tipus"
versions: "Versions"
work_packages: "Paquets de treball"
templated: 'Template project'
projects/status:
code: 'Estat'
explanation: 'Status description'
Expand Down Expand Up @@ -486,7 +485,6 @@ ca:
parent_work_package: "Pare"
priority: "Prioritat"
progress: "Progrés (%)"
schedule_manually: "Schedule manually"
spent_hours: "Temps invertit"
spent_time: "Temps invertit"
subproject: "Subprojecte"
Expand Down Expand Up @@ -884,7 +882,6 @@ ca:
- "Oct"
- "Nov"
- "Des"
abbr_week: 'Wk'
day_names:
- "Diumenge"
- "Dilluns"
Expand Down Expand Up @@ -1947,12 +1944,6 @@ ca:
warning_one: Els membres del projecte hauran de reubicar els repositoris del projecte.
warning_two: Els vncles existents al projecte ja no funcionaran.
title: Canviar l'identificador del projecte
template:
copying: >
Your project is being created from the selected template project. You will be notified by mail as soon as the project is available.
use_template: 'Use template'
make_template: 'Set as template'
remove_from_templates: 'Remove from templates'
archive:
are_you_sure: "Esteu segur que voleu arxivar el projecte \"%{name}\"?"
archived: "Archived"
Expand Down
9 changes: 0 additions & 9 deletions config/locales/crowdin/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ cs:
types: "Typy"
versions: "Verze"
work_packages: "Pracovní balíčky"
templated: 'Template project'
projects/status:
code: 'Stav'
explanation: 'Status description'
Expand Down Expand Up @@ -488,7 +487,6 @@ cs:
parent_work_package: "Rodič"
priority: "Priorita"
progress: "Průběh (%)"
schedule_manually: "Schedule manually"
spent_hours: "Strávený čas"
spent_time: "Strávený čas"
subproject: "Dílčí projekt"
Expand Down Expand Up @@ -892,7 +890,6 @@ cs:
- "Říjen"
- "Listopad"
- "Prosinec"
abbr_week: 'Wk'
day_names:
- "neděle"
- "pondělí"
Expand Down Expand Up @@ -1988,12 +1985,6 @@ cs:
warning_one: Členové projektu budou muset přemístit úložiště projektu.
warning_two: Existující odkazy na projekt nebudou nadále fungovat.
title: Změnit identifikátor projektu
template:
copying: >
Your project is being created from the selected template project. You will be notified by mail as soon as the project is available.
use_template: 'Use template'
make_template: 'Set as template'
remove_from_templates: 'Remove from templates'
archive:
are_you_sure: "Opravdu chcete archivovat projekt '%{name}'?"
archived: "Archived"
Expand Down
Loading

0 comments on commit b2998d0

Please sign in to comment.