Commit graph

18 commits

Author SHA1 Message Date
GitLab Bot
1808454313 Add latest changes from gitlab-org/gitlab@master 2020-01-31 12:08:33 +00:00
GitLab Bot
4eeb6b0d16 Add latest changes from gitlab-org/gitlab@master 2019-12-13 15:08:02 +00:00
Jacopo
864bd12be4 Uses projects_authorizations.access_level in MembersFinder 2019-08-28 17:48:55 +02:00
Andreas Brandl
988dc80585
Further remove code branches by database type
We dropped MySQL support and a lot of mysql specific code has been
removed in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/29608.

This comes in from the other direction and removes any `if postgresql?`
branches.
2019-07-29 12:47:06 +02:00
Jacopo
a9827e0e18 Removes duplicated members from api/projects/:id/members/all
When using the members/all api the same user was returned multiple times
when he was a member of the project/group and also of one of the
ancestor groups.
Now the member is returned only once giving priority to the membership
on the project and maintaining the same behaviour of the members UI.
2019-05-27 15:40:56 +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
Stan Hu
32b96bfd81 Merge branch 'frozen-string-app-finders-graphql' into 'master'
Enable frozen string in app/graphql + app/finders

See merge request gitlab-org/gitlab-ce!21681
2018-09-13 19:44:31 +00:00
gfyoung
47b3038434 Enable frozen string in app/graphql + app/finders
Partially addresses #47424.
2018-09-11 12:15:23 -07:00
Yorick Peterse
2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
Mario de la Ossa
cf41aaba5a Backport of "Add assignee lists to boards" 2018-06-07 20:54:24 +00:00
Andreas Brandl
b25319f92b More readable SQL query. 2018-02-21 13:54:35 +01:00
Andreas Brandl
3dbec2c285 Fix MembersFinder to never include group invitees.
This was the default behavior, because all members with `user_id` set to
`null` were excluded.
2018-02-20 18:07:40 +01:00
Andreas Brandl
a10d09ec65 Fix N+1 query problem for users on members view.
For each member being rendered on
Projects::ProjectMembersController#index, there was a query to the users
table to retrieve the corresponding user:

```
SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1
```
2018-02-20 18:07:40 +01:00
Andreas Brandl
c2ae4a6399 Use DISTINCT ON and translate to MySQL.
Realized window functions are not available in older MySQL versions
either.

Falling back to DISTINCT ON for postgresql and a convoluted translation
for MySQL.
2018-02-20 18:07:39 +01:00
Andreas Brandl
df7d65a7aa Simplify database queries in MembersFinder.
Closes #41461.
2018-02-20 16:30:09 +01:00
Dmitriy Zaporozhets
26f28f9654 Show members of parent groups on project members page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-03-09 10:23:57 +02:00
Jose Ivan Vargas
57b5612aaa Removed the "Groups" option from the settings gear
Fixed more tests
2017-01-03 10:52:14 -06:00
Jose Ivan Vargas
ad58dec2e1 Added groups to members section, added a members finder 2017-01-03 10:52:14 -06:00