diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-07 15:06:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-07 15:06:21 +0300 |
commit | 84a0e65ac88c7a3db86a0e4347606ba093490bef (patch) | |
tree | 860de954548b509e92f6f95a66c8c75cf389efb0 /app | |
parent | bf3d94a7332ff411b654137a1d1288c399fceba4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/ide/stores/actions/file.js | 7 | ||||
-rw-r--r-- | app/assets/javascripts/ide/stores/utils.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/main.js | 18 | ||||
-rw-r--r-- | app/views/layouts/header/_current_user_dropdown.html.haml | 4 | ||||
-rw-r--r-- | app/views/layouts/header/_default.html.haml | 4 | ||||
-rw-r--r-- | app/views/layouts/header/_help_dropdown.html.haml | 4 |
6 files changed, 15 insertions, 26 deletions
diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js index 59445afc7a4..0393f3859a9 100644 --- a/app/assets/javascripts/ide/stores/actions/file.js +++ b/app/assets/javascripts/ide/stores/actions/file.js @@ -5,7 +5,7 @@ import eventHub from '../../eventhub'; import service from '../../services'; import * as types from '../mutation_types'; import router from '../../ide_router'; -import { setPageTitle, replaceFileUrl } from '../utils'; +import { setPageTitle, replaceFileUrl, addFinalNewlineIfNeeded } from '../utils'; import { viewerTypes, stageKeys } from '../../constants'; export const closeFile = ({ commit, state, dispatch }, file) => { @@ -140,7 +140,10 @@ export const getRawFileData = ({ state, commit, dispatch, getters }, { path }) = export const changeFileContent = ({ commit, dispatch, state }, { path, content }) => { const file = state.entries[path]; - commit(types.UPDATE_FILE_CONTENT, { path, content }); + commit(types.UPDATE_FILE_CONTENT, { + path, + content: addFinalNewlineIfNeeded(content), + }); const indexOfChangedFile = state.changedFiles.findIndex(f => f.path === path); diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js index a8d8ff31afe..3ccb3722e6f 100644 --- a/app/assets/javascripts/ide/stores/utils.js +++ b/app/assets/javascripts/ide/stores/utils.js @@ -269,3 +269,7 @@ export const pathsAreEqual = (a, b) => { return cleanA === cleanB; }; + +// if the contents of a file dont end with a newline, this function adds a newline +export const addFinalNewlineIfNeeded = content => + content.charAt(content.length - 1) !== '\n' ? `${content}\n` : content; diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 007eecdd293..465c9a362ba 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -160,24 +160,6 @@ function deferredInitialisation() { }); loadAwardsHandler(); - - /** - * Toggle Canary Badge - * - * For GitLab.com only, when the user is using canary - * we render a Next badge and hide the option to switch - * to canay - */ - if (Cookies.get('gitlab_canary') && Cookies.get('gitlab_canary') === 'true') { - const canaryBadge = document.querySelector('.js-canary-badge'); - const canaryLink = document.querySelector('.js-canary-link'); - if (canaryBadge) { - canaryBadge.classList.remove('hidden'); - } - if (canaryLink) { - canaryLink.classList.add('hidden'); - } - } } document.addEventListener('DOMContentLoaded', () => { diff --git a/app/views/layouts/header/_current_user_dropdown.html.haml b/app/views/layouts/header/_current_user_dropdown.html.haml index efe74ddd902..484a5053a4b 100644 --- a/app/views/layouts/header/_current_user_dropdown.html.haml +++ b/app/views/layouts/header/_current_user_dropdown.html.haml @@ -35,8 +35,8 @@ %li.d-md-none = render 'shared/user_dropdown_contributing_link' = render_if_exists 'shared/user_dropdown_instance_review' - - if Gitlab.com? - %li.js-canary-link.d-md-none + - if Gitlab.com_but_not_canary? + %li.d-md-none = link_to _("Switch to GitLab Next"), "https://next.gitlab.com/" - if current_user_menu?(:sign_out) diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index d8697be7f7a..5719fb24b89 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -18,8 +18,8 @@ - if logo_text.present? %span.logo-text.d-none.d-lg-block.prepend-left-8 = logo_text - - if Gitlab.com? - = link_to 'https://next.gitlab.com', class: 'label-link js-canary-badge canary-badge bg-transparent hidden', target: :_blank do + - if Gitlab.com_and_canary? + = link_to 'https://next.gitlab.com', class: 'label-link canary-badge bg-transparent', target: :_blank do %span.color-label.has-tooltip.badge.badge-pill.green-badge = _('Next') diff --git a/app/views/layouts/header/_help_dropdown.html.haml b/app/views/layouts/header/_help_dropdown.html.haml index 71977b23481..93854c212df 100644 --- a/app/views/layouts/header/_help_dropdown.html.haml +++ b/app/views/layouts/header/_help_dropdown.html.haml @@ -12,6 +12,6 @@ %li = render 'shared/user_dropdown_contributing_link' = render_if_exists 'shared/user_dropdown_instance_review' - - if Gitlab.com? - %li.js-canary-link + - if Gitlab.com_but_not_canary? + %li = link_to _("Switch to GitLab Next"), "https://next.gitlab.com/" |