summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-08-31 18:02:19 +0200
committerDouwe Maan <douwe@selenight.nl>2017-08-31 18:02:19 +0200
commit92edb3edab89dcb7b87bad3ac0fe7fed404fea85 (patch)
treeb96e7b9d37a789ad252ee5c01a6c2811b9bc88d5 /app
parent7c215dd23dfa942d6b83252403ce326df96ab3ea (diff)
parent9aef0427eb9986fc27a399ea6b47e1518d6ebdac (diff)
downloadgitlab-ce-92edb3edab89dcb7b87bad3ac0fe7fed404fea85.tar.gz
Merge branch 'master' into issue-discussions-refactor
# Conflicts: # app/models/issue.rb
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/fly_out_nav.js13
-rw-r--r--app/assets/javascripts/issue_show/components/edited.vue2
-rw-r--r--app/assets/javascripts/monitoring/components/dashboard.vue (renamed from app/assets/javascripts/monitoring/components/monitoring.vue)56
-rw-r--r--app/assets/javascripts/monitoring/components/empty_state.vue (renamed from app/assets/javascripts/monitoring/components/monitoring_state.vue)52
-rw-r--r--app/assets/javascripts/monitoring/components/graph.vue (renamed from app/assets/javascripts/monitoring/components/monitoring_column.vue)26
-rw-r--r--app/assets/javascripts/monitoring/components/graph/deployment.vue (renamed from app/assets/javascripts/monitoring/components/monitoring_deployment.vue)2
-rw-r--r--app/assets/javascripts/monitoring/components/graph/flag.vue (renamed from app/assets/javascripts/monitoring/components/monitoring_flag.vue)2
-rw-r--r--app/assets/javascripts/monitoring/components/graph/legend.vue (renamed from app/assets/javascripts/monitoring/components/monitoring_legends.vue)4
-rw-r--r--app/assets/javascripts/monitoring/components/graph_group.vue21
-rw-r--r--app/assets/javascripts/monitoring/components/graph_row.vue (renamed from app/assets/javascripts/monitoring/components/monitoring_row.vue)14
-rw-r--r--app/assets/javascripts/monitoring/monitoring_bundle.js6
-rw-r--r--app/assets/javascripts/project_select_combo_button.js16
-rw-r--r--app/assets/javascripts/vue_shared/components/commit.vue20
-rw-r--r--app/assets/stylesheets/framework/dropdowns.scss4
-rw-r--r--app/assets/stylesheets/framework/selects.scss1
-rw-r--r--app/assets/stylesheets/pages/merge_requests.scss2
-rw-r--r--app/controllers/admin/users_controller.rb15
-rw-r--r--app/controllers/concerns/requires_whitelisted_monitoring_client.rb3
-rw-r--r--app/controllers/projects/application_controller.rb2
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/helpers/application_settings_helper.rb3
-rw-r--r--app/helpers/auth_helper.rb2
-rw-r--r--app/helpers/projects_helper.rb2
-rw-r--r--app/mailers/base_mailer.rb4
-rw-r--r--app/models/ci/build.rb4
-rw-r--r--app/models/concerns/spammable.rb2
-rw-r--r--app/models/issue.rb6
-rw-r--r--app/models/merge_request.rb6
-rw-r--r--app/models/namespace.rb4
-rw-r--r--app/models/project.rb5
-rw-r--r--app/models/protected_branch.rb2
-rw-r--r--app/models/repository.rb2
-rw-r--r--app/models/snippet.rb2
-rw-r--r--app/models/user.rb1
-rw-r--r--app/policies/base_policy.rb4
-rw-r--r--app/services/akismet_service.rb2
-rw-r--r--app/services/auth/container_registry_authentication_service.rb2
-rw-r--r--app/services/projects/update_pages_service.rb2
-rw-r--r--app/services/upload_service.rb2
-rw-r--r--app/services/users/build_service.rb2
-rw-r--r--app/views/layouts/nav/_new_project_sidebar.html.haml2
-rw-r--r--app/views/projects/settings/_head.html.haml2
42 files changed, 196 insertions, 130 deletions
diff --git a/app/assets/javascripts/fly_out_nav.js b/app/assets/javascripts/fly_out_nav.js
index 32cb42c8b10..81697af189b 100644
--- a/app/assets/javascripts/fly_out_nav.js
+++ b/app/assets/javascripts/fly_out_nav.js
@@ -1,4 +1,3 @@
-import Cookies from 'js-cookie';
import bp from './breakpoints';
const HIDE_INTERVAL_TIMEOUT = 300;
@@ -8,9 +7,11 @@ const IS_SHOWING_FLY_OUT_CLASS = 'is-showing-fly-out';
let currentOpenMenu = null;
let menuCornerLocs;
let timeoutId;
+let sidebar;
export const mousePos = [];
+export const setSidebar = (el) => { sidebar = el; };
export const setOpenMenu = (menu = null) => { currentOpenMenu = menu; };
export const slope = (a, b) => (b.y - a.y) / (b.x - a.x);
@@ -20,10 +21,8 @@ let headerHeight = 50;
export const getHeaderHeight = () => headerHeight;
export const canShowActiveSubItems = (el) => {
- const isHiddenByMedia = bp.getBreakpointSize() === 'sm' || bp.getBreakpointSize() === 'md';
-
- if (el.classList.contains('active') && !isHiddenByMedia) {
- return Cookies.get('sidebar_collapsed') === 'true';
+ if (el.classList.contains('active') && (sidebar && !sidebar.classList.contains('sidebar-icons-only'))) {
+ return false;
}
return true;
@@ -143,13 +142,13 @@ export const documentMouseMove = (e) => {
};
export default () => {
- const sidebar = document.querySelector('.sidebar-top-level-items');
+ sidebar = document.querySelector('.nav-sidebar');
if (!sidebar) return;
const items = [...sidebar.querySelectorAll('.sidebar-top-level-items > li')];
- sidebar.addEventListener('mouseleave', () => {
+ sidebar.querySelector('.sidebar-top-level-items').addEventListener('mouseleave', () => {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
diff --git a/app/assets/javascripts/issue_show/components/edited.vue b/app/assets/javascripts/issue_show/components/edited.vue
index d59e6d11032..992b7064c13 100644
--- a/app/assets/javascripts/issue_show/components/edited.vue
+++ b/app/assets/javascripts/issue_show/components/edited.vue
@@ -37,7 +37,7 @@ export default {
Edited
<time-ago-tooltip
v-if="updatedAt"
- placement="bottom"
+ tooltip-placement="bottom"
:time="updatedAt"
/>
<span
diff --git a/app/assets/javascripts/monitoring/components/monitoring.vue b/app/assets/javascripts/monitoring/components/dashboard.vue
index a6a2d3119e3..74244faa5d9 100644
--- a/app/assets/javascripts/monitoring/components/monitoring.vue
+++ b/app/assets/javascripts/monitoring/components/dashboard.vue
@@ -3,8 +3,9 @@
import _ from 'underscore';
import statusCodes from '../../lib/utils/http_status';
import MonitoringService from '../services/monitoring_service';
- import monitoringRow from './monitoring_row.vue';
- import monitoringState from './monitoring_state.vue';
+ import GraphGroup from './graph_group.vue';
+ import GraphRow from './graph_row.vue';
+ import EmptyState from './empty_state.vue';
import MonitoringStore from '../stores/monitoring_store';
import eventHub from '../event_hub';
@@ -31,8 +32,9 @@
},
components: {
- monitoringRow,
- monitoringState,
+ GraphGroup,
+ GraphRow,
+ EmptyState,
},
methods: {
@@ -94,7 +96,6 @@
this.updatedAspectRatios = 0;
}
},
-
},
created() {
@@ -118,40 +119,27 @@
},
};
</script>
+
<template>
- <div
- class="prometheus-graphs"
- v-if="!showEmptyState">
- <div
- class="row"
+ <div v-if="!showEmptyState" class="prometheus-graphs">
+ <graph-group
v-for="(groupData, index) in store.groups"
- :key="index">
- <div
- class="col-md-12">
- <div
- class="panel panel-default prometheus-panel">
- <div
- class="panel-heading">
- <h4>{{groupData.group}}</h4>
- </div>
- <div
- class="panel-body">
- <monitoring-row
- v-for="(row, index) in groupData.metrics"
- :key="index"
- :row-data="row"
- :update-aspect-ratio="updateAspectRatio"
- :deployment-data="store.deploymentData"
- />
- </div>
- </div>
- </div>
- </div>
+ :key="index"
+ :name="groupData.group"
+ >
+ <graph-row
+ v-for="(row, index) in groupData.metrics"
+ :key="index"
+ :row-data="row"
+ :update-aspect-ratio="updateAspectRatio"
+ :deployment-data="store.deploymentData"
+ />
+ </graph-group>
</div>
- <monitoring-state
+ <empty-state
+ v-else
:selected-state="state"
:documentation-path="documentationPath"
:settings-path="settingsPath"
- v-else
/>
</template>
diff --git a/app/assets/javascripts/monitoring/components/monitoring_state.vue b/app/assets/javascripts/monitoring/components/empty_state.vue
index 598021aa4df..a8708be76de 100644
--- a/app/assets/javascripts/monitoring/components/monitoring_state.vue
+++ b/app/assets/javascripts/monitoring/components/empty_state.vue
@@ -62,49 +62,33 @@
},
};
</script>
+
<template>
- <div
- class="prometheus-state">
- <div
- class="row">
- <div
- class="col-md-4 col-md-offset-4 state-svg"
- v-html="currentState.svg">
- </div>
+ <div class="prometheus-state">
+ <div class="row">
+ <div class="col-md-4 col-md-offset-4 state-svg" v-html="currentState.svg"></div>
</div>
- <div
- class="row">
- <div
- class="col-md-6 col-md-offset-3">
- <h4
- class="text-center state-title">
+ <div class="row">
+ <div class="col-md-6 col-md-offset-3">
+ <h4 class="text-center state-title">
{{currentState.title}}
</h4>
</div>
</div>
- <div
- class="row">
- <div
- class="col-md-6 col-md-offset-3">
- <div
- class="description-text text-center state-description">
- {{currentState.description}}
- <a
- :href="settingsPath"
- v-if="showButtonDescription">
- Prometheus server
- </a>
+ <div class="row">
+ <div class="col-md-6 col-md-offset-3">
+ <div class="description-text text-center state-description">
+ {{currentState.description}}
+ <a v-if="showButtonDescription" :href="settingsPath">
+ Prometheus server
+ </a>
</div>
</div>
</div>
- <div
- class="row state-button-section">
- <div
- class="col-md-4 col-md-offset-4 text-center state-button">
- <a
- class="btn btn-success"
- :href="buttonPath">
- {{currentState.buttonText}}
+ <div class="row state-button-section">
+ <div class="col-md-4 col-md-offset-4 text-center state-button">
+ <a class="btn btn-success" :href="buttonPath">
+ {{currentState.buttonText}}
</a>
</div>
</div>
diff --git a/app/assets/javascripts/monitoring/components/monitoring_column.vue b/app/assets/javascripts/monitoring/components/graph.vue
index a31c26fb4fc..6f6da9e1463 100644
--- a/app/assets/javascripts/monitoring/components/monitoring_column.vue
+++ b/app/assets/javascripts/monitoring/components/graph.vue
@@ -1,8 +1,8 @@
<script>
import d3 from 'd3';
- import monitoringLegends from './monitoring_legends.vue';
- import monitoringFlag from './monitoring_flag.vue';
- import monitoringDeployment from './monitoring_deployment.vue';
+ import GraphLegend from './graph/legend.vue';
+ import GraphFlag from './graph/flag.vue';
+ import GraphDeployment from './graph/deployment.vue';
import MonitoringMixin from '../mixins/monitoring_mixins';
import eventHub from '../event_hub';
import measurements from '../utils/measurements';
@@ -14,7 +14,7 @@
export default {
props: {
- columnData: {
+ graphData: {
type: Object,
required: true,
},
@@ -66,9 +66,9 @@
},
components: {
- monitoringLegends,
- monitoringFlag,
- monitoringDeployment,
+ GraphLegend,
+ GraphFlag,
+ GraphDeployment,
},
computed: {
@@ -97,7 +97,7 @@
methods: {
draw() {
const breakpointSize = bp.getBreakpointSize();
- const query = this.columnData.queries[0];
+ const query = this.graphData.queries[0];
this.margin = measurements.large.margin;
if (breakpointSize === 'xs' || breakpointSize === 'sm') {
this.graphHeight = 300;
@@ -106,7 +106,7 @@
}
this.data = query.result[0].values;
this.unitOfDisplay = query.unit || '';
- this.yAxisLabel = this.columnData.y_label || 'Values';
+ this.yAxisLabel = this.graphData.y_label || 'Values';
this.legendTitle = query.label || 'Average';
this.graphWidth = this.$refs.baseSvg.clientWidth -
this.margin.left - this.margin.right;
@@ -224,7 +224,7 @@
:class="classType">
<h5
class="text-center graph-title">
- {{columnData.title}}
+ {{graphData.title}}
</h5>
<div
class="prometheus-svg-container"
@@ -240,7 +240,7 @@
class="y-axis"
transform="translate(70, 20)">
</g>
- <monitoring-legends
+ <graph-legend
:graph-width="graphWidth"
:graph-height="graphHeight"
:margin="margin"
@@ -268,13 +268,13 @@
stroke-width="2"
transform="translate(-5, 20)">
</path>
- <monitoring-deployment
+ <graph-deployment
:show-deploy-info="showDeployInfo"
:deployment-data="reducedDeploymentData"
:graph-height="graphHeight"
:graph-height-offset="graphHeightOffset"
/>
- <monitoring-flag
+ <graph-flag
v-if="showFlag"
:current-x-coordinate="currentXCoordinate"
:current-y-coordinate="currentYCoordinate"
diff --git a/app/assets/javascripts/monitoring/components/monitoring_deployment.vue b/app/assets/javascripts/monitoring/components/graph/deployment.vue
index dadbcd1aaa6..3623d2ed946 100644
--- a/app/assets/javascripts/monitoring/components/monitoring_deployment.vue
+++ b/app/assets/javascripts/monitoring/components/graph/deployment.vue
@@ -1,5 +1,5 @@
<script>
- import { dateFormat, timeFormat } from '../utils/date_time_formatters';
+ import { dateFormat, timeFormat } from '../../utils/date_time_formatters';
export default {
props: {
diff --git a/app/assets/javascripts/monitoring/components/monitoring_flag.vue b/app/assets/javascripts/monitoring/components/graph/flag.vue
index 61cbeeebb17..c4d4647d240 100644
--- a/app/assets/javascripts/monitoring/components/monitoring_flag.vue
+++ b/app/assets/javascripts/monitoring/components/graph/flag.vue
@@ -1,5 +1,5 @@
<script>
- import { dateFormat, timeFormat } from '../utils/date_time_formatters';
+ import { dateFormat, timeFormat } from '../../utils/date_time_formatters';
export default {
props: {
diff --git a/app/assets/javascripts/monitoring/components/monitoring_legends.vue b/app/assets/javascripts/monitoring/components/graph/legend.vue
index 922a5e1bf0e..d08f9cbffd4 100644
--- a/app/assets/javascripts/monitoring/components/monitoring_legends.vue
+++ b/app/assets/javascripts/monitoring/components/graph/legend.vue
@@ -74,7 +74,7 @@
};
</script>
<template>
- <g
+ <g
class="axis-label-container">
<line
class="label-x-axis-line"
@@ -100,7 +100,7 @@
:width="yLabelWidth"
:height="yLabelHeight">
</rect>
- <text
+ <text
class="label-axis-text y-label-text"
text-anchor="middle"
:transform="textTransform"
diff --git a/app/assets/javascripts/monitoring/components/graph_group.vue b/app/assets/javascripts/monitoring/components/graph_group.vue
new file mode 100644
index 00000000000..32c90fda8cc
--- /dev/null
+++ b/app/assets/javascripts/monitoring/components/graph_group.vue
@@ -0,0 +1,21 @@
+<script>
+export default {
+ props: {
+ name: {
+ type: String,
+ required: true,
+ },
+ },
+};
+</script>
+
+<template>
+ <div class="panel panel-default prometheus-panel">
+ <div class="panel-heading">
+ <h4>{{name}}</h4>
+ </div>
+ <div class="panel-body">
+ <slot />
+ </div>
+ </div>
+</template>
diff --git a/app/assets/javascripts/monitoring/components/monitoring_row.vue b/app/assets/javascripts/monitoring/components/graph_row.vue
index e5528f17880..bdb9149c3b4 100644
--- a/app/assets/javascripts/monitoring/components/monitoring_row.vue
+++ b/app/assets/javascripts/monitoring/components/graph_row.vue
@@ -1,5 +1,5 @@
<script>
- import monitoringColumn from './monitoring_column.vue';
+ import Graph from './graph.vue';
export default {
props: {
@@ -17,7 +17,7 @@
},
},
components: {
- monitoringColumn,
+ Graph,
},
computed: {
bootstrapClass() {
@@ -26,12 +26,12 @@
},
};
</script>
+
<template>
- <div
- class="prometheus-row row">
- <monitoring-column
- v-for="(column, index) in rowData"
- :column-data="column"
+ <div class="prometheus-row row">
+ <graph
+ v-for="(graphData, index) in rowData"
+ :graph-data="graphData"
:class-type="bootstrapClass"
:key="index"
:update-aspect-ratio="updateAspectRatio"
diff --git a/app/assets/javascripts/monitoring/monitoring_bundle.js b/app/assets/javascripts/monitoring/monitoring_bundle.js
index 5d5cb56af72..ef280e02092 100644
--- a/app/assets/javascripts/monitoring/monitoring_bundle.js
+++ b/app/assets/javascripts/monitoring/monitoring_bundle.js
@@ -1,10 +1,10 @@
import Vue from 'vue';
-import Monitoring from './components/monitoring.vue';
+import Dashboard from './components/dashboard.vue';
document.addEventListener('DOMContentLoaded', () => new Vue({
el: '#prometheus-graphs',
components: {
- 'monitoring-dashboard': Monitoring,
+ Dashboard,
},
- render: createElement => createElement('monitoring-dashboard'),
+ render: createElement => createElement('dashboard'),
}));
diff --git a/app/assets/javascripts/project_select_combo_button.js b/app/assets/javascripts/project_select_combo_button.js
index 46a26fb91f4..99cea683d9a 100644
--- a/app/assets/javascripts/project_select_combo_button.js
+++ b/app/assets/javascripts/project_select_combo_button.js
@@ -14,7 +14,14 @@ export default class ProjectSelectComboButton {
bindEvents() {
this.projectSelectInput.siblings('.new-project-item-select-button')
- .on('click', this.openDropdown);
+ .on('click', e => this.openDropdown(e));
+
+ this.newItemBtn.on('click', (e) => {
+ if (!this.getProjectFromLocalStorage()) {
+ e.preventDefault();
+ this.openDropdown(e);
+ }
+ });
this.projectSelectInput.on('change', () => this.selectProject());
}
@@ -28,8 +35,9 @@ export default class ProjectSelectComboButton {
}
}
- openDropdown() {
- $(this).siblings('.project-item-select').select2('open');
+ // eslint-disable-next-line class-methods-use-this
+ openDropdown(event) {
+ $(event.currentTarget).siblings('.project-item-select').select2('open');
}
selectProject() {
@@ -56,10 +64,8 @@ export default class ProjectSelectComboButton {
if (project) {
this.newItemBtn.attr('href', project.url);
this.newItemBtn.text(`${this.formattedText.defaultTextPrefix} in ${project.name}`);
- this.newItemBtn.enable();
} else {
this.newItemBtn.text(`Select project to create ${this.formattedText.presetTextSuffix}`);
- this.newItemBtn.disable();
}
}
diff --git a/app/assets/javascripts/vue_shared/components/commit.vue b/app/assets/javascripts/vue_shared/components/commit.vue
index 262584769e0..50d14282cad 100644
--- a/app/assets/javascripts/vue_shared/components/commit.vue
+++ b/app/assets/javascripts/vue_shared/components/commit.vue
@@ -1,6 +1,7 @@
<script>
import commitIconSvg from 'icons/_icon_commit.svg';
import userAvatarLink from './user_avatar/user_avatar_link.vue';
+ import tooltip from '../directives/tooltip';
export default {
props: {
@@ -100,17 +101,22 @@
this.author.username ? `${this.author.username}'s avatar` : null;
},
},
- data() {
- return { commitIconSvg };
+ directives: {
+ tooltip,
},
components: {
userAvatarLink,
},
+ created() {
+ this.commitIconSvg = commitIconSvg;
+ },
};
</script>
<template>
<div class="branch-commit">
- <div v-if="hasCommitRef" class="icon-container hidden-xs">
+ <div
+ v-if="hasCommitRef"
+ class="icon-container hidden-xs">
<i
v-if="tag"
class="fa fa-tag"
@@ -126,7 +132,10 @@
<a
v-if="hasCommitRef"
class="ref-name hidden-xs"
- :href="commitRef.ref_url">
+ :href="commitRef.ref_url"
+ v-tooltip
+ data-container="body"
+ :title="commitRef.name">
{{commitRef.name}}
</a>
@@ -153,7 +162,8 @@
:img-alt="userImageAltDescription"
:tooltip-text="author.username"
/>
- <a class="commit-row-message"
+ <a
+ class="commit-row-message"
:href="commitUrl">
{{title}}
</a>
diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss
index f79261dfd61..27d9d17bfc4 100644
--- a/app/assets/stylesheets/framework/dropdowns.scss
+++ b/app/assets/stylesheets/framework/dropdowns.scss
@@ -189,7 +189,7 @@
width: auto;
top: 100%;
left: 0;
- z-index: 9;
+ z-index: 200;
min-width: 240px;
max-width: 500px;
margin-top: 2px;
@@ -801,3 +801,5 @@
margin-top: 2px;
}
}
+
+@include new-style-dropdown('.js-namespace-select + ');
diff --git a/app/assets/stylesheets/framework/selects.scss b/app/assets/stylesheets/framework/selects.scss
index 8018eb8ba84..a39927eb0df 100644
--- a/app/assets/stylesheets/framework/selects.scss
+++ b/app/assets/stylesheets/framework/selects.scss
@@ -267,6 +267,7 @@
// TODO: change global style
.ajax-project-dropdown,
+body[data-page="projects:new"] #select2-drop,
body[data-page="projects:blob:new"] #select2-drop,
body[data-page="profiles:show"] #select2-drop,
body[data-page="projects:blob:edit"] #select2-drop {
diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss
index 334bec8dd7e..9d51c0b7a8a 100644
--- a/app/assets/stylesheets/pages/merge_requests.scss
+++ b/app/assets/stylesheets/pages/merge_requests.scss
@@ -612,6 +612,8 @@
}
.mr-version-controls {
+ @include new-style-dropdown;
+
position: relative;
background: $gray-light;
color: $gl-text-color;
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index fa1bc72560e..a99563b7100 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -117,11 +117,14 @@ class Admin::UsersController < Admin::ApplicationController
user_params_with_pass = user_params.dup
if params[:user][:password].present?
- user_params_with_pass.merge!(
+ password_params = {
password: params[:user][:password],
- password_confirmation: params[:user][:password_confirmation],
- password_expires_at: Time.now
- )
+ password_confirmation: params[:user][:password_confirmation]
+ }
+
+ password_params[:password_expires_at] = Time.now unless changing_own_password?
+
+ user_params_with_pass.merge!(password_params)
end
respond_to do |format|
@@ -167,6 +170,10 @@ class Admin::UsersController < Admin::ApplicationController
protected
+ def changing_own_password?
+ user == current_user
+ end
+
def user
@user ||= User.find_by!(username: params[:id])
end
diff --git a/app/controllers/concerns/requires_whitelisted_monitoring_client.rb b/app/controllers/concerns/requires_whitelisted_monitoring_client.rb
index ad2f4bbc486..0218ac83441 100644
--- a/app/controllers/concerns/requires_whitelisted_monitoring_client.rb
+++ b/app/controllers/concerns/requires_whitelisted_monitoring_client.rb
@@ -1,5 +1,8 @@
module RequiresWhitelistedMonitoringClient
extend ActiveSupport::Concern
+
+ include Gitlab::CurrentSettings
+
included do
before_action :validate_ip_whitelisted_or_valid_token!
end
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb
index 221e01b415a..d7dd8ddcb7d 100644
--- a/app/controllers/projects/application_controller.rb
+++ b/app/controllers/projects/application_controller.rb
@@ -94,6 +94,6 @@ class Projects::ApplicationController < ApplicationController
end
def require_pages_enabled!
- not_found unless Gitlab.config.pages.enabled
+ not_found unless @project.pages_available?
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 07775a8b159..36bb7015fa1 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -202,7 +202,7 @@ module ApplicationHelper
end
def support_url
- current_application_settings.help_page_support_url.presence || promo_url + '/getting-help/'
+ Gitlab::CurrentSettings.current_application_settings.help_page_support_url.presence || promo_url + '/getting-help/'
end
def page_filter_path(options = {})
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index 3b76da238e0..04955ed625e 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -1,5 +1,8 @@
module ApplicationSettingsHelper
extend self
+
+ include Gitlab::CurrentSettings
+
delegate :gravatar_enabled?,
:signup_enabled?,
:password_authentication_enabled?,
diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb
index 9c71d6c7f4c..66dc0b1e6f7 100644
--- a/app/helpers/auth_helper.rb
+++ b/app/helpers/auth_helper.rb
@@ -1,4 +1,6 @@
module AuthHelper
+ include Gitlab::CurrentSettings
+
PROVIDERS_WITH_ICONS = %w(twitter github gitlab bitbucket google_oauth2 facebook azure_oauth2 authentiq).freeze
FORM_BASED_PROVIDERS = [/\Aldap/, 'crowd'].freeze
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index bee4950e414..c5490a2d1a8 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -1,4 +1,6 @@
module ProjectsHelper
+ include Gitlab::CurrentSettings
+
def link_to_project(project)
link_to [project.namespace.becomes(Namespace), project], title: h(project.name) do
title = content_tag(:span, project.name, class: 'project-name')
diff --git a/app/mailers/base_mailer.rb b/app/mailers/base_mailer.rb
index 654468bc7fe..8e99db444d6 100644
--- a/app/mailers/base_mailer.rb
+++ b/app/mailers/base_mailer.rb
@@ -1,11 +1,13 @@
class BaseMailer < ActionMailer::Base
+ include Gitlab::CurrentSettings
+
around_action :render_with_default_locale
helper ApplicationHelper
helper MarkupHelper
attr_accessor :current_user
- helper_method :current_user, :can?
+ helper_method :current_user, :can?, :current_application_settings
default from: proc { default_sender_address.format }
default reply_to: proc { default_reply_to_address.format }
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 095192e9894..8adaafe6439 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -387,7 +387,9 @@ module Ci
[
{ key: 'GITLAB_USER_ID', value: user.id.to_s, public: true },
- { key: 'GITLAB_USER_EMAIL', value: user.email, public: true }
+ { key: 'GITLAB_USER_EMAIL', value: user.email, public: true },
+ { key: 'GITLAB_USER_LOGIN', value: user.username, public: true },
+ { key: 'GITLAB_USER_NAME', value: user.name, public: true }
]
end
diff --git a/app/models/concerns/spammable.rb b/app/models/concerns/spammable.rb
index f2707022a4b..731d9b9a745 100644
--- a/app/models/concerns/spammable.rb
+++ b/app/models/concerns/spammable.rb
@@ -28,7 +28,7 @@ module Spammable
def submittable_as_spam?
if user_agent_detail
- user_agent_detail.submittable? && current_application_settings.akismet_enabled
+ user_agent_detail.submittable? && Gitlab::CurrentSettings.current_application_settings.akismet_enabled
else
false
end
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 5820e57e531..8c7d492e605 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -273,7 +273,13 @@ class Issue < ActiveRecord::Base
true
end
+ def update_project_counter_caches?
+ state_changed? || confidential_changed?
+ end
+
def update_project_counter_caches
+ return unless update_project_counter_caches?
+
Projects::OpenIssuesCountService.new(project).refresh_cache
end
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 5be2f6d4e82..ca3a1806ee8 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -942,7 +942,13 @@ class MergeRequest < ActiveRecord::Base
true
end
+ def update_project_counter_caches?
+ state_changed?
+ end
+
def update_project_counter_caches
+ return unless update_project_counter_caches?
+
Projects::OpenMergeRequestsCountService.new(target_project).refresh_cache
end
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index e7bc1d1b080..e7cbc5170e8 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -195,6 +195,10 @@ class Namespace < ActiveRecord::Base
parent.present?
end
+ def subgroup?
+ has_parent?
+ end
+
def soft_delete_without_removing_associations
# We can't use paranoia's `#destroy` since this will hard-delete projects.
# Project uses `pending_delete` instead of the acts_as_paranoia gem.
diff --git a/app/models/project.rb b/app/models/project.rb
index 9d7bea4eb66..5b4904a5c51 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -19,6 +19,7 @@ class Project < ActiveRecord::Base
include Routable
extend Gitlab::ConfigHelper
+ extend Gitlab::CurrentSettings
BoardLimitExceeded = Class.new(StandardError)
@@ -1231,6 +1232,10 @@ class Project < ActiveRecord::Base
File.join(pages_path, 'public')
end
+ def pages_available?
+ Gitlab.config.pages.enabled && !namespace.subgroup?
+ end
+
def remove_private_deploy_keys
exclude_keys_linked_to_other_projects = <<-SQL
NOT EXISTS (
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb
index 5f0d0802ac9..89bfc5f9a9c 100644
--- a/app/models/protected_branch.rb
+++ b/app/models/protected_branch.rb
@@ -2,6 +2,8 @@ class ProtectedBranch < ActiveRecord::Base
include Gitlab::ShellAdapter
include ProtectedRef
+ extend Gitlab::CurrentSettings
+
protected_ref_access_levels :merge, :push
# Check if branch name is marked as protected in the system
diff --git a/app/models/repository.rb b/app/models/repository.rb
index d29d2a83708..b3fa51a14f7 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -1044,7 +1044,7 @@ class Repository
end
def fetch_remote(remote, forced: false, no_tags: false)
- gitlab_shell.fetch_remote(repository_storage_path, disk_path, remote, forced: forced, no_tags: no_tags)
+ gitlab_shell.fetch_remote(raw_repository, remote, forced: forced, no_tags: no_tags)
end
def fetch_ref(source_path, source_ref, target_ref)
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 09d5ff46618..9533aa7f555 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -10,6 +10,8 @@ class Snippet < ActiveRecord::Base
include Spammable
include Editable
+ extend Gitlab::CurrentSettings
+
cache_markdown_field :title, pipeline: :single_line
cache_markdown_field :description
cache_markdown_field :content
diff --git a/app/models/user.rb b/app/models/user.rb
index 70787de4b40..78e7c750c3b 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -2,6 +2,7 @@ require 'carrierwave/orm/activerecord'
class User < ActiveRecord::Base
extend Gitlab::ConfigHelper
+ extend Gitlab::CurrentSettings
include Gitlab::ConfigHelper
include Gitlab::CurrentSettings
diff --git a/app/policies/base_policy.rb b/app/policies/base_policy.rb
index a605a3457c8..8fa7b2753c7 100644
--- a/app/policies/base_policy.rb
+++ b/app/policies/base_policy.rb
@@ -1,8 +1,6 @@
require_dependency 'declarative_policy'
class BasePolicy < DeclarativePolicy::Base
- include Gitlab::CurrentSettings
-
desc "User is an instance admin"
with_options scope: :user, score: 0
condition(:admin) { @user&.admin? }
@@ -15,6 +13,6 @@ class BasePolicy < DeclarativePolicy::Base
desc "The application is restricted from public visibility"
condition(:restricted_public_level, scope: :global) do
- current_application_settings.restricted_visibility_levels.include?(Gitlab::VisibilityLevel::PUBLIC)
+ Gitlab::CurrentSettings.current_application_settings.restricted_visibility_levels.include?(Gitlab::VisibilityLevel::PUBLIC)
end
end
diff --git a/app/services/akismet_service.rb b/app/services/akismet_service.rb
index 7b5482b3cd1..aa6f0e841c9 100644
--- a/app/services/akismet_service.rb
+++ b/app/services/akismet_service.rb
@@ -1,4 +1,6 @@
class AkismetService
+ include Gitlab::CurrentSettings
+
attr_accessor :owner, :text, :options
def initialize(owner, text, options = {})
diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb
index 7dae5880931..9a636346899 100644
--- a/app/services/auth/container_registry_authentication_service.rb
+++ b/app/services/auth/container_registry_authentication_service.rb
@@ -1,6 +1,6 @@
module Auth
class ContainerRegistryAuthenticationService < BaseService
- include Gitlab::CurrentSettings
+ extend Gitlab::CurrentSettings
AUDIENCE = 'container_registry'.freeze
diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb
index 394b336a638..f6b83a2f621 100644
--- a/app/services/projects/update_pages_service.rb
+++ b/app/services/projects/update_pages_service.rb
@@ -1,5 +1,7 @@
module Projects
class UpdatePagesService < BaseService
+ include Gitlab::CurrentSettings
+
BLOCK_SIZE = 32.kilobytes
MAX_SIZE = 1.terabyte
SITE_PATH = 'public/'.freeze
diff --git a/app/services/upload_service.rb b/app/services/upload_service.rb
index 6c5b2baff41..76700dfcdee 100644
--- a/app/services/upload_service.rb
+++ b/app/services/upload_service.rb
@@ -1,4 +1,6 @@
class UploadService
+ include Gitlab::CurrentSettings
+
def initialize(model, file, uploader_class = FileUploader)
@model, @file, @uploader_class = model, file, uploader_class
end
diff --git a/app/services/users/build_service.rb b/app/services/users/build_service.rb
index ff234a3440f..6f05500adea 100644
--- a/app/services/users/build_service.rb
+++ b/app/services/users/build_service.rb
@@ -1,5 +1,7 @@
module Users
class BuildService < BaseService
+ include Gitlab::CurrentSettings
+
def initialize(current_user, params = {})
@current_user = current_user
@params = params.dup
diff --git a/app/views/layouts/nav/_new_project_sidebar.html.haml b/app/views/layouts/nav/_new_project_sidebar.html.haml
index 53dbf9e2f2b..f5361c7af0c 100644
--- a/app/views/layouts/nav/_new_project_sidebar.html.haml
+++ b/app/views/layouts/nav/_new_project_sidebar.html.haml
@@ -208,7 +208,7 @@
= link_to project_settings_ci_cd_path(@project), title: 'CI / CD' do
%span
CI / CD
- - if Gitlab.config.pages.enabled
+ - if @project.pages_available?
= nav_link(controller: :pages) do
= link_to project_pages_path(@project), title: 'Pages' do
%span
diff --git a/app/views/projects/settings/_head.html.haml b/app/views/projects/settings/_head.html.haml
index 15ba09b10ba..7d24c6a9122 100644
--- a/app/views/projects/settings/_head.html.haml
+++ b/app/views/projects/settings/_head.html.haml
@@ -23,7 +23,7 @@
= link_to project_settings_ci_cd_path(@project), title: 'Pipelines' do
%span
Pipelines
- - if Gitlab.config.pages.enabled
+ - if @project.pages_available?
= nav_link(controller: :pages) do
= link_to project_pages_path(@project), title: 'Pages' do
%span