Commit 07175a5f authored by Valery Sizov's avatar Valery Sizov

Resolve conflicts

[Multiple isssue assignees] feature is far behind of the master by this commit I resolve the BE part
parent 3d0ac747
......@@ -97,12 +97,8 @@ module Issuable
acts_as_paranoid
<<<<<<< HEAD
after_save :record_metrics
=======
after_save :update_assignee_cache_counts, if: :assignee_id_changed?
after_save :record_metrics, unless: :imported?
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
# We want to use optimistic lock for cases when only title or description are involved
# http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html
......@@ -295,24 +291,12 @@ module Issuable
self.class.to_ability_name
end
<<<<<<< HEAD
# Convert this Issuable class name to a format usable by notifications.
#
# Examples:
#
# issuable.class # => MergeRequest
# issuable.human_class_name # => "merge request"
def human_class_name
@human_class_name ||= self.class.name.titleize.downcase
=======
# Returns a Hash of attributes to be used for Twitter card metadata
def card_attributes
{
'Author' => author.try(:name),
'Assignee' => assignee.try(:name)
}
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
end
def notes_with_associations
......
......@@ -37,11 +37,8 @@ class Issue < ActiveRecord::Base
validates :project, presence: true
<<<<<<< HEAD
scope :open_for, ->(user) { opened.assigned_to(user) }
=======
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
scope :in_projects, ->(project_ids) { where(project_id: project_ids) }
scope :assigned, -> { where('EXISTS (SELECT TRUE FROM issue_assignees WHERE issue_id = issues.id)') }
scope :unassigned, -> { where('NOT EXISTS (SELECT TRUE FROM issue_assignees WHERE issue_id = issues.id)') }
scope :assigned_to, ->(u) { where('EXISTS (SELECT TRUE FROM issue_assignees WHERE user_id = ? AND issue_id = issues.id)', u.id)}
......
......@@ -108,10 +108,10 @@ class Milestone < ActiveRecord::Base
end
end
<<<<<<< HEAD
def participants
User.joins(assigned_issues: :milestone).where("milestones.id = ?", id)
=======
end
def self.sort(method)
case method.to_s
when 'due_date_asc'
......@@ -125,7 +125,6 @@ class Milestone < ActiveRecord::Base
else
order_by(method)
end
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
end
##
......
......@@ -89,11 +89,8 @@ class User < ActiveRecord::Base
has_many :merge_requests, dependent: :destroy, foreign_key: :author_id
has_many :events, dependent: :destroy, foreign_key: :author_id
has_many :subscriptions, dependent: :destroy
<<<<<<< HEAD
has_many :recent_events, -> { order "id DESC" }, foreign_key: :author_id, class_name: "Event"
=======
has_many :recent_events, -> { order "id DESC" }, foreign_key: :author_id, class_name: "Event"
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
has_many :oauth_applications, class_name: 'Doorkeeper::Application', as: :owner, dependent: :destroy
has_one :abuse_report, dependent: :destroy, foreign_key: :user_id
has_many :reported_abuse_reports, dependent: :destroy, foreign_key: :reporter_id, class_name: "AbuseReport"
......@@ -113,13 +110,10 @@ class User < ActiveRecord::Base
has_many :protected_branch_push_access_levels, dependent: :destroy, class_name: ProtectedBranch::PushAccessLevel
has_many :triggers, dependent: :destroy, class_name: 'Ci::Trigger', foreign_key: :owner_id
<<<<<<< HEAD
has_many :issue_assignees
has_many :assigned_issues, class_name: "Issue", through: :issue_assignees, source: :issue
has_many :assigned_merge_requests, dependent: :nullify, foreign_key: :assignee_id, class_name: "MergeRequest"
=======
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
# Issues that a user owns are expected to be moved to the "ghost" user before
# the user is destroyed. If the user owns any issues during deletion, this
# should be treated as an exceptional condition.
......
......@@ -4,12 +4,8 @@
- if @issue.assignees.any?
%p
<<<<<<< HEAD
Assignee: #{@issue.assignee_list}
=======
Assignee: #{@issue.assignee_name}
- if @issue.description
%div
= markdown(@issue.description, pipeline: :email, author: @issue.author)
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
%p
You have been mentioned in an issue.
<<<<<<< HEAD
- if current_application_settings.email_author_in_body
%div
#{link_to @issue.author_name, user_url(@issue.author)} wrote:
- if @issue.description
= markdown(@issue.description, pipeline: :email, author: @issue.author)
- if @issue.assignees.present?
%p
Assignee: #{@issue.assignee_list}
=======
= render template: 'notify/new_issue_email'
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
-# @project is present when viewing Project's milestone
- project = @project || issuable.project
<<<<<<< HEAD
- assignees = issuable.assignees
=======
- namespace = @project_namespace || project.namespace.becomes(Namespace)
- assignee = issuable.assignee
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
- assignees = issuable.assignees
- issuable_type = issuable.class.table_name
- base_url_args = [namespace, project]
- issuable_type_args = base_url_args + [issuable_type]
......@@ -30,12 +26,7 @@
- render_colored_label(label)
%span.assignee-icon
<<<<<<< HEAD
- assignees.each do |assignee|
= link_to polymorphic_path(base_url_args, { milestone_title: @milestone.title, assignee_id: assignee.id, state: 'all' }),
=======
- if assignee
= link_to polymorphic_path(issuable_type_args, { milestone_title: @milestone.title, assignee_id: issuable.assignee_id, state: 'all' }),
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
class: 'has-tooltip', title: "Assigned to #{assignee.name}", data: { container: 'body' } do
- image_tag(avatar_icon(assignee, 16), class: "avatar s16", alt: '')
......@@ -11,11 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
<<<<<<< HEAD
ActiveRecord::Schema.define(version: 20170320173259) do
=======
ActiveRecord::Schema.define(version: 20170427180205) do
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......
......@@ -373,36 +373,20 @@ Creates a new project issue.
POST /projects/:id/issues
```
<<<<<<< HEAD
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer | yes | The ID of a project |
| `title` | string | yes | The title of an issue |
| `description` | string | no | The description of an issue |
| `confidential` | boolean | no | Set an issue to be confidential. Default is `false`. |
| `assignee_ids` | Array[integer] | no | The ID of a user to assign issue |
| `milestone_id` | integer | no | The ID of a milestone to assign issue |
| `labels` | string | no | Comma-separated label names for an issue |
| `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. `2016-03-11T03:45:40Z` (requires admin or project owner rights) |
| `due_date` | string | no | Date time string in the format YEAR-MONTH-DAY, e.g. `2016-03-11` |
| `merge_request_to_resolve_discussions_of` | integer | no | The IID of a merge request in which to resolve all issues. This will fill the issue with a default description and mark all discussions as resolved. When passing a description or title, these values will take precedence over the default values. |
| `discussion_to_resolve` | string | no | The ID of a discussion to resolve. This will fill in the issue with a default description and mark the discussion as resolved. Use in combination with `merge_request_to_resolve_discussions_of`. |
=======
| Attribute | Type | Required | Description |
|-------------------------------------------|---------|----------|--------------|
| Attribute | Type | Required | Description |
|-------------------------------------------|----------------|----------|--------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
| `title` | string | yes | The title of an issue |
| `description` | string | no | The description of an issue |
| `confidential` | boolean | no | Set an issue to be confidential. Default is `false`. |
| `assignee_id` | integer | no | The ID of a user to assign issue |
| `milestone_id` | integer | no | The ID of a milestone to assign issue |
| `labels` | string | no | Comma-separated label names for an issue |
| `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. `2016-03-11T03:45:40Z` (requires admin or project owner rights) |
| `due_date` | string | no | Date time string in the format YEAR-MONTH-DAY, e.g. `2016-03-11` |
| `merge_request_to_resolve_discussions_of` | integer | no | The IID of a merge request in which to resolve all issues. This will fill the issue with a default description and mark all discussions as resolved. When passing a description or title, these values will take precedence over the default values.|
| `discussion_to_resolve` | string | no | The ID of a discussion to resolve. This will fill in the issue with a default description and mark the discussion as resolved. Use in combination with `merge_request_to_resolve_discussions_of`. |
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
| `weight` | integer | no | The weight of the issue in range 0 to 9 |
| `title` | string | yes | The title of an issue |
| `description` | string | no | The description of an issue |
| `confidential` | boolean | no | Set an issue to be confidential. Default is `false`. |
| `assignee_ids` | Array[integer] | no | The ID of a user to assign issue |
| `milestone_id` | integer | no | The ID of a milestone to assign issue |
| `labels` | string | no | Comma-separated label names for an issue |
| `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. `2016-03-11T03:45:40Z` (requires admin or project owner rights) |
| `due_date` | string | no | Date time string in the format YEAR-MONTH-DAY, e.g. `2016-03-11` |
| `merge_request_to_resolve_discussions_of` | integer | no | The IID of a merge request in which to resolve all issues. This will fill the issue with a default description and mark all discussions as resolved. When passing a description or title, these values will take precedence over the default values.|
| `discussion_to_resolve` | string | no | The ID of a discussion to resolve. This will fill in the issue with a default description and mark the discussion as resolved. Use in combination with `merge_request_to_resolve_discussions_of`. |
| `weight` | integer | no | The weight of the issue in range 0 to 9 |
```bash
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/4/issues?title=Issues%20with%20auth&labels=bug
......
......@@ -17,12 +17,7 @@ describe 'Navigation bar counter', feature: true, caching: true do
expect_counters('issues', '1')
<<<<<<< HEAD
issue.assignees = []
visit issues_dashboard_path
=======
issue.update(assignee: nil)
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
Timecop.travel(3.minutes.from_now) do
visit issues_path
......
......@@ -43,15 +43,6 @@ describe 'Filter issues', js: true, feature: true do
group.add_developer(user)
group.add_developer(user2)
<<<<<<< HEAD
create(:issue, title: "Bug report 1", project: project)
create(:issue, title: "Bug report 2", project: project)
create(:issue, title: "issue with 'single quotes'", project: project)
create(:issue, title: "issue with \"double quotes\"", project: project)
create(:issue, title: "issue with !@\#{$%^&*()-+", project: project)
create(:issue, title: "issue by assignee", project: project, milestone: milestone, author: user, assignees: [user])
create(:issue, title: "issue by assignee with searchTerm", project: project, milestone: milestone, author: user, assignees: [user])
=======
sign_in(user)
create(:issue, project: project)
......@@ -60,9 +51,9 @@ describe 'Filter issues', js: true, feature: true do
create(:issue, project: project, title: "issue with 'single quotes'")
create(:issue, project: project, title: "issue with \"double quotes\"")
create(:issue, project: project, title: "issue with !@\#{$%^&*()-+")
create(:issue, project: project, title: "issue by assignee", milestone: milestone, author: user, assignee: user)
create(:issue, project: project, title: "issue by assignee with searchTerm", milestone: milestone, author: user, assignee: user)
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
create(:issue, project: project, title: "issue by assignee", milestone: milestone, author: user, assignees: [user])
create(:issue, project: project, title: "issue by assignee with searchTerm", milestone: milestone, author: user, assignees: [user])
issue = create(:issue,
title: "Bug 2",
......
......@@ -4,13 +4,8 @@ describe "Search", feature: true do
include FilteredSearchHelpers
let(:user) { create(:user) }
<<<<<<< HEAD
let(:project) { create(:project, namespace: user.namespace) }
let!(:issue) { create(:issue, project: project, assignees: [user]) }
=======
let(:project) { create(:empty_project, namespace: user.namespace) }
let!(:issue) { create(:issue, project: project, assignee: user) }
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
let!(:issue) { create(:issue, project: project, assignees: [user]) }
let!(:issue2) { create(:issue, project: project, author: user) }
before do
......
require 'spec_helper'
describe IssuesFinder do
<<<<<<< HEAD
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:project1) { create(:empty_project) }
......@@ -10,26 +9,11 @@ describe IssuesFinder do
let(:label) { create(:label, project: project2) }
let(:issue1) { create(:issue, author: user, assignees: [user], project: project1, milestone: milestone, title: 'gitlab') }
let(:issue2) { create(:issue, author: user, assignees: [user], project: project2, description: 'gitlab') }
let(:issue3) { create(:issue, author: user2, assignees: [user2], project: project2) }
let(:issue3) { create(:issue, author: user2, assignees: [user2], project: project2, title: 'tanuki', description: 'tanuki') }
describe '#execute' do
let(:closed_issue) { create(:issue, author: user2, assignees: [user2], project: project2, state: 'closed') }
let!(:label_link) { create(:label_link, label: label, target: issue2) }
=======
set(:user) { create(:user) }
set(:user2) { create(:user) }
set(:project1) { create(:empty_project) }
set(:project2) { create(:empty_project) }
set(:milestone) { create(:milestone, project: project1) }
set(:label) { create(:label, project: project2) }
set(:issue1) { create(:issue, author: user, assignee: user, project: project1, milestone: milestone, title: 'gitlab') }
set(:issue2) { create(:issue, author: user, assignee: user, project: project2, description: 'gitlab') }
set(:issue3) { create(:issue, author: user2, assignee: user2, project: project2, title: 'tanuki', description: 'tanuki') }
describe '#execute' do
set(:closed_issue) { create(:issue, author: user2, assignee: user2, project: project2, state: 'closed') }
set(:label_link) { create(:label_link, label: label, target: issue2) }
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
let(:search_user) { user }
let(:params) { {} }
let(:issues) { described_class.new(search_user, params.reverse_merge(scope: scope, state: 'opened')).execute }
......
......@@ -36,19 +36,11 @@ describe Notify do
end
context 'for issues' do
<<<<<<< HEAD
let(:issue) { create(:issue, author: current_user, assignees: [assignee], project: project) }
let(:issue_with_description) { create(:issue, author: current_user, assignees: [assignee], project: project, description: FFaker::Lorem.sentence) }
let(:issue_with_description) { create(:issue, author: current_user, assignees: [assignee], project: project, description: 'My awesome description') }
describe 'that are new' do
subject { Notify.new_issue_email(issue.assignees.first.id, issue.id) }
=======
let(:issue) { create(:issue, author: current_user, assignee: assignee, project: project) }
let(:issue_with_description) { create(:issue, author: current_user, assignee: assignee, project: project, description: 'My awesome description') }
describe 'that are new' do
subject { described_class.new_issue_email(issue.assignee_id, issue.id) }
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
subject { described_class.new_issue_email(issue.assignees.first.id, issue.id) }
it_behaves_like 'an assignee email'
it_behaves_like 'an email starting a new thread with reply-by-email enabled' do
......@@ -77,11 +69,7 @@ describe Notify do
end
describe 'that are new with a description' do
<<<<<<< HEAD
subject { Notify.new_issue_email(issue_with_description.assignees.first.id, issue_with_description.id) }
=======
subject { described_class.new_issue_email(issue_with_description.assignee_id, issue_with_description.id) }
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
subject { described_class.new_issue_email(issue_with_description.assignees.first.id, issue_with_description.id) }
it_behaves_like 'it should show Gmail Actions View Issue link'
......@@ -91,11 +79,7 @@ describe Notify do
end
describe 'that have been reassigned' do
<<<<<<< HEAD
subject { Notify.reassigned_issue_email(recipient.id, issue.id, [previous_assignee.id], current_user.id) }
=======
subject { described_class.reassigned_issue_email(recipient.id, issue.id, previous_assignee.id, current_user.id) }
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
subject { described_class.reassigned_issue_email(recipient.id, issue.id, [previous_assignee.id], current_user.id) }
it_behaves_like 'a multiple recipients email'
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
......
......@@ -193,7 +193,6 @@ describe Issue, models: true do
expect(issue.assignee_or_author?(user)).to be_truthy
end
<<<<<<< HEAD
it 'returns true for a user that is the author of an issue' do
issue.update(author: user)
......@@ -205,8 +204,6 @@ describe Issue, models: true do
end
end
=======
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
describe '#closed_by_merge_requests' do
let(:project) { create(:project, :repository) }
let(:issue) { create(:issue, project: project)}
......@@ -434,14 +431,10 @@ describe Issue, models: true do
it 'updates when assignees change' do
user1 = create(:user)
user2 = create(:user)
<<<<<<< HEAD
issue = create(:issue, assignees: [user1])
=======
project = create(:empty_project)
issue = create(:issue, assignee: user1, project: project)
issue = create(:issue, assignees: [user1], project: project)
project.add_developer(user1)
project.add_developer(user2)
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
expect(user1.assigned_open_issues_count).to eq(1)
expect(user2.assigned_open_issues_count).to eq(0)
......
require 'spec_helper'
describe IssuePolicy, models: true do
let(:guest) { create(:user) }
let(:author) { create(:user) }
let(:assignee) { create(:user) }
let(:reporter) { create(:user) }
let(:group) { create(:group, :public) }
let(:reporter_from_group_link) { create(:user) }
def permissions(user, issue)
IssuePolicy.abilities(user, issue).to_set
end
context 'a private project' do
let(:non_member) { create(:user) }
let(:project) { create(:empty_project, :private) }
let(:issue) { create(:issue, project: project, assignees: [assignee], author: author) }
let(:issue_no_assignee) { create(:issue, project: project) }
before do
project.team << [guest, :guest]
project.team << [author, :guest]
project.team << [assignee, :guest]
project.team << [reporter, :reporter]
group.add_reporter(reporter_from_group_link)
create(:project_group_link, group: group, project: project)
end
it 'does not allow non-members to read issues' do
expect(permissions(non_member, issue)).not_to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(non_member, issue_no_assignee)).not_to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows guests to read issues' do
expect(permissions(guest, issue)).to include(:read_issue)
expect(permissions(guest, issue)).not_to include(:update_issue, :admin_issue)
expect(permissions(guest, issue_no_assignee)).to include(:read_issue)
expect(permissions(guest, issue_no_assignee)).not_to include(:update_issue, :admin_issue)
end
it 'allows reporters to read, update, and admin issues' do
expect(permissions(reporter, issue)).to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(reporter, issue_no_assignee)).to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows reporters from group links to read, update, and admin issues' do
expect(permissions(reporter_from_group_link, issue)).to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(reporter_from_group_link, issue_no_assignee)).to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows issue authors to read and update their issues' do
expect(permissions(author, issue)).to include(:read_issue, :update_issue)
expect(permissions(author, issue)).not_to include(:admin_issue)
expect(permissions(author, issue_no_assignee)).to include(:read_issue)
expect(permissions(author, issue_no_assignee)).not_to include(:update_issue, :admin_issue)
end
it 'allows issue assignees to read and update their issues' do
expect(permissions(assignee, issue)).to include(:read_issue, :update_issue)
expect(permissions(assignee, issue)).not_to include(:admin_issue)
expect(permissions(assignee, issue_no_assignee)).to include(:read_issue)
expect(permissions(assignee, issue_no_assignee)).not_to include(:update_issue, :admin_issue)
end
context 'with confidential issues' do
let(:confidential_issue) { create(:issue, :confidential, project: project, assignees: [assignee], author: author) }
let(:confidential_issue_no_assignee) { create(:issue, :confidential, project: project) }
it 'does not allow non-members to read confidential issues' do
expect(permissions(non_member, confidential_issue)).not_to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(non_member, confidential_issue_no_assignee)).not_to include(:read_issue, :update_issue, :admin_issue)
end
it 'does not allow guests to read confidential issues' do
expect(permissions(guest, confidential_issue)).not_to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(guest, confidential_issue_no_assignee)).not_to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows reporters to read, update, and admin confidential issues' do
expect(permissions(reporter, confidential_issue)).to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(reporter, confidential_issue_no_assignee)).to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows reporters from group links to read, update, and admin confidential issues' do
expect(permissions(reporter_from_group_link, confidential_issue)).to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(reporter_from_group_link, confidential_issue_no_assignee)).to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows issue authors to read and update their confidential issues' do
expect(permissions(author, confidential_issue)).to include(:read_issue, :update_issue)
expect(permissions(author, confidential_issue)).not_to include(:admin_issue)
expect(permissions(author, confidential_issue_no_assignee)).not_to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows issue assignees to read and update their confidential issues' do
expect(permissions(assignee, confidential_issue)).to include(:read_issue, :update_issue)
expect(permissions(assignee, confidential_issue)).not_to include(:admin_issue)
expect(permissions(assignee, confidential_issue_no_assignee)).not_to include(:read_issue, :update_issue, :admin_issue)
end
end
end
context 'a public project' do
let(:project) { create(:empty_project, :public) }
let(:issue) { create(:issue, project: project, assignees: [assignee], author: author) }
let(:issue_no_assignee) { create(:issue, project: project) }
before do
project.team << [guest, :guest]
project.team << [reporter, :reporter]
group.add_reporter(reporter_from_group_link)
create(:project_group_link, group: group, project: project)
end
it 'allows guests to read issues' do
expect(permissions(guest, issue)).to include(:read_issue)
expect(permissions(guest, issue)).not_to include(:update_issue, :admin_issue)
expect(permissions(guest, issue_no_assignee)).to include(:read_issue)
expect(permissions(guest, issue_no_assignee)).not_to include(:update_issue, :admin_issue)
end
it 'allows reporters to read, update, and admin issues' do
expect(permissions(reporter, issue)).to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(reporter, issue_no_assignee)).to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows reporters from group links to read, update, and admin issues' do
expect(permissions(reporter_from_group_link, issue)).to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(reporter_from_group_link, issue_no_assignee)).to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows issue authors to read and update their issues' do
expect(permissions(author, issue)).to include(:read_issue, :update_issue)
expect(permissions(author, issue)).not_to include(:admin_issue)
expect(permissions(author, issue_no_assignee)).to include(:read_issue)
expect(permissions(author, issue_no_assignee)).not_to include(:update_issue, :admin_issue)
end
it 'allows issue assignees to read and update their issues' do
expect(permissions(assignee, issue)).to include(:read_issue, :update_issue)
expect(permissions(assignee, issue)).not_to include(:admin_issue)
expect(permissions(assignee, issue_no_assignee)).to include(:read_issue)
expect(permissions(assignee, issue_no_assignee)).not_to include(:update_issue, :admin_issue)
end
context 'with confidential issues' do
let(:confidential_issue) { create(:issue, :confidential, project: project, assignees: [assignee], author: author) }
let(:confidential_issue_no_assignee) { create(:issue, :confidential, project: project) }
it 'does not allow guests to read confidential issues' do
expect(permissions(guest, confidential_issue)).not_to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(guest, confidential_issue_no_assignee)).not_to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows reporters to read, update, and admin confidential issues' do
expect(permissions(reporter, confidential_issue)).to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(reporter, confidential_issue_no_assignee)).to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows reporter from group links to read, update, and admin confidential issues' do
expect(permissions(reporter_from_group_link, confidential_issue)).to include(:read_issue, :update_issue, :admin_issue)
expect(permissions(reporter_from_group_link, confidential_issue_no_assignee)).to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows issue authors to read and update their confidential issues' do
expect(permissions(author, confidential_issue)).to include(:read_issue, :update_issue)
expect(permissions(author, confidential_issue)).not_to include(:admin_issue)
expect(permissions(author, confidential_issue_no_assignee)).not_to include(:read_issue, :update_issue, :admin_issue)
end
it 'allows issue assignees to read and update their confidential issues' do
expect(permissions(assignee, confidential_issue)).to include(:read_issue, :update_issue)
expect(permissions(assignee, confidential_issue)).not_to include(:admin_issue)
expect(permissions(assignee, confidential_issue_no_assignee)).not_to include(:read_issue, :update_issue, :admin_issue)
end
end
end
end
......@@ -31,13 +31,8 @@ describe API::Issues do
:confidential,
project: project,
author: author,
<<<<<<< HEAD
assignees: [assignee],
created_at: generate(:issue_created_at),
=======
assignee: assignee,
created_at: generate(:past_time),
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
updated_at: 2.hours.ago
end
let!(:issue) do
......
......@@ -26,13 +26,8 @@ describe API::V3::Issues do
:confidential,
project: project,
author: author,
<<<<<<< HEAD
assignees: [assignee],
created_at: generate(:issue_created_at),
=======
assignee: assignee,
created_at: generate(:past_time),
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
updated_at: 2.hours.ago
end
let!(:issue) do
......
......@@ -13,12 +13,8 @@ describe Issues::UpdateService, services: true do
let(:issue) do
create(:issue, title: 'Old title',
<<<<<<< HEAD
assignees: [user3],
=======
description: "for #{user2.to_reference}",
assignee_id: user3.id,
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0
assignee_ids: [user3.id],
project: project)
end
......
......@@ -72,13 +72,8 @@ describe Users::DestroyService, services: true do
project.add_developer(user)
end
<<<<<<< HEAD:spec/services/users/destroy_spec.rb
context "for an issue the user was assigned to" do
let!(:issue) { create(:issue, project: project, assignees: [user]) }
=======
context "for an merge request the user was assigned to" do
let!(:merge_request) { create(:merge_request, source_project: project, assignee: user) }
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0:spec/services/users/destroy_service_spec.rb
before do
service.execute(user)
......@@ -91,11 +86,7 @@ describe Users::DestroyService, services: true do
it 'migrates the merge request so that it is "Unassigned"' do
migrated_merge_request = MergeRequest.find_by_id(merge_request.id)
<<<<<<< HEAD:spec/services/users/destroy_spec.rb
expect(migrated_issue.assignees).to be_empty
=======
expect(migrated_merge_request.assignee).to be_nil
>>>>>>> ebe5fef5b52c6561be470e7f0b2a173d81bc64c0:spec/services/users/destroy_service_spec.rb
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