Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Commit

Permalink
Merge branch 'release/8.0' into stable/8
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Sep 26, 2018
2 parents 9c98140 + bcc006e commit 4cd874b
Show file tree
Hide file tree
Showing 130 changed files with 1,448 additions and 866 deletions.
145 changes: 103 additions & 42 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ dist: trusty
cache:
bundler: true
directories:
- frontend/node_modules
- frontend/node_modules/foundation-apps
- public/assets
- app/assets/javascripts/bundles
- app/assets/javascripts/locales

branches:
only:
Expand All @@ -60,56 +63,114 @@ env:
- CI=true
- RAILS_ENV=test

matrix:
- "TEST_SUITE=npm"


- "TEST_SUITE=spec_legacy DB=mysql GROUP_SIZE=1 GROUP=1"
- "TEST_SUITE=spec_legacy DB=postgres GROUP_SIZE=1 GROUP=1"

- "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=1 GROUP=1"
- "TEST_SUITE=cucumber DB=postgres GROUP_SIZE=1 GROUP=1"

- "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=1"
- "TEST_SUITE=specs DB=postgres GROUP_SIZE=4 GROUP=1"
- "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=2"
- "TEST_SUITE=specs DB=postgres GROUP_SIZE=4 GROUP=2"
- "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=3"
- "TEST_SUITE=specs DB=postgres GROUP_SIZE=4 GROUP=3"
- "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=4"
- "TEST_SUITE=specs DB=postgres GROUP_SIZE=4 GROUP=4"

- "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=1"
- "TEST_SUITE=features DB=postgres GROUP_SIZE=4 GROUP=1"
- "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=2"
- "TEST_SUITE=features DB=postgres GROUP_SIZE=4 GROUP=2"
- "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=3"
- "TEST_SUITE=features DB=postgres GROUP_SIZE=4 GROUP=3"
- "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=4"
- "TEST_SUITE=features DB=postgres GROUP_SIZE=4 GROUP=4"


before_install:

# Install pandoc for testing textile migration
- travis_retry sudo apt-get update -qq
- travis_retry sudo apt-get install -qq pandoc

# Install Node latest LTS
- "nvm install --lts"
# work around https://github.com/travis-ci/travis-ci/issues/8969
- travis_retry gem update --system
# Don't install 1.16.3
- gem install bundler -v 1.16.2

# Install Node latest LTS
# This should only be necessary when preparing the cache or for npm test runs
# but installing later fails for unknown reasons.
- nvm install --lts

bundler_args: --binstubs --without development production docker

before_script:
- bash script/ci_setup.sh $TEST_SUITE $DB

script:
- bash script/ci_runner.sh
stages:
- prepare cache
- test

jobs:
include:
- stage: prepare cache
name: 'Prepare cache'
script:
- bash script/ci/cache_prepare.sh
- stage: test
name: 'npm'
script:
- bash script/ci/setup.sh npm
- bash script/ci/runner.sh npm
- name: 'spec_legacy (1/1) - mysql'
script:
- bash script/ci/setup.sh spec_legacy mysql
- bash script/ci/runner.sh spec_legacy 1 1
- name: 'spec_legacy (1/1) - postgresql'
script:
- bash script/ci/setup.sh spec_legacy postgres
- bash script/ci/runner.sh spec_legacy 1 1
- name: 'cucumber (1/1) - mysql'
script:
- bash script/ci/setup.sh cucumber mysql
- bash script/ci/runner.sh cucumber 1 1
- name: 'cucumber (1/1) - postgresql'
script:
- bash script/ci/setup.sh cucumber postgres
- bash script/ci/runner.sh cucumber 1 1
- name: 'unit specs (1/4) - mysql'
script:
- bash script/ci/setup.sh specs mysql
- bash script/ci/runner.sh specs 4 1
- name: 'unit specs (1/4) - postgresql'
script:
- bash script/ci/setup.sh specs postgres
- bash script/ci/runner.sh specs 4 1
- name: 'unit specs (2/4) - mysql'
script:
- bash script/ci/setup.sh specs mysql
- bash script/ci/runner.sh specs 4 2
- name: 'unit specs (2/4) - postgresql'
script:
- bash script/ci/setup.sh spec postgres
- bash script/ci/runner.sh specs 4 2
- name: 'unit specs (3/4) - mysql'
script:
- bash script/ci/setup.sh specs mysql
- bash script/ci/runner.sh specs 4 3
- name: 'unit specs (3/4) - postgresql'
script:
- bash script/ci/setup.sh specs postgres
- bash script/ci/runner.sh specs 4 3
- name: 'unit specs (4/4) - mysql'
script:
- bash script/ci/setup.sh specs mysql
- bash script/ci/runner.sh specs 4 4
- name: 'unit specs (4/4) - postgresql'
script:
- bash script/ci/setup.sh specs postgres
- bash script/ci/runner.sh specs 4 4
- name: 'feature specs (1/4) - mysql'
script:
- bash script/ci/setup.sh features mysql
- bash script/ci/runner.sh features 4 1
- name: 'feature specs (1/4) - postgresql'
script:
- bash script/ci/setup.sh features postgres
- bash script/ci/runner.sh features 4 1
- name: 'feature specs (2/4) - mysql'
script:
- bash script/ci/setup.sh features mysql
- bash script/ci/runner.sh features 4 2
- name: 'feature specs (2/4) - postgresql'
script:
- bash script/ci/setup.sh features postgres
- bash script/ci/runner.sh features 4 2
- name: 'feature specs (3/4) - mysql'
script:
- bash script/ci/setup.sh features mysql
- bash script/ci/runner.sh features 4 3
- name: 'feature specs (3/4) - postgresql'
script:
- bash script/ci/setup.sh features postgres
- bash script/ci/runner.sh features 4 3
- name: 'feature specs (4/4) - mysql'
script:
- bash script/ci/setup.sh features mysql
- bash script/ci/runner.sh features 4 4
- name: 'feature specs (4/4) - postgresql'
script:
- bash script/ci/setup.sh features postgres
- bash script/ci/runner.sh features 4 4


