summaryrefslogtreecommitdiff
path: root/app/models/todo.rb
Commit message (Collapse)AuthorAgeFilesLines
* Clean up ActiveRecord code in TodoServiceYorick Peterse2018-10-081-0/+24
| | | | | | | | | | | | | | | | | | | | | | 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.
* Clean up ActiveRecord code in TodosFinderYorick Peterse2018-10-081-0/+19
| | | | | | | | 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.
* Added FromUnion to easily select from a UNIONYorick Peterse2018-09-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge branch 'group-todos' into 'master'Sean McGivern2018-08-071-2/+9
|\ | | | | | | | | Group todos See merge request gitlab-org/gitlab-ce!20675
| * Revert "Revert "Merge branch 'ee-5481-epic-todos' into 'master'""Jarka Kadlecová2018-08-021-2/+9
| | | | | | | | This reverts commit 8717c7dad9b5a8fa21ec9a652c54718a6b4c2175.
* | Enable frozen string in app/models/*.rbrepo-forks/gitlab-ce-frozen-string-enable-app-modelsgfyoung2018-07-261-0/+2
|/ | | | Partially addresses #47424.
* Revert "Merge branch 'ee-5481-epic-todos' into 'master'"Jarka Kadlecová2018-07-111-9/+2
| | | | | This reverts commit 4d9a3f42f1fd3be21555e19872b7121cca65015e, reversing changes made to ecf9c145f6e4d170cd059df88743393d9e63c489.
* More EE->CE fixesJan Provaznik2018-07-031-1/+1
|
* [backend] Addressed review commentsJan Provaznik2018-07-031-2/+2
| | | | | | | * Group filtering now includes also issues/MRs from subgroups/subprojects * fixed due_date * Also DRYed todo controller specs
* Support todos for epics backportJarka Kadlecová2018-07-031-2/+9
|
* Revert the addition of goldiloaderYorick Peterse2018-04-181-1/+1
| | | | | | | | | 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.
* Use Goldiloader for handling N+1 queriesYorick Peterse2018-04-091-1/+1
| | | | | | | 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.
* [Rails5] Rename `sort` methods to `sort_by_attribute`blackst0ne2018-04-041-1/+1
|
* Remove default scope from todosremove-default-scope-from-todosSean McGivern2018-03-051-6/+8
| | | | This was causing todo priority sorting to fail.
* Set todos#author_id to NOT NULL.32282-add-foreign-keys-to-todosAndreas Brandl2018-02-051-0/+1
|
* Enable Style/DotPosition Rubocop :cop:Grzegorz Bizon2017-06-211-3/+3
|
* Added Cop to blacklist polymorphic associationsYorick Peterse2017-06-071-1/+1
| | | | | | | | 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.
* Improve text on todo list when the todo action comes from yourselfJacopo2017-04-281-0/+12
| | | | | | | | | | | | | | 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"
* Allow sorting by due date and label prioritySean McGivern2017-03-151-1/+7
|
* Revert "Prefer leading style for Style/DotPosition"Douwe Maan2017-02-231-3/+3
| | | | This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
* Prefer leading style for Style/DotPositionDouwe Maan2017-02-231-3/+3
|
* Enable Style/MutableConstantDouwe Maan2017-02-231-1/+1
|
* Create directly_addressed Todos when mentioned in beginning of a lineErshad Kunnakkadan2017-02-081-7/+9
|
* Present TODO's list without grouping by projectOswaldo Ferreira2017-01-271-2/+2
|
* Notify the user who set auto-merge when merge conflict occurstwonegatives2017-01-141-1/+7
|
* Fix and improve `Sortable.highest_label_priority`23928-sortable-highest_label_priority-is-buggedAlejandro Rodríguez2016-10-271-1/+1
|
* Use keyword arguments on Sortable#highest_label_priorityDouglas Barbosa Alexandre2016-10-191-1/+7
|
* Fix sorting by label prioritiesDouglas Barbosa Alexandre2016-10-191-1/+1
|
* Todos sorting dropdownissue_18135Felipe Artur2016-08-191-0/+19
|
* Add approval required todosapproval-required-todoSean McGivern2016-07-121-5/+7
|
* Don't garbage collect commits that have related DB records like commentsDouwe Maan2016-07-041-0/+8
|
* Expose action_nameRobert Schilling2016-07-011-0/+11
|
* Move to helper, no instance variablesRobert Schilling2016-07-011-7/+0
|
* Add Todos APIDouglas Barbosa Alexandre2016-07-011-0/+7
|
* Manually create todo for issuablePhil Hughes2016-06-141-0/+1
| | | | | | Added a button into the sidebar for issues & merge requests to allow users to manually create todo items Closes #15045
* Create a todo on failing MR buildSean McGivern2016-05-171-2/+7
| | | | | | | | | | | | 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.
* Remove the annotate gem and delete old annotationsJeroen van Baarsen2016-05-091-18/+0
| | | | | | | | | In 8278b763d96ef10c6494409b18b7eb541463af29 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
* Refactor `Todo#target`Douglas Barbosa Alexandre2016-03-181-5/+1
|
* Rename `Todo#to_reference` to `Todo#target_reference`Douglas Barbosa Alexandre2016-03-181-1/+1
| | | | Since we're not actually returning a todo reference.
* Use `Commit#short_id` instead of `Commit.truncate_sha`Douglas Barbosa Alexandre2016-03-181-1/+1
|
* Reuse `for_commit?` on conditional validationsDouglas Barbosa Alexandre2016-03-181-2/+2
|
* Update schema info comment on todo related filesDouglas Barbosa Alexandre2016-03-181-2/+3
|
* Use todo.done without ! in the controller to mark todo as doneDouglas Barbosa Alexandre2016-03-181-1/+1
|
* Trigger a todo for mentions on commits pageDouglas Barbosa Alexandre2016-03-181-1/+28
|
* Does not raise an error when Todo is already marked as doneDouglas Barbosa Alexandre2016-02-231-1/+1
|
* "X assigned you Y" instead of "X assigned Y"Douwe Maan2016-02-201-11/+0
|
* Rename Tasks to TodosDouglas Barbosa Alexandre2016-02-201-0/+64