mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-23 19:46:12 +10:00
Merge branch 'update_stable-7-13' into '7-13-stable'
Update stable for 7.13.2 See merge request !1056
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
Please view this file on the master branch, on stable branches it's out of date.
|
||||
|
||||
v 7.13.2
|
||||
- Fix randomly failed spec
|
||||
- Create project services on Project creation
|
||||
- Add admin_merge_request ability to Developer level and up
|
||||
- Fix Error 500 when browsing projects with no HEAD (Stan Hu)
|
||||
- Fix labels / assignee / milestone for the merge requests when issues are disabled
|
||||
- Show the first tab automatically on MergeRequests#new
|
||||
- Add rake task 'gitlab:update_commit_count' (Daniel Gerhardt)
|
||||
- Fix Gmail Actions
|
||||
|
||||
v 7.13.1
|
||||
- Fix: Label modifications are not reflected in existing notes and in the issue list
|
||||
- Fix: Label not shown in the Issue list, although it's set through web interface
|
||||
@@ -9,6 +19,7 @@ v 7.13.1
|
||||
- Fix: ActionView::Template::Error
|
||||
- Fix: "Create Merge Request" isn't always shown in event for newly pushed branch
|
||||
- Fix bug causing "Remove source-branch" option not to work for merge requests from the same project.
|
||||
- Render Note field hints consistently for "new" and "edit" forms
|
||||
|
||||
v 7.13.0
|
||||
- Remove repository graph log to fix slow cache updates after push event (Stan Hu)
|
||||
|
||||
@@ -15,9 +15,7 @@ class @MergeRequest
|
||||
this.$('.show-all-commits').on 'click', =>
|
||||
this.showAllCommits()
|
||||
|
||||
# `MergeRequests#new` has no tab-persisting or lazy-loading behavior
|
||||
unless @opts.action == 'new'
|
||||
new MergeRequestTabs(@opts)
|
||||
@initTabs()
|
||||
|
||||
# Prevent duplicate event bindings
|
||||
@disableTaskList()
|
||||
@@ -29,6 +27,14 @@ class @MergeRequest
|
||||
$: (selector) ->
|
||||
this.$el.find(selector)
|
||||
|
||||
initTabs: ->
|
||||
if @opts.action != 'new'
|
||||
# `MergeRequests#new` has no tab-persisting or lazy-loading behavior
|
||||
new MergeRequestTabs(@opts)
|
||||
else
|
||||
# Show the first tab (Commits)
|
||||
$('.merge-request-tabs a[data-toggle="tab"]:first').tab('show')
|
||||
|
||||
showAllCommits: ->
|
||||
this.$('.first-commits').remove()
|
||||
this.$('.all-commits').removeClass 'hide'
|
||||
|
||||
@@ -274,7 +274,8 @@ module ProjectsHelper
|
||||
end
|
||||
|
||||
def readme_cache_key
|
||||
[@project.id, @project.commit.sha, "readme"].join('-')
|
||||
sha = @project.commit.try(:sha) || 'nil'
|
||||
[@project.id, sha, "readme"].join('-')
|
||||
end
|
||||
|
||||
def round_commit_count(project)
|
||||
|
||||
@@ -158,12 +158,13 @@ class Ability
|
||||
:create_project_snippet,
|
||||
:update_issue,
|
||||
:admin_issue,
|
||||
:admin_label,
|
||||
:admin_label
|
||||
]
|
||||
end
|
||||
|
||||
def project_dev_rules
|
||||
project_report_rules + [
|
||||
:admin_merge_request,
|
||||
:create_merge_request,
|
||||
:create_wiki,
|
||||
:push_code
|
||||
|
||||
@@ -159,6 +159,16 @@ module Issuable
|
||||
end
|
||||
end
|
||||
|
||||
# Convert this Issuable class name to a format usable by Ability definitions
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# issuable.class # => MergeRequest
|
||||
# issuable.to_ability_name # => "merge_request"
|
||||
def to_ability_name
|
||||
self.class.to_s.underscore
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def filter_superceded_votes(votes, notes)
|
||||
|
||||
@@ -27,8 +27,10 @@ class IssuableBaseService < BaseService
|
||||
old_branch, new_branch)
|
||||
end
|
||||
|
||||
def filter_params
|
||||
unless can?(current_user, :admin_issue, project)
|
||||
def filter_params(issuable_ability_name = :issue)
|
||||
ability = :"admin_#{issuable_ability_name}"
|
||||
|
||||
unless can?(current_user, ability, project)
|
||||
params.delete(:milestone_id)
|
||||
params.delete(:label_ids)
|
||||
params.delete(:assignee_id)
|
||||
|
||||
@@ -10,6 +10,10 @@ module Issues
|
||||
|
||||
private
|
||||
|
||||
def filter_params
|
||||
super(:issue)
|
||||
end
|
||||
|
||||
def execute_hooks(issue, action = 'open')
|
||||
issue_data = hook_data(issue, action)
|
||||
issue.project.execute_hooks(issue_data, :issue_hooks)
|
||||
|
||||
@@ -20,5 +20,11 @@ module MergeRequests
|
||||
merge_request.project.execute_services(merge_data, :merge_request_hooks)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def filter_params
|
||||
super(:merge_request)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -85,6 +85,8 @@ module Projects
|
||||
|
||||
@project.create_wiki if @project.wiki_enabled?
|
||||
|
||||
@project.build_missing_services
|
||||
|
||||
event_service.create_project(@project, current_user)
|
||||
system_hook_service.execute_hooks_for(@project, :create)
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
= yield
|
||||
%div.footer{style: "margin-top: 10px;"}
|
||||
%p
|
||||
\—
|
||||
—
|
||||
%br
|
||||
- if @target_url
|
||||
#{link_to "View it on GitLab", @target_url}
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
= note_target_fields(note)
|
||||
= render layout: 'projects/md_preview', locals: { preview_class: 'note-text' } do
|
||||
= render 'projects/zen', f: f, attr: :note, classes: 'note_text js-note-text js-task-list-field'
|
||||
|
||||
.comment-hints.clearfix
|
||||
.pull-left #{link_to 'Markdown ', help_page_path('markdown', 'markdown'),{ target: '_blank', tabindex: -1 }}
|
||||
.pull-right #{link_to 'Attach a file', '#', class: 'markdown-selector', tabindex: -1 }
|
||||
= render 'projects/notes/hints'
|
||||
|
||||
.note-form-actions
|
||||
.buttons
|
||||
|
||||
@@ -8,18 +8,8 @@
|
||||
= f.hidden_field :noteable_type
|
||||
|
||||
= render layout: 'projects/md_preview', locals: { preview_class: "note-text", referenced_users: true } do
|
||||
= render 'projects/zen', f: f, attr: :note,
|
||||
classes: 'note_text js-note-text'
|
||||
|
||||
.comment-hints.clearfix
|
||||
.pull-left
|
||||
= link_to "Markdown ", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }
|
||||
tip:
|
||||
= random_markdown_tip
|
||||
.pull-right
|
||||
= link_to '#', class: 'markdown-selector', tabindex: -1 do
|
||||
Attach a file
|
||||
= icon('paperclip')
|
||||
= render 'projects/zen', f: f, attr: :note, classes: 'note_text js-note-text'
|
||||
= render 'projects/notes/hints'
|
||||
.error-alert
|
||||
|
||||
.note-form-actions
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
.comment-hints.clearfix
|
||||
.pull-left
|
||||
= link_to 'Markdown', help_page_path('markdown', 'markdown'), target: '_blank', tabindex: -1
|
||||
tip:
|
||||
= random_markdown_tip
|
||||
.pull-right
|
||||
= link_to '#', class: 'markdown-selector', tabindex: -1 do
|
||||
= icon('paperclip')
|
||||
Attach a file
|
||||
@@ -8,7 +8,7 @@
|
||||
- else
|
||||
none
|
||||
.issuable-context-selectbox
|
||||
- if can?(current_user, :"admin_#{issuable.class.to_s.underscore}", @project)
|
||||
- if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
|
||||
= users_select_tag("#{issuable.class.table_name.singularize}[assignee_id]", placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: issuable.assignee_id, project: @target_project, null_user: true)
|
||||
|
||||
%div.prepend-top-20.clearfix
|
||||
@@ -24,7 +24,7 @@
|
||||
- else
|
||||
none
|
||||
.issuable-context-selectbox
|
||||
- if can?(current_user, :"admin_#{issuable.class.to_s.underscore}", @project)
|
||||
- if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
|
||||
= f.select(:milestone_id, milestone_options(issuable), { include_blank: 'Select milestone' }, {class: 'select2 select2-compact js-select2 js-milestone'})
|
||||
= hidden_field_tag :issuable_context
|
||||
= f.submit class: 'btn hide'
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
.clearfix
|
||||
.error-alert
|
||||
%hr
|
||||
- if can?(current_user, :admin_issue, @project)
|
||||
- if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
|
||||
.form-group
|
||||
.issue-assignee
|
||||
= f.label :assignee_id, class: 'control-label' do
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB |
@@ -1,28 +0,0 @@
|
||||
# GitLab buttons in Gmail
|
||||
|
||||
GitLab supports [Google actions in email](https://developers.google.com/gmail/markup/actions/actions-overview).
|
||||
|
||||
If correctly setup, emails that require an action will be marked in Gmail.
|
||||
|
||||

|
||||
|
||||
To get this functioning, you need to be registered with Google.
|
||||
[See how to register with Google in this document.](https://developers.google.com/gmail/markup/registering-with-google)
|
||||
|
||||
To aid the registering with Google, GitLab offers a rake task that will send an email to Google whitelisting email address from your GitLab server.
|
||||
|
||||
To check what would be sent to the Google email address, run the rake task:
|
||||
|
||||
```bash
|
||||
bundle exec rake gitlab:mail_google_schema_whitelisting RAILS_ENV=production
|
||||
```
|
||||
|
||||
**This will not send the email but give you the output of how the mail will look.**
|
||||
|
||||
Copy the output of the rake task to [Google email markup tester](https://www.google.com/webmasters/markup-tester/u/0/) and press "Validate".
|
||||
|
||||
If you receive "No errors detected" message from the tester you can send the email using:
|
||||
|
||||
```bash
|
||||
bundle exec rake gitlab:mail_google_schema_whitelisting RAILS_ENV=production SEND=true
|
||||
```
|
||||
@@ -17,6 +17,7 @@ If a user is a GitLab administrator they receive all permissions.
|
||||
| Create code snippets | | ✓ | ✓ | ✓ | ✓ |
|
||||
| Manage issue tracker | | ✓ | ✓ | ✓ | ✓ |
|
||||
| Manage labels | | ✓ | ✓ | ✓ | ✓ |
|
||||
| Manage merge requests | | | ✓ | ✓ | ✓ |
|
||||
| Create new merge request | | | ✓ | ✓ | ✓ |
|
||||
| Create new branches | | | ✓ | ✓ | ✓ |
|
||||
| Push to non-protected branches | | | ✓ | ✓ | ✓ |
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
require "#{Rails.root}/app/helpers/emails_helper"
|
||||
require 'action_view/helpers'
|
||||
extend ActionView::Helpers
|
||||
|
||||
include ActionView::Context
|
||||
include EmailsHelper
|
||||
|
||||
namespace :gitlab do
|
||||
desc "Email google whitelisting email with example email for actions in inbox"
|
||||
task mail_google_schema_whitelisting: :environment do
|
||||
subject = "Rails | Implemented feature"
|
||||
url = "#{Gitlab.config.gitlab.url}/base/rails-project/issues/#{rand(1..100)}#note_#{rand(10..1000)}"
|
||||
schema = email_action(url)
|
||||
body = email_template(schema, url)
|
||||
mail = Notify.test_email("schema.whitelisting+sample@gmail.com", subject, body.html_safe)
|
||||
if send_now
|
||||
mail.deliver
|
||||
else
|
||||
puts "WOULD SEND:"
|
||||
end
|
||||
puts mail
|
||||
end
|
||||
|
||||
def email_template(schema, url)
|
||||
"<html lang='en'>
|
||||
<head>
|
||||
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
||||
<title>
|
||||
GitLab
|
||||
</title>
|
||||
</meta>
|
||||
</head>
|
||||
<style>
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
p.details {
|
||||
font-style:italic;
|
||||
color:#777
|
||||
}
|
||||
.footer p {
|
||||
font-size:small;
|
||||
color:#777
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div class='content'>
|
||||
<div>
|
||||
<p>I like it :+1: </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='footer' style='margin-top: 10px;'>
|
||||
<p>
|
||||
<br>
|
||||
<a href=\"#{url}\">View it on GitLab</a>
|
||||
You're receiving this notification because you are a member of the Base / Rails Project project team.
|
||||
#{schema}
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>"
|
||||
end
|
||||
|
||||
def send_now
|
||||
if ENV['SEND'] == "true"
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace :gitlab do
|
||||
desc "GitLab | Update commit count for projects"
|
||||
task update_commit_count: :environment do
|
||||
projects = Project.where(commit_count: 0)
|
||||
puts "#{projects.size} projects need to be updated. This might take a while."
|
||||
ask_to_continue unless ENV['force'] == 'yes'
|
||||
|
||||
projects.find_each(batch_size: 100) do |project|
|
||||
print "#{project.name_with_namespace.yellow} ... "
|
||||
|
||||
unless project.repo_exists?
|
||||
puts "skipping, because the repo is empty".magenta
|
||||
next
|
||||
end
|
||||
|
||||
project.update_commit_count
|
||||
puts project.commit_count.to_s.green
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -22,7 +22,7 @@ describe ProjectsHelper do
|
||||
|
||||
let(:user) { create(:user) }
|
||||
|
||||
it "returns false if there are no approipriate permissions" do
|
||||
it "returns false if there are no appropriate permissions" do
|
||||
allow(helper).to receive(:can?) { false }
|
||||
|
||||
expect(helper.can_change_visibility_level?(project, user)).to be_falsey
|
||||
@@ -52,4 +52,22 @@ describe ProjectsHelper do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "readme_cache_key" do
|
||||
let(:project) { create(:project) }
|
||||
|
||||
before do
|
||||
helper.instance_variable_set(:@project, project)
|
||||
end
|
||||
|
||||
it "returns a valid cach key" do
|
||||
expect(helper.send(:readme_cache_key)).to eq("#{project.id}-#{project.commit.id}-readme")
|
||||
end
|
||||
|
||||
it "returns a valid cache key if HEAD does not exist" do
|
||||
allow(project).to receive(:commit) { nil }
|
||||
|
||||
expect(helper.send(:readme_cache_key)).to eq("#{project.id}-nil-readme")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,13 +4,19 @@ describe Projects::CreateService do
|
||||
describe :create_by_user do
|
||||
before do
|
||||
@user = create :user
|
||||
@admin = create :user, admin: true
|
||||
@opts = {
|
||||
name: "GitLab",
|
||||
namespace: @user.namespace
|
||||
}
|
||||
end
|
||||
|
||||
it 'creates services on Project creation' do
|
||||
project = create_project(@user, @opts)
|
||||
project.reload
|
||||
|
||||
expect(project.services).not_to be_empty
|
||||
end
|
||||
|
||||
context 'user namespace' do
|
||||
before do
|
||||
@project = create_project(@user, @opts)
|
||||
@@ -75,7 +81,9 @@ describe Projects::CreateService do
|
||||
end
|
||||
|
||||
it 'should allow a restricted visibility level for admins' do
|
||||
project = create_project(@admin, @opts)
|
||||
admin = create(:admin)
|
||||
project = create_project(admin, @opts)
|
||||
|
||||
expect(project.errors.any?).to be(false)
|
||||
expect(project.saved?).to be(true)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user