Commit Graph

44 Commits

Author SHA1 Message Date
GitLab Bot ed79d7cc5b Add latest changes from gitlab-org/gitlab@master 2025-04-09 18:13:01 +00:00
GitLab Bot 9b2f8b766c Add latest changes from gitlab-org/gitlab@master 2024-09-23 18:11:25 +00:00
GitLab Bot d57f7e7a39 Add latest changes from gitlab-org/gitlab@master 2024-02-27 21:09:43 +00:00
GitLab Bot 1570618396 Add latest changes from gitlab-org/gitlab@master 2023-12-04 12:12:44 +00:00
GitLab Bot 61cb988554 Add latest changes from gitlab-org/gitlab@master 2023-11-23 15:13:51 +00:00
GitLab Bot 77ded523f1 Add latest changes from gitlab-org/gitlab@master 2023-11-16 12:07:22 +00:00
GitLab Bot 6399bb0f03 Add latest changes from gitlab-org/gitlab@master 2022-12-17 00:08:16 +00:00
GitLab Bot e750680e89 Add latest changes from gitlab-org/gitlab@master 2022-08-17 09:11:44 +00:00
GitLab Bot cd6e1ccea4 Add latest changes from gitlab-org/gitlab@master 2022-06-21 12:08:35 +00:00
GitLab Bot 3a0f6ebaa9 Add latest changes from gitlab-org/gitlab@master 2021-12-07 15:15:03 +00:00
GitLab Bot ec6dd14345 Add latest changes from gitlab-org/gitlab@master 2021-12-07 00:14:07 +00:00
GitLab Bot d1ade10ba6 Add latest changes from gitlab-org/gitlab@master 2021-12-02 18:11:52 +00:00
GitLab Bot 7dd9256e5e Add latest changes from gitlab-org/gitlab@master 2021-11-09 03:42:22 +00:00
GitLab Bot bea3a92105 Add latest changes from gitlab-org/gitlab@master 2021-09-02 15:11:35 +00:00
GitLab Bot 1f1e53f43f Add latest changes from gitlab-org/gitlab@master 2020-05-28 15:08:02 +00: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
Stan Hu a769292c67 Eliminate most N+1 queries loading UserController#calendar_activities
We can reduce a significant number of queries by preloading the
associations for events.

On GitLab.com, for a date that had 456 events, this brought the load
time down from 8.7 to 1.2 s.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58392
2019-03-01 10:57:09 -08:00
Jasper Maes db80db793f Replace deprecated uniq on a Relation with distinct 2018-10-26 18:19:28 +02:00
gfyoung c858f70d07 Enable frozen string for lib/gitlab/*.rb 2018-10-22 07:00:50 +00: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
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
George Tsiolis 124cece3b3 Include private contributions in user contribution graph 2018-09-07 15:08:55 +00:00
Jan Provaznik 7b7b249ef4 Replace .having with .where in calendar query
the current syntax doesn't work properly in Rails 5, the resulting query
looks like:
HAVING "events"."project_id" IN (0)

instead of:
HAVING "events"."project_id" IN (SELECT "projects"."id" FROM...

Also we should not use ActiveRecord internal methods. In this case we
can filter projects in WHERE clause instead of doing this in HAVING
clause. Usage of WHERE should be also more efficient because grouping
is then done on much smaller subset of records.
2018-05-30 20:33:25 +02:00
Riccardo Padovani e2bdce8def Count discussions on issues and merge requests as contributions for the contributions calendar 2018-03-07 10:16:38 +00:00
Riccardo Padovani 5c5fc89b6c #43691: DiffNotes not counted by ContributionsCalendar 2018-03-05 14:51:20 +00:00
Bob Van Landuyt 148816cd67 Port `read_cross_project` ability from EE 2018-02-22 17:11:36 +01:00
Mike Greiling 08c513b6d9 fix rubocop violations 👮 2017-07-31 18:19:18 -05:00
Mike Greiling 1b9b6974fd fix mysql syntax for date INTERVAL arithmatic 2017-07-31 17:36:47 -05:00
Mike Greiling d1f5e81e8b adjust timezone for date grouping in contributions calendar 2017-07-29 01:50:17 -05:00
Mike Greiling be77d76e73 use timezone-aware Date.current instead of Date.today in ContributionsCalendar class 2017-07-29 00:36:54 -05:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Sean McGivern ed6f6cf2fc Fix memoization in ContributionsCalendar#activity_dates
This doesn't appear to be actually called twice, but having it appear to work
but not would be a problem if it was.
2017-06-07 14:29:49 +01:00
Rémy Coutable 4f51e1fad0
Add comment events to contributions calendar
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-02-13 18:59:13 +01:00
Robert Speicher b0088b527e
Merge branch '23403-fix-events-for-private-project-features' into 'security'
Respect project visibility settings in the contributions calendar

This MR fixes a number of bugs relating to access controls and date selection of events for the contributions calendar

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/23403

See merge request !2019

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-09 12:27:41 +01:00
Clement Ho a147b43dcc Replace contributions calendar timezone payload with dates 2016-09-16 14:38:59 -05:00
Clement Ho a15e9f02b8 Reduce contributions calendar data payload 2016-08-25 16:00:39 -05:00
Phil Hughes 18b361cf80 Group the contributing calendar by day
This aligns the boxes correctly with the day on the left side of the calendar
2016-05-16 12:22:17 +01:00
Robert Speicher 1a1113f7c4 Simplify `ContributionsCalendar#starting_year` and `#starting_month` 2016-01-01 22:11:34 -05:00
Guilherme Garnier 59d0263bc8 Fix rubocop warnings in lib 2015-10-03 01:29:58 -05:00
Zhang Sen 0cbafa4d65 Fix contributions calendar empty problem under mysql
When using MySQL as database backend in GitLab, ``date`` in ``date(created_at), count(id) as total_amount``
won't return the ``date`` column (should be ``date(created_at)``), as a result, there's no contribution in the user
profile page.
Adding an ``as date`` can solve this problem.
2015-04-25 20:13:52 +08:00
Dmitriy Zaporozhets 8494170550 Improve contribution calendar per day info 2015-03-22 14:52:44 -07:00
Dmitriy Zaporozhets 54aca18cf8 Contribution calendar will use events instead of commits to count contributions 2015-03-22 14:35:27 -07:00
Dmitriy Zaporozhets 43afe46bbd Refactor contributions events and write tests for calendar 2015-03-22 13:55:00 -07:00
Dmitriy Zaporozhets 64891c6c40 Replace commits calendar with contributions calendar
* count opening of issues and merge requests
* dont trigger git repository - use events from database
* much-much faster since does not affected by repository size
2015-03-21 23:48:08 -07:00