diff --git a/models/summary.go b/models/summary.go index 55e8061..49b26c4 100644 --- a/models/summary.go +++ b/models/summary.go @@ -136,7 +136,10 @@ func (s *Summary) FillMissing() { } // construct dummy item for all missing types - presentType, _ := s.findFirstPresentType() + presentType, err := s.findFirstPresentType() + if err != nil { + return // all types are either zero or missing entirely, nothing to fill + } for _, t := range missingTypes { s.FillBy(presentType, t) } diff --git a/repositories/user.go b/repositories/user.go index 90183dd..64be152 100644 --- a/repositories/user.go +++ b/repositories/user.go @@ -147,6 +147,7 @@ func (r *UserRepository) Update(user *models.User) (*models.User, error) { "share_oss": user.ShareOSs, "share_projects": user.ShareProjects, "share_machines": user.ShareMachines, + "share_labels": user.ShareLabels, "wakatime_api_key": user.WakatimeApiKey, "has_data": user.HasData, "reset_token": user.ResetToken, diff --git a/routes/settings.go b/routes/settings.go index 490f939..6434eee 100644 --- a/routes/settings.go +++ b/routes/settings.go @@ -252,6 +252,7 @@ func (h *SettingsHandler) actionUpdateSharing(w http.ResponseWriter, r *http.Req user.ShareEditors, err = strconv.ParseBool(r.PostFormValue("share_editors")) user.ShareOSs, err = strconv.ParseBool(r.PostFormValue("share_oss")) user.ShareMachines, err = strconv.ParseBool(r.PostFormValue("share_machines")) + user.ShareLabels, err = strconv.ParseBool(r.PostFormValue("share_labels")) user.ShareDataMaxDays, err = strconv.Atoi(r.PostFormValue("max_days")) if err != nil { diff --git a/views/settings.tpl.html b/views/settings.tpl.html index db24b21..98cb526 100644 --- a/views/settings.tpl.html +++ b/views/settings.tpl.html @@ -298,11 +298,9 @@
@@ -314,11 +312,9 @@
@@ -330,11 +326,9 @@
@@ -346,8 +340,7 @@
- - + +
+ +
+
+ Share project labels: +
+
+
@@ -657,8 +662,16 @@ // Time zone stuff - const userTimeZone = {{ .User.Location }} - const userTzOffset = {{ .User.TZOffset.Hours }} + const userTimeZone = { + { . + User.Location + } + } + const userTzOffset = { + { . + User.TZOffset.Hours + } + } const selectTimezone = document.getElementById('select-timezone') const createTzOption = (tz) => { if (!tz) tz = 'Local'