BigW Consortium Gitlab

Fixed dodgy merge

parent 7dabca1b
......@@ -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 [getting started section of the GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit#getting-started).
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).
## Software stack
......
......@@ -230,6 +230,7 @@
float: right;
margin-top: 8px;
padding-bottom: 8px;
border-bottom: 1px solid $border-color;
}
}
......
......@@ -110,7 +110,7 @@
.top-area {
@include clearfix;
border-bottom: 1px solid $border-color;
border-bottom: 1px solid $white-normal;
.nav-text {
padding-top: 16px;
......
......@@ -15,39 +15,27 @@ module Users
end
def execute
transition = user.block_transition
user.transaction do
# 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
# Reverse the user block if record migration fails
if !migrate_records && transition
transition.rollback
user.save!
end
end
user.reload
end
private
def migrate_records
user.transaction(requires_new: true) do
user.transaction do
@ghost_user = User.ghost
migrate_issues
migrate_merge_requests
migrate_notes
migrate_abuse_reports
migrate_award_emojis
migrate_award_emoji
end
user.reload
end
private
def migrate_issues
user.issues.update_all(author_id: ghost_user.id)
end
......@@ -64,7 +52,7 @@ module Users
user.reported_abuse_reports.update_all(reporter_id: ghost_user.id)
end
def migrate_award_emojis
def migrate_award_emoji
user.award_emoji.update_all(user_id: ghost_user.id)
end
end
......
---
title: Add Slack slash command api to services documentation and rearrange order and
cases
merge_request: 10757
author: TM Lee
---
title: Add a transaction around move_issues_to_ghost_user
merge_request: 10465
author:
---
title: Fix dead link to GDK on the README page
merge_request:
author: Dino Maric
......@@ -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 tomcat7 restart
sudo service restart tomcat7
```
Once the Tomcat service restarts the PlantUML service will be ready and
......
......@@ -490,98 +490,41 @@ Remove all previously JIRA settings from a project.
DELETE /projects/:id/services/jira
```
## Slack slash commands
## Mattermost 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"
}
}
```
Ability to receive slash commands from a Mattermost chat instance.
### Create/Edit Slack slash command service
### Create/Edit Mattermost Slash Command service
Set Slack slash command for a project.
Set Mattermost Slash Command for a project.
```
PUT /projects/:id/services/slack-slash-commands
PUT /projects/:id/services/mattermost-slash-commands
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | yes | The Slack token |
| `token` | string | yes | The Mattermost token |
### Delete Slack slash command service
### Delete Mattermost Slash Command service
Delete Slack slash command service for a project.
Delete Mattermost Slash Command service for a project.
```
DELETE /projects/:id/services/slack-slash-commands
DELETE /projects/:id/services/mattermost-slash-commands
```
## Mattermost slash commands
Ability to receive slash commands from a Mattermost chat instance.
### Get Mattermost slash command service settings
### Get Mattermost Slash Command service settings
Get Mattermost slash command service settings 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
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `token` | string | yes | The Mattermost token |
### Delete Mattermost slash command service
Delete Mattermost slash command service for a project.
```
DELETE /projects/:id/services/mattermost-slash-commands
```
## Pipeline-Emails
Get emails for GitLab CI pipelines.
......
......@@ -14,10 +14,8 @@ 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 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.
manipulation we use fixtures which are pre-compiled from HAML source files and
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`
......
......@@ -60,23 +60,5 @@ 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
......@@ -35,57 +35,5 @@ 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment