Skip to content

Commit

Permalink
Merge branch 'release/15.3' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
openprojectci committed Feb 8, 2025
2 parents d36b9cb + 3aefd1c commit b83c60a
Show file tree
Hide file tree
Showing 113 changed files with 832 additions and 552 deletions.
2 changes: 1 addition & 1 deletion app/components/shares/invite_user_form_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
) do |form|
grid_layout('invite-user-form', tag: :div) do |invite_form|
invite_form.with_area('invitee') do
render(Shares::Invitee.new(form, allow_hover_cards:))
render(Shares::Invitee.new(form))
end

invite_form.with_area('permission') do
Expand Down
5 changes: 2 additions & 3 deletions app/components/shares/invite_user_form_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@ class InviteUserFormComponent < ApplicationComponent # rubocop:disable OpenProje
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers

attr_reader :entity, :strategy, :errors, :allow_hover_cards
attr_reader :entity, :strategy, :errors

def initialize(strategy:, errors: nil, allow_hover_cards: false)
def initialize(strategy:, errors: nil)
super

@strategy = strategy
@entity = strategy.entity
@errors = errors
@allow_hover_cards = allow_hover_cards
end

def new_share
Expand Down
10 changes: 2 additions & 8 deletions app/components/shares/manage_shares_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%=
if strategy.manageable?
modal_content.with_row do
render(Shares::InviteUserFormComponent.new(strategy:, errors:, allow_hover_cards:))
render(Shares::InviteUserFormComponent.new(strategy:, errors:))
end
end

Expand Down Expand Up @@ -100,15 +100,9 @@
end
else
strategy.shares.each do |share|
render(Shares::ShareRowComponent.new(share:, strategy:, container: border_box, allow_hover_cards:))
render(Shares::ShareRowComponent.new(share:, strategy:, container: border_box))
end
end
end
end

if allow_hover_cards
modal_content.with_row do
helpers.angular_component_tag 'opce-custom-modal-overlay', class: 'op-user-share-modal-overlay'
end
end
%>
2 changes: 0 additions & 2 deletions app/components/shares/manage_shares_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class ManageSharesComponent < ApplicationComponent # rubocop:disable OpenProject
attr_reader :strategy,
:entity,
:errors,
:allow_hover_cards,
:modal_content

def initialize(strategy:, modal_content:, errors: nil)
Expand All @@ -46,7 +45,6 @@ def initialize(strategy:, modal_content:, errors: nil)
@entity = strategy.entity
@errors = errors
@modal_content = modal_content
@allow_hover_cards = strategy.allow_hover_cards?
end

def self.wrapper_key
Expand Down
2 changes: 1 addition & 1 deletion app/components/shares/share_row_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

user_row_grid.with_area(:avatar, tag: :div) do
render(Users::AvatarComponent.new(user: principal, show_name: false, size: :medium,
hover_card: { active: allow_hover_cards, target: :custom }))
hover_card: { active: true }))
end

user_row_grid.with_area(:user_details, tag: :div, classes: 'ellipsis') do
Expand Down
5 changes: 2 additions & 3 deletions app/components/shares/share_row_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ShareRowComponent < ApplicationComponent # rubocop:disable OpenProject/Add
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers

def initialize(share:, strategy:, container: nil, allow_hover_cards: false)
def initialize(share:, strategy:, container: nil)
super

@share = share
Expand All @@ -45,7 +45,6 @@ def initialize(share:, strategy:, container: nil, allow_hover_cards: false)
@principal = share.principal
@available_roles = strategy.available_roles
@container = container
@allow_hover_cards = allow_hover_cards
end

def wrapper_uniq_by
Expand All @@ -54,7 +53,7 @@ def wrapper_uniq_by

private

attr_reader :share, :entity, :principal, :container, :available_roles, :strategy, :allow_hover_cards
attr_reader :share, :entity, :principal, :container, :available_roles, :strategy

def share_editable?
@share_editable ||= User.current != share.principal && sharing_manageable?
Expand Down
16 changes: 7 additions & 9 deletions app/components/shares/user_details_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
<%= component_wrapper do
<%=
component_wrapper do
flex_layout do |flex|
flex.with_row do
render(
Primer::Beta::Link.new(
font_weight: :semibold,
href: principal_show_path,
)
) { user.name }
helpers.primer_link_to_user(user, font_weight: :semibold, href: principal_show_path)
end

