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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
037b3729
Commit
037b3729
authored
Jul 27, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure user profile calendar is generated based on server timezone, not local timezone
parent
4c89929f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
app/assets/javascripts/users/activity_calendar.js
app/assets/javascripts/users/activity_calendar.js
+10
-2
app/assets/javascripts/users/user_tabs.js
app/assets/javascripts/users/user_tabs.js
+2
-1
app/views/users/show.html.haml
app/views/users/show.html.haml
+1
-1
No files found.
app/assets/javascripts/users/activity_calendar.js
View file @
037b3729
...
...
@@ -6,6 +6,14 @@ const LOADING_HTML = `
</div>
`
;
function
getSystemDate
(
systemUtcOffsetSeconds
)
{
const
date
=
new
Date
();
const
localUtcOffsetMinutes
=
0
-
date
.
getTimezoneOffset
();
const
systemUtcOffsetMinutes
=
systemUtcOffsetSeconds
/
60
;
date
.
setMinutes
((
date
.
getMinutes
()
-
localUtcOffsetMinutes
)
+
systemUtcOffsetMinutes
);
return
date
;
}
function
formatTooltipText
({
date
,
count
})
{
const
dateObject
=
new
Date
(
date
);
const
dateDayName
=
gl
.
utils
.
getDayName
(
dateObject
);
...
...
@@ -21,7 +29,7 @@ function formatTooltipText({ date, count }) {
const
initColorKey
=
()
=>
d3
.
scale
.
linear
().
range
([
'
#acd5f2
'
,
'
#254e77
'
]).
domain
([
0
,
3
]);
export
default
class
ActivityCalendar
{
constructor
(
container
,
timestamps
,
calendarActivitiesPath
)
{
constructor
(
container
,
timestamps
,
calendarActivitiesPath
,
utcOffset
=
0
)
{
this
.
calendarActivitiesPath
=
calendarActivitiesPath
;
this
.
clickDay
=
this
.
clickDay
.
bind
(
this
);
this
.
currentSelectedDate
=
''
;
...
...
@@ -36,7 +44,7 @@ export default class ActivityCalendar {
this
.
timestampsTmp
=
[];
let
group
=
0
;
const
today
=
new
Date
(
);
const
today
=
getSystemDate
(
utcOffset
);
today
.
setHours
(
0
,
0
,
0
,
0
,
0
);
const
oneYearAgo
=
new
Date
(
today
);
...
...
app/assets/javascripts/users/user_tabs.js
View file @
037b3729
...
...
@@ -150,6 +150,7 @@ export default class UserTabs {
const
$calendarWrap
=
this
.
$parentEl
.
find
(
'
.user-calendar
'
);
const
calendarPath
=
$calendarWrap
.
data
(
'
calendarPath
'
);
const
calendarActivitiesPath
=
$calendarWrap
.
data
(
'
calendarActivitiesPath
'
);
const
utcOffset
=
$calendarWrap
.
data
(
'
utcOffset
'
);
$
.
ajax
({
dataType
:
'
json
'
,
...
...
@@ -158,7 +159,7 @@ export default class UserTabs {
$calendarWrap
.
html
(
CALENDAR_TEMPLATE
);
// eslint-disable-next-line no-new
new
ActivityCalendar
(
'
.js-contrib-calendar
'
,
activityData
,
calendarActivitiesPath
);
new
ActivityCalendar
(
'
.js-contrib-calendar
'
,
activityData
,
calendarActivitiesPath
,
utcOffset
);
},
});
...
...
app/views/users/show.html.haml
View file @
037b3729
...
...
@@ -104,7 +104,7 @@
.tab-content
#activity
.tab-pane
.row-content-block.calender-block.white.second-block.hidden-xs
.user-calendar
{
data:
{
calendar_path:
user_calendar_path
(
@user
,
:json
),
calendar_activities_path:
user_calendar_activities_path
}
}
.user-calendar
{
data:
{
calendar_path:
user_calendar_path
(
@user
,
:json
),
calendar_activities_path:
user_calendar_activities_path
,
utc_offset:
Time
.
zone
.
utc_offset
}
}
%h4
.center.light
%i
.fa.fa-spinner.fa-spin
.user-calendar-activities
...
...
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