diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 15:06:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 15:06:34 +0300 |
commit | cd4cb29b2c304f00d238ee72fe40c767cb3e2675 (patch) | |
tree | 4dba0f038795f8d8f43ed807a1b7f58af27b61a9 /app | |
parent | 2b339d4e892045d1d7be117d1557a5394ebd6e72 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js | 68 | ||||
-rw-r--r-- | app/assets/javascripts/projects/project_new.js | 4 | ||||
-rw-r--r-- | app/controllers/groups_controller.rb | 1 | ||||
-rw-r--r-- | app/services/concerns/users/participable_service.rb | 3 | ||||
-rw-r--r-- | app/services/issues/duplicate_service.rb | 2 | ||||
-rw-r--r-- | app/views/groups/settings/_permissions.html.haml | 7 |
6 files changed, 54 insertions, 31 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index db3ad0bb4c9..e25c9d90f60 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -3,11 +3,44 @@ import 'at.js'; import _ from 'underscore'; import glRegexp from './lib/utils/regexp'; import AjaxCache from './lib/utils/ajax_cache'; +import { spriteIcon } from './lib/utils/common_utils'; function sanitize(str) { return str.replace(/<(?:.|\n)*?>/gm, ''); } +export function membersBeforeSave(members) { + return _.map(members, member => { + const GROUP_TYPE = 'Group'; + + let title = ''; + if (member.username == null) { + return member; + } + title = member.name; + if (member.count && !member.mentionsDisabled) { + title += ` (${member.count})`; + } + + const autoCompleteAvatar = member.avatar_url || member.username.charAt(0).toUpperCase(); + + const rectAvatarClass = member.type === GROUP_TYPE ? 'rect-avatar' : ''; + const imgAvatar = `<img src="${member.avatar_url}" alt="${member.username}" class="avatar ${rectAvatarClass} avatar-inline center s26"/>`; + const txtAvatar = `<div class="avatar ${rectAvatarClass} center avatar-inline s26">${autoCompleteAvatar}</div>`; + const avatarIcon = member.mentionsDisabled + ? spriteIcon('notifications-off', 's16 vertical-align-middle prepend-left-5') + : ''; + + return { + username: member.username, + avatarTag: autoCompleteAvatar.length === 1 ? txtAvatar : imgAvatar, + title: sanitize(title), + search: sanitize(`${member.username} ${member.name}`), + icon: avatarIcon, + }; + }); +} + export const defaultAutocompleteConfig = { emojis: true, members: true, @@ -167,12 +200,13 @@ class GfmAutoComplete { alias: 'users', displayTpl(value) { let tmpl = GfmAutoComplete.Loading.template; - const { avatarTag, username, title } = value; + const { avatarTag, username, title, icon } = value; if (username != null) { tmpl = GfmAutoComplete.Members.templateFunction({ avatarTag, username, title, + icon, }); } return tmpl; @@ -185,33 +219,7 @@ class GfmAutoComplete { data: GfmAutoComplete.defaultLoadingData, callbacks: { ...this.getDefaultCallbacks(), - beforeSave(members) { - return $.map(members, m => { - let title = ''; - if (m.username == null) { - return m; - } - title = m.name; - if (m.count) { - title += ` (${m.count})`; - } - - const GROUP_TYPE = 'Group'; - - const autoCompleteAvatar = m.avatar_url || m.username.charAt(0).toUpperCase(); - - const rectAvatarClass = m.type === GROUP_TYPE ? 'rect-avatar' : ''; - const imgAvatar = `<img src="${m.avatar_url}" alt="${m.username}" class="avatar ${rectAvatarClass} avatar-inline center s26"/>`; - const txtAvatar = `<div class="avatar ${rectAvatarClass} center avatar-inline s26">${autoCompleteAvatar}</div>`; - - return { - username: m.username, - avatarTag: autoCompleteAvatar.length === 1 ? txtAvatar : imgAvatar, - title: sanitize(title), - search: sanitize(`${m.username} ${m.name}`), - }; - }); - }, + beforeSave: membersBeforeSave, }, }); } @@ -624,8 +632,8 @@ GfmAutoComplete.Emoji = { }; // Team Members GfmAutoComplete.Members = { - templateFunction({ avatarTag, username, title }) { - return `<li>${avatarTag} ${username} <small>${_.escape(title)}</small></li>`; + templateFunction({ avatarTag, username, title, icon }) { + return `<li>${avatarTag} ${username} <small>${_.escape(title)}</small> ${icon}</li>`; }, }; GfmAutoComplete.Labels = { diff --git a/app/assets/javascripts/projects/project_new.js b/app/assets/javascripts/projects/project_new.js index 2429da9c061..dac105d7243 100644 --- a/app/assets/javascripts/projects/project_new.js +++ b/app/assets/javascripts/projects/project_new.js @@ -182,6 +182,10 @@ const bindEvents = () => { text: s__('ProjectTemplates|Netlify/Hexo'), icon: '.template-option .icon-netlify', }, + salesforcedx: { + text: s__('ProjectTemplates|SalesforceDX'), + icon: '.template-option svg.icon-gitlab', + }, serverless_framework: { text: s__('ProjectTemplates|Serverless Framework/JS'), icon: '.template-option .icon-serverless_framework', diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 755d97b091c..0953ca96317 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -181,6 +181,7 @@ class GroupsController < Groups::ApplicationController :avatar, :description, :emails_disabled, + :mentions_disabled, :lfs_enabled, :name, :path, diff --git a/app/services/concerns/users/participable_service.rb b/app/services/concerns/users/participable_service.rb index 1c828234f1b..6fde9abfdb0 100644 --- a/app/services/concerns/users/participable_service.rb +++ b/app/services/concerns/users/participable_service.rb @@ -55,7 +55,8 @@ module Users username: group.full_path, name: group.full_name, avatar_url: group.avatar_url, - count: group_counts.fetch(group.id, 0) + count: group_counts.fetch(group.id, 0), + mentionsDisabled: group.mentions_disabled } end end diff --git a/app/services/issues/duplicate_service.rb b/app/services/issues/duplicate_service.rb index 82c226f601e..c936d75e277 100644 --- a/app/services/issues/duplicate_service.rb +++ b/app/services/issues/duplicate_service.rb @@ -25,3 +25,5 @@ module Issues end end end + +Issues::DuplicateService.prepend_if_ee('EE::Issues::DuplicateService') diff --git a/app/views/groups/settings/_permissions.html.haml b/app/views/groups/settings/_permissions.html.haml index 4c88660ccb9..618cfe57be4 100644 --- a/app/views/groups/settings/_permissions.html.haml +++ b/app/views/groups/settings/_permissions.html.haml @@ -23,6 +23,13 @@ %span.d-block= s_('GroupSettings|Disable email notifications') %span.text-muted= s_('GroupSettings|This setting will override user notification preferences for all members of the group, subgroups, and projects.') + .form-group.append-bottom-default + .form-check + = f.check_box :mentions_disabled, checked: @group.mentions_disabled?, class: 'form-check-input' + = f.label :mentions_disabled, class: 'form-check-label' do + %span.d-block= s_('GroupSettings|Disable group mentions') + %span.text-muted= s_('GroupSettings|This setting will prevent group members from being notified if the group is mentioned.') + = render_if_exists 'groups/settings/ip_restriction', f: f, group: @group = render_if_exists 'groups/settings/allowed_email_domain', f: f, group: @group = render 'groups/settings/lfs', f: f |