Commit Graph

99 Commits

Author SHA1 Message Date
Valery Sizov 387c4b2c21 Backport of multiple_assignees_feature [ci skip] 2017-05-04 17:11:53 +03:00
Alfredo Sumaran b64a37c4ed Allow to create new branch and empty WIP merge request from issue page 2017-05-04 08:09:21 +00:00
Valery Sizov 36a8cc3eca Remove helpers assigned_issuables_count and cached_assigned_issuables_count 2017-04-20 13:28:04 +03:00
Robert Speicher add1c18860 Remove an unused `Issue.open_for` scope 2017-04-10 18:32:30 -04:00
Felipe Artur 251255e7ca Do not set closed_at to nil when issue is reopened 2017-04-04 15:19:09 -03:00
Oswaldo Ferreira d730b69eb2 Spam check only when spammable attributes have changed 2017-03-21 14:20:15 -03:00
Felipe Artur 94c19fbfe8 Add closed_at field to issues 2017-03-17 16:41:09 -03:00
Douwe Maan b7123a8f59 Merge branch '27271-missing-time-spent-in-issue-webhook' into 'master'
Include time tracking attributes in webhooks payload

Closes #27271

See merge request !9942
2017-03-15 15:29:16 +00:00
Ruben Davila dd53a9c013 Include time tracking attributes in webhooks payload 2017-03-14 11:56:15 -05:00
Valery Sizov 29e34c3326 Preserve order by priority on issues board 2017-03-14 18:13:52 +02:00
Oswaldo Ferreira aeb9db6753 Present group and dashboard MR list without grouping by project 2017-01-27 20:20:18 -02:00
Berna Castro ac66268443 Refactor Project#to_reference and make full_path a keyword argument
Refactor overall code and fix failing specs

Fix Project#to_reference

Fix wrong spaces and update changelog

Refactor #to_reference for Project & Issue

Fix and improves Project#to_reference
2017-01-27 20:20:17 -02:00
Berna Castro 78c8bce1ff Fix and add specs for Issue#to_reference 2017-01-27 20:20:17 -02:00
Robert Speicher fcb37542e7 Use `:empty_project` where possible in model specs 2017-01-26 17:44:59 -05:00
Robert Speicher c1743ba4c4 Use a project factory with a repository where necessary 2017-01-25 14:52:12 -05:00
James Lopez 112f470572 Fix cross-project references copy to include the project reference
Also added relevant specs and refactored to_references in a bunch of places to be more consistent.
2017-01-03 13:01:46 +01:00
Sean McGivern 4bf61b8bd4 Merge branch 'jej-24637-move-issue-visible_to_user-to-finder' into 'security'
Issue#visible_to_user moved to IssuesFinder

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/24637.

See merge request !2039
2016-12-15 11:41:04 -03:00
Oswaldo Ferreira f272ee6eba Add shorthand support to gitlab markdown references 2016-12-02 19:18:17 -02:00
Ahmad Sherif 916332815e Drop Project#authorized_for_user? in favor of ProjectTeam#member?
Closes #23938
2016-11-23 12:57:58 +02:00
Douwe Maan bf061d0aff
Merge branch 'issue_23548_dev' into 'master'
disable markdown in comments when referencing disabled features

fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/23548

This MR prevents the following references when tool is disabled:

- issues
- snippets
- commits - when repo is disabled
- commit range - when repo is disabled
- milestones

This MR does not prevent references to repository files, since they are just markdown links and don't leak
information.

See merge request !2011

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-09 12:25:17 +01:00
Paco Guzman 493367108e Use MergeRequestsClosingIssues cache data on Issue#closed_by_merge_requests method 2016-10-20 12:55:14 +02:00
Rémy Coutable ec0061a95c Allow Member.add_user to handle access requesters
Changes include:

- Ensure Member.add_user is not called directly when not necessary
- New GroupMember.add_users_to_group to have the same abstraction level as for Project
- Refactor Member.add_user to take a source instead of an array of members
- Fix Rubocop offenses
- Always use Project#add_user instead of project.team.add_user
- Factorize users addition as members in Member.add_users_to_source
- Make access_level a keyword argument in GroupMember.add_users_to_group and ProjectMember.add_users_to_projects
- Destroy any requester before adding them as a member
- Improve the way we handle access requesters in Member.add_user
  Instead of removing the requester and creating a new member,
  we now simply accepts their access request. This way, they will
  receive a "access request granted" email.
- Fix error that was previously silently ignored
- Stop raising when access level is invalid in Member, let Rails validation do their work

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-28 09:43:00 +02:00
Yorick Peterse 002ad21581
Method for returning issues readable by a user
The method Ability.issues_readable_by_user takes a list of users and an
optional user and returns an Array of issues readable by said user. This
method in turn is used by
Banzai::ReferenceParser::IssueParser#nodes_visible_to_user so this
method no longer needs to get all the available abilities just to check
if a user has the "read_issue" ability.

To test this I benchmarked an issue with 222 comments on my development
environment. Using these changes the time spent in nodes_visible_to_user
was reduced from around 120 ms to around 40 ms.
2016-07-29 12:51:18 +02:00
Alejandro Rodríguez ea63346df5 Refactor user authorization check for a single project to avoid querying all user projects
Currently, even when searching for all authorized issues of *one* project, we run the
`Users#authorized_projects` query (which can be rather slow). This update checks if
we are handling issues of just one project and does the authorization check locally.
It does have the downside of basically repeating the logic of `Users#authorized_projects`
on `Project#authorized_for_user`.
2016-07-20 15:14:31 -04:00
Josh Frye 0f3df62e1a Update specs. Add CHANGELOG entry 2016-06-02 09:25:40 -04:00
Yorick Peterse 580d250166
Refactor Participable
There are several changes to this module:

1. The use of an explicit stack in Participable#participants
2. Proc behaviour has been changed
3. Batch permissions checking

== Explicit Stack

Participable#participants no longer uses recursion to process "self" and
all child objects, instead it uses an Array and processes objects in
breadth-first order. This allows us to for example create a single
Gitlab::ReferenceExtractor instance and pass this to any Procs. Re-using
a ReferenceExtractor removes the need for running potentially many SQL
queries every time a Proc is called on a new object.

== Proc Behaviour Changed

Previously a Proc in Participable was expected to return an Array of
User instances. This has been changed and instead it's now expected that
a Proc modifies the Gitlab::ReferenceExtractor passed to it. The return
value of the Proc is ignored.

== Permissions Checking

The method Participable#participants uses
Ability.users_that_can_read_project to check if the returned users have
access to the project of "self" _without_ running multiple SQL queries
for every user.
2016-06-01 16:22:35 +02:00
Robert Speicher 75739e54be Enable RSpec/NotToNot cop and auto-correct offenses
Also removes the note from the development/testing.md guide
2016-05-24 15:40:29 -04:00
Jeroen van Baarsen f1479b56b7
Remove the annotate gem and delete old annotations
In 8278b763d9 the default behaviour of annotation
has changes, which was causing a lot of noise in diffs. We decided in #17382
that it is better to get rid of the whole annotate gem, and instead let people
look at schema.rb for the columns in a table.

Fixes: #17382
2016-05-09 18:00:28 +02:00
Timothy Andrew f801e2243d A new branch created for a confidential issue is named `<id>-confidential-issue`. 2016-04-19 09:22:55 +05:30
Timothy Andrew 953bafff90 Merge remote-tracking branch 'origin/master' into 14566-confidential-issue-branches 2016-04-15 09:50:53 +05:30
Timothy Andrew f5ce601c2b Make a few style changes based on MR feedback. 2016-04-15 09:31:26 +05:30
Zeger-Jan van de Weg 0385cd5a58 Start with iid on branch creation 2016-04-14 14:49:45 +02:00
Timothy Andrew 8dd1a6fc91 Fix the rubocop check. 2016-04-13 09:04:08 +05:30
Timothy Andrew 66ca80181b Test the `Issue#to_branch_name` method. 2016-04-12 16:01:44 +05:30
Timothy Andrew 91034af3c9 Augment the tests for `Issue#related_branches`
- Test the case where we have a referenced merge request that's being
- excluded as a "related branch"
- This took a while to figure out, especially the
  `create_cross_references!` line.
2016-04-12 15:50:19 +05:30
Timothy Andrew 5d88de092f Refactor `Issue#related_branches`
- Previously, the controller held the logic to calculate
  related branches, which was:

  `<branches ending with `issue.iid`> - <branches with a merge request referenced in the current issue>`

- This logic belongs in the `related_branches` method, not in the
  controller. This commit makes this change.

- This means that `Issue#related_branches` now needs to take a `User`.
  When we find the branches that have a merge request referenced in the
  current issue, this is limited to merge requests that the current user
  has access to.

