Fixed being behind

This commit is contained in:
Luke "Jared" Bennett 2017-04-26 11:17:53 +01:00
parent a582ee2ff0
commit 597c5c762f
No known key found for this signature in database
GPG Key ID: 402ED51FB5D306C2
12 changed files with 184 additions and 31 deletions

View File

@ -73,7 +73,7 @@ One small thing you also have to do when installing it yourself is to copy the e
cp config/unicorn.rb.example.development config/unicorn.rb
Instructions on how to start GitLab and how to run the tests can be found in the [development section of the GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit#development).
Instructions on how to start GitLab and how to run the tests can be found in the [getting started section of the GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit#getting-started).
## Software stack

View File

@ -230,7 +230,6 @@
float: right;
margin-top: 8px;
padding-bottom: 8px;
border-bottom: 1px solid $border-color;
}
}

View File

@ -110,7 +110,7 @@
.top-area {
@include clearfix;
border-bottom: 1px solid $white-normal;
border-bottom: 1px solid $border-color;
.nav-text {
padding-top: 16px;

View File

@ -15,20 +15,20 @@ module Users
end
def execute
# Block the user before moving records to prevent a data race.
# For example, if the user creates an issue after `migrate_issues`
# runs and before the user is destroyed, the destroy will fail with
# an exception.
user.block
transition = user.block_transition
user.transaction do
@ghost_user = User.ghost
# Block the user before moving records to prevent a data race.
# For example, if the user creates an issue after `migrate_issues`
# runs and before the user is destroyed, the destroy will fail with
# an exception.
user.block
migrate_issues
migrate_merge_requests
migrate_notes
migrate_abuse_reports
migrate_award_emoji
# Reverse the user block if record migration fails
if !migrate_records && transition
transition.rollback
user.save!
end
end
user.reload
@ -36,6 +36,18 @@ module Users
private
def migrate_records
user.transaction(requires_new: true) do
@ghost_user = User.ghost
migrate_issues
migrate_merge_requests
migrate_notes
migrate_abuse_reports
migrate_award_emojis
end
end
def migrate_issues
user.issues.update_all(author_id: ghost_user.id)
end
@ -52,7 +64,7 @@ module Users
user.reported_abuse_reports.update_all(reporter_id: ghost_user.id)
end
def migrate_award_emoji
def migrate_award_emojis
user.award_emoji.update_all(user_id: ghost_user.id)
end
end

View File

@ -0,0 +1,5 @@
---
title: Add Slack slash command api to services documentation and rearrange order and
cases
merge_request: 10757
author: TM Lee

View File

@ -0,0 +1,4 @@
---
title: Add a transaction around move_issues_to_ghost_user
merge_request: 10465
author:

View File

@ -0,0 +1,4 @@
---
title: Fix dead link to GDK on the README page
merge_request:
author: Dino Maric

View File

@ -28,7 +28,7 @@ using Tomcat:
sudo apt-get install tomcat7
sudo cp target/plantuml.war /var/lib/tomcat7/webapps/plantuml.war
sudo chown tomcat7:tomcat7 /var/lib/tomcat7/webapps/plantuml.war
sudo service restart tomcat7
sudo service tomcat7 restart
```
Once the Tomcat service restarts the PlantUML service will be ready and

View File

@ -490,13 +490,78 @@ Remove all previously JIRA settings from a project.
DELETE /projects/:id/services/jira
```
## Mattermost Slash Commands
## Slack slash commands
Ability to receive slash commands from a Slack chat instance.
### Get Slack slash command service settings
Get Slack slash command service settings for a project.
```
GET /projects/:id/services/slack-slash-commands
```
Example response:
```json
{
"id": 4,
"title": "Slack slash commands",
"created_at": "2017-06-27T05:51:39-07:00",
"updated_at": "2017-06-27T05:51:39-07:00",
"active": true,
"push_events": true,
"issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"build_events": true,
"pipeline_events": true,
"properties": {
"token": "9koXpg98eAheJpvBs5tK"
}
}
```
### Create/Edit Slack slash command service
Set Slack slash command for a project.
```
PUT /projects/:id/services/slack-slash-commands
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | yes | The Slack token |
### Delete Slack slash command service
Delete Slack slash command service for a project.
```
DELETE /projects/:id/services/slack-slash-commands
```
## Mattermost slash commands
Ability to receive slash commands from a Mattermost chat instance.
### Create/Edit Mattermost Slash Command service
### Get Mattermost slash command service settings
Set Mattermost Slash Command for a project.
Get Mattermost slash command service settings for a project.
```
GET /projects/:id/services/mattermost-slash-commands
```
### Create/Edit Mattermost slash command service
Set Mattermost slash command for a project.
```
PUT /projects/:id/services/mattermost-slash-commands
@ -509,22 +574,14 @@ Parameters:
| `token` | string | yes | The Mattermost token |
### Delete Mattermost Slash Command service
### Delete Mattermost slash command service
Delete Mattermost Slash Command service for a project.
Delete Mattermost slash command service for a project.
```
DELETE /projects/:id/services/mattermost-slash-commands
```
### Get Mattermost Slash Command service settings
Get Mattermost Slash Command service settings for a project.
```
GET /projects/:id/services/mattermost-slash-commands
```
## Pipeline-Emails
Get emails for GitLab CI pipelines.

View File

@ -14,8 +14,10 @@ for more information on general testing practices at GitLab.
GitLab uses the [Karma][karma] test runner with [Jasmine][jasmine] as its test
framework for our JavaScript unit tests. For tests that rely on DOM
manipulation we use fixtures which are pre-compiled from HAML source files and
served during testing by the [jasmine-jquery][jasmine-jquery] plugin.
manipulation, we generate HTML files using RSpec suites (see `spec/javascripts/fixtures/*.rb` for examples).
Some fixtures are still HAML templates that are translated to HTML files using the same mechanism (see `static_fixtures.rb`).
Those will be migrated over time.
Fixtures are served during testing by the [jasmine-jquery][jasmine-jquery] plugin.
JavaScript tests live in `spec/javascripts/`, matching the folder structure
of `app/assets/javascripts/`: `app/assets/javascripts/behaviors/autosize.js`

View File

@ -60,5 +60,23 @@ describe Users::MigrateToGhostUserService, services: true do
end
end
end
context "when record migration fails with a rollback exception" do
before do
expect_any_instance_of(MergeRequest::ActiveRecord_Associations_CollectionProxy)
.to receive(:update_all).and_raise(ActiveRecord::Rollback)
end
context "for records that were already migrated" do
let!(:issue) { create(:issue, project: project, author: user) }
let!(:merge_request) { create(:merge_request, source_project: project, author: user, target_branch: "first") }
it "reverses the migration" do
service.execute
expect(issue.reload.author).to eq(user)
end
end
end
end
end

View File

@ -35,5 +35,57 @@ shared_examples "migrating a deleted user's associated records to the ghost user
expect(user).to be_blocked
end
context "race conditions" do
context "when #{record_class_name} migration fails and is rolled back" do
before do
expect_any_instance_of(record_class::ActiveRecord_Associations_CollectionProxy)
.to receive(:update_all).and_raise(ActiveRecord::Rollback)
end
it 'rolls back the user block' do
service.execute
expect(user.reload).not_to be_blocked
end
it "doesn't unblock an previously-blocked user" do
user.block
service.execute
expect(user.reload).to be_blocked
end
end
context "when #{record_class_name} migration fails with a non-rollback exception" do
before do
expect_any_instance_of(record_class::ActiveRecord_Associations_CollectionProxy)
.to receive(:update_all).and_raise(ArgumentError)
end
it 'rolls back the user block' do
service.execute rescue nil
expect(user.reload).not_to be_blocked
end
it "doesn't unblock an previously-blocked user" do
user.block
service.execute rescue nil
expect(user.reload).to be_blocked
end
end
it "blocks the user before #{record_class_name} migration begins" do
expect(service).to receive("migrate_#{record_class_name.parameterize('_')}s".to_sym) do
expect(user.reload).to be_blocked
end
service.execute
end
end
end
end