Commit graph

20 commits

Author SHA1 Message Date
Robert Speicher
51e63a795e
Add additional scope check to Todo#for_target spec
This works around a condition where the Issue and the MergeRequest
created by FactoryBoth both had the same ID, which caused `for_target`
to return two records when we only expected one.
2018-11-30 13:47:08 -06:00
Jasper Maes
5d5481519d Rails5: Passing a class as a value in an Active Record query is deprecated 2018-11-17 16:14:36 +01: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
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
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
Jarka Kadlecová
57a44f2da3 Support todos for epics backport 2018-07-03 09:34:44 +02:00
Andreas Brandl
24a11c957a Set todos#author_id to NOT NULL. 2018-02-05 16:16:57 +01:00
Rémy Coutable
ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +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
Oswaldo Ferreira
441501e4bf Present TODO's list without grouping by project 2017-01-27 20:20:18 -02:00
Robert Speicher
fcb37542e7 Use :empty_project where possible in model specs 2017-01-26 17:44:59 -05: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
Douglas Barbosa Alexandre
02b0c37cab Refactor Todo#target 2016-03-18 13:27:27 -03:00
Douglas Barbosa Alexandre
2a8858ca8a Rename Todo#to_reference to Todo#target_reference
Since we're not actually returning a todo reference.
2016-03-18 13:24:47 -03:00
Douglas Barbosa Alexandre
231d4fb9f8 Use Commit#short_id instead of Commit.truncate_sha 2016-03-18 11:07:30 -03:00
Douglas Barbosa Alexandre
a5bad46505 Update schema info comment on todo related files 2016-03-18 11:00:53 -03:00
Douglas Barbosa Alexandre
fb72271e24 Use todo.done without ! in the controller to mark todo as done 2016-03-18 11:00:53 -03:00
Douglas Barbosa Alexandre
c29da3f8ca Trigger a todo for mentions on commits page 2016-03-18 11:00:53 -03:00
Douglas Barbosa Alexandre
28097398c5 Does not raise an error when Todo is already marked as done 2016-02-23 10:43:29 -03:00
Renamed from spec/models/todo_spec.rb.rb (Browse further)