mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-13 15:59:33 -05:00
0905ce83ea
- Resolves #259 - Replaces #716 (thanks @silentcode !) - The main toggle _for now_ (due to the still weird settings migration to the database) is `GetDefaultDisableGravatar`, because it's used `loadPictureFrom` which in turn sets the default value for the install page which in turn is the explicit value that Forgejo will use to decide to enable or disable Gravatar after the install page. - Tests still rely on the fact that gravatar is enabled by default for some tests, so there's a small hack in `MainTest` for that. This is not enabled per-tests as this would otherwise just cause random test failures for when rebasing happens. - Unit tests ensures this value by default stays false. Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/837 (cherry picked from commitc6c7c1aa1e
) (cherry picked from commitf0bc5f63d4
)
20 lines
384 B
Go
20 lines
384 B
Go
// Copyright 2023 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package setting
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDisableGravatar(t *testing.T) {
|
|
assert.True(t, GetDefaultDisableGravatar())
|
|
|
|
cfg, err := NewConfigProviderFromData(``)
|
|
assert.NoError(t, err)
|
|
loadAvatarsFrom(cfg)
|
|
|
|
assert.True(t, DisableGravatar)
|
|
}
|