Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] dev from opf:dev #236

Merged
merged 60 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
5788a24
allow changing of direct login provider at runtime
machisuji Jun 5, 2024
de014f5
we have to use with_config (either that or with_settings) for both op…
machisuji Jun 5, 2024
58f8b4b
Merge pull request #15759 from opf/fix/allow-changing-of-direct-login…
ulferts Jun 6, 2024
6b9ce75
Add chronic_duration in our code to customize it
cbliard Jun 7, 2024
a49169d
Faster spec/lib/chronic_duration_spec.rb execution
cbliard Jun 7, 2024
bf7a371
Restore rightful copyright of chronic_duration.js
cbliard Jun 7, 2024
5a2a501
Restore test for chronic_duration.js
cbliard Jun 7, 2024
2e36de7
Add :days_and_hours format to ChronicDuration
cbliard Jun 7, 2024
5e2603d
Add 'daysAndHours' format to js ChronicDuration
cbliard Jun 10, 2024
495aa9c
Display durations as days and hours
cbliard Jun 10, 2024
b5b0c41
Remove days per month and days per week from admin
cbliard Jun 10, 2024
4e9404d
Make work and remaining work columns 200px wide
cbliard Jun 10, 2024
99e915b
Changing mail address should invalidate tokens on top of session
oliverguenther Jun 10, 2024
23637b1
Fix tests for new duration display with days and hours only
cbliard Jun 10, 2024
cb6de4e
Remove unused formatter
cbliard Jun 10, 2024
914011d
Fix floating point precision issue
cbliard Jun 10, 2024
72751b3
Use days and hours formatter in work package exports
cbliard Jun 10, 2024
200cebc
Remove useless code
cbliard Jun 10, 2024
a020c99
Fix test
cbliard Jun 10, 2024
a60beca
Add groups to user profile
oliverguenther Jun 10, 2024
d9a7194
Don't clear invitation tokens on login
oliverguenther Jun 10, 2024
74d9b85
Fix rubocop issues
klaustopher Jun 11, 2024
ccca8ff
Merge pull request #15804 from opf/fix/group-profile
klaustopher Jun 11, 2024
3168ead
[#55517] Remove filter from 14.2 pending a more robust option
akabiru Jun 7, 2024
9741e02
[#55507] Not possible to add multiple projects at the same time
akabiru Jun 7, 2024
a7d1068
Merge pull request #15796 from opf/fix/change-mail-invalidations
cbliard Jun 11, 2024
933f249
Merge branch 'release/14.1' into release/14.2
cbliard Jun 11, 2024
ff5aedf
fix[Op#55507]: get rid of catch-all
akabiru Jun 11, 2024
d4a1e8d
fix[Op#55507]: address error case for permissions failure
akabiru Jun 11, 2024
7f9f708
fix[Op#55507]: ensure not found error is raised accordingly
akabiru Jun 11, 2024
82a3b27
[55622] Fix label for status default percent complete in admin
cbliard Jun 11, 2024
e35e66b
[#52670] drastically reduce size of resize handle
Kharonus Jun 11, 2024
d8e0258
[#52670] no hover effect on collapsed state fixed
Kharonus Jun 11, 2024
2d30b4b
[#55529] encode collection key correctly
Kharonus Jun 11, 2024
6b7bcc6
Merge pull request #15816 from opf/bug/52670-main-menu-resizer-size-r…
Kharonus Jun 11, 2024
e0b3cd5
fix[Op#55507]: ensure unique mapping insert
akabiru Jun 11, 2024
0c26602
Merge pull request #15779 from opf/bug/55466-progress-units-in-days-a…
dombesz Jun 11, 2024
91c1a1d
update locales from crowdin [ci skip]
openprojectci Jun 12, 2024
b32eb38
Bump appsignal from 3.7.5 to 3.7.6
dependabot[bot] Jun 12, 2024
020b8ca
Merge pull request #15830 from opf/dependabot/bundler/dev/appsignal-3…
klaustopher Jun 12, 2024
4054b73
Remove ui-router from projects
oliverguenther Jun 11, 2024
d0d9522
Replace ui-router in job status
oliverguenther Jun 11, 2024
4e48a73
Merge pull request #15818 from opf/bug/55529-sharepoint-integration-b…
Kharonus Jun 12, 2024
d33bd88
Fix global menu item too height in Safari 17
Eric-Guo Jun 12, 2024
3bfc90a
Merge pull request #15827 from Eric-Guo/global_menu_safari_fix
HDinger Jun 12, 2024
143650c
[#55523] make add projects dialog mobile friendly
judithroth Jun 11, 2024
46152f3
Fix import of job status module
oliverguenther Jun 12, 2024
5fa649b
Review feedback: use system arguments instead of classes
judithroth Jun 12, 2024
7b2672a
Introduce center alignment class for Horizontal groups
HDinger Jun 12, 2024
a93047f
Merge pull request #15822 from opf/impl/ui-router-job-status
HDinger Jun 12, 2024
091775e
Update Rubocop gems and properly load them
klaustopher Jun 12, 2024
c322b42
update migration script, specifically fix the OP7 step
machisuji Jun 12, 2024
64f21f2
[#55490] 14.2 Documentation: Avoid redundant emails in case of @menti…
MayaBerd Jun 10, 2024
9ffe49d
Set shared notification setting to true by default
oliverguenther Jun 11, 2024
86ff20e
disable direct login provider if value is empty
machisuji Jun 12, 2024
a406ff8
Update teaser for 14.2
oliverguenther Jun 12, 2024
e7a4343
tests[Op#55507]: ensure only active projects are mapped
akabiru Jun 12, 2024
76ea564
Merge pull request #15820 from opf/bug/55523-add-dialog-not-mobile-fr…
judithroth Jun 12, 2024
622c27e
Merge pull request #15782 from opf/bug/55507-not-possible-to-add-mult…
akabiru Jun 12, 2024
31ceb4e
Merge branch 'release/14.2' into dev
akabiru Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require:
- rubocop-capybara
- rubocop-factory_bot
- rubocop-performance
- rubocop-inflector
- ./config/initializers/inflections.rb

<% if File.exist?('.rubocop-local.yml') %>
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,6 @@ gem "turbo-rails", "~> 2.0.0"

gem "httpx"

gem "gitlab_chronic_duration"

group :test do
gem "launchy", "~> 3.0.0"
gem "rack-test", "~> 2.1.0"
Expand Down Expand Up @@ -330,10 +328,12 @@ group :development, :test do

# ruby linting
gem "rubocop", require: false
gem "rubocop-inflector", require: false
gem "rubocop-capybara", require: false
gem "rubocop-factory_bot", require: false
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
gem "rubocop-rspec", require: false
gem "rubocop-rspec_rails", require: false

# erb linting
gem "erb_lint", require: false
Expand Down
31 changes: 12 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ GEM
airbrake-ruby (6.2.2)
rbtree3 (~> 0.6)
android_key_attestation (0.3.0)
appsignal (3.7.5)
appsignal (3.7.6)
rack
ast (2.4.2)
attr_required (1.0.2)
Expand Down Expand Up @@ -556,8 +556,6 @@ GEM
fuubar (2.5.1)
rspec-core (~> 3.0)
ruby-progressbar (~> 1.4)
gitlab_chronic_duration (0.12.0)
numerizer (~> 0.2)
glob (0.4.0)
globalid (1.2.1)
activesupport (>= 6.1)
Expand Down Expand Up @@ -940,7 +938,7 @@ GEM
actionpack (>= 5.2)
railties (>= 5.2)
retriable (3.1.2)
rexml (3.2.9)
rexml (3.3.0)
strscan
rinku (2.0.6)
roar (1.2.0)
Expand Down Expand Up @@ -985,12 +983,8 @@ GEM
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.26.0)
rubocop (~> 1.41)
rubocop-inflector (0.2.1)
activesupport
rubocop
rubocop-rspec
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
Expand All @@ -999,13 +993,11 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.31.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.29.0)
rubocop (~> 1.40)
rubocop-rspec (3.0.1)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
rubocop-rspec (~> 3, >= 3.0.1)
ruby-duration (3.2.3)
activesupport (>= 3.0.0)
i18n
Expand Down Expand Up @@ -1214,7 +1206,6 @@ DEPENDENCIES
fog-aws
friendly_id (~> 5.5.0)
fuubar (~> 2.5.0)
gitlab_chronic_duration
gon (~> 6.4.0)
good_job (= 3.26.2)
google-apis-gmail_v1
Expand Down Expand Up @@ -1316,10 +1307,12 @@ DEPENDENCIES
rspec-rails (~> 6.1.0)
rspec-retry (~> 0.6.1)
rubocop
rubocop-inflector
rubocop-capybara
rubocop-factory_bot
rubocop-performance
rubocop-rails
rubocop-rspec
rubocop-rspec_rails
ruby-duration (~> 3.2.0)
ruby-prof
ruby-progressbar (~> 1.13.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
) do |form|
concat(render(Primer::Alpha::Dialog::Body.new(
id: dialog_body_id, test_selector: dialog_body_id, aria: { label: title },
classes: "FormControl-horizontalGroup--sm-vertical FormControl-horizontalGroup--center-aligned",
style: "min-height: 300px"
)) do
render(Projects::CustomFields::CustomFieldMappingForm.new(form, project_custom_field: @project_custom_field))
Expand Down
43 changes: 3 additions & 40 deletions app/contracts/settings/working_days_and_hours_params_contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ class WorkingDaysAndHoursParamsContract < ::ParamsContract

validate :working_days_are_present
validate :hours_per_day_are_present
validate :days_per_week_are_present
validate :days_per_month_are_present
validate :durations_are_positive_values
validate :durations_are_within_bounds
validate :days_per_week_and_days_per_month_are_consistent
validate :unique_job

protected
Expand All @@ -53,45 +50,19 @@ def hours_per_day_are_present
end
end

def days_per_week_are_present
if days_per_week.blank?
errors.add :base, :days_per_week_are_missing
end
end

def days_per_month_are_present
if days_per_month.blank?
errors.add :base, :days_per_month_are_missing
end
end

def durations_are_positive_values
if hours_per_day &&
days_per_week &&
days_per_month &&
any_duration_is_negative_or_zero?
hours_per_day_is_negative_or_zero?
errors.add :base, :durations_are_not_positive_numbers
end
end

def durations_are_within_bounds
errors.add :base, :hours_per_day_is_out_of_bounds if hours_per_day.to_i > 24
errors.add :base, :days_per_week_is_out_of_bounds if days_per_week.to_i > 7
errors.add :base, :days_per_month_is_out_of_bounds if days_per_month.to_i > 31
end

def any_duration_is_negative_or_zero?
!hours_per_day.to_i.positive? ||
!days_per_week.to_i.positive? ||
!days_per_month.to_i.positive?
end

def days_per_week_and_days_per_month_are_consistent
if days_per_week &&
days_per_month &&
days_per_week.to_i != days_per_month.to_i / ChronicDuration::FULL_WEEKS_PER_MONTH
errors.add :base, :days_per_week_and_days_per_month_are_inconsistent
end
def hours_per_day_is_negative_or_zero?
!hours_per_day.to_i.positive?
end

def unique_job
Expand All @@ -107,13 +78,5 @@ def working_days
def hours_per_day
params[:hours_per_day]
end

def days_per_week
params[:days_per_week]
end

def days_per_month
params[:days_per_month]
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ProjectCustomFieldsController < ::Admin::SettingsController
before_action :prepare_custom_option_position, only: %i(update create)
before_action :find_custom_option, only: :delete_option
before_action :project_custom_field_mappings_query, only: %i[project_mappings unlink]
before_action :find_link_project_custom_field_mapping, only: :link
before_action :find_custom_field_projects_to_link, only: :link
before_action :find_unlink_project_custom_field_mapping, only: :unlink
# rubocop:enable Rails/LexicallyScopedActionFilter

Expand Down Expand Up @@ -75,15 +75,15 @@ def project_mappings

def link
create_service = ProjectCustomFieldProjectMappings::BulkCreateService
.new(user: current_user, project: @project, project_custom_field: @custom_field,
.new(user: current_user, projects: @projects, project_custom_field: @custom_field,
include_sub_projects: include_sub_projects?)
.call

create_service.on_success { render_project_list }

create_service.on_failure do
update_flash_message_via_turbo_stream(
message: join_flash_messages(create_service.errors.full_messages),
message: join_flash_messages(create_service.errors),
full: true, dismiss_scheme: :hide, scheme: :danger
)
end
Expand Down Expand Up @@ -195,8 +195,8 @@ def find_unlink_project_custom_field_mapping
respond_with_turbo_streams
end

def find_link_project_custom_field_mapping
@project = Project.find(permitted_params.project_custom_field_project_mapping[:project_id])
def find_custom_field_projects_to_link
@projects = Project.find(params.to_unsafe_h[:project_custom_field_project_mapping][:project_ids])
rescue ActiveRecord::RecordNotFound
update_flash_message_via_turbo_stream(
message: t(:notice_file_not_found), full: true, dismiss_scheme: :hide, scheme: :danger
Expand All @@ -220,7 +220,7 @@ def drop_success_streams(call)
end

def include_sub_projects?
ActiveRecord::Type::Boolean.new.cast(permitted_params.project_custom_field_project_mapping[:include_sub_projects])
ActiveRecord::Type::Boolean.new.cast(params.to_unsafe_h[:project_custom_field_project_mapping][:include_sub_projects])
end
end
end
18 changes: 12 additions & 6 deletions app/controllers/my_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ def account; end

def update_account
write_settings

# If mail changed, expire all other sessions
if @user.previous_changes['mail'] && ::Sessions::DropOtherSessionsService.call(@user, session)
flash[:info] = "#{flash[:notice]} #{t(:notice_account_other_session_expired)}"
flash.delete :notice
end
end

def settings; end
Expand Down Expand Up @@ -219,6 +213,7 @@ def write_settings

if result&.success
flash[:notice] = notice_account_updated
handle_email_changes
else
flash[:error] = error_account_update_failed(result)
end
Expand All @@ -228,6 +223,17 @@ def write_settings

helper_method :has_tokens?

def handle_email_changes
# If mail changed, expire all other sessions
if @user.previous_changes['mail']
Users::DropTokensService.new(current_user: @user).call!
Sessions::DropOtherSessionsService.call!(@user, session)

flash[:info] = "#{flash[:notice]} #{t(:notice_account_other_session_expired)}"
flash.delete :notice
end
end

def has_tokens?
Setting.feeds_enabled? || Setting.rest_api_enabled? || current_user.ical_tokens.any?
end
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def show
.where.not(project_id: nil)
.where(id: Member.visible(current_user))

@groups = @user.groups.visible

if can_show_user?
@events = events
render layout: (can_manage_or_create_users? ? "admin" : "no_menu")
Expand Down
11 changes: 6 additions & 5 deletions app/forms/projects/custom_fields/custom_field_mapping_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,23 @@

module Projects::CustomFields
class CustomFieldMappingForm < ApplicationForm
form do |f|
f.group(layout: :horizontal) do |f_group|
f_group.project_autocompleter(
form do |form|
form.group(layout: :horizontal) do |group|
group.project_autocompleter(
name: :id,
label: Project.model_name.human,
visually_hide_label: true,
autocomplete_options: {
openDirectly: false,
focusDirectly: false,
multiple: true,
dropdownPosition: "bottom",
disabledProjects: projects_with_custom_field_mapping,
inputName: "project_custom_field_project_mapping[project_id]"
inputName: "project_custom_field_project_mapping[project_ids]"
}
)

f_group.check_box(
group.check_box(
name: :include_sub_projects,
label: I18n.t("projects.settings.project_custom_fields.new_project_mapping_form.include_sub_projects"),
checked: false,
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/omniauth_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ def omniauth_direct_login?
# If this option is active /login will lead directly to the configured omniauth provider
# and so will a click on 'Sign in' (as opposed to opening the drop down menu).
def direct_login_provider
Setting.omniauth_direct_login_provider
Setting.omniauth_direct_login_provider.presence
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,30 @@
#++
module WorkPackage::Exports
module Formatters
class DerivedRemainingHours < ::Exports::Formatters::Default
class CompoundHours < ::Exports::Formatters::Default
def self.apply?(name, _export_format)
%i[derived_remaining_time derived_remaining_hours].include?(name.to_sym)
name.to_sym == key
end

def format(work_package, **)
formatted_derived_hours(work_package)
hours = format_value(work_package.public_send(attribute))
derived_hours = total_prefix(format_value(work_package.public_send(:"derived_#{attribute}")))

[hours, derived_hours].compact.join(" ").presence
end

def format_value(value, _options = nil)
DurationConverter.output(value)
end

private

def formatted_hours(value)
value.nil? ? nil : "#{value} #{I18n.t('export.units.hours')}"
def attribute
self.class.key
end

def formatted_derived_hours(work_package)
if (derived_estimated_value = work_package.derived_estimated_hours)
formatted_hours(derived_estimated_value)
end
def total_prefix(value)
value && "· Σ #{value}"
end
end
end
Expand Down
Loading
Loading