Not too important, but I think that it'd be a pretty neat touch.
(cherry picked from commit 64de4e02f9)
Add placeholder text
(cherry picked from commit 1396e2716b)
Add test for OSM feature (doesn't work yet)
(cherry picked from commit 2c94e6d56f)
Lint tests (sorry, I'm a bit tired)
(cherry picked from commit 5731fbb4a4)
It finally works, will add more tests later.
(cherry picked from commit 4437292622)
Improve testing
(cherry picked from commit 56a028ec96)
Introduce new button for OpenStreetMap URL
(cherry picked from commit 852317b467)
16, "gt-mr-2" in *all* icons
(cherry picked from commit c2c60a01eb)
Wait, I forgot about *that* icon
(cherry picked from commit 9930f9b8f2)
Alright, we just made all the icons in that submenu a bit bolder and more consistent.
(cherry picked from commit d5c0009ad0)
Remove | Safe attribute, it does exactly the opposite of what I intended it to.
(cherry picked from commit 1254f2aa9d)
Make OSM button configurable
(cherry picked from commit ba3d76f5ba)
Fix tests (tested)
(cherry picked from commit 22983c65f8)
Add more tests
(cherry picked from commit 4bbcbd37e1)
Add tooltip
(cherry picked from commit b906008ff1)
Revert "16, "gt-mr-2" in *all* icons"
This reverts commit c2c60a01eb.
(cherry picked from commit 02bb52617d)
Revert "Wait, I forgot about *that* icon"
This reverts commit 9930f9b8f2.
(cherry picked from commit a36d657509)
Revert "Alright, we just made all the icons in that submenu a bit bolder and more consistent."
This reverts commit d5c0009ad0.
(cherry picked from commit 27d8d1c5fc)
There was some recent discussion about this in Discord `ui-design`
channel and the conclusion was that
https://github.com/go-gitea/gitea/issues/24305 should have fixed their
OS font installation to have semibold weights.
I have now tested this 601 weight on a Windows 10 machine on Firefox
myself, and I immediately noticed that bold was excessivly bold and
rendering as 700 because browsers are biased towards bolder fonts. So
revert this back to the previous value.
To avoid duplicated load of the same data in an HTTP request, we can set
a context cache to do that. i.e. Some pages may load a user from a
database with the same id in different areas on the same page. But the
code is hidden in two different deep logic. How should we share the
user? As a result of this PR, now if both entry functions accept
`context.Context` as the first parameter and we just need to refactor
`GetUserByID` to reuse the user from the context cache. Then it will not
be loaded twice on an HTTP request.
But of course, sometimes we would like to reload an object from the
database, that's why `RemoveContextData` is also exposed.
The core context cache is here. It defines a new context
```go
type cacheContext struct {
ctx context.Context
data map[any]map[any]any
lock sync.RWMutex
}
var cacheContextKey = struct{}{}
func WithCacheContext(ctx context.Context) context.Context {
return context.WithValue(ctx, cacheContextKey, &cacheContext{
ctx: ctx,
data: make(map[any]map[any]any),
})
}
```
Then you can use the below 4 methods to read/write/del the data within
the same context.
```go
func GetContextData(ctx context.Context, tp, key any) any
func SetContextData(ctx context.Context, tp, key, value any)
func RemoveContextData(ctx context.Context, tp, key any)
func GetWithContextCache[T any](ctx context.Context, cacheGroupKey string, cacheTargetID any, f func() (T, error)) (T, error)
```
Then let's take a look at how `system.GetString` implement it.
```go
func GetSetting(ctx context.Context, key string) (string, error) {
return cache.GetWithContextCache(ctx, contextCacheKey, key, func() (string, error) {
return cache.GetString(genSettingCacheKey(key), func() (string, error) {
res, err := GetSettingNoCache(ctx, key)
if err != nil {
return "", err
}
return res.SettingValue, nil
})
})
}
```
First, it will check if context data include the setting object with the
key. If not, it will query from the global cache which may be memory or
a Redis cache. If not, it will get the object from the database. In the
end, if the object gets from the global cache or database, it will be
set into the context cache.
An object stored in the context cache will only be destroyed after the
context disappeared.
As discussed in #22847 the helpers in helpers.less need to have a
separate prefix as they are causing conflicts with fomantic styles
This will allow us to have the `.gt-hidden { display:none !important; }`
style that is needed to for the reverted PR.
Of note in doing this I have noticed that there was already a conflict
with at least one chroma style which this PR now avoids.
I've also added in the `gt-hidden` style that matches the tailwind one
and switched the code that needed it to use that.
Signed-off-by: Andrew Thornton <art27@cantab.net>
---------
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
There are several places in templates/repo/issue/view_content/comments.tmpl where links are made to Posters or Assignees who are Ghosts or have IDs <0.
Fix#20559
Signed-off-by: Andrew Thornton <art27@cantab.net>