}
// check heatmap visibility if the visibility is disabled
-// this behavior, in special the one for the admin, is
-// due to the fact that the heatmap is the same for all viewers;
-// otherwise, there is no reason for it
func TestPrivateActivityYesHeatmapInvisibleForPublic(t *testing.T) {
defer prepareTestEnv(t)()
assert.False(t, visible, "user should have no visible heatmap")
}
-func TestPrivateActivityYesHeatmapInvisibleForUserItselfAtProfile(t *testing.T) {
+func TestPrivateActivityYesHeatmapVisibleForUserItselfAtProfile(t *testing.T) {
defer prepareTestEnv(t)()
testPrivateActivityDoSomethingForActionEntries(t)
testPrivateActivityHelperEnablePrivateActivity(t)
session := loginUser(t, privateActivityTestUser)
visible := testPrivateActivityHelperHasVisibleProfileHeatmapFromSession(t, session)
- assert.False(t, visible, "user should have no visible heatmap")
+ assert.True(t, visible, "user should have visible heatmap")
}
-func TestPrivateActivityYesHeatmapInvisibleForUserItselfAtDashboard(t *testing.T) {
+func TestPrivateActivityYesHeatmapVisibleForUserItselfAtDashboard(t *testing.T) {
defer prepareTestEnv(t)()
testPrivateActivityDoSomethingForActionEntries(t)
testPrivateActivityHelperEnablePrivateActivity(t)
session := loginUser(t, privateActivityTestUser)
visible := testPrivateActivityHelperHasVisibleDashboardHeatmapFromSession(t, session)
- assert.False(t, visible, "user should have no visible heatmap")
+ assert.True(t, visible, "user should have visible heatmap")
}
func TestPrivateActivityYesHeatmapInvisibleForOtherUser(t *testing.T) {
assert.False(t, visible, "user should have no visible heatmap")
}
-func TestPrivateActivityYesHeatmapInvsisibleForAdmin(t *testing.T) {
+func TestPrivateActivityYesHeatmapVisibleForAdmin(t *testing.T) {
defer prepareTestEnv(t)()
testPrivateActivityDoSomethingForActionEntries(t)
testPrivateActivityHelperEnablePrivateActivity(t)
session := loginUser(t, privateActivityTestAdmin)
visible := testPrivateActivityHelperHasVisibleProfileHeatmapFromSession(t, session)
- assert.False(t, visible, "user should have no visible heatmap")
+ assert.True(t, visible, "user should have visible heatmap")
}
// check heatmap api provides content if the visibility is enabled
ctx.Data["PageIsNews"] = true
ctx.Data["SearchLimit"] = setting.UI.User.RepoPagingNum
- // no heatmap access for admins; GetUserHeatmapDataByUser ignores the calling user
- // so everyone would get the same empty heatmap
- if setting.Service.EnableUserHeatmap && !ctxUser.KeepActivityPrivate {
+ if setting.Service.EnableUserHeatmap {
data, err := models.GetUserHeatmapDataByUserTeam(ctxUser, ctx.Org.Team, ctx.User)
if err != nil {
ctx.ServerError("GetUserHeatmapDataByUserTeam", err)
ctx.Data["Owner"] = ctxUser
ctx.Data["OpenIDs"] = openIDs
- // no heatmap access for admins; GetUserHeatmapDataByUser ignores the calling user
- // so everyone would get the same empty heatmap
- if setting.Service.EnableUserHeatmap && !ctxUser.KeepActivityPrivate {
+ if setting.Service.EnableUserHeatmap {
data, err := models.GetUserHeatmapDataByUser(ctxUser, ctx.User)
if err != nil {
ctx.ServerError("GetUserHeatmapDataByUser", err)