addons:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ gem 'sprockets', '~> 3.7.0'
# also, better than thin since we can control worker concurrency.
gem 'unicorn'

gem 'nokogiri', '~> 1.8.2'
gem 'nokogiri', '~> 1.8.4'

# carrierwave 0.11.3 should allow to use fog-aws without the rest of the
# fog dependency chain. We only need aws here, so we can avoid it
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ GEM
netrc (0.11.0)
newrelic_rpm (4.5.0.337)
nio4r (2.3.0)
nokogiri (1.8.2)
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
nokogumbo (1.5.0)
nokogiri
Expand Down Expand Up @@ -670,7 +670,7 @@ DEPENDENCIES
mysql2 (~> 0.5.0)
net-ldap (~> 0.16.0)
newrelic_rpm
nokogiri (~> 1.8.2)
nokogiri (~> 1.8.4)
oj (~> 3.5.0)
okcomputer (~> 1.16.0)
omniauth!
Expand Down
2 changes: 2 additions & 0 deletions app/assets/javascripts/repository_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@
Enable select2
*/
branch.select2({
dropdownCssClass: '-large-dropdown',
placeholder: I18n.t('js.repositories.select_branch')
}
);
tag.select2({
dropdownCssClass: '-large-dropdown',
placeholder: I18n.t('js.repositories.select_tag'),
});

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/vendor/ckeditor/ckeditor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/assets/javascripts/vendor/ckeditor/ckeditor.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions app/assets/stylesheets/content/_choice.sass
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ $choice-parent-relation-select-width: 375px
.choice--button
.button
margin: 2px


.select2-drop.-large-dropdown
min-width: 25vw
1 change: 0 additions & 1 deletion app/assets/stylesheets/layout/_drop_down.sass
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
.dropdown .dropdown-menu,
.drop-down .menu-drop-down-container
LI > A,
LABEL,
.menu-item
display: block
@include varprop(color, context-menu-unselected-font-color)
Expand Down
97 changes: 97 additions & 0 deletions app/contracts/types/base_contract.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#-- encoding: UTF-8

#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See docs/COPYRIGHT.rdoc for more details.
#++

require 'model_contract'

module Types
class BaseContract < ::ModelContract

def self.model
Type
end

attribute :name
attribute :is_in_roadmap
attribute :is_milestone
attribute :is_default
attribute :color_id
attribute :project_ids
attribute :attribute_groups

validate :validate_current_user_is_admin
validate :validate_attribute_group_names
validate :validate_attribute_groups

def validate_current_user_is_admin
unless user.admin?
errors.add(:base, :error_unauthorized)
end
end

def validate_attribute_group_names
seen = Set.new
model.attribute_groups.each do |group|
errors.add(:attribute_groups, :group_without_name) unless group.key.present?
errors.add(:attribute_groups, :duplicate_group, group: group.key) if seen.add?(group.key).nil?
end
end

def validate_attribute_groups
model.attribute_groups_objects.each do |group|
if group.is_a?(Type::QueryGroup)
validate_query_group(group)
else
validate_attribute_group(group)
end
end
end

def validate_query_group(group)
query = group.query

contract_class = query.persisted? ? Queries::UpdateContract : Queries::CreateContract
contract = contract_class.new(query, user)

unless contract.validate
errors.add(:attribute_groups, :query_invalid, group: group.key, details: contract.errors.full_messages.join)
end
end

def validate_attribute_group(group)
valid_attributes = model.work_package_attributes.keys

group.attributes.each do |key|
if key.is_a?(String) && valid_attributes.exclude?(key)
errors.add(:attribute_groups, :attribute_unknown)
end
end
end
end
end
4 changes: 4 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ def set_localization

def require_login
unless User.current.logged?

# Ensure we reset the session to terminate any old session objects
reset_session

respond_to do |format|
format.any(:html, :atom) do redirect_to signin_path(back_url: login_back_url) end

Expand Down
3 changes: 3 additions & 0 deletions app/controllers/repositories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ def diff
end

def stats
# allow object_src self to be able to load dynamic stats SVGs from ./graph
override_content_security_policy_directives object_src: %w('self')

@show_commits_per_author = current_user.allowed_to_in_project?(:view_commit_author_statistics,
@project)
end
Expand Down
Loading

0 comments on commit 4cd874b

Please sign in to comment.