diff options
Diffstat (limited to 'app')
212 files changed, 720 insertions, 441 deletions
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index 1d1415fe6ca..7cc4e6a2c3a 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -85,6 +85,9 @@ export default { } return __('Show latest version'); }, + canCurrentUserFork() { + return this.currentUser.canFork === true && this.currentUser.canCreateMergeRequest; + }, }, watch: { diffViewType() { @@ -192,7 +195,7 @@ export default { v-for="file in diffFiles" :key="file.newPath" :file="file" - :current-user="currentUser" + :can-current-user-fork="canCurrentUserFork" /> </div> <no-changes v-else /> diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index 944084f05c9..7e7058d8d08 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -18,8 +18,8 @@ export default { type: Object, required: true, }, - currentUser: { - type: Object, + canCurrentUserFork: { + type: Boolean, required: true, }, }, @@ -87,7 +87,7 @@ export default { class="diff-file file-holder" > <diff-file-header - :current-user="currentUser" + :can-current-user-fork="canCurrentUserFork" :diff-file="file" :collapsible="true" :expanded="!isCollapsed" diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index c5abd0a9568..c494d3bcd3e 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -39,8 +39,8 @@ export default { required: false, default: true, }, - currentUser: { - type: Object, + canCurrentUserFork: { + type: Boolean, required: true, }, }, @@ -228,7 +228,7 @@ export default { <edit-button v-if="!diffFile.deletedFile" - :current-user="currentUser" + :can-current-user-fork="canCurrentUserFork" :edit-path="diffFile.editPath" :can-modify-blob="diffFile.canModifyBlob" @showForkMessage="showForkMessage" diff --git a/app/assets/javascripts/diffs/components/diff_line_note_form.vue b/app/assets/javascripts/diffs/components/diff_line_note_form.vue index db380e68bd1..32f9516d332 100644 --- a/app/assets/javascripts/diffs/components/diff_line_note_form.vue +++ b/app/assets/javascripts/diffs/components/diff_line_note_form.vue @@ -13,12 +13,8 @@ export default { noteForm, }, props: { - diffFile: { - type: Object, - required: true, - }, - diffLines: { - type: Array, + diffFileHash: { + type: String, required: true, }, line: { @@ -40,6 +36,7 @@ export default { noteableData: state => state.notes.noteableData, diffViewType: state => state.diffs.diffViewType, }), + ...mapGetters('diffs', ['getDiffFileByHash']), ...mapGetters(['isLoggedIn', 'noteableType', 'getNoteableData', 'getNotesDataByProp']), }, mounted() { @@ -68,13 +65,14 @@ export default { }); }, handleSaveNote(note) { + const selectedDiffFile = this.getDiffFileByHash(this.diffFileHash); const postData = getNoteFormData({ note, noteableData: this.noteableData, noteableType: this.noteableType, noteTargetLine: this.noteTargetLine, diffViewType: this.diffViewType, - diffFile: this.diffFile, + diffFile: selectedDiffFile, linePosition: this.position, }); diff --git a/app/assets/javascripts/diffs/components/diff_table_cell.vue b/app/assets/javascripts/diffs/components/diff_table_cell.vue index bd02b45a63c..5962f30d9bb 100644 --- a/app/assets/javascripts/diffs/components/diff_table_cell.vue +++ b/app/assets/javascripts/diffs/components/diff_table_cell.vue @@ -24,8 +24,12 @@ export default { type: Object, required: true, }, - diffFile: { - type: Object, + fileHash: { + type: String, + required: true, + }, + contextLinesPath: { + type: String, required: true, }, diffViewType: { @@ -120,14 +124,14 @@ export default { :class="classNameMap" > <diff-line-gutter-content - :file-hash="diffFile.fileHash" + :file-hash="fileHash" + :context-lines-path="contextLinesPath" :line-type="normalizedLine.type" :line-code="normalizedLine.lineCode" :line-position="linePosition" :line-number="lineNumber" :meta-data="normalizedLine.metaData" :show-comment-button="showCommentButton" - :context-lines-path="diffFile.contextLinesPath" :is-bottom="isBottom" :is-match-line="isMatchLine" :is-context-line="isContentLine" diff --git a/app/assets/javascripts/diffs/components/edit_button.vue b/app/assets/javascripts/diffs/components/edit_button.vue index ebf90631d76..2fb85ca2f07 100644 --- a/app/assets/javascripts/diffs/components/edit_button.vue +++ b/app/assets/javascripts/diffs/components/edit_button.vue @@ -5,8 +5,8 @@ export default { type: String, required: true, }, - currentUser: { - type: Object, + canCurrentUserFork: { + type: Boolean, required: true, }, canModifyBlob: { @@ -17,12 +17,12 @@ export default { }, methods: { handleEditClick(evt) { - if (!this.currentUser || this.canModifyBlob) { + if (!this.canCurrentUserFork || this.canModifyBlob) { // if we can Edit, do default Edit button behavior return; } - if (this.currentUser.canFork && this.currentUser.canCreateMergeRequest) { + if (this.canCurrentUserFork) { evt.preventDefault(); this.$emit('showForkMessage'); } diff --git a/app/assets/javascripts/diffs/components/inline_diff_comment_row.vue b/app/assets/javascripts/diffs/components/inline_diff_comment_row.vue index 1e8f2eecd76..ca265dd892c 100644 --- a/app/assets/javascripts/diffs/components/inline_diff_comment_row.vue +++ b/app/assets/javascripts/diffs/components/inline_diff_comment_row.vue @@ -13,12 +13,8 @@ export default { type: Object, required: true, }, - diffFile: { - type: Object, - required: true, - }, - diffLines: { - type: Array, + diffFileHash: { + type: String, required: true, }, lineIndex: { @@ -58,10 +54,9 @@ export default { /> <diff-line-note-form v-if="diffLineCommentForms[line.lineCode]" - :diff-file="diffFile" - :diff-lines="diffLines" + :diff-file-hash="diffFileHash" :line="line" - :note-target-line="diffLines[lineIndex]" + :note-target-line="line" /> </div> </td> diff --git a/app/assets/javascripts/diffs/components/inline_diff_table_row.vue b/app/assets/javascripts/diffs/components/inline_diff_table_row.vue index 8e4715c9862..0197a510ef1 100644 --- a/app/assets/javascripts/diffs/components/inline_diff_table_row.vue +++ b/app/assets/javascripts/diffs/components/inline_diff_table_row.vue @@ -16,8 +16,12 @@ export default { DiffTableCell, }, props: { - diffFile: { - type: Object, + fileHash: { + type: String, + required: true, + }, + contextLinesPath: { + type: String, required: true, }, line: { @@ -50,7 +54,7 @@ export default { inlineRowId() { const { lineCode, oldLine, newLine } = this.line; - return lineCode || `${this.diffFile.fileHash}_${oldLine}_${newLine}`; + return lineCode || `${this.fileHash}_${oldLine}_${newLine}`; }, }, created() { @@ -78,7 +82,8 @@ export default { @mouseout="handleMouseMove" > <diff-table-cell - :diff-file="diffFile" + :file-hash="fileHash" + :context-lines-path="contextLinesPath" :line="line" :line-type="oldLineType" :is-bottom="isBottom" @@ -87,7 +92,8 @@ export default { class="diff-line-num old_line" /> <diff-table-cell - :diff-file="diffFile" + :file-hash="fileHash" + :context-lines-path="contextLinesPath" :line="line" :line-type="newLineType" :is-bottom="isBottom" diff --git a/app/assets/javascripts/diffs/components/inline_diff_view.vue b/app/assets/javascripts/diffs/components/inline_diff_view.vue index 9c1359f7c89..9fd19b74cd7 100644 --- a/app/assets/javascripts/diffs/components/inline_diff_view.vue +++ b/app/assets/javascripts/diffs/components/inline_diff_view.vue @@ -60,15 +60,15 @@ export default { v-for="(line, index) in normalizedDiffLines" > <inline-diff-table-row - :diff-file="diffFile" + :file-hash="diffFile.fileHash" + :context-lines-path="diffFile.contextLinesPath" :line="line" :is-bottom="index + 1 === diffLinesLength" :key="line.lineCode" /> <inline-diff-comment-row v-if="shouldRenderCommentRow(line)" - :diff-file="diffFile" - :diff-lines="normalizedDiffLines" + :diff-file-hash="diffFile.fileHash" :line="line" :line-index="index" :key="index" diff --git a/app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue b/app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue index 1e20792b647..cc5248c25d9 100644 --- a/app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue +++ b/app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue @@ -13,12 +13,8 @@ export default { type: Object, required: true, }, - diffFile: { - type: Object, - required: true, - }, - diffLines: { - type: Array, + diffFileHash: { + type: String, required: true, }, lineIndex: { @@ -91,10 +87,9 @@ export default { <diff-line-note-form v-if="diffLineCommentForms[leftLineCode] && diffLineCommentForms[leftLineCode]" - :diff-file="diffFile" - :diff-lines="diffLines" + :diff-file-hash="diffFileHash" :line="line.left" - :note-target-line="diffLines[lineIndex].left" + :note-target-line="line.left" position="left" /> </td> @@ -112,10 +107,9 @@ export default { <diff-line-note-form v-if="diffLineCommentForms[rightLineCode] && diffLineCommentForms[rightLineCode] && line.right.type" - :diff-file="diffFile" - :diff-lines="diffLines" + :diff-file-hash="diffFileHash" :line="line.right" - :note-target-line="diffLines[lineIndex].right" + :note-target-line="line.right" position="right" /> </td> diff --git a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue index b76fc63205b..ee5bb4d8d05 100644 --- a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue +++ b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue @@ -19,8 +19,12 @@ export default { DiffTableCell, }, props: { - diffFile: { - type: Object, + fileHash: { + type: String, + required: true, + }, + contextLinesPath: { + type: String, required: true, }, line: { @@ -103,7 +107,8 @@ export default { @mouseout="handleMouseMove" > <diff-table-cell - :diff-file="diffFile" + :file-hash="fileHash" + :context-lines-path="contextLinesPath" :line="line" :line-type="oldLineType" :line-position="linePositionLeft" @@ -123,7 +128,8 @@ export default { > </td> <diff-table-cell - :diff-file="diffFile" + :file-hash="fileHash" + :context-lines-path="contextLinesPath" :line="line" :line-type="newLineType" :line-position="linePositionRight" diff --git a/app/assets/javascripts/diffs/components/parallel_diff_view.vue b/app/assets/javascripts/diffs/components/parallel_diff_view.vue index 216865474a6..32528c9e7ab 100644 --- a/app/assets/javascripts/diffs/components/parallel_diff_view.vue +++ b/app/assets/javascripts/diffs/components/parallel_diff_view.vue @@ -93,17 +93,17 @@ export default { v-for="(line, index) in parallelDiffLines" > <parallel-diff-table-row - :diff-file="diffFile" + :file-hash="diffFile.fileHash" + :context-lines-path="diffFile.contextLinesPath" :line="line" :is-bottom="index + 1 === diffLinesLength" :key="index" /> <parallel-diff-comment-row v-if="shouldRenderCommentRow(line)" - :key="line.left.lineCode || line.right.lineCode" + :key="`dcr-${index}`" :line="line" - :diff-file="diffFile" - :diff-lines="parallelDiffLines" + :diff-file-hash="diffFile.fileHash" :line-index="index" /> </template> diff --git a/app/assets/javascripts/diffs/store/getters.js b/app/assets/javascripts/diffs/store/getters.js index f89acb73ed8..855de79adf8 100644 --- a/app/assets/javascripts/diffs/store/getters.js +++ b/app/assets/javascripts/diffs/store/getters.js @@ -57,4 +57,8 @@ export const getDiffFileDiscussions = (state, getters, rootState, rootGetters) = ) || []; // prevent babel-plugin-rewire from generating an invalid default during karma∂ tests +export const getDiffFileByHash = state => fileHash => + state.diffFiles.find(file => file.fileHash === fileHash); + +// prevent babel-plugin-rewire from generating an invalid default during karma tests export default () => {}; diff --git a/app/assets/javascripts/ide/components/new_dropdown/button.vue b/app/assets/javascripts/ide/components/new_dropdown/button.vue index 7682b34ce4d..ff114e47741 100644 --- a/app/assets/javascripts/ide/components/new_dropdown/button.vue +++ b/app/assets/javascripts/ide/components/new_dropdown/button.vue @@ -38,6 +38,7 @@ export default { <button :aria-label="label" type="button" + class="btn-blank" @click.stop.prevent="clicked" > <icon diff --git a/app/assets/javascripts/notes/components/diff_with_note.vue b/app/assets/javascripts/notes/components/diff_with_note.vue index 9c2908c477e..27ff7dea909 100644 --- a/app/assets/javascripts/notes/components/diff_with_note.vue +++ b/app/assets/javascripts/notes/components/diff_with_note.vue @@ -1,94 +1,90 @@ <script> - import { mapState, mapActions } from 'vuex'; - import imageDiffHelper from '~/image_diff/helpers/index'; - import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; - import DiffFileHeader from '~/diffs/components/diff_file_header.vue'; - import SkeletonLoadingContainer from '~/vue_shared/components/skeleton_loading_container.vue'; - import { trimFirstCharOfLineContent } from '~/diffs/store/utils'; +import { mapState, mapActions } from 'vuex'; +import imageDiffHelper from '~/image_diff/helpers/index'; +import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; +import DiffFileHeader from '~/diffs/components/diff_file_header.vue'; +import SkeletonLoadingContainer from '~/vue_shared/components/skeleton_loading_container.vue'; +import { trimFirstCharOfLineContent } from '~/diffs/store/utils'; - export default { - components: { - DiffFileHeader, - SkeletonLoadingContainer, +export default { + components: { + DiffFileHeader, + SkeletonLoadingContainer, + }, + props: { + discussion: { + type: Object, + required: true, }, - props: { - discussion: { - type: Object, - required: true, - }, + }, + data() { + return { + error: false, + }; + }, + computed: { + ...mapState({ + noteableData: state => state.notes.noteableData, + }), + hasTruncatedDiffLines() { + return this.discussion.truncatedDiffLines && this.discussion.truncatedDiffLines.length !== 0; }, - data() { - return { - error: false, - }; + isDiscussionsExpanded() { + return true; // TODO: @fatihacet - Fix this. }, - computed: { - ...mapState({ - noteableData: state => state.notes.noteableData, - }), - hasTruncatedDiffLines() { - return this.discussion.truncatedDiffLines && - this.discussion.truncatedDiffLines.length !== 0; - }, - isDiscussionsExpanded() { - return true; // TODO: @fatihacet - Fix this. - }, - isCollapsed() { - return this.diffFile.collapsed || false; - }, - isImageDiff() { - return !this.diffFile.text; - }, - diffFileClass() { - const { text } = this.diffFile; - return text ? 'text-file' : 'js-image-file'; - }, - diffFile() { - return convertObjectPropsToCamelCase(this.discussion.diffFile, { deep: true }); - }, - imageDiffHtml() { - return this.discussion.imageDiffHtml; - }, - currentUser() { - return this.noteableData.current_user; - }, - userColorScheme() { - return window.gon.user_color_scheme; - }, - normalizedDiffLines() { - if (this.discussion.truncatedDiffLines) { - return this.discussion.truncatedDiffLines.map(line => - trimFirstCharOfLineContent(convertObjectPropsToCamelCase(line)), - ); - } - - return []; - }, + isCollapsed() { + return this.diffFile.collapsed || false; + }, + isImageDiff() { + return !this.diffFile.text; + }, + diffFileClass() { + const { text } = this.diffFile; + return text ? 'text-file' : 'js-image-file'; + }, + diffFile() { + return convertObjectPropsToCamelCase(this.discussion.diffFile, { deep: true }); }, - mounted() { - if (this.isImageDiff) { - const canCreateNote = false; - const renderCommentBadge = true; - imageDiffHelper.initImageDiff(this.$refs.fileHolder, canCreateNote, renderCommentBadge); - } else if (!this.hasTruncatedDiffLines) { - this.fetchDiff(); + imageDiffHtml() { + return this.discussion.imageDiffHtml; + }, + userColorScheme() { + return window.gon.user_color_scheme; + }, + normalizedDiffLines() { + if (this.discussion.truncatedDiffLines) { + return this.discussion.truncatedDiffLines.map(line => + trimFirstCharOfLineContent(convertObjectPropsToCamelCase(line)), + ); } + + return []; + }, + }, + mounted() { + if (this.isImageDiff) { + const canCreateNote = false; + const renderCommentBadge = true; + imageDiffHelper.initImageDiff(this.$refs.fileHolder, canCreateNote, renderCommentBadge); + } else if (!this.hasTruncatedDiffLines) { + this.fetchDiff(); + } + }, + methods: { + ...mapActions(['fetchDiscussionDiffLines']), + rowTag(html) { + return html.outerHTML ? 'tr' : 'template'; }, - methods: { - ...mapActions(['fetchDiscussionDiffLines']), - rowTag(html) { - return html.outerHTML ? 'tr' : 'template'; - }, - fetchDiff() { - this.error = false; - this.fetchDiscussionDiffLines(this.discussion) - .then(this.highlight) - .catch(() => { - this.error = true; - }); - }, + fetchDiff() { + this.error = false; + this.fetchDiscussionDiffLines(this.discussion) + .then(this.highlight) + .catch(() => { + this.error = true; + }); }, - }; + }, +}; </script> <template> @@ -99,7 +95,7 @@ > <diff-file-header :diff-file="diffFile" - :current-user="currentUser" + :can-current-user-fork="false" :discussions-expanded="isDiscussionsExpanded" :expanded="!isCollapsed" /> diff --git a/app/assets/javascripts/pipelines/components/stage.vue b/app/assets/javascripts/pipelines/components/stage.vue index 56fdb858088..c7df69c69ed 100644 --- a/app/assets/javascripts/pipelines/components/stage.vue +++ b/app/assets/javascripts/pipelines/components/stage.vue @@ -175,6 +175,7 @@ export default { <span :aria-label="stage.title" aria-hidden="true" + class="no-pointer-events" > <icon :name="borderlessIcon" /> </span> diff --git a/app/assets/javascripts/vue_shared/components/memory_graph.vue b/app/assets/javascripts/vue_shared/components/memory_graph.vue index 522091ea889..552a92541be 100644 --- a/app/assets/javascripts/vue_shared/components/memory_graph.vue +++ b/app/assets/javascripts/vue_shared/components/memory_graph.vue @@ -126,7 +126,7 @@ export default { :cx="dotX" :cy="dotY" r="1.5" - tranform="translate(0 -1)" + transform="translate(0 -1)" /> </svg> </div> diff --git a/app/assets/stylesheets/bootstrap_migration.scss b/app/assets/stylesheets/bootstrap_migration.scss index ded33e8b151..d28ad407734 100644 --- a/app/assets/stylesheets/bootstrap_migration.scss +++ b/app/assets/stylesheets/bootstrap_migration.scss @@ -110,7 +110,7 @@ code { padding: 2px 4px; color: $red-600; background-color: $red-100; - border-radius: 3px; + border-radius: $border-radius-default; .code > & { background-color: inherit; @@ -128,7 +128,8 @@ table { border-spacing: 0; } -.tooltip { +.tooltip, +.no-pointer-events { // Fix bootstrap4 bug whereby tooltips flicker when they are hovered over their borders pointer-events: none; } diff --git a/app/assets/stylesheets/framework/gfm.scss b/app/assets/stylesheets/framework/gfm.scss index 1cf12b1a015..d2ba76f5160 100644 --- a/app/assets/stylesheets/framework/gfm.scss +++ b/app/assets/stylesheets/framework/gfm.scss @@ -9,12 +9,8 @@ .gfm-project_member { padding: 0 2px; - border-radius: #{$border-radius-default / 2}; - background-color: $user-mention-bg; - - &:hover { - background-color: $user-mention-bg-hover; - } + background-color: $blue-100; + border-radius: $border-radius-default; } .gfm-color_chip { diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss index 5835b8b8c9b..c8349a4ef79 100644 --- a/app/assets/stylesheets/pages/merge_requests.scss +++ b/app/assets/stylesheets/pages/merge_requests.scss @@ -551,6 +551,7 @@ @include media-breakpoint-up(lg) { .branch-actions { align-self: center; + margin-left: $gl-padding; } } } diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index c01066c688a..9dc0c31be49 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -116,7 +116,12 @@ class Projects::WikisController < Projects::ApplicationController # Call #wiki to make sure the Wiki Repo is initialized @project_wiki.wiki - @sidebar_wiki_entries = WikiPage.group_by_directory(@project_wiki.pages(limit: 15)) + + @sidebar_page = @project_wiki.find_sidebar(params[:version_id]) + + unless @sidebar_page # Fallback to default sidebar + @sidebar_wiki_entries = WikiPage.group_by_directory(@project_wiki.pages(limit: 15)) + end rescue ProjectWiki::CouldNotCreateWikiError flash[:notice] = "Could not create Wiki Repository at this time. Please try again later." redirect_to project_path(@project) diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb index c7d6bc6cfdc..b06595081e7 100644 --- a/app/finders/projects_finder.rb +++ b/app/finders/projects_finder.rb @@ -16,6 +16,7 @@ # personal: boolean # search: string # non_archived: boolean +# archived: 'only' or boolean # class ProjectsFinder < UnionFinder include CustomAttributesFilter @@ -130,7 +131,7 @@ class ProjectsFinder < UnionFinder def by_archived(projects) if params[:non_archived] projects.non_archived - elsif params.key?(:archived) # Back-compatibility with the places where `params[:archived]` can be set explicitly to `false` + elsif params.key?(:archived) if params[:archived] == 'only' projects.archived elsif Gitlab::Utils.to_boolean(params[:archived]) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index b0f381db5ab..221f1aa9dd8 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -413,20 +413,6 @@ module ProjectsHelper @ref || @repository.try(:root_ref) end - # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1235 - def sanitize_repo_path(project, message) - return '' unless message.present? - - exports_path = File.join(Settings.shared['path'], 'tmp/project_exports') - filtered_message = message.strip.gsub(exports_path, "[REPO EXPORT PATH]") - - disk_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do - Gitlab.config.repositories.storages[project.repository_storage].legacy_disk_path - end - - filtered_message.gsub(disk_path.chomp('/'), "[REPOS PATH]") - end - def project_child_container_class(view_path) view_path == "projects/issues/issues" ? "prepend-top-default" : "project-show-#{view_path}" end diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index 9151543dfdc..ebfde993456 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -8,7 +8,7 @@ module SubmoduleHelper url = repository.submodule_url_for(ref, submodule_item.path) if url == '.' || url == './' - url = File.join(Gitlab.config.gitlab.url, @project.full_path) + url = File.join(Gitlab.config.gitlab.url, repository.project.full_path) end if url =~ %r{([^/:]+)/([^/]+(?:\.git)?)\Z} @@ -31,7 +31,7 @@ module SubmoduleHelper [namespace_project_path(namespace, project), namespace_project_tree_path(namespace, project, submodule_item.id)] elsif relative_self_url?(url) - relative_self_links(url, submodule_item.id) + relative_self_links(url, submodule_item.id, repository.project) elsif github_dot_com_url?(url) standard_links('github.com', namespace, project, submodule_item.id) elsif gitlab_dot_com_url?(url) @@ -73,7 +73,7 @@ module SubmoduleHelper [base, [base, '/tree/', commit].join('')] end - def relative_self_links(url, commit) + def relative_self_links(url, commit, project) url.rstrip! # Map relative links to a namespace and project # For example: @@ -85,7 +85,7 @@ module SubmoduleHelper namespace = components.pop.gsub(/^\.\.$/, '') if namespace.empty? - namespace = @project.namespace.full_path + namespace = project.namespace.full_path end begin diff --git a/app/models/deployment.rb b/app/models/deployment.rb index ac86e9e8de0..687246b47b2 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -92,10 +92,6 @@ class Deployment < ActiveRecord::Base @stop_action ||= manual_actions.find_by(name: on_stop) end - def stop_action? - stop_action.present? - end - def formatted_deployment_time created_at.to_time.in_time_zone.to_s(:medium) end diff --git a/app/models/environment.rb b/app/models/environment.rb index 8d523dae324..4856d313318 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -117,7 +117,7 @@ class Environment < ActiveRecord::Base external_url.gsub(%r{\A.*?://}, '') end - def stop_action? + def stop_action_available? available? && stop_action.present? end diff --git a/app/models/note.rb b/app/models/note.rb index abc40d9016e..fe3507adcb3 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -202,7 +202,7 @@ class Note < ActiveRecord::Base end def hook_attrs - attributes + Gitlab::HookData::NoteBuilder.new(self).build end def for_commit? diff --git a/app/models/project.rb b/app/models/project.rb index 4606cdc70a8..5f582dfa5ee 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2173,10 +2173,13 @@ class Project < ActiveRecord::Base merge_requests = source_of_merge_requests.opened .where(allow_collaboration: true) - if branch_name - merge_requests.find_by(source_branch: branch_name)&.can_be_merged_by?(user) - else - merge_requests.any? { |merge_request| merge_request.can_be_merged_by?(user) } + # Issue for N+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/49322 + Gitlab::GitalyClient.allow_n_plus_1_calls do + if branch_name + merge_requests.find_by(source_branch: branch_name)&.can_be_merged_by?(user) + else + merge_requests.any? { |merge_request| merge_request.can_be_merged_by?(user) } + end end end diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index 9ae2fb0013a..3aa56b3983f 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ProjectWiki include Gitlab::ShellAdapter include Storage::LegacyProjectWiki @@ -9,6 +11,7 @@ class ProjectWiki }.freeze unless defined?(MARKUPS) CouldNotCreateWikiError = Class.new(StandardError) + SIDEBAR = '_sidebar' # Returns a string describing what went wrong after # an operation fails. @@ -98,6 +101,10 @@ class ProjectWiki end end + def find_sidebar(version = nil) + find_page(SIDEBAR, version) + end + def find_file(name, version = nil) wiki.file(name, version) end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 4b49edb01a5..55243136140 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -60,7 +60,7 @@ class WikiPage attr_accessor :attributes def hook_attrs - attributes + Gitlab::HookData::WikiPageBuilder.new(self).build end def initialize(wiki, page = nil, persisted = false) diff --git a/app/policies/environment_policy.rb b/app/policies/environment_policy.rb index 978dc3a7c81..2d07311db72 100644 --- a/app/policies/environment_policy.rb +++ b/app/policies/environment_policy.rb @@ -2,11 +2,12 @@ class EnvironmentPolicy < BasePolicy delegate { @subject.project } condition(:stop_with_deployment_allowed) do - @subject.stop_action? && can?(:create_deployment) && can?(:update_build, @subject.stop_action) + @subject.stop_action_available? && + can?(:create_deployment) && can?(:update_build, @subject.stop_action) end condition(:stop_with_update_allowed) do - !@subject.stop_action? && can?(:update_environment, @subject) + !@subject.stop_action_available? && can?(:update_environment, @subject) end rule { stop_with_deployment_allowed | stop_with_update_allowed }.enable :stop_environment diff --git a/app/serializers/environment_entity.rb b/app/serializers/environment_entity.rb index 0fc3f92b151..83558fc6659 100644 --- a/app/serializers/environment_entity.rb +++ b/app/serializers/environment_entity.rb @@ -7,7 +7,7 @@ class EnvironmentEntity < Grape::Entity expose :external_url expose :environment_type expose :last_deployment, using: DeploymentEntity - expose :stop_action?, as: :has_stop_action + expose :stop_action_available?, as: :has_stop_action expose :metrics_path, if: -> (environment, _) { environment.has_metrics? } do |environment| metrics_project_environment_path(environment.project, environment) diff --git a/app/services/access_token_validation_service.rb b/app/services/access_token_validation_service.rb index 46e19230328..2a337918d21 100644 --- a/app/services/access_token_validation_service.rb +++ b/app/services/access_token_validation_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AccessTokenValidationService # Results: VALID = :valid diff --git a/app/services/after_branch_delete_service.rb b/app/services/after_branch_delete_service.rb index 227e9ea9c6d..e7eb74d3e7d 100644 --- a/app/services/after_branch_delete_service.rb +++ b/app/services/after_branch_delete_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ## # Branch can be deleted either by DeleteBranchService # or by GitPushService. diff --git a/app/services/akismet_service.rb b/app/services/akismet_service.rb index 0521393dd27..82ae66ab0f5 100644 --- a/app/services/akismet_service.rb +++ b/app/services/akismet_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AkismetService attr_accessor :owner, :text, :options diff --git a/app/services/application_settings/base_service.rb b/app/services/application_settings/base_service.rb index 2bcc7d7c08b..ebe067536ca 100644 --- a/app/services/application_settings/base_service.rb +++ b/app/services/application_settings/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationSettings class BaseService < ::BaseService def initialize(application_setting, user, params = {}) diff --git a/app/services/application_settings/update_service.rb b/app/services/application_settings/update_service.rb index 7bcb8f49d0d..19cf34e2ac4 100644 --- a/app/services/application_settings/update_service.rb +++ b/app/services/application_settings/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationSettings class UpdateService < ApplicationSettings::BaseService attr_reader :params, :application_setting diff --git a/app/services/applications/create_service.rb b/app/services/applications/create_service.rb index 94a434b95dd..7db90c0b3c6 100644 --- a/app/services/applications/create_service.rb +++ b/app/services/applications/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Applications class CreateService def initialize(current_user, params) diff --git a/app/services/audit_event_service.rb b/app/services/audit_event_service.rb index 5ad9a50687c..4c5e22bdd7e 100644 --- a/app/services/audit_event_service.rb +++ b/app/services/audit_event_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AuditEventService def initialize(author, entity, details = {}) @author, @entity, @details = author, entity, details diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb index f28cddb2af3..81857d0cb4c 100644 --- a/app/services/auth/container_registry_authentication_service.rb +++ b/app/services/auth/container_registry_authentication_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Auth class ContainerRegistryAuthenticationService < BaseService AUDIENCE = 'container_registry'.freeze diff --git a/app/services/badges/base_service.rb b/app/services/badges/base_service.rb index 4f87426bd38..45fc9ac4373 100644 --- a/app/services/badges/base_service.rb +++ b/app/services/badges/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Badges class BaseService protected diff --git a/app/services/badges/build_service.rb b/app/services/badges/build_service.rb index 6267e571838..e5ede1586b6 100644 --- a/app/services/badges/build_service.rb +++ b/app/services/badges/build_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Badges class BuildService < Badges::BaseService # returns the created badge diff --git a/app/services/badges/create_service.rb b/app/services/badges/create_service.rb index aafb87f7dcd..4a55a00daeb 100644 --- a/app/services/badges/create_service.rb +++ b/app/services/badges/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Badges class CreateService < Badges::BaseService # returns the created badge diff --git a/app/services/badges/update_service.rb b/app/services/badges/update_service.rb index 495a4a2c99d..a653b7903dd 100644 --- a/app/services/badges/update_service.rb +++ b/app/services/badges/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Badges class UpdateService < Badges::BaseService # returns the updated badge diff --git a/app/services/base_count_service.rb b/app/services/base_count_service.rb index 975e288301c..ad1647842b8 100644 --- a/app/services/base_count_service.rb +++ b/app/services/base_count_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Base class for services that count a single resource such as the number of # issues for a project. class BaseCountService diff --git a/app/services/base_renderer.rb b/app/services/base_renderer.rb index d6e30bd7008..30a6e8c62dd 100644 --- a/app/services/base_renderer.rb +++ b/app/services/base_renderer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BaseRenderer attr_reader :current_user diff --git a/app/services/base_service.rb b/app/services/base_service.rb index 3519b7c5e7d..3e968c8f707 100644 --- a/app/services/base_service.rb +++ b/app/services/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BaseService include Gitlab::Allowable diff --git a/app/services/boards/base_service.rb b/app/services/boards/base_service.rb index 72822ffffa1..205db47888e 100644 --- a/app/services/boards/base_service.rb +++ b/app/services/boards/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards class BaseService < ::BaseService # Parent can either a group or a project diff --git a/app/services/boards/create_service.rb b/app/services/boards/create_service.rb index bd0bb387662..4caf5ffa3cb 100644 --- a/app/services/boards/create_service.rb +++ b/app/services/boards/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards class CreateService < Boards::BaseService def execute diff --git a/app/services/boards/issues/create_service.rb b/app/services/boards/issues/create_service.rb index 3025029755c..bd045e18b8d 100644 --- a/app/services/boards/issues/create_service.rb +++ b/app/services/boards/issues/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards module Issues class CreateService < Boards::BaseService diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb index b1dbe73cdf7..50c11be0d15 100644 --- a/app/services/boards/issues/list_service.rb +++ b/app/services/boards/issues/list_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards module Issues class ListService < Boards::BaseService diff --git a/app/services/boards/issues/move_service.rb b/app/services/boards/issues/move_service.rb index ee3112c7571..6fd8a23b2a1 100644 --- a/app/services/boards/issues/move_service.rb +++ b/app/services/boards/issues/move_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards module Issues class MoveService < Boards::BaseService diff --git a/app/services/boards/list_service.rb b/app/services/boards/list_service.rb index 9269b8d2620..edd1cc7c2e1 100644 --- a/app/services/boards/list_service.rb +++ b/app/services/boards/list_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards class ListService < Boards::BaseService def execute diff --git a/app/services/boards/lists/create_service.rb b/app/services/boards/lists/create_service.rb index 6fd9885d4f3..48d2d5abaec 100644 --- a/app/services/boards/lists/create_service.rb +++ b/app/services/boards/lists/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards module Lists class CreateService < Boards::BaseService diff --git a/app/services/boards/lists/destroy_service.rb b/app/services/boards/lists/destroy_service.rb index d75c5fd3dc6..e12d4f46e19 100644 --- a/app/services/boards/lists/destroy_service.rb +++ b/app/services/boards/lists/destroy_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards module Lists class DestroyService < Boards::BaseService diff --git a/app/services/boards/lists/generate_service.rb b/app/services/boards/lists/generate_service.rb index 05d4ab5dbcc..4fbf1026019 100644 --- a/app/services/boards/lists/generate_service.rb +++ b/app/services/boards/lists/generate_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards module Lists class GenerateService < Boards::BaseService diff --git a/app/services/boards/lists/list_service.rb b/app/services/boards/lists/list_service.rb index e57c95294af..e10eb52e041 100644 --- a/app/services/boards/lists/list_service.rb +++ b/app/services/boards/lists/list_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards module Lists class ListService < Boards::BaseService diff --git a/app/services/boards/lists/move_service.rb b/app/services/boards/lists/move_service.rb index 7d0730e8332..27a36051662 100644 --- a/app/services/boards/lists/move_service.rb +++ b/app/services/boards/lists/move_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Boards module Lists class MoveService < Boards::BaseService diff --git a/app/services/chat_names/authorize_user_service.rb b/app/services/chat_names/authorize_user_service.rb index 7256466c9e8..78b53cb3637 100644 --- a/app/services/chat_names/authorize_user_service.rb +++ b/app/services/chat_names/authorize_user_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ChatNames class AuthorizeUserService include Gitlab::Routing diff --git a/app/services/chat_names/find_user_service.rb b/app/services/chat_names/find_user_service.rb index d458b814183..854b191c45c 100644 --- a/app/services/chat_names/find_user_service.rb +++ b/app/services/chat_names/find_user_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ChatNames class FindUserService def initialize(service, params) diff --git a/app/services/ci/create_pipeline_schedule_service.rb b/app/services/ci/create_pipeline_schedule_service.rb index cd40deb6187..0d5f50c26a1 100644 --- a/app/services/ci/create_pipeline_schedule_service.rb +++ b/app/services/ci/create_pipeline_schedule_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class CreatePipelineScheduleService < BaseService def execute diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 17a53b6a8fd..85df8bcff8c 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class CreatePipelineService < BaseService attr_reader :pipeline diff --git a/app/services/ci/ensure_stage_service.rb b/app/services/ci/ensure_stage_service.rb index b8c7be2d350..3d0e39d1b9f 100644 --- a/app/services/ci/ensure_stage_service.rb +++ b/app/services/ci/ensure_stage_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci ## # We call this service everytime we persist a CI/CD job. diff --git a/app/services/ci/extract_sections_from_build_trace_service.rb b/app/services/ci/extract_sections_from_build_trace_service.rb index 75f9e0f897d..693f6d55be3 100644 --- a/app/services/ci/extract_sections_from_build_trace_service.rb +++ b/app/services/ci/extract_sections_from_build_trace_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class ExtractSectionsFromBuildTraceService < BaseService def execute(build) diff --git a/app/services/ci/fetch_kubernetes_token_service.rb b/app/services/ci/fetch_kubernetes_token_service.rb index bca883ec0a0..15eda56cac6 100644 --- a/app/services/ci/fetch_kubernetes_token_service.rb +++ b/app/services/ci/fetch_kubernetes_token_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ## # TODO: # Almost components in this class were copied from app/models/project_services/kubernetes_service.rb diff --git a/app/services/ci/pipeline_trigger_service.rb b/app/services/ci/pipeline_trigger_service.rb index 85533a1cbdb..f54574b026b 100644 --- a/app/services/ci/pipeline_trigger_service.rb +++ b/app/services/ci/pipeline_trigger_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class PipelineTriggerService < BaseService include Gitlab::Utils::StrongMemoize diff --git a/app/services/ci/play_build_service.rb b/app/services/ci/play_build_service.rb index e24f48c2d16..eb0b070657d 100644 --- a/app/services/ci/play_build_service.rb +++ b/app/services/ci/play_build_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class PlayBuildService < ::BaseService def execute(build) diff --git a/app/services/ci/process_pipeline_service.rb b/app/services/ci/process_pipeline_service.rb index 55af193d717..cda9bbff3b4 100644 --- a/app/services/ci/process_pipeline_service.rb +++ b/app/services/ci/process_pipeline_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class ProcessPipelineService < BaseService attr_reader :pipeline diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index 6eb1c4f52de..f7ccec3a700 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci # This class responsible for assigning # proper pending build to runner on runner API request diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index 6128b2a8fbb..6ceb59e4780 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class RetryBuildService < ::BaseService CLONE_ACCESSORS = %i[pipeline project ref tag options commands name diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index c5a43869990..42a13367a99 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class RetryPipelineService < ::BaseService include Gitlab::OptimisticLocking diff --git a/app/services/ci/stop_environments_service.rb b/app/services/ci/stop_environments_service.rb index 43c9a065fcf..973ae5ce5aa 100644 --- a/app/services/ci/stop_environments_service.rb +++ b/app/services/ci/stop_environments_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class StopEnvironmentsService < BaseService attr_reader :ref @@ -8,7 +10,7 @@ module Ci return unless @ref.present? environments.each do |environment| - next unless environment.stop_action? + next unless environment.stop_action_available? next unless can?(current_user, :stop_environment, environment) environment.stop_with_action!(current_user) diff --git a/app/services/ci/update_build_queue_service.rb b/app/services/ci/update_build_queue_service.rb index 41b1c144c3e..9c589d910eb 100644 --- a/app/services/ci/update_build_queue_service.rb +++ b/app/services/ci/update_build_queue_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class UpdateBuildQueueService def execute(build) diff --git a/app/services/ci/update_runner_service.rb b/app/services/ci/update_runner_service.rb index 450ee7da1c9..e4117a51fe6 100644 --- a/app/services/ci/update_runner_service.rb +++ b/app/services/ci/update_runner_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ci class UpdateRunnerService attr_reader :runner diff --git a/app/services/clusters/applications/base_helm_service.rb b/app/services/clusters/applications/base_helm_service.rb index cba1b920f7c..270a8eb24f4 100644 --- a/app/services/clusters/applications/base_helm_service.rb +++ b/app/services/clusters/applications/base_helm_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters module Applications class BaseHelmService diff --git a/app/services/clusters/applications/check_ingress_ip_address_service.rb b/app/services/clusters/applications/check_ingress_ip_address_service.rb index e572b1e5d99..f32e73e8b1c 100644 --- a/app/services/clusters/applications/check_ingress_ip_address_service.rb +++ b/app/services/clusters/applications/check_ingress_ip_address_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters module Applications class CheckIngressIpAddressService < BaseHelmService diff --git a/app/services/clusters/applications/check_installation_progress_service.rb b/app/services/clusters/applications/check_installation_progress_service.rb index 90393e951a4..4640c5a2d4b 100644 --- a/app/services/clusters/applications/check_installation_progress_service.rb +++ b/app/services/clusters/applications/check_installation_progress_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters module Applications class CheckInstallationProgressService < BaseHelmService diff --git a/app/services/clusters/applications/install_service.rb b/app/services/clusters/applications/install_service.rb index 7ec3a9baa6e..7e3c0e77a83 100644 --- a/app/services/clusters/applications/install_service.rb +++ b/app/services/clusters/applications/install_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters module Applications class InstallService < BaseHelmService diff --git a/app/services/clusters/applications/schedule_installation_service.rb b/app/services/clusters/applications/schedule_installation_service.rb index 9c5461e85e1..4ead4f619c8 100644 --- a/app/services/clusters/applications/schedule_installation_service.rb +++ b/app/services/clusters/applications/schedule_installation_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters module Applications class ScheduleInstallationService < ::BaseService diff --git a/app/services/clusters/create_service.rb b/app/services/clusters/create_service.rb index 418888e3293..e3e0cfa462c 100644 --- a/app/services/clusters/create_service.rb +++ b/app/services/clusters/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters class CreateService < BaseService attr_reader :access_token diff --git a/app/services/clusters/gcp/fetch_operation_service.rb b/app/services/clusters/gcp/fetch_operation_service.rb index a4cd3ca5c11..02c96a1e286 100644 --- a/app/services/clusters/gcp/fetch_operation_service.rb +++ b/app/services/clusters/gcp/fetch_operation_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters module Gcp class FetchOperationService diff --git a/app/services/clusters/gcp/finalize_creation_service.rb b/app/services/clusters/gcp/finalize_creation_service.rb index 84944e95542..264419501dc 100644 --- a/app/services/clusters/gcp/finalize_creation_service.rb +++ b/app/services/clusters/gcp/finalize_creation_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters module Gcp class FinalizeCreationService diff --git a/app/services/clusters/gcp/provision_service.rb b/app/services/clusters/gcp/provision_service.rb index 8beea5a8cfb..ab1bf9c64f6 100644 --- a/app/services/clusters/gcp/provision_service.rb +++ b/app/services/clusters/gcp/provision_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters module Gcp class ProvisionService diff --git a/app/services/clusters/gcp/verify_provision_status_service.rb b/app/services/clusters/gcp/verify_provision_status_service.rb index 7cc4324677e..b24246f5c4b 100644 --- a/app/services/clusters/gcp/verify_provision_status_service.rb +++ b/app/services/clusters/gcp/verify_provision_status_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters module Gcp class VerifyProvisionStatusService diff --git a/app/services/clusters/update_service.rb b/app/services/clusters/update_service.rb index 989218e32a2..98fdeec4fb1 100644 --- a/app/services/clusters/update_service.rb +++ b/app/services/clusters/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Clusters class UpdateService < BaseService def execute(cluster) diff --git a/app/services/cohorts_service.rb b/app/services/cohorts_service.rb index 6781533af28..7a14e97f749 100644 --- a/app/services/cohorts_service.rb +++ b/app/services/cohorts_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CohortsService MONTHS_INCLUDED = 12 diff --git a/app/services/commits/change_service.rb b/app/services/commits/change_service.rb index 1ce6ab36cbf..2fbd442fc2e 100644 --- a/app/services/commits/change_service.rb +++ b/app/services/commits/change_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Commits class ChangeService < Commits::CreateService def initialize(*args) diff --git a/app/services/commits/cherry_pick_service.rb b/app/services/commits/cherry_pick_service.rb index 320e229560d..4c5b15b2f95 100644 --- a/app/services/commits/cherry_pick_service.rb +++ b/app/services/commits/cherry_pick_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Commits class CherryPickService < ChangeService def create_commit! diff --git a/app/services/commits/create_service.rb b/app/services/commits/create_service.rb index 4d0578becbe..3ce9acc833c 100644 --- a/app/services/commits/create_service.rb +++ b/app/services/commits/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Commits class CreateService < ::BaseService ValidationError = Class.new(StandardError) diff --git a/app/services/commits/revert_service.rb b/app/services/commits/revert_service.rb index dc27399e047..dddb8b24eac 100644 --- a/app/services/commits/revert_service.rb +++ b/app/services/commits/revert_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Commits class RevertService < ChangeService def create_commit! diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb index 2a69a205629..3adf8a0c1a1 100644 --- a/app/services/compare_service.rb +++ b/app/services/compare_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'securerandom' # Compare 2 refs for one repo or between repositories diff --git a/app/services/concerns/exclusive_lease_guard.rb b/app/services/concerns/exclusive_lease_guard.rb index f45436370c1..f102e00d150 100644 --- a/app/services/concerns/exclusive_lease_guard.rb +++ b/app/services/concerns/exclusive_lease_guard.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # # Concern that helps with getting an exclusive lease for running a block # of code. diff --git a/app/services/concerns/issues/resolve_discussions.rb b/app/services/concerns/issues/resolve_discussions.rb index 455f761ca9b..1563ed965df 100644 --- a/app/services/concerns/issues/resolve_discussions.rb +++ b/app/services/concerns/issues/resolve_discussions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issues module ResolveDiscussions include Gitlab::Utils::StrongMemoize diff --git a/app/services/concerns/update_visibility_level.rb b/app/services/concerns/update_visibility_level.rb index 536fcc6acce..b7a161f5089 100644 --- a/app/services/concerns/update_visibility_level.rb +++ b/app/services/concerns/update_visibility_level.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module UpdateVisibilityLevel def valid_visibility_level_change?(target, new_visibility) # check that user is allowed to set specified visibility_level diff --git a/app/services/concerns/users/new_user_notifier.rb b/app/services/concerns/users/new_user_notifier.rb index 231693ce7a9..11547e4a5b6 100644 --- a/app/services/concerns/users/new_user_notifier.rb +++ b/app/services/concerns/users/new_user_notifier.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Users module NewUserNotifier def notify_new_user(user, reset_token) diff --git a/app/services/concerns/users/participable_service.rb b/app/services/concerns/users/participable_service.rb index bf60b96938d..5b408bd96c7 100644 --- a/app/services/concerns/users/participable_service.rb +++ b/app/services/concerns/users/participable_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Users module ParticipableService extend ActiveSupport::Concern diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb index 9b1a4d960e2..65208b07e27 100644 --- a/app/services/create_branch_service.rb +++ b/app/services/create_branch_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateBranchService < BaseService def execute(branch_name, ref) create_master_branch if project.empty_repo? diff --git a/app/services/create_deployment_service.rb b/app/services/create_deployment_service.rb index 7e5a77fb056..bb3f605da28 100644 --- a/app/services/create_deployment_service.rb +++ b/app/services/create_deployment_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDeploymentService attr_reader :job diff --git a/app/services/create_release_service.rb b/app/services/create_release_service.rb index 54ff1f74126..09c68390007 100644 --- a/app/services/create_release_service.rb +++ b/app/services/create_release_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateReleaseService < BaseService def execute(tag_name, release_description) repository = project.repository diff --git a/app/services/create_snippet_service.rb b/app/services/create_snippet_service.rb index 40286dbf3bf..6f1fce4989e 100644 --- a/app/services/create_snippet_service.rb +++ b/app/services/create_snippet_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateSnippetService < BaseService include SpamCheckService diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb index e1499dcee64..44252f7b0a6 100644 --- a/app/services/delete_branch_service.rb +++ b/app/services/delete_branch_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DeleteBranchService < BaseService def execute(branch_name) repository = project.repository diff --git a/app/services/delete_merged_branches_service.rb b/app/services/delete_merged_branches_service.rb index c98d1e3c540..ff3e4783fe3 100644 --- a/app/services/delete_merged_branches_service.rb +++ b/app/services/delete_merged_branches_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DeleteMergedBranchesService < BaseService def async_execute DeleteMergedBranchesWorker.perform_async(project.id, current_user.id) diff --git a/app/services/deploy_keys/create_service.rb b/app/services/deploy_keys/create_service.rb index 16de3d08df2..a25e73666f8 100644 --- a/app/services/deploy_keys/create_service.rb +++ b/app/services/deploy_keys/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module DeployKeys class CreateService < Keys::BaseService def execute diff --git a/app/services/deploy_tokens/create_service.rb b/app/services/deploy_tokens/create_service.rb index 52f545947af..dc0122002e9 100644 --- a/app/services/deploy_tokens/create_service.rb +++ b/app/services/deploy_tokens/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module DeployTokens class CreateService < BaseService def execute diff --git a/app/services/discussions/base_service.rb b/app/services/discussions/base_service.rb index e4dfe6e71bb..86b8310f0a6 100644 --- a/app/services/discussions/base_service.rb +++ b/app/services/discussions/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Discussions class BaseService < ::BaseService end diff --git a/app/services/discussions/resolve_service.rb b/app/services/discussions/resolve_service.rb index 0437195f588..816cd45b07a 100644 --- a/app/services/discussions/resolve_service.rb +++ b/app/services/discussions/resolve_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Discussions class ResolveService < Discussions::BaseService def execute(one_or_more_discussions) diff --git a/app/services/discussions/update_diff_position_service.rb b/app/services/discussions/update_diff_position_service.rb index 746f209e20f..c61437fb2e3 100644 --- a/app/services/discussions/update_diff_position_service.rb +++ b/app/services/discussions/update_diff_position_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Discussions class UpdateDiffPositionService < BaseService def execute(discussion) diff --git a/app/services/emails/base_service.rb b/app/services/emails/base_service.rb index 5bbceeb3b3f..ba7b689a9af 100644 --- a/app/services/emails/base_service.rb +++ b/app/services/emails/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Emails class BaseService def initialize(current_user, params = {}) diff --git a/app/services/emails/confirm_service.rb b/app/services/emails/confirm_service.rb index b5301bf2b82..38204e011dd 100644 --- a/app/services/emails/confirm_service.rb +++ b/app/services/emails/confirm_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Emails class ConfirmService < ::Emails::BaseService def execute(email) diff --git a/app/services/emails/create_service.rb b/app/services/emails/create_service.rb index 94a841af7c3..acf575e24e5 100644 --- a/app/services/emails/create_service.rb +++ b/app/services/emails/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Emails class CreateService < ::Emails::BaseService def execute(extra_params = {}) diff --git a/app/services/emails/destroy_service.rb b/app/services/emails/destroy_service.rb index 1ed131fe326..9ca1a03e172 100644 --- a/app/services/emails/destroy_service.rb +++ b/app/services/emails/destroy_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Emails class DestroyService < ::Emails::BaseService def execute(email) diff --git a/app/services/event_create_service.rb b/app/services/event_create_service.rb index 44dc90b3462..e7464fd9d5f 100644 --- a/app/services/event_create_service.rb +++ b/app/services/event_create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # EventCreateService class # # Used for creating events feed on dashboard after certain user action diff --git a/app/services/events/render_service.rb b/app/services/events/render_service.rb index bb72d7685dd..50429683902 100644 --- a/app/services/events/render_service.rb +++ b/app/services/events/render_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Events class RenderService < BaseRenderer def execute(events, atom_request: false) diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb index 8d4b9f14780..025f093a428 100644 --- a/app/services/files/base_service.rb +++ b/app/services/files/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Files class BaseService < Commits::CreateService FileChangedError = Class.new(StandardError) diff --git a/app/services/files/create_dir_service.rb b/app/services/files/create_dir_service.rb index 8ecac6115bd..362b80071ba 100644 --- a/app/services/files/create_dir_service.rb +++ b/app/services/files/create_dir_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Files class CreateDirService < Files::BaseService def create_commit! diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb index a954564946b..fd5442a6c28 100644 --- a/app/services/files/create_service.rb +++ b/app/services/files/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Files class CreateService < Files::BaseService def create_commit! diff --git a/app/services/files/delete_service.rb b/app/services/files/delete_service.rb index 32a57484d4e..0ec1f79d396 100644 --- a/app/services/files/delete_service.rb +++ b/app/services/files/delete_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Files class DeleteService < Files::BaseService def create_commit! diff --git a/app/services/files/multi_service.rb b/app/services/files/multi_service.rb index 13a1dee4173..08088f8c592 100644 --- a/app/services/files/multi_service.rb +++ b/app/services/files/multi_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Files class MultiService < Files::BaseService UPDATE_FILE_ACTIONS = %w(update move delete).freeze diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb index 1902d1cea72..2b3e96e6c53 100644 --- a/app/services/files/update_service.rb +++ b/app/services/files/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Files class UpdateService < Files::BaseService def create_commit! diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index f3bfc53dcd3..29c8ce5fea3 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GitPushService < BaseService attr_accessor :push_data, :push_commits include Gitlab::Access diff --git a/app/services/git_tag_push_service.rb b/app/services/git_tag_push_service.rb index 9917a39b795..3ff2d1d107d 100644 --- a/app/services/git_tag_push_service.rb +++ b/app/services/git_tag_push_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GitTagPushService < BaseService attr_accessor :push_data diff --git a/app/services/gpg_keys/create_service.rb b/app/services/gpg_keys/create_service.rb index e822a89c4d3..e41444b2a82 100644 --- a/app/services/gpg_keys/create_service.rb +++ b/app/services/gpg_keys/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module GpgKeys class CreateService < Keys::BaseService def execute diff --git a/app/services/gravatar_service.rb b/app/services/gravatar_service.rb index c6e52c3bb91..2a7a5dae291 100644 --- a/app/services/gravatar_service.rb +++ b/app/services/gravatar_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GravatarService def execute(email, size = nil, scale = 2, username: nil) return unless Gitlab::CurrentSettings.gravatar_enabled? diff --git a/app/services/groups/base_service.rb b/app/services/groups/base_service.rb index a8fa098246a..8c8acce5ca5 100644 --- a/app/services/groups/base_service.rb +++ b/app/services/groups/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Groups class BaseService < ::BaseService attr_accessor :group, :current_user, :params diff --git a/app/services/groups/create_service.rb b/app/services/groups/create_service.rb index 70e50aa0f12..24d8400c625 100644 --- a/app/services/groups/create_service.rb +++ b/app/services/groups/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Groups class CreateService < Groups::BaseService def initialize(user, params = {}) diff --git a/app/services/groups/destroy_service.rb b/app/services/groups/destroy_service.rb index 58e88688dfa..c4554ce45fb 100644 --- a/app/services/groups/destroy_service.rb +++ b/app/services/groups/destroy_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Groups class DestroyService < Groups::BaseService def async_execute diff --git a/app/services/groups/nested_create_service.rb b/app/services/groups/nested_create_service.rb index c2dfbac5414..50d34d8cb91 100644 --- a/app/services/groups/nested_create_service.rb +++ b/app/services/groups/nested_create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Groups class NestedCreateService < Groups::BaseService attr_reader :group_path, :visibility_level diff --git a/app/services/groups/transfer_service.rb b/app/services/groups/transfer_service.rb index e591c820cff..ea7576077f3 100644 --- a/app/services/groups/transfer_service.rb +++ b/app/services/groups/transfer_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Groups class TransferService < Groups::BaseService ERROR_MESSAGES = { diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb index 08e3efb96e3..436a6b18cb1 100644 --- a/app/services/groups/update_service.rb +++ b/app/services/groups/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Groups class UpdateService < Groups::BaseService include UpdateVisibilityLevel diff --git a/app/services/ham_service.rb b/app/services/ham_service.rb index b0e1799b489..794eb34d9ca 100644 --- a/app/services/ham_service.rb +++ b/app/services/ham_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class HamService attr_accessor :spam_log diff --git a/app/services/import_export_clean_up_service.rb b/app/services/import_export_clean_up_service.rb index 3702c3742ef..e75a951944e 100644 --- a/app/services/import_export_clean_up_service.rb +++ b/app/services/import_export_clean_up_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ImportExportCleanUpService LAST_MODIFIED_TIME_IN_MINUTES = 1440 diff --git a/app/services/issuable/bulk_update_service.rb b/app/services/issuable/bulk_update_service.rb index 5d42a89fced..051d5ba881d 100644 --- a/app/services/issuable/bulk_update_service.rb +++ b/app/services/issuable/bulk_update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issuable class BulkUpdateService < IssuableBaseService def execute(type) diff --git a/app/services/issuable/common_system_notes_service.rb b/app/services/issuable/common_system_notes_service.rb index 3da21bd8b8f..028b350ca07 100644 --- a/app/services/issuable/common_system_notes_service.rb +++ b/app/services/issuable/common_system_notes_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issuable class CommonSystemNotesService < ::BaseService attr_reader :issuable diff --git a/app/services/issuable/destroy_service.rb b/app/services/issuable/destroy_service.rb index 0b1a33518c6..4c64655a622 100644 --- a/app/services/issuable/destroy_service.rb +++ b/app/services/issuable/destroy_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issuable class DestroyService < IssuableBaseService def execute(issuable) diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 5e06e0c61cf..7d60c65bb79 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class IssuableBaseService < BaseService private diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb index cbfef175af0..25389a946bb 100644 --- a/app/services/issues/base_service.rb +++ b/app/services/issues/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issues class BaseService < ::IssuableBaseService def hook_data(issue, action, old_associations: {}) diff --git a/app/services/issues/build_service.rb b/app/services/issues/build_service.rb index 3a4f7b159f1..52b45f1b2ce 100644 --- a/app/services/issues/build_service.rb +++ b/app/services/issues/build_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issues class BuildService < Issues::BaseService include ResolveDiscussions @@ -44,14 +46,14 @@ module Issues other_note_count = discussion.notes.size - 1 - discussion_info = "- [ ] #{first_note_to_resolve.author.to_reference} #{action} a [discussion](#{note_url}): " - discussion_info << " (+#{other_note_count} #{'comment'.pluralize(other_note_count)})" if other_note_count > 0 + discussion_info = ["- [ ] #{first_note_to_resolve.author.to_reference} #{action} a [discussion](#{note_url}): "] + discussion_info << "(+#{other_note_count} #{'comment'.pluralize(other_note_count)})" if other_note_count > 0 note_without_block_quotes = Banzai::Filter::BlockquoteFenceFilter.new(first_note_to_resolve.note).call spaces = ' ' * 4 quote = note_without_block_quotes.lines.map { |line| "#{spaces}> #{line}" }.join - [discussion_info, quote].join("\n\n") + [discussion_info.join(' '), quote].join("\n\n") end def issue_params diff --git a/app/services/issues/close_service.rb b/app/services/issues/close_service.rb index 4a99367c575..e5cc12e6082 100644 --- a/app/services/issues/close_service.rb +++ b/app/services/issues/close_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issues class CloseService < Issues::BaseService # Closes the supplied issue if the current user is able to do so. diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb index 0307634c0b6..5793a15e1bc 100644 --- a/app/services/issues/create_service.rb +++ b/app/services/issues/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issues class CreateService < Issues::BaseService include SpamCheckService diff --git a/app/services/issues/duplicate_service.rb b/app/services/issues/duplicate_service.rb index 5c0854e664d..9b22f5e7914 100644 --- a/app/services/issues/duplicate_service.rb +++ b/app/services/issues/duplicate_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issues class DuplicateService < Issues::BaseService def execute(duplicate_issue, canonical_issue) diff --git a/app/services/issues/fetch_referenced_merge_requests_service.rb b/app/services/issues/fetch_referenced_merge_requests_service.rb index 39c8ded9df4..5e84f3c81c9 100644 --- a/app/services/issues/fetch_referenced_merge_requests_service.rb +++ b/app/services/issues/fetch_referenced_merge_requests_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issues class FetchReferencedMergeRequestsService < Issues::BaseService def execute(issue) diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb index 6e5c29a5c40..841bce9949e 100644 --- a/app/services/issues/move_service.rb +++ b/app/services/issues/move_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issues class MoveService < Issues::BaseService MoveError = Class.new(StandardError) diff --git a/app/services/issues/reopen_service.rb b/app/services/issues/reopen_service.rb index 02224f3357a..3bd53f9ccdc 100644 --- a/app/services/issues/reopen_service.rb +++ b/app/services/issues/reopen_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issues class ReopenService < Issues::BaseService def execute(issue) diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index 1000e1842b6..c02dddf67b2 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Issues class UpdateService < Issues::BaseService include SpamCheckService diff --git a/app/services/keys/base_service.rb b/app/services/keys/base_service.rb index df8e82f5f60..113e22b01ce 100644 --- a/app/services/keys/base_service.rb +++ b/app/services/keys/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Keys class BaseService attr_accessor :user, :params diff --git a/app/services/keys/create_service.rb b/app/services/keys/create_service.rb index e2e5a6c46c5..d9fa69a88d7 100644 --- a/app/services/keys/create_service.rb +++ b/app/services/keys/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Keys class CreateService < ::Keys::BaseService def execute diff --git a/app/services/keys/destroy_service.rb b/app/services/keys/destroy_service.rb index 785cfa3a1d8..e2ae4047941 100644 --- a/app/services/keys/destroy_service.rb +++ b/app/services/keys/destroy_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Keys class DestroyService < ::Keys::BaseService def execute(key) diff --git a/app/services/keys/last_used_service.rb b/app/services/keys/last_used_service.rb index dbd79f7da55..daef544bac0 100644 --- a/app/services/keys/last_used_service.rb +++ b/app/services/keys/last_used_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Keys class LastUsedService TIMEOUT = 1.day.to_i diff --git a/app/services/labels/base_service.rb b/app/services/labels/base_service.rb index 91d72a57b4e..ead7f2ea607 100644 --- a/app/services/labels/base_service.rb +++ b/app/services/labels/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Labels class BaseService < ::BaseService COLOR_NAME_TO_HEX = { diff --git a/app/services/labels/create_service.rb b/app/services/labels/create_service.rb index 6c399c92377..fe34be41ac1 100644 --- a/app/services/labels/create_service.rb +++ b/app/services/labels/create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Labels class CreateService < Labels::BaseService def initialize(params = {}) diff --git a/app/services/labels/find_or_create_service.rb b/app/services/labels/find_or_create_service.rb index a72da3c637f..e4486764a4d 100644 --- a/app/services/labels/find_or_create_service.rb +++ b/app/services/labels/find_or_create_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Labels class FindOrCreateService def initialize(current_user, parent, params = {}) diff --git a/app/services/labels/promote_service.rb b/app/services/labels/promote_service.rb index 74a85e5c9f0..c0463052821 100644 --- a/app/services/labels/promote_service.rb +++ b/app/services/labels/promote_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Labels class PromoteService < BaseService BATCH_SIZE = 1000 diff --git a/app/services/labels/transfer_service.rb b/app/services/labels/transfer_service.rb index 9b7486cf53b..1bd8d9fc325 100644 --- a/app/services/labels/transfer_service.rb +++ b/app/services/labels/transfer_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Labels::TransferService class # # User for recreate the missing group labels at project level diff --git a/app/services/labels/update_service.rb b/app/services/labels/update_service.rb index 28dcabf9541..c3a720a1c66 100644 --- a/app/services/labels/update_service.rb +++ b/app/services/labels/update_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Labels class UpdateService < Labels::BaseService def initialize(params = {}) diff --git a/app/services/merge_request_metrics_service.rb b/app/services/merge_request_metrics_service.rb index 9248de14a53..4e88b77c855 100644 --- a/app/services/merge_request_metrics_service.rb +++ b/app/services/merge_request_metrics_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MergeRequestMetricsService delegate :update!, to: :@merge_request_metrics diff --git a/app/services/metrics_service.rb b/app/services/metrics_service.rb index c237d2ae8c9..222a5c8c79c 100644 --- a/app/services/metrics_service.rb +++ b/app/services/metrics_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'prometheus/client/formats/text' class MetricsService diff --git a/app/services/note_summary.rb b/app/services/note_summary.rb index a6f6320d573..81f6f92f75c 100644 --- a/app/services/note_summary.rb +++ b/app/services/note_summary.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class NoteSummary attr_reader :note attr_reader :metadata diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb index d9834fd0ccc..4389fd89538 100644 --- a/app/services/notification_recipient_service.rb +++ b/app/services/notification_recipient_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # # Used by NotificationService to determine who should receive notification # diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index d7be9a925b5..4511c500fca 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # rubocop:disable GitlabSecurity/PublicSend # NotificationService class diff --git a/app/services/preview_markdown_service.rb b/app/services/preview_markdown_service.rb index 6da4d9523cf..a15ee4911ef 100644 --- a/app/services/preview_markdown_service.rb +++ b/app/services/preview_markdown_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class PreviewMarkdownService < BaseService def execute text, commands = explain_quick_actions(params[:text]) diff --git a/app/services/push_event_payload_service.rb b/app/services/push_event_payload_service.rb index b0a389c85f9..bb1259787af 100644 --- a/app/services/push_event_payload_service.rb +++ b/app/services/push_event_payload_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Service class for creating push event payloads as stored in the # "push_event_payloads" table. # diff --git a/app/services/repair_ldap_blocked_user_service.rb b/app/services/repair_ldap_blocked_user_service.rb index 863cef7ff61..6ed42054ac3 100644 --- a/app/services/repair_ldap_blocked_user_service.rb +++ b/app/services/repair_ldap_blocked_user_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RepairLdapBlockedUserService attr_accessor :user diff --git a/app/services/repository_archive_clean_up_service.rb b/app/services/repository_archive_clean_up_service.rb index ba7be4b3f89..99a9c834352 100644 --- a/app/services/repository_archive_clean_up_service.rb +++ b/app/services/repository_archive_clean_up_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RepositoryArchiveCleanUpService LAST_MODIFIED_TIME_IN_MINUTES = 120 diff --git a/app/services/reset_project_cache_service.rb b/app/services/reset_project_cache_service.rb index a162a6eedb9..676d367a1c1 100644 --- a/app/services/reset_project_cache_service.rb +++ b/app/services/reset_project_cache_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ResetProjectCacheService < BaseService def execute @project.increment!(:jobs_cache_index) diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 1d4d03a8b7d..1b707d79b43 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SearchService include Gitlab::Allowable diff --git a/app/services/spam_check_service.rb b/app/services/spam_check_service.rb index d4ade869777..895261925ba 100644 --- a/app/services/spam_check_service.rb +++ b/app/services/spam_check_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # SpamCheckService # # Provide helper methods for checking if a given spammable object has diff --git a/app/services/spam_service.rb b/app/services/spam_service.rb index 73ea3018fbd..f2f133dae28 100644 --- a/app/services/spam_service.rb +++ b/app/services/spam_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SpamService attr_accessor :spammable, :request, :options attr_reader :spam_log diff --git a/app/services/submit_usage_ping_service.rb b/app/services/submit_usage_ping_service.rb index ac029fad7ea..93c2e222963 100644 --- a/app/services/submit_usage_ping_service.rb +++ b/app/services/submit_usage_ping_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SubmitUsagePingService URL = 'https://version.gitlab.com/usage_data'.freeze diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb index ba7946fd23c..bd3907cdf8e 100644 --- a/app/services/system_hooks_service.rb +++ b/app/services/system_hooks_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SystemHooksService def execute_hooks_for(model, event) data = build_event_data(model, event) diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 00bf5434b7f..77494295f14 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # SystemNoteService # # Used for creating system notes (e.g., when a user references a merge request @@ -21,9 +23,11 @@ module SystemNoteService total_count = new_commits.length + existing_commits.length commits_text = "#{total_count} commit".pluralize(total_count) - body = "added #{commits_text}\n\n" - body << commits_list(noteable, new_commits, existing_commits, oldrev) - body << "\n\n[Compare with previous version](#{diff_comparison_url(noteable, project, oldrev)})" + text_parts = ["added #{commits_text}"] + text_parts << commits_list(noteable, new_commits, existing_commits, oldrev) + text_parts << "[Compare with previous version](#{diff_comparison_url(noteable, project, oldrev)})" + + body = text_parts.join("\n\n") create_note(NoteSummary.new(noteable, project, author, body, action: 'commit', commit_count: total_count)) end @@ -103,18 +107,19 @@ module SystemNoteService added_labels = added_labels.map(&references).join(' ') removed_labels = removed_labels.map(&references).join(' ') - body = '' + text_parts = [] if added_labels.present? - body << "added #{added_labels}" - body << ' and ' if removed_labels.present? + text_parts << "added #{added_labels}" + text_parts << 'and' if removed_labels.present? end if removed_labels.present? - body << "removed #{removed_labels}" + text_parts << "removed #{removed_labels}" end - body << ' ' << 'label'.pluralize(labels_count) + text_parts << 'label'.pluralize(labels_count) + body = text_parts.join(' ') create_note(NoteSummary.new(noteable, project, author, body, action: 'label')) end @@ -188,8 +193,10 @@ module SystemNoteService spent_at = noteable.spent_at parsed_time = Gitlab::TimeTrackingFormatter.output(time_spent.abs) action = time_spent > 0 ? 'added' : 'subtracted' - body = "#{action} #{parsed_time} of time spent" - body << " at #{spent_at}" if spent_at + + text_parts = ["#{action} #{parsed_time} of time spent"] + text_parts << "at #{spent_at}" if spent_at + body = text_parts.join(' ') end create_note(NoteSummary.new(noteable, project, author, body, action: 'time_tracking')) @@ -268,17 +275,19 @@ module SystemNoteService diff_refs = change_position.diff_refs version_index = merge_request.merge_request_diffs.viewable.count - body = "changed this line in" + text_parts = ["changed this line in"] if version_params = merge_request.version_params_for(diff_refs) line_code = change_position.line_code(project.repository) url = url_helpers.diffs_project_merge_request_url(project, merge_request, version_params.merge(anchor: line_code)) - body << " [version #{version_index} of the diff](#{url})" + text_parts << "[version #{version_index} of the diff](#{url})" else - body << " version #{version_index} of the diff" + text_parts << "version #{version_index} of the diff" end + body = text_parts.join(' ') note_attributes = discussion.reply_attributes.merge(project: project, author: author, note: body) + note = Note.create(note_attributes.merge(system: true)) note.system_note_metadata = SystemNoteMetadata.new(action: 'outdated') diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index f91cd03bf5c..0bcd53c76a9 100644 --- a/app/services/todo_service.rb +++ b/app/services/todo_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # TodoService class # # Used for creating/updating todos after certain user actions diff --git a/app/services/update_release_service.rb b/app/services/update_release_service.rb index dc696e9c440..422ba668e35 100644 --- a/app/services/update_release_service.rb +++ b/app/services/update_release_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UpdateReleaseService < BaseService def execute(tag_name, release_description) repository = project.repository diff --git a/app/services/update_snippet_service.rb b/app/services/update_snippet_service.rb index 358bca73aec..15bc1046a4e 100644 --- a/app/services/update_snippet_service.rb +++ b/app/services/update_snippet_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UpdateSnippetService < BaseService include SpamCheckService diff --git a/app/services/upload_service.rb b/app/services/upload_service.rb index d5a9b344905..39909ee4f82 100644 --- a/app/services/upload_service.rb +++ b/app/services/upload_service.rb @@ -1,12 +1,14 @@ +# frozen_string_literal: true + class UploadService - def initialize(model, file, uploader_class = FileUploader) - @model, @file, @uploader_class = model, file, uploader_class + def initialize(model, file, uploader_class = FileUploader, **uploader_context) + @model, @file, @uploader_class, @uploader_context = model, file, uploader_class, uploader_context end def execute return nil unless @file && @file.size <= max_attachment_size - uploader = @uploader_class.new(@model) + uploader = @uploader_class.new(@model, nil, @uploader_context) uploader.store!(@file) uploader.to_h diff --git a/app/services/user_agent_detail_service.rb b/app/services/user_agent_detail_service.rb index a1ee3df5fe1..5cb42e879a0 100644 --- a/app/services/user_agent_detail_service.rb +++ b/app/services/user_agent_detail_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UserAgentDetailService attr_accessor :spammable, :request diff --git a/app/services/user_project_access_changed_service.rb b/app/services/user_project_access_changed_service.rb index 8630e572624..adca43660e8 100644 --- a/app/services/user_project_access_changed_service.rb +++ b/app/services/user_project_access_changed_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UserProjectAccessChangedService def initialize(user_ids) @user_ids = Array.wrap(user_ids) diff --git a/app/services/validate_new_branch_service.rb b/app/services/validate_new_branch_service.rb index 643f2ce1481..c19e2ec2043 100644 --- a/app/services/validate_new_branch_service.rb +++ b/app/services/validate_new_branch_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative 'base_service' class ValidateNewBranchService < BaseService diff --git a/app/services/verify_pages_domain_service.rb b/app/services/verify_pages_domain_service.rb index 13cb53dee01..07f7391f877 100644 --- a/app/services/verify_pages_domain_service.rb +++ b/app/services/verify_pages_domain_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'resolv' class VerifyPagesDomainService < BaseService diff --git a/app/services/web_hook_service.rb b/app/services/web_hook_service.rb index 8a86e47f0ea..34724e0250d 100644 --- a/app/services/web_hook_service.rb +++ b/app/services/web_hook_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class WebHookService class InternalErrorResponse attr_reader :body, :headers, :code diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index 21292ddcf44..83f7b99d2a5 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -15,7 +15,7 @@ class FileUploader < GitlabUploader prepend ObjectStorage::Extension::RecordsUploads MARKDOWN_PATTERN = %r{\!?\[.*?\]\(/uploads/(?<secret>[0-9a-f]{32})/(?<file>.*?)\)} - DYNAMIC_PATH_PATTERN = %r{(?<secret>\h{32})/(?<identifier>.*)} + DYNAMIC_PATH_PATTERN = %r{.*(?<secret>\h{32})/(?<identifier>.*)} after :remove, :prune_store_dir @@ -67,6 +67,10 @@ class FileUploader < GitlabUploader SecureRandom.hex end + def self.extract_dynamic_path(path) + DYNAMIC_PATH_PATTERN.match(path) + end + def upload_paths(identifier) [ File.join(secret, identifier), @@ -143,7 +147,7 @@ class FileUploader < GitlabUploader return if apply_context!(value.uploader_context) # fallback to the regex based extraction - if matches = DYNAMIC_PATH_PATTERN.match(value.path) + if matches = self.class.extract_dynamic_path(value.path) @secret = matches[:secret] @identifier = matches[:identifier] end diff --git a/app/views/ci/runner/_how_to_setup_runner.html.haml b/app/views/ci/runner/_how_to_setup_runner.html.haml index 3ae9ce6c11f..13f96b9747c 100644 --- a/app/views/ci/runner/_how_to_setup_runner.html.haml +++ b/app/views/ci/runner/_how_to_setup_runner.html.haml @@ -1,16 +1,17 @@ -- link = link_to _("GitLab Runner section"), 'https://about.gitlab.com/gitlab-ci/#gitlab-runner', target: '_blank' +- link = link_to _("Install GitLab Runner"), 'https://docs.gitlab.com/runner/install/', target: '_blank' .append-bottom-10 %h4= _("Setup a #{type} Runner manually") %ol %li - = _("Install a Runner compatible with GitLab CI") - = (_("(check out the %{link} for information on how to install it).") % { link: link }).html_safe + = link.html_safe %li = _("Specify the following URL during the Runner setup:") %code#coordinator_address= root_url(only_path: false) + = clipboard_button(target: '#coordinator_address', title: _("Copy URL to clipboard"), class: "btn-transparent btn-clipboard") %li = _("Use the following registration token during setup:") %code#registration_token= registration_token + = clipboard_button(target: '#registration_token', title: _("Copy token to clipboard"), class: "btn-transparent btn-clipboard") %li = _("Start the Runner!") diff --git a/app/views/doorkeeper/applications/_delete_form.html.haml b/app/views/doorkeeper/applications/_delete_form.html.haml index 84b4ce5b606..ac5cac50699 100644 --- a/app/views/doorkeeper/applications/_delete_form.html.haml +++ b/app/views/doorkeeper/applications/_delete_form.html.haml @@ -2,9 +2,9 @@ = form_tag oauth_application_path(application) do %input{ :name => "_method", :type => "hidden", :value => "delete" }/ - if defined? small - = button_tag type: "submit", class: "btn btn-transparent", data: { confirm: "Are you sure?" } do + = button_tag type: "submit", class: "btn btn-transparent", data: { confirm: _("Are you sure?") } do %span.sr-only - Destroy + = _('Destroy') = icon('trash') - else - = submit_tag 'Destroy', data: { confirm: "Are you sure?" }, class: submit_btn_css + = submit_tag _('Destroy'), data: { confirm: _("Are you sure?") }, class: submit_btn_css diff --git a/app/views/doorkeeper/applications/_form.html.haml b/app/views/doorkeeper/applications/_form.html.haml index be0935b8313..1ddd0df54cd 100644 --- a/app/views/doorkeeper/applications/_form.html.haml +++ b/app/views/doorkeeper/applications/_form.html.haml @@ -10,16 +10,14 @@ = f.text_area :redirect_uri, class: 'form-control', required: true %span.form-text.text-muted - Use one line per URI + = _('Use one line per URI') - if Doorkeeper.configuration.native_redirect_uri %span.form-text.text-muted - Use - %code= Doorkeeper.configuration.native_redirect_uri - for local tests + = _('Use <code>%{native_redirect_uri}</code> for local tests').html_safe % { native_redirect_uri: Doorkeeper.configuration.native_redirect_uri } .form-group = f.label :scopes, class: 'label-light' = render 'shared/tokens/scopes_form', prefix: 'doorkeeper_application', token: application, scopes: @scopes .prepend-top-default - = f.submit 'Save application', class: "btn btn-create" + = f.submit _('Save application'), class: "btn btn-create" diff --git a/app/views/doorkeeper/applications/edit.html.haml b/app/views/doorkeeper/applications/edit.html.haml index 49f90298a50..aad4200f240 100644 --- a/app/views/doorkeeper/applications/edit.html.haml +++ b/app/views/doorkeeper/applications/edit.html.haml @@ -1,4 +1,4 @@ -- page_title "Edit", @application.name, "Applications" +- page_title _("Edit"), @application.name, _("Applications") - @content_class = "limit-container-width" unless fluid_layout -%h3.page-title Edit application +%h3.page-title= _('Edit application') = render 'form', application: @application diff --git a/app/views/doorkeeper/applications/index.html.haml b/app/views/doorkeeper/applications/index.html.haml index cdf3ff81bd9..ab3a1b100ce 100644 --- a/app/views/doorkeeper/applications/index.html.haml +++ b/app/views/doorkeeper/applications/index.html.haml @@ -1,4 +1,4 @@ -- page_title "Applications" +- page_title _("Applications") - @content_class = "limit-container-width" unless fluid_layout .row.prepend-top-default @@ -7,28 +7,27 @@ = page_title %p - if user_oauth_applications? - Manage applications that can use GitLab as an OAuth provider, - and applications that you've authorized to use your account. + = _("Manage applications that can use GitLab as an OAuth provider, and applications that you've authorized to use your account.") - else - Manage applications that you've authorized to use your account. + = _("Manage applications that you've authorized to use your account.") .col-lg-8 - if user_oauth_applications? %h5.prepend-top-0 - Add new application + = _('Add new application') = render 'form', application: @application %hr - if user_oauth_applications? .oauth-applications %h5 - Your applications (#{@applications.size}) + = _("Your applications (%{size})") % { size: @applications.size } - if @applications.any? .table-responsive %table.table %thead %tr - %th Name - %th Callback URL - %th Clients + %th= _('Name') + %th= _('Callback URL') + %th= _('Clients') %th.last-heading %tbody - @applications.each do |application| @@ -41,25 +40,25 @@ %td = link_to edit_oauth_application_path(application), class: "btn btn-transparent append-right-5" do %span.sr-only - Edit + = _('Edit') = icon('pencil') = render 'delete_form', application: application, small: true - else .settings-message.text-center - You don't have any applications + = _("You don't have any applications") .oauth-authorized-applications.prepend-top-20.append-bottom-default - if user_oauth_applications? %h5 - Authorized applications (#{@authorized_tokens.size}) + = _("Authorized applications (%{size})") % { size: @authorized_tokens.size } - if @authorized_tokens.any? .table-responsive %table.table.table-striped %thead %tr - %th Name - %th Authorized At - %th Scope + %th= _('Name') + %th= _('Authorized At') + %th= _('Scope') %th %tbody - @authorized_apps.each do |app| @@ -72,12 +71,12 @@ - @authorized_anonymous_tokens.each do |token| %tr %td - Anonymous + = _('Anonymous') .form-text.text-muted - %em Authorization was granted by entering your username and password in the application. + %em= _("Authorization was granted by entering your username and password in the application.") %td= token.created_at %td= token.scopes %td= render 'doorkeeper/authorized_applications/delete_form', token: token - else .settings-message.text-center - You don't have any authorized applications + = _("You don't have any authorized applications") diff --git a/app/views/doorkeeper/applications/new.html.haml b/app/views/doorkeeper/applications/new.html.haml index d3692d1f759..a66fab20d7c 100644 --- a/app/views/doorkeeper/applications/new.html.haml +++ b/app/views/doorkeeper/applications/new.html.haml @@ -1,6 +1,6 @@ -- page_title "New Application" +- page_title _("New Application") -%h3.page-title New Application +%h3.page-title= _("New Application") %hr diff --git a/app/views/doorkeeper/applications/show.html.haml b/app/views/doorkeeper/applications/show.html.haml index 89ad626f73f..bb76ac6d5f6 100644 --- a/app/views/doorkeeper/applications/show.html.haml +++ b/app/views/doorkeeper/applications/show.html.haml @@ -1,27 +1,27 @@ -- add_to_breadcrumbs "Applications", oauth_applications_path +- add_to_breadcrumbs _("Applications"), oauth_applications_path - breadcrumb_title @application.name -- page_title @application.name, "Applications" +- page_title @application.name, _("Applications") - @content_class = "limit-container-width" unless fluid_layout %h3.page-title - Application: #{@application.name} + = _("Application: %{name}") % { name: @application.name } .table-holder.oauth-application-show %table.table %tr %td - Application Id + = _('Application Id') %td %code#application_id= @application.uid %tr %td - Secret: + = _('Secret:') %td %code#secret= @application.secret %tr %td - Callback url + = _('Callback url') %td - @application.redirect_uri.split.each do |uri| %div @@ -30,5 +30,5 @@ = render "shared/tokens/scopes_list", token: @application .form-actions - = link_to 'Edit', edit_oauth_application_path(@application), class: 'btn btn-primary wide float-left' + = link_to _('Edit'), edit_oauth_application_path(@application), class: 'btn btn-primary wide float-left' = render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger prepend-left-10' diff --git a/app/views/doorkeeper/authorizations/error.html.haml b/app/views/doorkeeper/authorizations/error.html.haml index 6117b00149f..32b4ccb0fe6 100644 --- a/app/views/doorkeeper/authorizations/error.html.haml +++ b/app/views/doorkeeper/authorizations/error.html.haml @@ -1,3 +1,3 @@ -%h3.page-title An error has occurred +%h3.page-title= _("An error has occurred") %main{ :role => "main" } %pre= @pre_auth.error_response.body[:error_description] diff --git a/app/views/doorkeeper/authorizations/new.html.haml b/app/views/doorkeeper/authorizations/new.html.haml index 28cdc7607e0..ca62a59d909 100644 --- a/app/views/doorkeeper/authorizations/new.html.haml +++ b/app/views/doorkeeper/authorizations/new.html.haml @@ -3,34 +3,28 @@ .modal-content .modal-header %h3.page-title - Authorize - = link_to @pre_auth.client.name, @pre_auth.redirect_uri, target: '_blank', rel: 'noopener noreferrer' - to use your account? + - link_to_client = link_to(@pre_auth.client.name, @pre_auth.redirect_uri, target: '_blank', rel: 'noopener noreferrer') + = _("Authorize %{link_to_client} to use your account?") .modal-body - if current_user.admin? .text-warning %p = icon("exclamation-triangle fw") - You are an admin, which means granting access to - %strong= @pre_auth.client.name - will allow them to interact with GitLab as an admin as well. Proceed with caution. + = _('You are an admin, which means granting access to <strong>%{client_name}</strong> will allow them to interact with GitLab as an admin as well. Proceed with caution.').html_safe % { client_name: @pre_auth.client.name } %p - An application called - = link_to @pre_auth.client.name, @pre_auth.redirect_uri, target: '_blank', rel: 'noopener noreferrer' - is requesting access to your GitLab account. + - link_to_client = link_to(@pre_auth.client.name, @pre_auth.redirect_uri, target: '_blank', rel: 'noopener noreferrer') + = _("An application called %{link_to_client} is requesting access to your GitLab account.").html_safe % { link_to_client: link_to_client } - auth_app_owner = @pre_auth.client.application.owner - if auth_app_owner - This application was created by - = succeed "." do - = link_to auth_app_owner.name, user_path(auth_app_owner) + - link_to_owner = link_to(auth_app_owner.name, user_path(auth_app_owner)) + = _("This application was created by %{link_to_owner}.").html_safe % { link_to_owner: link_to_owner } - Please note that this application is not provided by GitLab and you should verify its authenticity before - allowing access. + = _("Please note that this application is not provided by GitLab and you should verify its authenticity before allowing access.") - if @pre_auth.scopes %p - This application will be able to: + = _("This application will be able to:") %ul - @pre_auth.scopes.each do |scope| %li @@ -44,7 +38,7 @@ = hidden_field_tag :response_type, @pre_auth.response_type = hidden_field_tag :scope, @pre_auth.scope = hidden_field_tag :nonce, @pre_auth.nonce - = submit_tag "Deny", class: "btn btn-danger" + = submit_tag _("Deny"), class: "btn btn-danger" = form_tag oauth_authorization_path, method: :post, class: 'inline' do = hidden_field_tag :client_id, @pre_auth.client.uid = hidden_field_tag :redirect_uri, @pre_auth.redirect_uri @@ -52,4 +46,4 @@ = hidden_field_tag :response_type, @pre_auth.response_type = hidden_field_tag :scope, @pre_auth.scope = hidden_field_tag :nonce, @pre_auth.nonce - = submit_tag "Authorize", class: "btn btn-success prepend-left-10" + = submit_tag _("Authorize"), class: "btn btn-success prepend-left-10" diff --git a/app/views/doorkeeper/authorizations/show.html.haml b/app/views/doorkeeper/authorizations/show.html.haml index 44e868e6782..e4bfd69e7f8 100644 --- a/app/views/doorkeeper/authorizations/show.html.haml +++ b/app/views/doorkeeper/authorizations/show.html.haml @@ -1,3 +1,3 @@ -%h3.page-title Authorization code: +%h3.page-title= _("Authorization code:") %main{ :role => "main" } %code#authorization_code= params[:code] diff --git a/app/views/doorkeeper/authorized_applications/_delete_form.html.haml b/app/views/doorkeeper/authorized_applications/_delete_form.html.haml index 11c1e67878e..08f2442f025 100644 --- a/app/views/doorkeeper/authorized_applications/_delete_form.html.haml +++ b/app/views/doorkeeper/authorized_applications/_delete_form.html.haml @@ -6,4 +6,4 @@ = form_tag path do %input{ :name => "_method", :type => "hidden", :value => "delete" }/ - = submit_tag 'Revoke', onclick: "return confirm('Are you sure?')", class: 'btn btn-remove btn-sm' + = submit_tag _('Revoke'), onclick: "return confirm('#{_('Are you sure?')}')", class: 'btn btn-remove btn-sm' diff --git a/app/views/doorkeeper/authorized_applications/index.html.haml b/app/views/doorkeeper/authorized_applications/index.html.haml index 30c9d02b72e..8e73298b250 100644 --- a/app/views/doorkeeper/authorized_applications/index.html.haml +++ b/app/views/doorkeeper/authorized_applications/index.html.haml @@ -1,12 +1,12 @@ %header - %h1 Your authorized applications + %h1= _("Your authorized applications") %main{ :role => "main" } .table-holder %table.table.table-striped %thead %tr - %th Application - %th Created At + %th= _('Application') + %th= _('Created At') %th %th %tbody diff --git a/app/views/import/bitbucket/deploy_key.js.haml b/app/views/import/bitbucket/deploy_key.js.haml index 81b34ab5c9d..99e8ac1afa1 100644 --- a/app/views/import/bitbucket/deploy_key.js.haml +++ b/app/views/import/bitbucket/deploy_key.js.haml @@ -1,3 +1,3 @@ :plain job = $("tr#repo_#{@repo_id}") - job.find(".import-actions").html("<p class='alert alert-danger'>Access denied! Please verify you can add deploy keys to this repository.</p>") + job.find(".import-actions").html("<p class='alert alert-danger'>#{_('Access denied! Please verify you can add deploy keys to this repository.')}</p>") diff --git a/app/views/import/bitbucket/status.html.haml b/app/views/import/bitbucket/status.html.haml index 4e8f715db4f..a75b7aa9dd2 100644 --- a/app/views/import/bitbucket/status.html.haml +++ b/app/views/import/bitbucket/status.html.haml @@ -1,22 +1,22 @@ -- page_title 'Bitbucket import' -- header_title 'Projects', root_path +- page_title _('Bitbucket import') +- header_title _('Projects'), root_path %h3.page-title %i.fa.fa-bitbucket - Import projects from Bitbucket + = _('Import projects from Bitbucket') - if @repos.any? %p.light - Select projects you want to import. + = _('Select projects you want to import.') %hr %p - if @incompatible_repos.any? = button_tag class: 'btn btn-import btn-success js-import-all' do - Import all compatible projects + = _('Import all compatible projects') = icon('spinner spin', class: 'loading-icon') - else = button_tag class: 'btn btn-import btn-success js-import-all' do - Import all projects + = _('Import all projects') = icon('spinner spin', class: 'loading-icon') .table-responsive @@ -26,9 +26,9 @@ %colgroup.import-jobs-status-col %thead %tr - %th From Bitbucket - %th To GitLab - %th Status + %th= _('From Bitbucket') + %th= _('To GitLab') + %th= _('Status') %tbody - @already_added_projects.each do |project| %tr{ id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}" } @@ -40,10 +40,10 @@ - if project.import_status == 'finished' %span %i.fa.fa-check - done + = _('done') - elsif project.import_status == 'started' %i.fa.fa-spinner.fa-spin - started + = _('started') - else = project.human_import_status_name @@ -66,7 +66,7 @@ = text_field_tag :path, repo.name, class: "input-mini form-control", tabindex: 2, autofocus: true, required: true %td.import-actions.job-status = button_tag class: 'btn btn-import js-add-to-import' do - Import + = _('Import') = icon('spinner spin', class: 'loading-icon') - @incompatible_repos.each do |repo| %tr{ id: "repo_#{repo.owner}___#{repo.slug}" } @@ -74,16 +74,13 @@ = link_to repo.full_name, "https://bitbucket.org/#{repo.full_name}", target: '_blank', rel: 'noopener noreferrer' %td.import-target %td.import-actions-job-status - = label_tag 'Incompatible Project', nil, class: 'label badge-danger' + = label_tag _('Incompatible Project'), nil, class: 'label badge-danger' - if @incompatible_repos.any? %p - One or more of your Bitbucket projects cannot be imported into GitLab - directly because they use Subversion or Mercurial for version control, - rather than Git. Please convert - = link_to 'them to Git,', 'https://www.atlassian.com/git/tutorials/migrating-overview' - and go through the - = link_to 'import flow', status_import_bitbucket_path - again. + = _("One or more of your Bitbucket projects cannot be imported into GitLab directly because they use Subversion or Mercurial for version control, rather than Git.") + - link_to_git = link_to(_('Git'), 'https://www.atlassian.com/git/tutorials/migrating-overview') + - link_to_import_flow = link_to(_('import flow'), status_import_bitbucket_path) + = _("Please convert them to %{link_to_git}, and go through the %{link_to_import_flow} again.").html_safe % { link_to_git: link_to_git, link_to_import_flow: link_to_import_flow } .js-importer-status{ data: { jobs_import_path: "#{jobs_import_bitbucket_path}", import_path: "#{import_bitbucket_path}" } } diff --git a/app/views/import/fogbugz/new.html.haml b/app/views/import/fogbugz/new.html.haml index 74d686b6703..b54b1af1e0c 100644 --- a/app/views/import/fogbugz/new.html.haml +++ b/app/views/import/fogbugz/new.html.haml @@ -1,26 +1,24 @@ -- page_title "FogBugz Import" -- header_title "Projects", root_path +- page_title _("FogBugz Import") +- header_title _("Projects"), root_path %h3.page-title %i.fa.fa-bug - Import projects from FogBugz + = _('Import projects from FogBugz') %hr = form_tag callback_import_fogbugz_path do %p - To get started you enter your FogBugz URL and login information below. - In the next steps, you'll be able to map users and select the projects - you want to import. + = _("To get started you enter your FogBugz URL and login information below. In the next steps, you'll be able to map users and select the projects you want to import.") .form-group.row - = label_tag :uri, 'FogBugz URL', class: 'col-form-label col-md-2' + = label_tag :uri, _('FogBugz URL'), class: 'col-form-label col-md-2' .col-md-4 = text_field_tag :uri, nil, placeholder: 'https://mycompany.fogbugz.com', class: 'form-control' .form-group.row - = label_tag :email, 'FogBugz Email', class: 'col-form-label col-md-2' + = label_tag :email, _('FogBugz Email'), class: 'col-form-label col-md-2' .col-md-4 = text_field_tag :email, nil, class: 'form-control' .form-group.row - = label_tag :password, 'FogBugz Password', class: 'col-form-label col-md-2' + = label_tag :password, _('FogBugz Password'), class: 'col-form-label col-md-2' .col-md-4 = password_field_tag :password, nil, class: 'form-control' .form-actions - = submit_tag 'Continue to the next step', class: 'btn btn-create' + = submit_tag _('Continue to the next step'), class: 'btn btn-create' diff --git a/app/views/import/fogbugz/new_user_map.html.haml b/app/views/import/fogbugz/new_user_map.html.haml index d27c5d3c36d..ff2f989c509 100644 --- a/app/views/import/fogbugz/new_user_map.html.haml +++ b/app/views/import/fogbugz/new_user_map.html.haml @@ -1,39 +1,33 @@ -- page_title 'User map', 'FogBugz import' -- header_title "Projects", root_path +- page_title _('User map'), _('FogBugz import') +- header_title _("Projects"), root_path %h3.page-title %i.fa.fa-bug - Import projects from FogBugz + = _('Import projects from FogBugz') %hr = form_tag create_user_map_import_fogbugz_path do %p - Customize how FogBugz email addresses and usernames are imported into GitLab. - In the next step, you'll be able to select the projects you want to import. + = _("Customize how FogBugz email addresses and usernames are imported into GitLab. In the next step, you'll be able to select the projects you want to import.") %p - The user map is a mapping of the FogBugz users that participated on your projects to the way their email address and usernames will be imported into GitLab. You can change this by populating the table below. + = _("The user map is a mapping of the FogBugz users that participated on your projects to the way their email address and usernames will be imported into GitLab. You can change this by populating the table below.") %ul %li - %strong Default: Map a FogBugz account ID to a full name + %strong= _("Default: Map a FogBugz account ID to a full name") %p - An empty GitLab User field will add the FogBugz user's full name - (e.g. "By John Smith") in the description of all issues and comments. - It will also associate and/or assign these issues and comments with - the project creator. + = _("An empty GitLab User field will add the FogBugz user's full name (e.g. \"By John Smith\") in the description of all issues and comments. It will also associate and/or assign these issues and comments with the project creator.") %li - %strong Map a FogBugz account ID to a GitLab user + %strong= _("Map a FogBugz account ID to a GitLab user") %p - Selecting a GitLab user will add a link to the GitLab user in the descriptions - of issues and comments (e.g. "By <a href="#">@johnsmith</a>"). It will also - associate and/or assign these issues and comments with the selected user. + = _('Selecting a GitLab user will add a link to the GitLab user in the descriptions of issues and comments (e.g. "By <a href="#">@johnsmith</a>"). It will also associate and/or assign these issues and comments with the selected user.').html_safe .table-holder %table.table %thead %tr - %th ID - %th Name - %th Email - %th GitLab User + %th= _("ID") + %th= _("Name") + %th= _("Email") + %th= _("GitLab User") %tbody - @user_map.each do |id, user| %tr @@ -45,4 +39,4 @@ scope: :all, email_user: true, selected: user[:gitlab_user]) .form-actions - = submit_tag 'Continue to the next step', class: 'btn btn-create' + = submit_tag _('Continue to the next step'), class: 'btn btn-create' diff --git a/app/views/import/fogbugz/status.html.haml b/app/views/import/fogbugz/status.html.haml index 7b832c6a23a..830d141ebea 100644 --- a/app/views/import/fogbugz/status.html.haml +++ b/app/views/import/fogbugz/status.html.haml @@ -1,20 +1,19 @@ -- page_title "FogBugz import" -- header_title "Projects", root_path +- page_title _("FogBugz import") +- header_title _("Projects"), root_path %h3.page-title %i.fa.fa-bug - Import projects from FogBugz + = _('Import projects from FogBugz') - if @repos.any? %p.light - Select projects you want to import. + = _('Select projects you want to import.') %p.light - Optionally, you can - = link_to 'customize', new_user_map_import_fogbugz_path - how FogBugz email addresses and usernames are imported into GitLab. + - link_to_customize = link_to('customize', new_user_map_import_fogbugz_path) + = _('Optionally, you can %{link_to_customize} how FogBugz email addresses and usernames are imported into GitLab.').html_safe % { link_to_customize: link_to_customize } %hr %p = button_tag class: 'btn btn-import btn-success js-import-all' do - Import all projects + = _('Import all projects') = icon("spinner spin", class: "loading-icon") .table-responsive @@ -24,9 +23,9 @@ %colgroup.import-jobs-status-col %thead %tr - %th From FogBugz - %th To GitLab - %th Status + %th= _("From FogBugz") + %th= _("To GitLab") + %th= _("Status") %tbody - @already_added_projects.each do |project| %tr{ id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}" } @@ -38,10 +37,10 @@ - if project.import_status == 'finished' %span %i.fa.fa-check - done + = _("done") - elsif project.import_status == 'started' %i.fa.fa-spinner.fa-spin - started + = _("started") - else = project.human_import_status_name @@ -53,7 +52,7 @@ #{current_user.username}/#{repo.name} %td.import-actions.job-status = button_tag class: "btn btn-import js-add-to-import" do - Import + = _("Import") = icon("spinner spin", class: "loading-icon") .js-importer-status{ data: { jobs_import_path: "#{jobs_import_fogbugz_path}", import_path: "#{import_fogbugz_path}" } } diff --git a/app/views/import/gitea/new.html.haml b/app/views/import/gitea/new.html.haml index 581576a8a3d..2b3102f9af9 100644 --- a/app/views/import/gitea/new.html.haml +++ b/app/views/import/gitea/new.html.haml @@ -1,23 +1,22 @@ -- page_title "Gitea Import" -- header_title "Projects", root_path +- page_title _("Gitea Import") +- header_title _("Projects"), root_path %h3.page-title = custom_icon('go_logo') - Import Projects from Gitea + = _('Import Projects from Gitea') %p - To get started, please enter your Gitea Host URL and a - = succeed '.' do - = link_to 'Personal Access Token', 'https://github.com/gogits/go-gogs-client/wiki#access-token' + - link_to_personal_token = link_to(_('Personal Access Token'), 'https://github.com/gogits/go-gogs-client/wiki#access-token') + = _('To get started, please enter your Gitea Host URL and a %{link_to_personal_token}.').html_safe % { link_to_personal_token: link_to_personal_token } = form_tag personal_access_token_import_gitea_path do .form-group.row - = label_tag :gitea_host_url, 'Gitea Host URL', class: 'col-form-label col-sm-2' + = label_tag :gitea_host_url, _('Gitea Host URL'), class: 'col-form-label col-sm-2' .col-sm-4 = text_field_tag :gitea_host_url, nil, placeholder: 'https://try.gitea.io', class: 'form-control' .form-group.row - = label_tag :personal_access_token, 'Personal Access Token', class: 'col-form-label col-sm-2' + = label_tag :personal_access_token, _('Personal Access Token'), class: 'col-form-label col-sm-2' .col-sm-4 = text_field_tag :personal_access_token, nil, class: 'form-control' .form-actions - = submit_tag 'List Your Gitea Repositories', class: 'btn btn-create' + = submit_tag _('List Your Gitea Repositories'), class: 'btn btn-create' diff --git a/app/views/import/gitea/status.html.haml b/app/views/import/gitea/status.html.haml index 589ca27e45d..88244fde16b 100644 --- a/app/views/import/gitea/status.html.haml +++ b/app/views/import/gitea/status.html.haml @@ -1,7 +1,7 @@ -- page_title "Gitea Import" -- header_title "Projects", root_path +- page_title _("Gitea Import") +- header_title _("Projects"), root_path %h3.page-title = custom_icon('go_logo') - Import Projects from Gitea + = _('Import Projects from Gitea') = render 'import/githubish_status', provider: 'gitea' diff --git a/app/views/import/github/new.html.haml b/app/views/import/github/new.html.haml index b9ebb1a39d9..6ff25f2c842 100644 --- a/app/views/import/github/new.html.haml +++ b/app/views/import/github/new.html.haml @@ -1,7 +1,7 @@ - title = has_ci_cd_only_params? ? _('Connect repositories from GitHub') : _('GitHub import') - page_title title - breadcrumb_title title -- header_title "Projects", root_path +- header_title _("Projects"), root_path %h3.page-title = icon 'github', text: import_github_title diff --git a/app/views/import/github/status.html.haml b/app/views/import/github/status.html.haml index b00b972d9c9..be057be6d1a 100644 --- a/app/views/import/github/status.html.haml +++ b/app/views/import/github/status.html.haml @@ -1,7 +1,7 @@ - title = has_ci_cd_only_params? ? _('Connect repositories from GitHub') : _('GitHub import') - page_title title - breadcrumb_title title -- header_title "Projects", root_path +- header_title _("Projects"), root_path %h3.page-title = icon 'github', text: import_github_title diff --git a/app/views/import/gitlab/status.html.haml b/app/views/import/gitlab/status.html.haml index 37734414835..b7bfbae5edf 100644 --- a/app/views/import/gitlab/status.html.haml +++ b/app/views/import/gitlab/status.html.haml @@ -1,15 +1,15 @@ -- page_title "GitLab.com import" -- header_title "Projects", root_path +- page_title _("GitLab.com import") +- header_title _("Projects"), root_path %h3.page-title %i.fa.fa-heart - Import projects from GitLab.com + = _('Import projects from GitLab.com') %p.light - Select projects you want to import. + = _('Select projects you want to import.') %hr %p = button_tag class: "btn btn-import btn-success js-import-all" do - Import all projects + = _('Import all projects') = icon("spinner spin", class: "loading-icon") .table-responsive @@ -19,9 +19,9 @@ %colgroup.import-jobs-status-col %thead %tr - %th From GitLab.com - %th To this GitLab instance - %th Status + %th= _('From GitLab.com') + %th= _('To this GitLab instance') + %th= _('Status') %tbody - @already_added_projects.each do |project| %tr{ id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}" } @@ -33,10 +33,10 @@ - if project.import_status == 'finished' %span %i.fa.fa-check - done + = _('done') - elsif project.import_status == 'started' %i.fa.fa-spinner.fa-spin - started + = _('started') - else = project.human_import_status_name @@ -48,7 +48,7 @@ = import_project_target(repo['namespace']['path'], repo['name']) %td.import-actions.job-status = button_tag class: "btn btn-import js-add-to-import" do - Import + = _('Import') = icon("spinner spin", class: "loading-icon") .js-importer-status{ data: { jobs_import_path: "#{jobs_import_gitlab_path}", import_path: "#{import_gitlab_path}" } } diff --git a/app/views/import/gitlab_projects/new.html.haml b/app/views/import/gitlab_projects/new.html.haml index cc672a5ea7c..a258fc64b1e 100644 --- a/app/views/import/gitlab_projects/new.html.haml +++ b/app/views/import/gitlab_projects/new.html.haml @@ -1,9 +1,9 @@ -- page_title "GitLab Import" -- header_title "Projects", root_path +- page_title _("GitLab Import") +- header_title _("Projects"), root_path %h3.page-title = icon('gitlab') - Import an exported GitLab project + = _('Import an exported GitLab project') %hr = form_tag import_gitlab_project_path, class: 'new_project', multipart: true do @@ -24,19 +24,19 @@ #{user_url(current_user.username)}/ = hidden_field_tag :namespace_id, value: current_user.namespace_id .form-group.col-12.col-sm-6.project-path - = label_tag :path, 'Project name', class: 'label-light' + = label_tag :path, _('Project name'), class: 'label-light' = text_field_tag :path, @path, placeholder: "my-awesome-project", class: "js-path-name form-control", tabindex: 2, autofocus: true, required: true .row .form-group.col-md-12 - To move or copy an entire GitLab project from another GitLab installation to this one, navigate to the original project's settings page, generate an export file, and upload it here. + = _("To move or copy an entire GitLab project from another GitLab installation to this one, navigate to the original project's settings page, generate an export file, and upload it here.") .row .form-group.col-sm-12 = hidden_field_tag :namespace_id, @namespace.id - = label_tag :file, 'GitLab project export', class: 'label-light' + = label_tag :file, _('GitLab project export'), class: 'label-light' .form-group = file_field_tag :file, class: '' .row .form-actions.col-sm-12 - = submit_tag 'Import project', class: 'btn btn-create' - = link_to 'Cancel', new_project_path, class: 'btn btn-cancel' + = submit_tag _('Import project'), class: 'btn btn-create' + = link_to _('Cancel'), new_project_path, class: 'btn btn-cancel' diff --git a/app/views/import/google_code/new.html.haml b/app/views/import/google_code/new.html.haml index 2f1fb8d9c56..fd6e4726fc5 100644 --- a/app/views/import/google_code/new.html.haml +++ b/app/views/import/google_code/new.html.haml @@ -1,62 +1,62 @@ -- page_title "Google Code import" -- header_title "Projects", root_path +- page_title _("Google Code import") +- header_title _("Projects"), root_path %h3.page-title %i.fa.fa-google - Import projects from Google Code + = _('Import projects from Google Code') %hr = form_tag callback_import_google_code_path, multipart: true do %p - Follow the steps below to export your Google Code project data. - In the next step, you'll be able to select the projects you want to import. + = _('Follow the steps below to export your Google Code project data.') + = _("In the next step, you'll be able to select the projects you want to import.") %ol %li %p - Go to - #{link_to "Google Takeout", "https://www.google.com/settings/takeout", target: '_blank', rel: 'noopener noreferrer'}. + - link_to_google_takeout = link_to(_("Google Takeout"), "https://www.google.com/settings/takeout", target: '_blank', rel: 'noopener noreferrer') + = _("Go to %{link_to_google_takeout}.").html_safe % { link_to_google_takeout: link_to_google_takeout } %li %p - Make sure you're logged into the account that owns the projects you'd like to import. + = _("Make sure you're logged into the account that owns the projects you'd like to import.") %li %p - Click the <strong>Select none</strong> button on the right, since we only need "Google Code Project Hosting". + = _('Click the <strong>Select none</strong> button on the right, since we only need "Google Code Project Hosting".').html_safe %li %p - Scroll down to <strong>Google Code Project Hosting</strong> and enable the switch on the right. + = _('Scroll down to <strong>Google Code Project Hosting</strong> and enable the switch on the right.').html_safe %li %p - Choose <strong>Next</strong> at the bottom of the page. + = _('Choose <strong>Next</strong> at the bottom of the page.').html_safe %li %p - Leave the "File type" and "Delivery method" options on their default values. + = _('Leave the "File type" and "Delivery method" options on their default values.') %li %p - Choose <strong>Create archive</strong> and wait for archiving to complete. + = _('Choose <strong>Create archive</strong> and wait for archiving to complete.').html_safe %li %p - Click the <strong>Download</strong> button and wait for downloading to complete. + = _('Click the <strong>Download</strong> button and wait for downloading to complete.').html_safe %li %p - Find the downloaded ZIP file and decompress it. + = _('Find the downloaded ZIP file and decompress it.') %li %p - Find the newly extracted <code>Takeout/Google Code Project Hosting/GoogleCodeProjectHosting.json</code> file. + = _('Find the newly extracted <code>Takeout/Google Code Project Hosting/GoogleCodeProjectHosting.json</code> file.').html_safe %li %p - Upload <code>GoogleCodeProjectHosting.json</code> here: + = _('Upload <code>GoogleCodeProjectHosting.json</code> here:').html_safe %p %input{ type: "file", name: "dump_file", id: "dump_file" } %li %p - Do you want to customize how Google Code email addresses and usernames are imported into GitLab? + = _('Do you want to customize how Google Code email addresses and usernames are imported into GitLab?') %p = label_tag :create_user_map_0 do = radio_button_tag :create_user_map, 0, true - No, directly import the existing email addresses and usernames. + = _('No, directly import the existing email addresses and usernames.') %p = label_tag :create_user_map_1 do = radio_button_tag :create_user_map, 1, false - Yes, let me map Google Code users to full names or GitLab users. + = _('Yes, let me map Google Code users to full names or GitLab users.') %li %p - = submit_tag 'Continue to the next step', class: "btn btn-create" + = submit_tag _('Continue to the next step'), class: "btn btn-create" diff --git a/app/views/import/google_code/new_user_map.html.haml b/app/views/import/google_code/new_user_map.html.haml index 91c774f575c..baaaf6bdc63 100644 --- a/app/views/import/google_code/new_user_map.html.haml +++ b/app/views/import/google_code/new_user_map.html.haml @@ -1,44 +1,36 @@ -- page_title "User map", "Google Code import" -- header_title "Projects", root_path +- page_title _("User map"), _("Google Code import") +- header_title _("Projects"), root_path %h3.page-title %i.fa.fa-google - Import projects from Google Code + = _('Import projects from Google Code') %hr = form_tag create_user_map_import_google_code_path do %p - Customize how Google Code email addresses and usernames are imported into GitLab. - In the next step, you'll be able to select the projects you want to import. + = _("Customize how Google Code email addresses and usernames are imported into GitLab. In the next step, you'll be able to select the projects you want to import.") %p - The user map is a JSON document mapping the Google Code users that participated on your projects to the way their email addresses and usernames will be imported into GitLab. You can change this by changing the value on the right hand side of <code>:</code>. Be sure to preserve the surrounding double quotes, other punctuation and the email address or username on the left hand side. + = _("The user map is a JSON document mapping the Google Code users that participated on your projects to the way their email addresses and usernames will be imported into GitLab. You can change this by changing the value on the right hand side of <code>:</code>. Be sure to preserve the surrounding double quotes, other punctuation and the email address or username on the left hand side.").html_safe %ul %li - %strong Default: Directly import the Google Code email address or username + %strong= _("Default: Directly import the Google Code email address or username") %p - <code>"johnsmith@example.com": "johnsm...@example.com"</code> - will add "By johnsm...@example.com" to all issues and comments originally created by johnsmith@example.com. - The email address or username is masked to ensure the user's privacy. + = _('<code>"johnsmith@example.com": "johnsm...@example.com"</code> will add "By johnsm...@example.com" to all issues and comments originally created by johnsmith@example.com. The email address or username is masked to ensure the user\'s privacy.').html_safe %li - %strong Map a Google Code user to a GitLab user + %strong= _("Map a Google Code user to a GitLab user") %p - <code>"johnsmith@example.com": "@johnsmith"</code> - will add "By <a href="#">@johnsmith</a>" to all issues and comments originally created by johnsmith@example.com, - and will set <a href="#">@johnsmith</a> as the assignee on all issues originally assigned to johnsmith@example.com. + = _('<code>"johnsmith@example.com": "@johnsmith"</code> will add "By <a href="#">@johnsmith</a>" to all issues and comments originally created by johnsmith@example.com, and will set <a href="#">@johnsmith</a> as the assignee on all issues originally assigned to johnsmith@example.com.').html_safe %li - %strong Map a Google Code user to a full name + %strong= _("Map a Google Code user to a full name") %p - <code>"johnsmith@example.com": "John Smith"</code> - will add "By John Smith" to all issues and comments originally created by johnsmith@example.com. + = _('<code>"johnsmith@example.com": "John Smith"</code> will add "By John Smith" to all issues and comments originally created by johnsmith@example.com.').html_safe %li - %strong Map a Google Code user to a full email address + %strong= _("Map a Google Code user to a full email address") %p - <code>"johnsmith@example.com": "johnsmith@example.com"</code> - will add "By <a href="#">johnsmith@example.com</a>" to all issues and comments originally created by johnsmith@example.com. - By default, the email address or username is masked to ensure the user's privacy. Use this option if you want to show the full email address. + = _('<code>"johnsmith@example.com": "johnsmith@example.com"</code> will add "By <a href="#">johnsmith@example.com</a>" to all issues and comments originally created by johnsmith@example.com. By default, the email address or username is masked to ensure the user\'s privacy. Use this option if you want to show the full email address.').html_safe .form-group.row .col-sm-12 = text_area_tag :user_map, JSON.pretty_generate(@user_map), class: 'form-control', rows: 15 .form-actions - = submit_tag 'Continue to the next step', class: "btn btn-create" + = submit_tag _('Continue to the next step'), class: "btn btn-create" diff --git a/app/views/import/google_code/status.html.haml b/app/views/import/google_code/status.html.haml index acf7a108cb0..347e2820f94 100644 --- a/app/views/import/google_code/status.html.haml +++ b/app/views/import/google_code/status.html.haml @@ -1,25 +1,24 @@ -- page_title "Google Code import" -- header_title "Projects", root_path +- page_title _("Google Code import") +- header_title _("Projects"), root_path %h3.page-title %i.fa.fa-google - Import projects from Google Code + = _('Import projects from Google Code') - if @repos.any? %p.light - Select projects you want to import. + = _('Select projects you want to import.') %p.light - Optionally, you can - = link_to "customize", new_user_map_import_google_code_path - how Google Code email addresses and usernames are imported into GitLab. + - link_to_customize = link_to(_("customize"), new_user_map_import_google_code_path) + = _("Optionally, you can %{link_to_customize} how Google Code email addresses and usernames are imported into GitLab.").html_safe % { link_to_customize: link_to_customize } %hr %p - if @incompatible_repos.any? = button_tag class: "btn btn-import btn-success js-import-all" do - Import all compatible projects + = _("Import all compatible projects") = icon("spinner spin", class: "loading-icon") - else = button_tag class: "btn btn-import btn-success js-import-all" do - Import all projects + = _("Import all projects") = icon("spinner spin", class: "loading-icon") .table-responsive @@ -29,9 +28,9 @@ %colgroup.import-jobs-status-col %thead %tr - %th From Google Code - %th To GitLab - %th Status + %th= _("From Google Code") + %th= _("To GitLab") + %th= _("Status") %tbody - @already_added_projects.each do |project| %tr{ id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}" } @@ -43,10 +42,10 @@ - if project.import_status == 'finished' %span %i.fa.fa-check - done + = _("done") - elsif project.import_status == 'started' %i.fa.fa-spinner.fa-spin - started + = _("started") - else = project.human_import_status_name @@ -58,7 +57,7 @@ #{current_user.username}/#{repo.name} %td.import-actions.job-status = button_tag class: "btn btn-import js-add-to-import" do - Import + = _("Import") = icon("spinner spin", class: "loading-icon") - @incompatible_repos.each do |repo| %tr{ id: "repo_#{repo.id}" } @@ -66,15 +65,12 @@ = link_to repo.name, "https://code.google.com/p/#{repo.name}", target: "_blank", rel: 'noopener noreferrer' %td.import-target %td.import-actions-job-status - = label_tag "Incompatible Project", nil, class: "label badge-danger" + = label_tag _("Incompatible Project"), nil, class: "label badge-danger" - if @incompatible_repos.any? %p - One or more of your Google Code projects cannot be imported into GitLab - directly because they use Subversion or Mercurial for version control, - rather than Git. Please convert them to Git on Google Code, and go - through the - = link_to "import flow", new_import_google_code_path - again. + = _("One or more of your Google Code projects cannot be imported into GitLab directly because they use Subversion or Mercurial for version control, rather than Git.") + - link_to_import_flow = link_to(_("import flow"), new_import_google_code_path) + = _("Please convert them to Git on Google Code, and go through the %{link_to_import_flow} again.").html_safe % { link_to_import_flow: link_to_import_flow } .js-importer-status{ data: { jobs_import_path: "#{jobs_import_google_code_path}", import_path: "#{import_google_code_path}" } } diff --git a/app/views/projects/commit/_change.html.haml b/app/views/projects/commit/_change.html.haml index 3d97e93c9e9..14a7e84394a 100644 --- a/app/views/projects/commit/_change.html.haml +++ b/app/views/projects/commit/_change.html.haml @@ -11,7 +11,7 @@ - branch_label = s_('ChangeTypeActionLabel|Pick into branch') - title = commit.merged_merge_request(current_user) ? _('Cherry-pick this merge request') : _('Cherry-pick this commit') -.modal{ id: "modal-#{type}-commit" } +.modal{ id: "modal-#{type}-commit", tabindex: -1 } .modal-dialog .modal-content .modal-header diff --git a/app/views/projects/environments/show.html.haml b/app/views/projects/environments/show.html.haml index a33bc9d4ce6..c7890b37381 100644 --- a/app/views/projects/environments/show.html.haml +++ b/app/views/projects/environments/show.html.haml @@ -16,7 +16,7 @@ ? .modal-body %p= s_('Environments|Are you sure you want to stop this environment?') - - unless @environment.stop_action? + - unless @environment.stop_action_available? .warning_message %p= s_('Environments|Note that this action will stop the environment, but it will %{emphasis_start}not%{emphasis_end} have an effect on any existing deployment due to no “stop environment action” being defined in the %{ci_config_link_start}.gitlab-ci.yml%{ci_config_link_end} file.').html_safe % { emphasis_start: '<strong>'.html_safe, emphasis_end: '</strong>'.html_safe, diff --git a/app/views/projects/imports/new.html.haml b/app/views/projects/imports/new.html.haml index 16c4f21279d..ca82054d799 100644 --- a/app/views/projects/imports/new.html.haml +++ b/app/views/projects/imports/new.html.haml @@ -10,7 +10,7 @@ .card-body %pre :preserve - #{h(sanitize_repo_path(@project, @project.import_error))} + #{h(@project.import_error)} = form_for @project, url: project_import_path(@project), method: :post do |f| = render "shared/import_form", f: f diff --git a/app/views/projects/protected_branches/_update_protected_branch.html.haml b/app/views/projects/protected_branches/_update_protected_branch.html.haml index f242459f69b..74bfaa9ff80 100644 --- a/app/views/projects/protected_branches/_update_protected_branch.html.haml +++ b/app/views/projects/protected_branches/_update_protected_branch.html.haml @@ -6,5 +6,5 @@ %td = hidden_field_tag "allowed_to_push_#{protected_branch.id}", protected_branch.push_access_levels.first.access_level = dropdown_tag( (protected_branch.push_access_levels.first.humanize || 'Select') , - options: { toggle_class: 'js-allowed-to-push qa-allowed-to-push', dropdown_class: 'dropdown-menu-selectable js-allowed-to-push-container capitalize-header', + options: { toggle_class: 'js-allowed-to-push', dropdown_class: 'dropdown-menu-selectable js-allowed-to-push-container capitalize-header', data: { field_name: "allowed_to_push_#{protected_branch.id}", access_level_id: protected_branch.push_access_levels.first.id }}) diff --git a/app/views/projects/protected_branches/shared/_protected_branch.html.haml b/app/views/projects/protected_branches/shared/_protected_branch.html.haml index 82ef08272d3..05cee483c0e 100644 --- a/app/views/projects/protected_branches/shared/_protected_branch.html.haml +++ b/app/views/projects/protected_branches/shared/_protected_branch.html.haml @@ -2,7 +2,7 @@ %tr.js-protected-branch-edit-form{ data: { url: namespace_project_protected_branch_path(@project.namespace, @project, protected_branch) } } %td - %span.ref-name.qa-protected-branch-name= protected_branch.name + %span.ref-name= protected_branch.name - if @project.root_ref?(protected_branch.name) %span.badge.badge-info.prepend-left-5 default diff --git a/app/views/projects/wikis/_sidebar.html.haml b/app/views/projects/wikis/_sidebar.html.haml index a23396dc0d8..28353927135 100644 --- a/app/views/projects/wikis/_sidebar.html.haml +++ b/app/views/projects/wikis/_sidebar.html.haml @@ -11,9 +11,11 @@ .blocks-container .block.block-first - %ul.wiki-pages - = render @sidebar_wiki_entries, context: 'sidebar' - + - if @sidebar_page + = render_wiki_content(@sidebar_page) + - else + %ul.wiki-pages + = render @sidebar_wiki_entries, context: 'sidebar' .block = link_to project_wikis_pages_path(@project), class: 'btn btn-block' do = s_("Wiki|More Pages") |