Skip to content
Snippets Groups Projects
Commit ff67e3ed authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 7071f9bf
No related branches found
No related tags found
No related merge requests found
Showing
with 232 additions and 181 deletions
/* eslint-disable func-names, no-var, no-else-return, consistent-return, one-var, no-return-assign, no-unused-expressions, no-sequences */
/* eslint-disable func-names, no-var, no-else-return, consistent-return, one-var, no-return-assign */
 
import $ from 'jquery';
 
Loading
Loading
@@ -9,40 +9,29 @@ const viewModes = ['two-up', 'swipe'];
export default class ImageFile {
constructor(file) {
this.file = file;
this.requestImageInfo(
$('.two-up.view .frame.deleted img', this.file),
(function(_this) {
return function() {
return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), () => {
_this.initViewModes();
// Load two-up view after images are loaded
// so that we can display the correct width and height information
const $images = $('.two-up.view img', _this.file);
$images.waitForImages(() => {
_this.initView('two-up');
});
});
};
})(this),
this.requestImageInfo($('.two-up.view .frame.deleted img', this.file), () =>
this.requestImageInfo($('.two-up.view .frame.added img', this.file), () => {
this.initViewModes();
// Load two-up view after images are loaded
// so that we can display the correct width and height information
const $images = $('.two-up.view img', this.file);
$images.waitForImages(() => {
this.initView('two-up');
});
}),
);
}
 
initViewModes() {
const viewMode = viewModes[0];
$('.view-modes', this.file).removeClass('hide');
$('.view-modes-menu', this.file).on(
'click',
'li',
(function(_this) {
return function(event) {
if (!$(event.currentTarget).hasClass('active')) {
return _this.activateViewMode(event.currentTarget.className);
}
};
})(this),
);
$('.view-modes-menu', this.file).on('click', 'li', event => {
if (!$(event.currentTarget).hasClass('active')) {
return this.activateViewMode(event.currentTarget.className);
}
});
return this.activateViewMode(viewMode);
}
 
Loading
Loading
@@ -51,15 +40,10 @@ export default class ImageFile {
.removeClass('active')
.filter(`.${viewMode}`)
.addClass('active');
return $(`.view:visible:not(.${viewMode})`, this.file).fadeOut(
200,
(function(_this) {
return function() {
$(`.view.${viewMode}`, _this.file).fadeIn(200);
return _this.initView(viewMode);
};
})(this),
);
return $(`.view:visible:not(.${viewMode})`, this.file).fadeOut(200, () => {
$(`.view.${viewMode}`, this.file).fadeIn(200);
return this.initView(viewMode);
});
}
 
