Skip to content

Commit e66a484

Browse files
Release OpenProject 15.1.1
2 parents acc2d66 + 9ead22d commit e66a484

File tree

93 files changed

+990
-686
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+990
-686
lines changed

app/components/work_package_relations_tab/add_work_package_child_form_component.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ def initialize(work_package:, base_errors: nil)
4747

4848
def submit_url_options
4949
{ method: :post,
50-
url: work_package_children_path(@work_package) }
50+
url: work_package_children_relations_path(@work_package) }
5151
end
5252
end

app/components/work_package_relations_tab/index_component.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
if should_render_add_child?
3838
menu.with_item(
3939
label: t("#{I18N_NAMESPACE}.relations.label_child_singular").capitalize,
40-
href: new_work_package_child_path(@work_package),
40+
href: new_work_package_children_relation_path(@work_package),
4141
test_selector: new_button_test_selector(relation_type: :child),
4242
content_arguments: {
4343
data: { turbo_stream: true }

app/components/work_package_relations_tab/index_component.rb

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ def self.wrapper_key
2727
private
2828

2929
def should_render_add_child?
30+
return false if @work_package.milestone?
31+
3032
helpers.current_user.allowed_in_project?(:manage_subtasks, @work_package.project)
3133
end
3234

app/components/work_package_relations_tab/relation_component.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def edit_path
8585

8686
def destroy_path
8787
if parent_child_relationship?
88-
work_package_child_path(@work_package, @child)
88+
work_package_children_relation_path(@work_package, @child)
8989
else
9090
work_package_relation_path(@work_package, @relation)
9191
end

app/controllers/custom_fields_controller.rb

+10-1
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ class CustomFieldsController < ApplicationController
3030
include CustomFields::SharedActions # share logic with ProjectCustomFieldsControlller
3131
layout "admin"
3232

33+
# rubocop:disable Rails/LexicallyScopedActionFilter
3334
before_action :require_admin
3435
before_action :find_custom_field, only: %i(edit update destroy delete_option reorder_alphabetical)
3536
before_action :prepare_custom_option_position, only: %i(update create)
3637
before_action :find_custom_option, only: :delete_option
38+
before_action :validate_enterprise_token, only: %i(create)
39+
# rubocop:enable Rails/LexicallyScopedActionFilter
3740

3841
def index
3942
# loading wp cfs exclicity to allow for eager loading
40-
@custom_fields_by_type = CustomField.all
43+
@custom_fields_by_type = CustomField
4144
.where.not(type: ["WorkPackageCustomField", "ProjectCustomField"])
4245
.group_by { |f| f.class.name }
4346

@@ -64,6 +67,12 @@ def show_local_breadcrumb
6467
false
6568
end
6669

70+
def validate_enterprise_token
71+
if params.dig(:custom_field, :field_format) == "hierarchy" && !EnterpriseToken.allows_to?(:custom_field_hierarchies)
72+
render_403
73+
end
74+
end
75+
6776
def find_custom_field
6877
@custom_field = CustomField.find(params[:id])
6978
rescue ActiveRecord::RecordNotFound

app/controllers/work_package_children_controller.rb renamed to app/controllers/work_package_children_relations_controller.rb

+21-37
Original file line numberDiff line numberDiff line change
@@ -28,78 +28,62 @@
2828
# See COPYRIGHT and LICENSE files for more details.
2929
#++
3030

31-
class WorkPackageChildrenController < ApplicationController
31+
class WorkPackageChildrenRelationsController < ApplicationController
3232
include OpTurbo::ComponentStream
3333
include OpTurbo::DialogStreamHelper
3434

3535
before_action :set_work_package
3636

3737
before_action :authorize # Short-circuit early if not authorized
3838

39-
before_action :set_child, except: %i[new create]
40-
before_action :set_relations, except: %i[new create]
41-
4239
def new
4340
component = WorkPackageRelationsTab::AddWorkPackageChildDialogComponent
4441
.new(work_package: @work_package)
4542
respond_with_dialog(component)
4643
end
4744

4845
def create
49-
target_work_package_id = params[:work_package][:id]
50-
target_child_work_package = WorkPackage.find(target_work_package_id)
46+
child = WorkPackage.find(params[:work_package][:id])
47+
service_result = set_relation(child:, parent: @work_package)
5148

52-
target_child_work_package.parent = @work_package
49+
respond_with_relations_tab_update(service_result)
50+
end
5351

54-
if target_child_work_package.save
55-
@children = @work_package.children.visible
56-
@relations = @work_package.relations.visible
52+
def destroy
53+
child = WorkPackage.find(params[:id])
54+
service_result = set_relation(child:, parent: nil)
5755

58-
component = WorkPackageRelationsTab::IndexComponent.new(
59-
work_package: @work_package,
60-
relations: @relations,
61-
children: @children
62-
)
63-
replace_via_turbo_stream(component:)
64-
update_flash_message_via_turbo_stream(
65-
message: I18n.t(:notice_successful_update), scheme: :success
66-
)
67-
respond_with_turbo_streams
68-
end
56+
respond_with_relations_tab_update(service_result)
6957
end
7058

71-
def destroy
72-
@child.parent = nil
59+
private
7360

74-
if @child.save
61+
def set_relation(child:, parent:)
62+
WorkPackages::UpdateService.new(user: current_user, model: child)
63+
.call(parent:)
64+
end
65+
66+
def respond_with_relations_tab_update(service_result)
67+
if service_result.success?
7568
@work_package.reload
76-
@children = @work_package.children.visible
7769
component = WorkPackageRelationsTab::IndexComponent.new(
7870
work_package: @work_package,
79-
relations: @relations,
80-
children: @children
71+
relations: @work_package.relations.visible,
72+
children: @work_package.children.visible
8173
)
8274
replace_via_turbo_stream(component:)
8375
update_flash_message_via_turbo_stream(
8476
message: I18n.t(:notice_successful_update), scheme: :success
8577
)
8678

8779
respond_with_turbo_streams
80+
else
81+
respond_with_turbo_streams(status: :unprocessable_entity)
8882
end
8983
end
9084

91-
private
92-
9385
def set_work_package
9486
@work_package = WorkPackage.find(params[:work_package_id])
9587
@project = @work_package.project
9688
end
97-
98-
def set_child
99-
@child = WorkPackage.find(params[:id])
100-
end
101-
102-
def set_relations
103-
@relations = @work_package.relations.visible
104-
end
10589
end

app/controllers/work_package_relations_controller.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def create
6262
if service_result.success?
6363
@work_package.reload
6464
component = WorkPackageRelationsTab::IndexComponent.new(work_package: @work_package,
65-
relations: @work_package.relations,
66-
children: @work_package.children)
65+
relations: @work_package.relations.visible,
66+
children: @work_package.children.visible)
6767
replace_via_turbo_stream(component:)
6868
respond_with_turbo_streams
6969
else
@@ -80,8 +80,8 @@ def update
8080
if service_result.success?
8181
@work_package.reload
8282
component = WorkPackageRelationsTab::IndexComponent.new(work_package: @work_package,
83-
relations: @work_package.relations,
84-
children: @work_package.children)
83+
relations: @work_package.relations.visible,
84+
children: @work_package.children.visible)
8585
replace_via_turbo_stream(component:)
8686
respond_with_turbo_streams
8787
else
@@ -93,11 +93,12 @@ def destroy
9393
service_result = Relations::DeleteService.new(user: current_user, model: @relation).call
9494