- This is not directly related to #14566, but is a related refactoring.
2016-04-12 11:43:15 +05:30
Grzegorz Bizon 915bfedfa7 Do not allow to move issue if it has not been persisted 2016-03-23 09:41:39 +01:00
Zeger-Jan van de Weg 6e5461c6ee Merge branch 'master' into 2489-soft-delete-issues 2016-03-21 19:32:37 +01:00
Robert Speicher ffc3acd498 Merge branch 'issues-show-performance' into 'master'
Improve performance of viewing individual issues

This MR does two things:

1. `Issue#related_branches` no longer performs Git operations that aren't needed
2. The output of `Repository#exists?` is now cached and flushed properly

Combined these two changes should further cut down the amount of Git operations performed when viewing individual issues (and possibly other pages).

See merge request !3296
2016-03-21 14:42:25 +00:00
Grzegorz Bizon 797af06491 Merge branch 'master' into feature/issue-move
* master:
  Fix bug where wrong commit ID was being used in a merge request diff to show old image
  Remove CHANGELOG item that was added during merge resolution
  Improve the "easy WIP & un-WIP from link" feature
  Fix specs
  \#to_branch_name now uses the iid as postfix
  Add label description in tooltip to labels in issue index and sidebar
  Easily (un)mark merge request as WIP using link
  Use specialized system notes when MR is (un)marked as WIP
  another attempt to fix oauth issue
  attempting to fix omniauth problem

Conflicts:
	app/assets/javascripts/issuable_form.js.coffee
2016-03-20 11:01:08 +01:00
Yorick Peterse 41b8d22631 Tweaked performance of Issue#related_branches
Requesting the branch names of a repository works even when it's empty,
thus there's no need to explicitly check for an empty repository.
Removing this check cuts down the amount of Git operations which in turn
cuts down request timings a bit. The regular expression used to compare
branches was also moved out of the loop so it's created only once.
2016-03-19 21:54:08 +01:00
Zeger-Jan van de Weg 212e83bab3 Soft delete issuables 2016-03-19 21:23:03 +01:00
Grzegorz Bizon 0115ad66d2 Merge branch 'master' into feature/issue-move
* master: (121 commits)
  Dedupe labels in labels selector in Dashboard pages
  Refactor colors and lists
  Add a safeguard in MergeRequest#compute_diverged_commits_count
  Fix an issue when the target branch of a MR had been deleted
  Add avatar to issue and MR pages header
  Cleanup somce css colors
  Re-group scss variables
  Refactor `Todo#target`
  Fixes issue with filter label missing on labels & milestones
  Rename `Todo#to_reference` to `Todo#target_reference`
  Fixed failing tests
  Updated controller with before_action Fixed other issues based on feedback
  Fixes issue on dashboard issues
  Full labels data in JSON
  Fixed issue with labels dropdown getting wrong labels
  Update CHANGELOG
  Use `Note#for_project_snippet?` to skip notes on project snippet
  Use `Commit#short_id` instead of `Commit.truncate_sha`
  Reuse `for_commit?` on conditional validations
  Update schema info comment on todo related files
  ...

Conflicts:
	app/models/issue.rb
	db/schema.rb
	spec/models/issue_spec.rb
2016-03-19 18:50:15 +01:00
Zeger-Jan van de Weg 70ca3370eb \#to_branch_name now uses the iid as postfix
Given the branch name 'mep-mep' with an iid being 1,
the current way, master's way, would yield a branch name of
1-mep-mep. The problem for larger projects however would be that
a developer might forget what iid the issue was.

When this developer would try to tab complete it would:
- Or result in 20+ branches possibly
- Or start with the wrong digit, try again with digit++
  - Would see 20 branches, repeat

Thus the obvious way of solving this is letting the dev tab complete
on the issue title, which is easier to remember.
2016-03-18 19:34:04 +01:00
Grzegorz Bizon b9036ba610 Prevent issue move if issue has been already moved 2016-03-17 11:48:51 +01:00
Zeger-Jan van de Weg 2b97c92119 Incorporate review 2016-03-15 20:21:11 +01:00
Zeger-Jan van de Weg ad97bebfed Enhance new branch button on an issue 2016-03-15 20:21:11 +01:00
Zeger-Jan van de Weg 228007dfbc new-branch-button 2016-03-15 20:21:11 +01:00
Yorick Peterse e32726c636 Added specs for Issue#referenced_merge_requests 2016-03-09 22:30:55 -05:00
Douwe Maan 1e8d703a85 Tag model specs 2015-12-09 10:50:51 +01:00