flex.with_row(classes: "ellipsis") do
Expand All @@ -24,7 +20,8 @@
concat(
form_with(url: resend_invite_path, method: :post) do
render(Primer::Beta::Button.new(type: :submit, px: 0, scheme: :link)) { I18n.t("sharing.user_details.resend_invite") }
end)
end
)
end
end
else
Expand All @@ -35,4 +32,5 @@
end
end
end
end %>
end
%>
2 changes: 1 addition & 1 deletion app/components/users/avatar_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AvatarComponent < ApplicationComponent
include OpPrimer::ComponentHelpers

def initialize(user:, show_name: true, link: true, size: "default", classes: "", title: nil, name_classes: "",
hover_card: { active: true, target: :default })
hover_card: { active: true })
super

@user = user
Expand Down
17 changes: 17 additions & 0 deletions app/controllers/work_package_relations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ def create
.call(create_relation_params)

respond_with_relations_tab_update(service_result, relation_to_scroll_to: service_result.result)

if service_result.failure?
update_via_turbo_stream(
component: WorkPackageRelationsTab::WorkPackageRelationFormComponent.new(work_package: @work_package,
relation: service_result.result,
base_errors: service_result.errors[:base]),
status: :bad_request
)
end
end

def update
Expand All @@ -69,6 +78,14 @@ def update
.call(update_relation_params)

respond_with_relations_tab_update(service_result)
if service_result.failure?
update_via_turbo_stream(
component: WorkPackageRelationsTab::WorkPackageRelationFormComponent.new(work_package: @work_package,
relation: service_result.result,
base_errors: service_result.errors[:base]),
status: :bad_request
)
end
end

def destroy
Expand Down
5 changes: 2 additions & 3 deletions app/forms/shares/invitee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@ class Invitee < ApplicationForm
appendToComponent: true,
disabled: @disabled,
isOpenedInModal: true,
hoverCards: @allow_hover_cards
hoverCards: true
}
)
end

def initialize(disabled: false, allow_hover_cards: false)
def initialize(disabled: false)
super()
@disabled = disabled
@allow_hover_cards = allow_hover_cards
end
end
end
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def theme_options_for_select

