Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6328c790
Commit
6328c790
authored
Dec 06, 2021
by
Heinrich Lee Yu
Committed by
Mayra Cabrera
Dec 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include DiffNotes and DiscussionNotes in calendar
parent
2cb2e671
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
app/models/event.rb
app/models/event.rb
+5
-4
lib/gitlab/contributions_calendar.rb
lib/gitlab/contributions_calendar.rb
+2
-2
spec/lib/gitlab/contributions_calendar_spec.rb
spec/lib/gitlab/contributions_calendar_spec.rb
+8
-1
No files found.
app/models/event.rb
View file @
6328c790
...
...
@@ -130,10 +130,11 @@ class Event < ApplicationRecord
# Update Gitlab::ContributionsCalendar#activity_dates if this changes
def
contributions
where
(
"action = ? OR (target_type IN (?) AND action IN (?)) OR (target_type = ? AND action = ?)"
,
actions
[
:pushed
],
%w(MergeRequest Issue)
,
[
actions
[
:created
],
actions
[
:closed
],
actions
[
:merged
]],
"Note"
,
actions
[
:commented
])
where
(
'action IN (?) OR (target_type IN (?) AND action IN (?))'
,
[
actions
[
:pushed
],
actions
[
:commented
]],
%w(MergeRequest Issue)
,
[
actions
[
:created
],
actions
[
:closed
],
actions
[
:merged
]]
)
end
def
limit_recent
(
limit
=
20
,
offset
=
nil
)
...
...
lib/gitlab/contributions_calendar.rb
View file @
6328c790
...
...
@@ -29,13 +29,13 @@ module Gitlab
# project_features for the (currently) 3 different contribution types
date_from
=
@contributor_time_instance
.
now
.
years_ago
(
1
)
repo_events
=
event_created_at
(
date_from
,
:repository
)
.
where
(
action: :pushed
,
target_type:
nil
)
.
where
(
action: :pushed
)
issue_events
=
event_created_at
(
date_from
,
:issues
)
.
where
(
action:
[
:created
,
:closed
],
target_type:
"Issue"
)
mr_events
=
event_created_at
(
date_from
,
:merge_requests
)
.
where
(
action:
[
:merged
,
:created
,
:closed
],
target_type:
"MergeRequest"
)
note_events
=
event_created_at
(
date_from
,
:merge_requests
)
.
where
(
action: :commented
,
target_type:
"Note"
)
.
where
(
action: :commented
)
events
=
Event
.
select
(
"date(created_at +
#{
date_interval
}
) AS date"
,
'COUNT(*) AS num_events'
)
...
...
spec/lib/gitlab/contributions_calendar_spec.rb
View file @
6328c790
...
...
@@ -50,7 +50,8 @@ RSpec.describe Gitlab::ContributionsCalendar do
Event
.
create!
(
project:
project
,
action:
action
,
target:
@targets
[
project
],
target_type:
@targets
[
project
].
class
.
name
,
target_id:
@targets
[
project
].
id
,
author:
contributor
,
created_at:
DateTime
.
new
(
day
.
year
,
day
.
month
,
day
.
day
,
hour
)
)
...
...
@@ -169,6 +170,12 @@ RSpec.describe Gitlab::ContributionsCalendar do
expect
(
calendar
(
contributor
).
events_by_date
(
today
)).
to
contain_exactly
(
e1
,
e2
,
e3
)
end
it
"includes diff notes on merge request"
do
e1
=
create_event
(
public_project
,
today
,
0
,
:commented
,
:diff_note_on_merge_request
)
expect
(
calendar
.
events_by_date
(
today
)).
to
contain_exactly
(
e1
)
end
context
'when the user cannot read cross project'
do
before
do
allow
(
Ability
).
to
receive
(
:allowed?
).
and_call_original
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment