Commit Graph

61 Commits

Author SHA1 Message Date
GitLab Bot d0356412df Add latest changes from gitlab-org/gitlab@master 2020-02-01 03:09:04 +00:00
GitLab Bot 6e81d7f628 Add latest changes from gitlab-org/gitlab@master 2019-11-15 15:06:12 +00:00
GitLab Bot 69944ffb68 Add latest changes from gitlab-org/gitlab@master 2019-11-12 15:06:26 +00:00
GitLab Bot 238d22c072 Add latest changes from gitlab-org/gitlab@master 2019-10-17 15:06:17 +00:00
GitLab Bot 6b75320f52 Add latest changes from gitlab-org/gitlab@master 2019-10-17 12:07:33 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Jan Provaznik 243bd0202f Create an event on epic actions
Creates new event when an epic is created, closed, reopened or
commented.
2019-09-03 21:29:55 +00:00
Arun Kumar Mohan 4ca32c2b55 Add Issue and Merge Request titles to Todo items
Only displays the todo body if the todo has a note.
This is to avoid redundant Issue or Merge Request titles
displayed both in the Todo title and body.
2019-08-27 20:09:24 -05:00
Stan Hu f2d932268d Rename Todos.with_api_entity_associations to with_entity_associations
Since this scope is used in both the controller and the API, we rename
it to make it clear that it's used for both.
2019-06-24 10:49:13 -07:00
Felipe Artur be33946819 Delete unauthorized Todos when project is private
Delete Todos for guest users when project visibility
level is updated to private.
2019-06-05 10:51:52 -03:00
Nick Thomas 013f7cd24c
Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
Stan Hu 062efe4f7a Significantly reduce N+1 queries in /api/v4/todos endpoint
By preloading associations and batching issuable metadata lookups,
we can significantly cut the number of SQL queries needed to load
the Todos API endpoint.

On GitLab.com, my own tests showed my user's SQL queries went
from 365 to under 60 SQL queries.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/40378
2019-03-06 07:03:46 -08:00
Felipe Artur 1653f7b1c6 Delete confidential issue todos for guests
Fix leaking information of confidential issues on TODOs
when user is downgraded to guest access.
2018-12-14 10:38:52 -02:00
Yorick Peterse 38b8ae641f
Clean up ActiveRecord code in TodoService
This refactors the TodoService class according to our code reuse
guidelines. The resulting code is a wee bit more verbose, but it allows
us to decouple the column names from the input, resulting in fewer
changes being necessary when we change the schema.

One particular noteworthy line in TodoService is the following:

    todos_ids = todos.update_state(state)

Technically this is a violation of the guidelines, because
`update_state` is a class method, which services are not supposed to use
(safe for a few allowed ones). I decided to keep this, since there is no
alternative. `update_state` doesn't produce a relation so it doesn't
belong in a Finder, and we can't move it to another Service either. As
such I opted to just use the method directly.

Cases like this may happen more frequently, at which point we should
update our documentation with some sort of recommendation. For now, I
want to refrain from doing so until we have a few more examples.
2018-10-08 15:19:12 +02:00
Yorick Peterse 4c1dc31051
Clean up ActiveRecord code in TodosFinder
This refactors the TodosFinder finder according to the new code reuse
rules, as enforced by the CodeReuse cops. I also changed some of the
methods to use regular if statements, instead of assignments and/or
early returns. This results in a more natural flow when reading the
code, and it makes it harder to accidentally return the wrong result.
2018-10-08 15:19:12 +02:00
Yorick Peterse 8a72f5c427
Added FromUnion to easily select from a UNION
This commit adds the module `FromUnion`, which provides the class method
`from_union`. This simplifies the process of selecting data from the
result of a UNION, and reduces the likelihood of making mistakes. As a
result, instead of this:

    union = Gitlab::SQL::Union.new([foo, bar])

    Foo.from("(#{union.to_sql}) #{Foo.table_name}")

We can now write this instead:

    Foo.from_union([foo, bar])

This commit also includes some changes to make this new setup work
properly. For example, a bug in Rails 4
(https://github.com/rails/rails/issues/24193) would break the use of
`from("sub-query-here").includes(:relation)` in certain cases. There was
also a CI query which appeared to repeat a lot of conditions from an
outer query on an inner query, which isn't necessary.

Finally, we include a RuboCop cop to ensure developers use this new
module, instead of using Gitlab::SQL::Union directly.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/51307
2018-09-17 12:39:43 +02:00
Sean McGivern b3deca7a26 Merge branch 'group-todos' into 'master'
Group todos

See merge request gitlab-org/gitlab-ce!20675
2018-08-07 12:35:32 +00:00
Jarka Kadlecová 15179878d5 Revert "Revert "Merge branch 'ee-5481-epic-todos' into 'master'""
This reverts commit 8717c7dad9.
2018-08-02 10:42:45 +02:00
gfyoung 50abbd3e53 Enable frozen string in app/models/*.rb
Partially addresses #47424.
2018-07-26 16:55:41 -07:00
Jarka Kadlecová 8717c7dad9 Revert "Merge branch 'ee-5481-epic-todos' into 'master'"
This reverts commit 4d9a3f42f1, reversing
changes made to ecf9c145f6.
2018-07-11 18:33:24 +02:00
Jan Provaznik 50c1a989cc More EE->CE fixes 2018-07-03 09:34:44 +02:00
Jan Provaznik 7458ca8ebb [backend] Addressed review comments
* Group filtering now includes also issues/MRs from
subgroups/subprojects
* fixed due_date
* Also DRYed todo controller specs
2018-07-03 09:34:44 +02:00
Jarka Kadlecová 57a44f2da3 Support todos for epics backport 2018-07-03 09:34:44 +02:00
Yorick Peterse 6f292eaa69
Revert the addition of goldiloader
This reverts the addition of the "goldiloader" Gem and all use of it.
While this Gem is very promising it's causing a variety of problems on
GitLab.com due to it eager-loading too much data in places where we
don't expect/can handle this. At least for the time being this means we
have to go back to manually fixing N+1 query problems, but at least
those should not cause a negative impact on availability.
2018-04-18 15:51:39 +02:00
Yorick Peterse 20fdbbe86a Use Goldiloader for handling N+1 queries
Goldiloader (https://github.com/salsify/goldiloader) can eager load
associations automatically. This removes the need for adding "includes"
calls in a variety of different places. This also comes with the added
benefit of not having to eager load data if it's not used.
2018-04-09 11:58:06 +01:00
blackst0ne 3d3b46f344 [Rails5] Rename `sort` methods to `sort_by_attribute` 2018-04-04 09:19:47 +00:00
Sean McGivern 631eed028b Remove default scope from todos
This was causing todo priority sorting to fail.
2018-03-05 16:42:51 +00:00
Andreas Brandl 24a11c957a Set todos#author_id to NOT NULL. 2018-02-05 16:16:57 +01:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Yorick Peterse 5819ca1a24
Added Cop to blacklist polymorphic associations
One should really use a separate table instead of using polymorphic
associations.

See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11168 for
more information.
2017-06-07 17:36:55 +02:00
Jacopo 60e9405bb7 Improve text on todo list when the todo action comes from yourself
Improved todo message when an issue is assigned to yourself.
- The new message when an user assign to himself an issue or a mr is: "You
assigned issue xx to yourself"
- The new message when an user adds a todo to himself is: "You added a
todo for issue xx"
- The new message when and user mention himself is: "You mentioned
yourself on issue xx"
- The new message when an user directly address himself is: "You
directly addressed yourself on issue xx"
- The new message when an user mark himself as an approver is: "You set
yourself as an approver for merge request xx"
2017-04-28 14:24:32 +02:00
Sean McGivern 101fddfa92 Allow sorting by due date and label priority 2017-03-15 17:02:37 +00:00
Douwe Maan 1fe7501b49 Revert "Prefer leading style for Style/DotPosition"
This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
2017-02-23 09:33:05 -06:00
Douwe Maan 206953a430 Prefer leading style for Style/DotPosition 2017-02-23 09:32:22 -06:00
Douwe Maan b7d8df503c Enable Style/MutableConstant 2017-02-23 09:31:56 -06:00
Ershad Kunnakkadan 3a23639bc0
Create directly_addressed Todos when mentioned in beginning of a line 2017-02-08 21:53:34 +05:30
Oswaldo Ferreira 441501e4bf Present TODO's list without grouping by project 2017-01-27 20:20:18 -02:00
twonegatives 85e0b99471 Notify the user who set auto-merge when merge conflict occurs 2017-01-14 12:22:30 +03:00
Alejandro Rodríguez 7bd6ff03d8 Fix and improve `Sortable.highest_label_priority` 2016-10-27 21:26:56 -03:00
Douglas Barbosa Alexandre 928acba4c0 Use keyword arguments on Sortable#highest_label_priority 2016-10-19 14:58:27 -02:00
Douglas Barbosa Alexandre 3c2aaec1f2 Fix sorting by label priorities 2016-10-19 14:58:27 -02:00
Felipe Artur 37bf35f0bc Todos sorting dropdown 2016-08-19 16:14:20 -03:00
Sean McGivern d957d5f1aa Add approval required todos 2016-07-12 19:01:09 +01:00
Douwe Maan 3286dd7a1d Don't garbage collect commits that have related DB records like comments 2016-07-04 00:11:33 -04:00
Robert Schilling 631765748e Expose action_name 2016-07-01 10:49:34 +02:00
Robert Schilling 39e6f504fc Move to helper, no instance variables 2016-07-01 10:49:34 +02:00
Douglas Barbosa Alexandre a1f224d3f7 Add Todos API 2016-07-01 10:49:34 +02:00
Phil Hughes f67b06ada0 Manually create todo for issuable
Added a button into the sidebar for issues & merge requests to allow users to manually create todo items

Closes #15045
2016-06-14 08:36:07 +01:00
Sean McGivern 6b834f2cbc Create a todo on failing MR build
When a build fails for a commit, create a todo for the author of the
merge request that commit is the HEAD of. If the commit isn't the HEAD
commit of any MR, don't do anything. If there already is a todo for that
user and MR, don't do anything.

Current limitations:
- This isn't configurable by project.
- The author of a merge request might not be the person who pushed the
  breaking commit.
2016-05-17 10:17:45 +01:00