Skip to content

Commit 50adeb0

Browse files
committed
Merge branch 'master' into kd/conf_disable_stars
2 parents 842ed0f + 7118347 commit 50adeb0

File tree

7 files changed

+47
-13
lines changed

7 files changed

+47
-13
lines changed

models/action.go

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,13 @@ func (a *Action) GetIssueContent() string {
289289

290290
// GetFeedsOptions options for retrieving feeds
291291
type GetFeedsOptions struct {
292-
RequestedUser *User // the user we want activity for
293-
RequestedTeam *Team // the team we want activity for
294-
Actor *User // the user viewing the activity
295-
IncludePrivate bool // include private actions
296-
OnlyPerformedBy bool // only actions performed by requested user
297-
IncludeDeleted bool // include deleted actions
292+
RequestedUser *User // the user we want activity for
293+
RequestedTeam *Team // the team we want activity for
294+
Actor *User // the user viewing the activity
295+
IncludePrivate bool // include private actions
296+
OnlyPerformedBy bool // only actions performed by requested user
297+
IncludeDeleted bool // include deleted actions
298+
Date string // the day we want activity for: YYYY-MM-DD
298299
}
299300

300301
// GetFeeds returns actions according to the provided options
@@ -380,5 +381,17 @@ func activityQueryCondition(opts GetFeedsOptions) (builder.Cond, error) {
380381
cond = cond.And(builder.Eq{"is_deleted": false})
381382
}
382383

384+
if opts.Date != "" {
385+
dateLow, err := time.Parse("2006-01-02", opts.Date)
386+
if err != nil {
387+
log.Warn("Unable to parse %s, filter not applied: %v", opts.Date, err)
388+
} else {
389+
dateHigh := dateLow.Add(86399000000000) // 23h59m59s
390+
391+
cond = cond.And(builder.Gte{"created_unix": dateLow.Unix()})
392+
cond = cond.And(builder.Lte{"created_unix": dateHigh.Unix()})
393+
}
394+
}
395+
383396
return cond, nil
384397
}

modules/setting/repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var (
4343
PrefixArchiveFiles bool
4444
DisableMirrors bool
4545
DisableMigrations bool
46-
DisableStars bool `ini:"DISABLE_STARS"`
46+
DisableStars bool `ini:"DISABLE_STARS"`
4747
DefaultBranch string
4848
AllowAdoptionOfUnadoptedRepositories bool
4949
AllowDeleteOfUnadoptedRepositories bool

options/locale/locale_zh-CN.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,7 +2269,7 @@ auths.tip.google_plus=从谷歌 API 控制台 (https://console.developers.google
22692269
auths.tip.openid_connect=使用 OpenID 连接发现 URL (<server>/.well-known/openid-configuration) 来指定终点
22702270
auths.tip.twitter=访问 https://dev.twitter.com/apps,创建应用并确保启用了"允许此应用程序用于登录 Twitter"的选项。
22712271
auths.tip.discord=在 https://discordapp.com/developers/applications/me 上注册新应用程序
2272-
auths.tip.gitea=注册一个新的 OAuth2 应用程序可以访问 https://docs.gitea.io/en-us/oauth 2-product/ 查看帮助 。
2272+
auths.tip.gitea=注册一个新的 OAuth2 应用程序可以访问 https://docs.gitea.io/en-us/oauth2-provider/ 查看帮助 。
22732273
auths.tip.yandex=在 https://oauth.yandex.com/client/new 上创建一个新的应用程序。在“ Yandex.Passport API”这部分中选择以下权限:“访问电子邮件地址(Access to email address)”,“访问用户头像(Access to user avatar)”和“访问用户名,名字和姓氏,性别(Access to username, first name and surname, genderAccess to username, first name and surname, gender)”
22742274
auths.tip.mastodon=输入您想要认证的 mastodon 实例的自定义 URL (或使用默认值)
22752275
auths.edit=修改认证源

routers/api/v1/settings/settings.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ func GetGeneralRepoSettings(ctx *context.APIContext) {
5757
// "200":
5858
// "$ref": "#/responses/GeneralRepoSettings"
5959
ctx.JSON(http.StatusOK, api.GeneralRepoSettings{
60-
MirrorsDisabled: setting.Repository.DisableMirrors,
61-
HTTPGitDisabled: setting.Repository.DisableHTTPGit,
62-
MigrationsDisabled: setting.Repository.DisableMigrations,
63-
StarsDisabled: setting.Repository.DisableStars,
60+
MirrorsDisabled: setting.Repository.DisableMirrors,
61+
HTTPGitDisabled: setting.Repository.DisableHTTPGit,
62+
MigrationsDisabled: setting.Repository.DisableMigrations,
63+
StarsDisabled: setting.Repository.DisableStars,
6464
TimeTrackingDisabled: !setting.Service.EnableTimetracking,
6565
LFSDisabled: !setting.LFS.StartServer,
6666
})

routers/user/home.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ func Dashboard(ctx *context.Context) {
156156
IncludePrivate: true,
157157
OnlyPerformedBy: false,
158158
IncludeDeleted: false,
159+
Date: ctx.Query("date"),
159160
})
160161

161162
if ctx.Written() {

routers/user/profile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ func Profile(ctx *context.Context) {
202202
IncludePrivate: showPrivate,
203203
OnlyPerformedBy: true,
204204
IncludeDeleted: false,
205+
Date: ctx.Query("date"),
205206
})
206207
if ctx.Written() {
207208
return

web_src/js/components/ActivityHeatmap.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
:end-date="endDate"
1111
:values="values"
1212
:range-color="colorRange"
13+
@day-click="handleDayClick($event)"
1314
/>
1415
</div>
1516
</template>
@@ -48,7 +49,25 @@ export default {
4849
}
4950
return s;
5051
}
51-
}
52+
},
53+
methods: {
54+
handleDayClick(e) {
55+
// Reset filter if same date is clicked
56+
const params = new URLSearchParams(document.location.search);
57+
const queryDate = params.get('date');
58+
// Timezone has to be stripped because toISOString() converts to UTC
59+
const clickedDate = new Date(e.date - (e.date.getTimezoneOffset() * 60000)).toISOString().substring(0, 10);
60+
61+
if (queryDate && queryDate === clickedDate) {
62+
params.delete('date');
63+
} else {
64+
params.set('date', clickedDate);
65+
}
66+
67+
const newSearch = params.toString();
68+
window.location.search = newSearch.length ? `?${newSearch}` : '';
69+
}
70+
},
5271
};
5372
</script>
5473
<style scoped/>

0 commit comments

Comments
 (0)