initView(viewMode) {
Loading
Loading
@@ -103,22 +87,18 @@ export default class ImageFile {
.on('touchmove', dragMove);
}
 
prepareFrames(view) {
static prepareFrames(view) {
var maxHeight, maxWidth;
maxWidth = 0;
maxHeight = 0;
$('.frame', view)
.each(
(function() {
return function(index, frame) {
var height, width;
width = $(frame).width();
height = $(frame).height();
maxWidth = width > maxWidth ? width : maxWidth;
return (maxHeight = height > maxHeight ? height : maxHeight);
};
})(this),
)
.each((index, frame) => {
var height, width;
width = $(frame).width();
height = $(frame).height();
maxWidth = width > maxWidth ? width : maxWidth;
return (maxHeight = height > maxHeight ? height : maxHeight);
})
.css({
width: maxWidth,
height: maxHeight,
Loading
Loading
@@ -128,104 +108,95 @@ export default class ImageFile {
 
views = {
'two-up': function() {
return $('.two-up.view .wrap', this.file).each(
(function(_this) {
return function(index, wrap) {
$('img', wrap).each(function() {
var currentWidth;
currentWidth = $(this).width();
if (currentWidth > availWidth / 2) {
return $(this).width(availWidth / 2);
}
});
return _this.requestImageInfo($('img', wrap), (width, height) => {
$('.image-info .meta-width', wrap).text(`${width}px`);
$('.image-info .meta-height', wrap).text(`${height}px`);
return $('.image-info', wrap).removeClass('hide');
});
};
})(this),
);
return $('.two-up.view .wrap', this.file).each((index, wrap) => {
$('img', wrap).each(function() {
var currentWidth;
currentWidth = $(this).width();
if (currentWidth > availWidth / 2) {
return $(this).width(availWidth / 2);
}
});
return this.requestImageInfo($('img', wrap), (width, height) => {
$('.image-info .meta-width', wrap).text(`${width}px`);
$('.image-info .meta-height', wrap).text(`${height}px`);
return $('.image-info', wrap).removeClass('hide');
});
});
},
swipe() {
var maxHeight, maxWidth;
maxWidth = 0;
maxHeight = 0;
return $('.swipe.view', this.file).each(
(function(_this) {
return function(index, view) {
var $swipeWrap, $swipeBar, $swipeFrame, wrapPadding, ref;
(ref = _this.prepareFrames(view)), ([maxWidth, maxHeight] = ref);
$swipeFrame = $('.swipe-frame', view);
$swipeWrap = $('.swipe-wrap', view);
$swipeBar = $('.swipe-bar', view);
$swipeFrame.css({
width: maxWidth + 16,
height: maxHeight + 28,
});
$swipeWrap.css({
width: maxWidth + 1,
height: maxHeight + 2,
});
// Set swipeBar left position to match image frame
$swipeBar.css({
left: 1,
});
wrapPadding = parseInt($swipeWrap.css('right').replace('px', ''), 10);
_this.initDraggable($swipeBar, wrapPadding, (e, left) => {
if (left > 0 && left < $swipeFrame.width() - wrapPadding * 2) {
$swipeWrap.width(maxWidth + 1 - left);
$swipeBar.css('left', left);
}
});
};
})(this),
);
return $('.swipe.view', this.file).each((index, view) => {
var $swipeWrap, $swipeBar, $swipeFrame, wrapPadding;
const ref = ImageFile.prepareFrames(view);
[maxWidth, maxHeight] = ref;
$swipeFrame = $('.swipe-frame', view);
$swipeWrap = $('.swipe-wrap', view);
$swipeBar = $('.swipe-bar', view);
$swipeFrame.css({
width: maxWidth + 16,
height: maxHeight + 28,
});
$swipeWrap.css({
width: maxWidth + 1,
height: maxHeight + 2,
});
// Set swipeBar left position to match image frame
$swipeBar.css({
left: 1,
});
wrapPadding = parseInt($swipeWrap.css('right').replace('px', ''), 10);
this.initDraggable($swipeBar, wrapPadding, (e, left) => {
if (left > 0 && left < $swipeFrame.width() - wrapPadding * 2) {
$swipeWrap.width(maxWidth + 1 - left);
$swipeBar.css('left', left);
}
});
});
},
'onion-skin': function() {
var dragTrackWidth, maxHeight, maxWidth;
maxWidth = 0;
maxHeight = 0;
dragTrackWidth = $('.drag-track', this.file).width() - $('.dragger', this.file).width();
return $('.onion-skin.view', this.file).each(
(function(_this) {
return function(index, view) {
var $frame, $track, $dragger, $frameAdded, framePadding, ref;
(ref = _this.prepareFrames(view)), ([maxWidth, maxHeight] = ref);
$frame = $('.onion-skin-frame', view);
$frameAdded = $('.frame.added', view);
$track = $('.drag-track', view);
$dragger = $('.dragger', $track);
$frame.css({
width: maxWidth + 16,
height: maxHeight + 28,
});
$('.swipe-wrap', view).css({
width: maxWidth + 1,
height: maxHeight + 2,
});
$dragger.css({
left: dragTrackWidth,
});
$frameAdded.css('opacity', 1);
framePadding = parseInt($frameAdded.css('right').replace('px', ''), 10);
_this.initDraggable($dragger, framePadding, (e, left) => {
var opacity = left / dragTrackWidth;
if (opacity >= 0 && opacity <= 1) {
$dragger.css('left', left);
$frameAdded.css('opacity', opacity);
}
});
};
})(this),
);
return $('.onion-skin.view', this.file).each((index, view) => {
var $frame, $track, $dragger, $frameAdded, framePadding;
const ref = ImageFile.prepareFrames(view);
[maxWidth, maxHeight] = ref;
$frame = $('.onion-skin-frame', view);
$frameAdded = $('.frame.added', view);
$track = $('.drag-track', view);
$dragger = $('.dragger', $track);
$frame.css({
width: maxWidth + 16,
height: maxHeight + 28,
});
$('.swipe-wrap', view).css({
width: maxWidth + 1,
height: maxHeight + 2,
});
$dragger.css({
left: dragTrackWidth,
});
$frameAdded.css('opacity', 1);
framePadding = parseInt($frameAdded.css('right').replace('px', ''), 10);
this.initDraggable($dragger, framePadding, (e, left) => {
var opacity = left / dragTrackWidth;
if (opacity >= 0 && opacity <= 1) {
$dragger.css('left', left);
$frameAdded.css('opacity', opacity);
}
});
});
},
};
 
Loading
Loading
@@ -235,14 +206,7 @@ export default class ImageFile {
if (domImg.complete) {
return callback.call(this, domImg.naturalWidth, domImg.naturalHeight);
} else {
return img.on(
'load',
(function(_this) {
return function() {
return callback.call(_this, domImg.naturalWidth, domImg.naturalHeight);
};
})(this),
);
return img.on('load', () => callback.call(this, domImg.naturalWidth, domImg.naturalHeight));
}
}
}
Loading
Loading
/* eslint-disable no-new */
import AbuseReports from './abuse_reports';
import UsersSelect from '~/users_select';
 
document.addEventListener('DOMContentLoaded', () => new AbuseReports());
document.addEventListener('DOMContentLoaded', () => {
new AbuseReports();
new UsersSelect();
});
Loading
Loading
@@ -49,7 +49,7 @@
line-height: $line-height-base;
position: relative;
min-height: $modal-body-height;
padding: #{2 * $grid-size} #{6 * $grid-size} #{2 * $grid-size} #{2 * $grid-size};
padding: #{2 * $grid-size};
text-align: left;
white-space: normal;
 
Loading
Loading
@@ -70,9 +70,9 @@
margin: 0;
}
 
.btn + .btn:not(.dropdown-toggle-split),
.btn + .btn-group,
.btn-group + .btn {
.btn-group + .btn,
.btn-group + .btn-group {
margin-left: $grid-size;
}
 
Loading
Loading
@@ -83,13 +83,6 @@
@include media-breakpoint-down(xs) {
flex-direction: column;
 
.btn + .btn:not(.dropdown-toggle-split),
.btn + .btn-group,
.btn-group + .btn {
margin-left: 0;
margin-top: $grid-size;
}
.btn-group .btn + .btn {
margin-left: -1px;
margin-top: 0;
Loading
Loading
Loading
Loading
@@ -274,6 +274,12 @@
height: 24px;
}
 
.git-clone-holder {
.btn {
height: auto;
}
}
.dropdown-toggle,
.clone-dropdown-btn {
.fa {
Loading
Loading
Loading
Loading
@@ -131,7 +131,6 @@
 
.modal-security-report-dast {
.modal-dialog {
width: $modal-lg;
max-width: $modal-lg;
}
 
Loading
Loading
# frozen_string_literal: true
 
class Admin::AbuseReportsController < Admin::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def index
@abuse_reports = AbuseReport.order(id: :desc).page(params[:page])
@abuse_reports = @abuse_reports.includes(:user, :reporter)
@abuse_reports = AbuseReportsFinder.new(params).execute
end
# rubocop: enable CodeReuse/ActiveRecord
 
def destroy
abuse_report = AbuseReport.find(params[:id])
Loading
Loading
# frozen_string_literal: true
class AbuseReportsFinder
attr_reader :params
def initialize(params = {})
@params = params
end
def execute
reports = AbuseReport.all
reports = reports.by_user(params[:user_id]) if params[:user_id].present?
reports.with_order_id_desc
.with_users
.page(params[:page])
end
end
Loading
Loading
@@ -2,6 +2,7 @@
 
class AbuseReport < ApplicationRecord
include CacheMarkdownField
include Sortable
 
cache_markdown_field :message, pipeline: :single_line
 
Loading
Loading
@@ -13,6 +14,9 @@ class AbuseReport < ApplicationRecord
validates :message, presence: true
validates :user_id, uniqueness: { message: 'has already been reported' }
 
scope :by_user, -> (user) { where(user_id: user) }
scope :with_users, -> { includes(:reporter, :user) }
# For CacheMarkdownField
alias_method :author, :reporter
 
Loading
Loading
Loading
Loading
@@ -6,11 +6,14 @@ class AwardEmoji < ApplicationRecord
 
include Participable
include GhostUser
include Importable
 
belongs_to :awardable, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations
belongs_to :user
 
validates :awardable, :user, presence: true
validates :user, presence: true
validates :awardable, presence: true, unless: :importing?
validates :name, presence: true, inclusion: { in: Gitlab::Emoji.emojis_names }
validates :name, uniqueness: { scope: [:user, :awardable_type, :awardable_id] }, unless: :ghost_user?
 
Loading
Loading
- page_title 'Abuse Reports'
%h3.page-title Abuse Reports
%hr
- page_title _('Abuse Reports')
%h3.page-title= _('Abuse Reports')
.row-content-block.second-block
= form_tag admin_abuse_reports_path, method: :get, class: 'filter-form' do
.filter-categories.flex-fill
.filter-item.inline
= dropdown_tag(user_dropdown_label(params[:user_id], 'User'),
options: { toggle_class: 'js-filter-submit js-user-search',
title: _('Filter by user'), filter: true, filterInput: 'input#user-search',
dropdown_class: 'dropdown-menu-selectable dropdown-menu-user js-filter-submit',
placeholder: _('Search users'),
data: { current_user: true, field_name: 'user_id' }})
.abuse-reports
- if @abuse_reports.present?
.table-holder
Loading
Loading
Loading
Loading
@@ -13,5 +13,11 @@
- @project.pages_domains.each do |domain|
%p
= external_link(domain.url, domain.url)
- unless @project.public_pages?
.card-footer.alert-warning
- help_page = help_page_path('/user/project/pages/pages_access_control')
- link_start = '<a href="%{url}" target="_blank" class="alert-link" rel="noopener noreferrer">'.html_safe % { url: help_page }
- link_end = '</a>'.html_safe
= s_('GitLabPages|Access Control is enabled for this Pages website; only authorized users will be able to access it. To make your website publicly available, navigate to your project\'s %{strong_start}Settings > General > Visibility%{strong_end} and select %{strong_start}Everyone%{strong_end} in pages section. Read the %{link_start}documentation%{link_end} for more information.').html_safe % { link_start: link_start, link_end: link_end, strong_start: '<strong>'.html_safe, strong_end: '</strong>'.html_safe }
.card-footer.alert-primary
= s_('GitLabPages|It may take up to 30 minutes before the site is available after the first deployment.')
- page_title 'Pages'
 
%h3.page-title.with-button
= s_('GitLabPages|Pages')
- if @project.pages_enabled?
%h3.page-title.with-button
= s_('GitLabPages|Pages')
 
- if can?(current_user, :update_pages, @project) && (Gitlab.config.pages.external_http || Gitlab.config.pages.external_https)
= link_to new_project_pages_domain_path(@project), class: 'btn btn-success float-right', title: s_('GitLabPages|New Domain') do
= s_('GitLabPages|New Domain')
- if can?(current_user, :update_pages, @project) && (Gitlab.config.pages.external_http || Gitlab.config.pages.external_https)
= link_to new_project_pages_domain_path(@project), class: 'btn btn-success float-right', title: s_('GitLabPages|New Domain') do
= s_('GitLabPages|New Domain')
 
%p.light
= s_('GitLabPages|With GitLab Pages you can host your static websites on GitLab. Combined with the power of GitLab CI and the help of GitLab Runner you can deploy static pages for your individual projects, your user or your group.')
- if Gitlab.config.pages.external_https
= render 'https_only'
%p.light
= s_('GitLabPages|With GitLab Pages you can host your static websites on GitLab. Combined with the power of GitLab CI and the help of GitLab Runner you can deploy static pages for your individual projects, your user or your group.')
- if Gitlab.config.pages.external_https
= render 'https_only'
 
%hr.clearfix
%hr.clearfix
 
= render 'access'
= render 'use'
- if Gitlab.config.pages.external_http || Gitlab.config.pages.external_https
= render 'list'
= render 'access'
= render 'use'
- if Gitlab.config.pages.external_http || Gitlab.config.pages.external_https
= render 'list'
- else
= render 'no_domains'
= render 'destroy'
- else
= render 'no_domains'
= render 'destroy'
.bs-callout.bs-callout-warning
= s_('GitLabPages|GitLab Pages are disabled for this project. You can enable them on your project\'s %{strong_start}Settings > General > Visibility%{strong_end} page.').html_safe % { strong_start: '<strong>'.html_safe, strong_end: '</strong>'.html_safe }
---
title: Add ability to reorder projects on operations dashboard
merge_request: 18855
author:
type: added
---
title: Fixes mobile styling issues on security modals
merge_request: 19391
author:
type: fixed
---
title: Add warnings about pages access control settings
merge_request: 19067
author:
type: added
---
title: Hide repeated trial offers on self-hosted instances
merge_request: 19511
author:
type: changed
---
title: Fix import of snippets having `award_emoji` (Project Export/Import)
merge_request: 19690
author:
type: fixed
---
title: Removed IIFEs from image_file.js
merge_request: 19548
author: nuwe1
type: other
---
title: Handle new Container Scanning report format
merge_request: 19123
author:
type: changed
---
title: Add user filtering to abuse reports page
merge_request: 19365
author:
type: changed
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment