Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-03 21:06:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-03 21:06:11 +0300
commit25521def84a6987fe9d4265b560e930bfb32c195 (patch)
tree711e001ea65f76a9c2eb034c4531bda325af84f3 /app
parent9a1c5456747a7b5b218b8b44e4b43396bf7fd705 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/repository/components/last_commit.vue4
-rw-r--r--app/assets/javascripts/repository/queries/pathLastCommit.query.graphql1
-rw-r--r--app/graphql/resolvers/last_commit_resolver.rb17
-rw-r--r--app/graphql/types/commit_type.rb2
-rw-r--r--app/graphql/types/tree/tree_type.rb6
-rw-r--r--app/presenters/commit_presenter.rb11
-rw-r--r--app/views/projects/branches/_branch.html.haml3
7 files changed, 38 insertions, 6 deletions
diff --git a/app/assets/javascripts/repository/components/last_commit.vue b/app/assets/javascripts/repository/components/last_commit.vue
index e2060d4aeec..1b023f13862 100644
--- a/app/assets/javascripts/repository/components/last_commit.vue
+++ b/app/assets/javascripts/repository/components/last_commit.vue
@@ -1,5 +1,4 @@
<script>
-/* eslint-disable @gitlab/vue-i18n/no-bare-strings */
import { GlTooltipDirective, GlLink, GlButton, GlLoadingIcon } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale';
import Icon from '../../vue_shared/components/icon.vue';
@@ -113,7 +112,7 @@ export default {
>
{{ commit.author.name }}
</gl-link>
- authored
+ {{ s__('LastCommit|authored') }}
<timeago-tooltip :time="commit.authoredDate" tooltip-placement="bottom" />
</div>
<pre
@@ -125,6 +124,7 @@ export default {
</pre>
</div>
<div class="commit-actions flex-row">
+ <div v-if="commit.signatureHtml" v-html="commit.signatureHtml"></div>
<gl-link
v-if="commit.latestPipeline"
v-gl-tooltip
diff --git a/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql b/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql
index 3bdfd979fa4..71c1bf12749 100644
--- a/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql
+++ b/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql
@@ -13,6 +13,7 @@ query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) {
avatarUrl
webUrl
}
+ signatureHtml
latestPipeline {
detailedStatus {
detailsPath
diff --git a/app/graphql/resolvers/last_commit_resolver.rb b/app/graphql/resolvers/last_commit_resolver.rb
new file mode 100644
index 00000000000..7a433d6556f
--- /dev/null
+++ b/app/graphql/resolvers/last_commit_resolver.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Resolvers
+ class LastCommitResolver < BaseResolver
+ type Types::CommitType, null: true
+
+ alias_method :tree, :object
+
+ def resolve(**args)
+ # Ensure merge commits can be returned by sending nil to Gitaly instead of '/'
+ path = tree.path == '/' ? nil : tree.path
+ commit = Gitlab::Git::Commit.last_for_path(tree.repository, tree.sha, path)
+
+ ::Commit.new(commit, tree.repository.project) if commit
+ end
+ end
+end
diff --git a/app/graphql/types/commit_type.rb b/app/graphql/types/commit_type.rb
index dd2d81adb8b..fe71791f413 100644
--- a/app/graphql/types/commit_type.rb
+++ b/app/graphql/types/commit_type.rb
@@ -15,6 +15,8 @@ module Types
field :message, type: GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions
field :authored_date, type: Types::TimeType, null: true # rubocop:disable Graphql/Descriptions
field :web_url, type: GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
+ field :signature_html, type: GraphQL::STRING_TYPE,
+ null: true, calls_gitaly: true, description: 'Rendered html for the commit signature'
# models/commit lazy loads the author by email
field :author, type: Types::UserType, null: true # rubocop:disable Graphql/Descriptions
diff --git a/app/graphql/types/tree/tree_type.rb b/app/graphql/types/tree/tree_type.rb
index b967cf3a247..56d544b5fd1 100644
--- a/app/graphql/types/tree/tree_type.rb
+++ b/app/graphql/types/tree/tree_type.rb
@@ -7,9 +7,9 @@ module Types
graphql_name 'Tree'
# Complexity 10 as it triggers a Gitaly call on each render
- field :last_commit, Types::CommitType, null: true, complexity: 10, calls_gitaly: true, resolve: -> (tree, args, ctx) do # rubocop:disable Graphql/Descriptions
- tree.repository.last_commit_for_path(tree.sha, tree.path)
- end
+ field :last_commit, Types::CommitType,
+ null: true, complexity: 10, calls_gitaly: true, resolver: Resolvers::LastCommitResolver,
+ description: 'Last commit for the tree'
field :trees, Types::Tree::TreeEntryType.connection_type, null: false, resolve: -> (obj, args, ctx) do # rubocop:disable Graphql/Descriptions
Gitlab::Graphql::Representation::TreeEntry.decorate(obj.trees, obj.repository)
diff --git a/app/presenters/commit_presenter.rb b/app/presenters/commit_presenter.rb
index f5b1e45c0e9..94fc8ac8e39 100644
--- a/app/presenters/commit_presenter.rb
+++ b/app/presenters/commit_presenter.rb
@@ -20,4 +20,15 @@ class CommitPresenter < Gitlab::View::Presenter::Delegated
def web_url
Gitlab::UrlBuilder.new(commit).url
end
+
+ def signature_html
+ return unless commit.has_signature?
+
+ ApplicationController.renderer.render(
+ 'projects/commit/_signature',
+ locals: { signature: commit.signature },
+ layout: false,
+ formats: [:html]
+ )
+ end
end
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index dbff2115f50..3e53cb510b0 100644
--- a/app/views/projects/branches/_branch.html.haml
+++ b/app/views/projects/branches/_branch.html.haml
@@ -34,8 +34,9 @@
= _('Merge request')
- if branch.name != @repository.root_ref
- = link_to project_compare_path(@project, @repository.root_ref, branch.name),
+ = link_to project_compare_index_path(@project, from: @repository.root_ref, to: branch.name),
class: "btn btn-default js-onboarding-compare-branches #{'prepend-left-10' unless merge_project}",
+ method: :post,
title: s_('Branches|Compare') do
= s_('Branches|Compare')