Merge branch 'release/7.4' into dev

pull/6142/head
Jens Ulferts 7 years ago
commit fd0464d6c5
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 2
      Gemfile
  2. 4
      Gemfile.lock
  3. 2
      app/assets/stylesheets/layout/_top_menu.sass
  4. 1
      app/assets/stylesheets/layout/_work_packages_details_view.sass
  5. 26
      app/contracts/relations/update_contract.rb
  6. 16
      spec/features/work_packages/details/details_relations_spec.rb

@ -56,7 +56,7 @@ gem 'friendly_id', '~> 5.2.1'
gem 'acts_as_list', '~> 0.9.9'
gem 'acts_as_tree', '~> 2.7.0'
gem 'awesome_nested_set', '~> 3.1.3'
gem 'typed_dag', '~> 2.0.0'
gem 'typed_dag', '~> 2.0.1'
gem 'color-tools', '~> 1.3.0', require: 'color'

@ -568,7 +568,7 @@ GEM
tilt (2.0.7)
timecop (0.9.1)
ttfunk (1.5.0)
typed_dag (2.0.0)
typed_dag (2.0.1)
rails (>= 5.0.4)
tzinfo (1.2.3)
thread_safe (~> 0.1)
@ -719,7 +719,7 @@ DEPENDENCIES
thin (~> 1.7.2)
timecop (~> 0.9.0)
transactional_lock!
typed_dag (~> 2.0.0)
typed_dag (~> 2.0.1)
tzinfo-data (~> 1.2017.2)
unicorn
unicorn-worker-killer

@ -67,7 +67,7 @@
position: relative
li.drop-down,
li.help-menu--overridden-link,
.accessibility-mode & li
.accessibility-mode & #account-nav-left li
float: left
list-style-type: none
white-space: nowrap

@ -52,6 +52,7 @@ body.action-create
page-break-inside: avoid
break-inside: avoid
overflow: hidden
backface-visibility: visible
.work-packages--details
height: 100%

@ -32,17 +32,29 @@ require 'relations/base_contract'
module Relations
class UpdateContract < BaseContract
def validate
links_immutable
validate :from_immutable
validate :to_immutable
super
private
def from_immutable
errors.add :from, :error_readonly if from_id_changed_and_not_swapped?
end
private
def to_immutable
errors.add :to, :error_readonly if to_id_changed_and_not_swapped?
end
def from_id_changed_and_not_swapped?
model.from_id_changed? && !from_and_to_swapped?
end
def to_id_changed_and_not_swapped?
model.to_id_changed? && !from_and_to_swapped?
end
def links_immutable
errors.add :from, :error_readonly if model.from_id_changed?
errors.add :to, :error_readonly if model.to_id_changed?
def from_and_to_swapped?
model.to_id == model.from_id_was && model.from_id == model.to_id_was
end
end
end

@ -137,17 +137,31 @@ describe 'Work package relations tab', js: true, selenium: true do
find(toggle_btn_selector).click
expect(page).to have_selector(toggle_btn_selector, text: 'Group by relation type', wait: 10)
# Expect current to be follows and other one related
expect(page).to have_selector('.relation-row--type', text: 'Follows')
expect(page).to have_selector('.relation-row--type', text: 'Related To')
# Expect current to be follows, then edit to blocks
# edit to blocks
relations.edit_relation_type(to_1, to_type: 'Blocks')
# the other one should not be altered
expect(page).to have_selector('.relation-row--type', text: 'Blocks')
expect(page).to have_selector('.relation-row--type', text: 'Related To')
updated_relation = Relation.find(relation_1.id)
expect(updated_relation.relation_type).to eq('blocks')
expect(updated_relation.from_id).to eq(work_package.id)
expect(updated_relation.to_id).to eq(to_1.id)
relations.edit_relation_type(to_1, to_type: 'Blocked by')
expect(page).to have_selector('.relation-row--type', text: 'Blocked by')
expect(page).to have_selector('.relation-row--type', text: 'Related To')
updated_relation = Relation.find(relation_1.id)
expect(updated_relation.relation_type).to eq('blocks')
expect(updated_relation.from_id).to eq(to_1.id)
expect(updated_relation.to_id).to eq(work_package.id)
end
end

Loading…
Cancel
Save