9595
if service_result.success?
96-
@children = WorkPackage.where(parent_id: @work_package.id)
96+
@children = WorkPackage.where(parent_id: @work_package.id).visible
9797
@relations = @work_package
9898
.relations
9999
.reload
100100
.includes(:to, :from)
101+
.visible
101102

102103
component = WorkPackageRelationsTab::IndexComponent.new(work_package: @work_package,
103104
relations: @relations,

app/controllers/work_package_relations_tab_controller.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ class WorkPackageRelationsTabController < ApplicationController
3333
before_action :authorize_global
3434

3535
def index
36-
@children = WorkPackage.where(parent_id: @work_package.id)
36+
@children = WorkPackage.where(parent_id: @work_package.id).visible
3737
@relations = @work_package
3838
.relations
39+
.visible
3940
.includes(:to, :from)
4041

4142
component = WorkPackageRelationsTab::IndexComponent.new(

app/services/principals/replace_references_service.rb

+8-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def call(from:, to:)
4343

4444
def rewrite_active_models(from, to)
4545
rewrite_author(from, to)
46+
rewrite_creator(from, to)
4647
rewrite_user(from, to)
4748
rewrite_assigned_to(from, to)
4849
rewrite_responsible(from, to)
@@ -92,6 +93,12 @@ def rewrite_author(from, to)
9293
end
9394
end
9495

96+
def rewrite_creator(from, to)
97+
[AuthProvider].each do |klass|
98+
rewrite(klass, :creator_id, from, to)
99+
end
100+
end
101+
95102
def rewrite_user(from, to)
96103
[TimeEntry,
97104
CostEntry,
@@ -149,7 +156,7 @@ def journal_classes
149156
end
150157

151158
def foreign_keys
152-
%w[author_id user_id assigned_to_id responsible_id logged_by_id presenter_id]
159+
%w[author_id creator_id user_id assigned_to_id responsible_id logged_by_id presenter_id]
153160
end
154161

155162
def rewrite(klass, attribute, from, to)

app/views/wiki/export_multiple.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ See COPYRIGHT and LICENSE files for more details.
5353
<% @pages.each do |page| %>
5454
<hr />
5555
<a name="<%= h(page.to_param) %>" />
56-
<%= format_text page.content ,:text, wiki_links: :anchor %>
56+
<%= format_text page ,:text, wiki_links: :anchor %>
5757
<% end %>
5858
</body>
5959
</html>

app/workers/principals/delete_job.rb

+5
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def delete_associated(principal)
6666
delete_notifications(principal)
6767
delete_private_queries(principal)
6868
delete_tokens(principal)
69+
delete_favorites(principal)
6970
end
7071

7172
def delete_notifications(principal)
@@ -77,6 +78,10 @@ def delete_private_queries(principal)
7778
CostQuery.where(user_id: principal.id, is_public: false).delete_all
7879
end
7980

81+
def delete_favorites(principal)
82+
Favorite.where(user_id: principal.id).delete_all
83+
end
84+
8085
def delete_tokens(principal)
8186
::Token::Base.where(user_id: principal.id).destroy_all
8287
end

config/initializers/menus.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@
675675
{ tab: :relations },
676676
skip_permissions_check: true,
677677
badge: ->(work_package:, **) {
678-
work_package.relations.count + work_package.children.count
678+
work_package.relations.visible.count + work_package.children.visible.count
679679
},
680680
caption: :"js.work_packages.tabs.relations"
681681
menu.push :watchers,

config/initializers/permissions.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@
326326

327327
wpt.permission :manage_subtasks,
328328
{
329-
work_package_children: %i[new create destroy]
329+
work_package_children_relations: %i[new create destroy]
330330
},
331331
permissible_on: :project,
332332
dependencies: :view_work_packages

config/locales/crowdin/de.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ de:
218218
heading: Für alle Projekte
219219
description: Dieses Projekt-Attribut ist in allen Projekten aktiviert, da die Option "Für alle Projekte" aktiviert ist. Es kann nicht für einzelne Projekte deaktiviert werden.
220220
items:
221-
actions: "Element-Aktionen"
221+
actions: "Aktionen"
222222
blankslate:
223223
root:
224224
title: "Ihre Liste der Elemente ist leer"
@@ -651,7 +651,7 @@ de:
651651
follows_description: "Das verknüpfte Arbeitspaket muss beendet sein bevor dieses Arbeitspaket starten kann"
652652
label_child_singular: "Untergeordnetes Arbeitspaket"
653653
label_child_plural: "Untergeordnete Arbeitspakete"
654-
child_description: "Makes the related work package a sub-item of the current (parent) work package"
654+
child_description: "Macht das zugehörige Arbeitspaket zu einem Unterelement des aktuellen (übergeordneten) Arbeitspakets"
655655
label_blocks_singular: "Blockiert"
656656
label_blocks_plural: "Blockiert"
657657
blocks_description: "Das verknüpfte Arbeitspaket kann erst geschlossen werden, wenn dieses Arbeitspaket geschlossen ist"
@@ -1822,7 +1822,7 @@ de:
18221822
label: "XLS"
18231823
columns:
18241824
input_label_report: "Spalten zur Attributtabelle hinzufügen"
1825-
input_caption_report: "Standardmäßig sind alle Attribute, die als Spalten in der Arbeitspaketliste hinzugefügt wurden, ausgewählt. Textfelder sind in der Attribut-Tabelle nicht verfügbar, können aber unterhalb der Tabelle angezeigt werden."
1825+
input_caption_report: "Standardmäßig sind alle Attribute, die als Spalten in der Arbeitspaketliste hinzugefügt wurden, ausgewählt. Langtextfelder sind in der Attributtabelle nicht verfügbar, können aber unterhalb der Tabelle angezeigt werden."
18261826
input_caption_table: "Standardmäßig sind alle Attribute, die als Spalten in der Arbeitspaketliste hinzugefügt wurden, ausgewählt. Textfelder sind in tabellenbasierten Exporten nicht verfügbar."
18271827
pdf:
18281828
export_type:

config/locales/crowdin/js-fr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ fr:
280280
Voulez-vous continuer ?
281281
work_packages_settings:
282282
warning_progress_calculation_mode_change_from_status_to_field_html: >-
283-
Passer du mode de calcul de la progression basé sur le statut au mode basé sur le travail transformera <i>% réalisé</i> en champ librement modifiable. Si vous complétez les champs <i>Travail</i> et <i>Travail restant</i>, ils seront également liés à <i>% réalisé</i>. Changer le champ <i>Travail restant</i> peut alors changer le <i>% réalisé</i>.
283+
Passer du mode de calcul de la progression basé sur le statut au mode basé sur le travail transformera <i>% réalisé</i> en champ librement modifiable. Si vous complétez les champs <i>Travail</i> et <i>Travail restant</i>, ils seront également liés à <i>% réalisé</i>. Changer le champ <i>Travail restant</i> peut alors changer le <i>% réalisé</i>.
284284
warning_progress_calculation_mode_change_from_field_to_status_html: >-
285285
Passer du mode de calcul de la progression basé sur le travail au mode basé sur le statut entraînera la perte de toutes les valeurs de <i>% réalisé</i> existantes et leur remplacement par les valeurs associées à chaque statut. Les valeurs existantes pour <i>Travail restant</i> peuvent également être recalculées pour refléter ce changement. Cette action est irréversible.
286286
custom_actions:

config/locales/crowdin/js-mn.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ mn:
102102
button_save: "Save"
103103
button_settings: "Settings"
104104
button_uncheck_all: "Uncheck all"
105-
button_update: "Update"
105+
button_update: "Шинэчлэх"
106106
button_export-pdf: "Download PDF"
107107
button_export-atom: "Download Atom"
108108
button_generate_pdf: "Generate PDF"

0 commit comments

Comments
 (0)