def body_data_attributes(local_assigns)
{
controller: "application",
controller: "application hover-card-trigger",
relative_url_root: root_path,
overflowing_identifier: ".__overflowing_body",
rendered_at: Time.zone.now.iso8601,
Expand Down
6 changes: 5 additions & 1 deletion app/models/relation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ class Relation < ApplicationRecord
scope :follows_with_lag,
-> { follows.where("lag > 0") }

validates :lag, numericality: { allow_nil: true }
validates :lag, numericality: {
allow_nil: true,
less_than_or_equal_to: 2_147_483_647,
greater_than_or_equal_to: 0
}

validates :to, uniqueness: { scope: :from }

Expand Down
4 changes: 0 additions & 4 deletions app/models/sharing_strategies/base_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ def manageable?
raise NotImplementedError, "Override in a subclass and return true if the current user can manage sharing"
end

def allow_hover_cards?
raise NotImplementedError, "Override in a subclass and return true if hover cards should appear hovering users"
end

def create_contract_class
raise NotImplementedError, "Override in a subclass and return the contract class for creating a share"
end
Expand Down
4 changes: 0 additions & 4 deletions app/models/sharing_strategies/project_query_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ def viewable?
@entity.visible?
end

def allow_hover_cards?
true
end

def create_contract_class
Shares::ProjectQueries::CreateContract
end
Expand Down
7 changes: 0 additions & 7 deletions app/models/sharing_strategies/work_package_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ def viewable?
user.allowed_in_project?(:view_shared_work_packages, @entity.project)
end

# Since the work package share dialog is embedded into an angular page, hover cards would compete for the
# portal outlet when rendering, causing bugs. Until the work package share dialog is refactored to be an
# async-dialog, we must disable hover cards for it.
def allow_hover_cards?
false
end

def share_description(share) # rubocop:disable Metrics/PerceivedComplexity,Metrics/AbcSize
scope = %i[sharing user_details]

Expand Down
11 changes: 11 additions & 0 deletions config/database.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,26 @@ DATABASE_OPTIONS = %w[
pool
username
password
passfile
sslmode
sslcompression
sslcert
sslkey
sslpassword
sslrootcert
sslcrl
ssl_min_protocol_version
application_name
statement_timeout
channel_binding
connect_timeout
client_encoding
keepalives
keepalives_idle
keepalives_interval
keepalives_count
gssencmode
replication
].freeze
DATABASE_VARIABLES = %w[
Expand Down
6 changes: 4 additions & 2 deletions config/initializers/permissions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,16 @@
map.permission :view_project_stages_and_gates,
{},
permissible_on: :project,
dependencies: :view_project
dependencies: :view_project,
visible: -> { OpenProject::FeatureDecisions.stages_and_gates_active? }

map.permission :edit_project_stages_and_gates,
{},
permissible_on: :project,
require: :member,
dependencies: :view_project_stages_and_gates,
contract_actions: { projects: %i[update] }
contract_actions: { projects: %i[update] },
visible: -> { OpenProject::FeatureDecisions.stages_and_gates_active? }

map.permission :select_project_life_cycle,
{
Expand Down
4 changes: 4 additions & 0 deletions config/locales/crowdin/af.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,10 @@ af:
from:
error_not_found: "work package in `from` position not found or not visible"
error_readonly: "an existing relation's `from` link is immutable"
lag:
greater_than_or_equal_to:
zero: "cannot be negative."
less_than_or_equal_to: "is too high."
repository:
not_available: "SCM vendor is not available"
not_whitelisted: "is not allowed by the configuration."
Expand Down
4 changes: 4 additions & 0 deletions config/locales/crowdin/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,10 @@ ar:
from:
error_not_found: "work package in `from` position not found or not visible"
error_readonly: "علاقة الارتباط هذه غير ممكن تغييرها"
lag:
greater_than_or_equal_to:
zero: "cannot be negative."
less_than_or_equal_to: "is too high."
repository:
not_available: "بائع SCM غير متاح"
not_whitelisted: "غير مسموح بالتكوين."
Expand Down
4 changes: 4 additions & 0 deletions config/locales/crowdin/az.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,10 @@ az:
from:
error_not_found: "work package in `from` position not found or not visible"
error_readonly: "an existing relation's `from` link is immutable"
lag:
greater_than_or_equal_to:
zero: "cannot be negative."
less_than_or_equal_to: "is too high."
repository:
not_available: "SCM vendor is not available"
not_whitelisted: "is not allowed by the configuration."
Expand Down
4 changes: 4 additions & 0 deletions config/locales/crowdin/be.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,10 @@ be:
from:
error_not_found: "work package in `from` position not found or not visible"
error_readonly: "an existing relation's `from` link is immutable"
lag:
greater_than_or_equal_to:
zero: "cannot be negative."
less_than_or_equal_to: "is too high."
repository:
not_available: "SCM vendor is not available"
not_whitelisted: "is not allowed by the configuration."
Expand Down
4 changes: 4 additions & 0 deletions config/locales/crowdin/bg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,10 @@ bg:
from:
error_not_found: "work package in `from` position not found or not visible"
error_readonly: "an existing relation's `from` link is immutable"
lag:
greater_than_or_equal_to:
zero: "cannot be negative."
less_than_or_equal_to: "is too high."
repository:
not_available: "SCM доставчик не е наличен"
not_whitelisted: "не е позволено от конфигурацията."
Expand Down
4 changes: 4 additions & 0 deletions config/locales/crowdin/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,10 @@ ca:
from:
error_not_found: "paquet de treball en posició \"des de\" no trobada o no visible"
error_readonly: "una relació d'enllaç existent \"des de\" és inamovible"
lag:
greater_than_or_equal_to:
zero: "cannot be negative."
less_than_or_equal_to: "is too high."
repository:
not_available: "El proveïdor SCM no està disponible"
not_whitelisted: "no està permès per la configuració."
Expand Down
4 changes: 4 additions & 0 deletions config/locales/crowdin/ckb-IR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,10 @@ ckb-IR:
from:
error_not_found: "work package in `from` position not found or not visible"
error_readonly: "an existing relation's `from` link is immutable"
lag:
greater_than_or_equal_to:
zero: "cannot be negative."
less_than_or_equal_to: "is too high."
repository:
not_available: "SCM vendor is not available"
not_whitelisted: "is not allowed by the configuration."
Expand Down
4 changes: 4 additions & 0 deletions config/locales/crowdin/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,10 @@ cs:
from:
error_not_found: "pracovní balíček v pozici `od` nebyl nalezen nebo není viditelný"
error_readonly: "existující odkaz `od` je neměnný"
lag:
greater_than_or_equal_to:
zero: "cannot be negative."
less_than_or_equal_to: "is too high."
repository:
not_available: "Prodejce SCM není k dispozici"
not_whitelisted: "není povoleno konfigurací."
Expand Down
4 changes: 4 additions & 0 deletions config/locales/crowdin/da.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,10 @@ da:
from:
error_not_found: "work package in `from` position not found or not visible"
error_readonly: "an existing relation's `from` link is immutable"
lag:
greater_than_or_equal_to:
zero: "cannot be negative."
less_than_or_equal_to: "is too high."
repository:
not_available: "SCM-leverandør utilgængelig"
not_whitelisted: "tillades ikke af opsætningen."
Expand Down
Loading

0 comments on commit b83c60a

Please sign in to comment.