Compare commits

..

No commits in common. "c35b16a9a491ffbd093bf3e759e94cdbc960fe9c" and "815d267c8031daa19b82b291a6393a54715567c0" have entirely different histories.

49 changed files with 387 additions and 174 deletions

View File

@ -81,4 +81,4 @@ jobs:
- "Makefile" - "Makefile"
- "package.json" - "package.json"
- "package-lock.json" - "package-lock.json"
- ".spectral.yaml" - ".spectral.yml"

View File

@ -121,6 +121,8 @@ If you have questions that are not covered by the documentation, you can get in
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea). We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea).
The Hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
The official Gitea CLI is developed at [gitea/tea](https://gitea.com/gitea/tea). The official Gitea CLI is developed at [gitea/tea](https://gitea.com/gitea/tea).
## Authors ## Authors

View File

@ -12,7 +12,6 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
) )
@ -59,7 +58,7 @@ func main() {
// use old en-US as the base, and copy the new translations to the old locales // use old en-US as the base, and copy the new translations to the old locales
enUsOld := inisOld["options/locale/locale_en-US.ini"] enUsOld := inisOld["options/locale/locale_en-US.ini"]
brokenWarned := make(container.Set[string]) brokenWarned := map[string]bool{}
for path, iniOld := range inisOld { for path, iniOld := range inisOld {
if iniOld == enUsOld { if iniOld == enUsOld {
continue continue
@ -78,7 +77,7 @@ func main() {
broken := oldStr != "" && strings.Count(oldStr, "%") != strings.Count(newStr, "%") broken := oldStr != "" && strings.Count(oldStr, "%") != strings.Count(newStr, "%")
broken = broken || strings.Contains(oldStr, "\n") || strings.Contains(oldStr, "\n") broken = broken || strings.Contains(oldStr, "\n") || strings.Contains(oldStr, "\n")
if broken { if broken {
brokenWarned.Add(secOld.Name() + "." + keyEnUs.Name()) brokenWarned[secOld.Name()+"."+keyEnUs.Name()] = true
fmt.Println("----") fmt.Println("----")
fmt.Printf("WARNING: skip broken locale: %s , [%s] %s\n", path, secEnUS.Name(), keyEnUs.Name()) fmt.Printf("WARNING: skip broken locale: %s , [%s] %s\n", path, secEnUS.Name(), keyEnUs.Name())
fmt.Printf("\told: %s\n", strings.ReplaceAll(oldStr, "\n", "\\n")) fmt.Printf("\told: %s\n", strings.ReplaceAll(oldStr, "\n", "\\n"))
@ -104,7 +103,7 @@ func main() {
broken = broken || strings.HasPrefix(str, "`\"") broken = broken || strings.HasPrefix(str, "`\"")
broken = broken || strings.Count(str, `"`)%2 == 1 broken = broken || strings.Count(str, `"`)%2 == 1
broken = broken || strings.Count(str, "`")%2 == 1 broken = broken || strings.Count(str, "`")%2 == 1
if broken && !brokenWarned.Contains(sec.Name()+"."+key.Name()) { if broken && !brokenWarned[sec.Name()+"."+key.Name()] {
fmt.Printf("WARNING: found broken locale: %s , [%s] %s\n", path, sec.Name(), key.Name()) fmt.Printf("WARNING: found broken locale: %s , [%s] %s\n", path, sec.Name(), key.Name())
fmt.Printf("\tstr: %s\n", strings.ReplaceAll(str, "\n", "\\n")) fmt.Printf("\tstr: %s\n", strings.ReplaceAll(str, "\n", "\\n"))
fmt.Println("----") fmt.Println("----")

View File

@ -15,8 +15,6 @@ import (
"regexp" "regexp"
"sort" "sort"
"strings" "strings"
"code.gitea.io/gitea/modules/container"
) )
// regexp is based on go-license, excluding README and NOTICE // regexp is based on go-license, excluding README and NOTICE
@ -57,14 +55,20 @@ func main() {
// yml // yml
// //
// It could be removed once we have a better regex. // It could be removed once we have a better regex.
excludedExt := container.SetOf(".gitignore", ".go", ".mod", ".sum", ".toml", ".yml") excludedExt := map[string]bool{
".gitignore": true,
".go": true,
".mod": true,
".sum": true,
".toml": true,
".yml": true,
}
var paths []string var paths []string
err := filepath.WalkDir(base, func(path string, entry fs.DirEntry, err error) error { err := filepath.WalkDir(base, func(path string, entry fs.DirEntry, err error) error {
if err != nil { if err != nil {
return err return err
} }
if entry.IsDir() || !licenseRe.MatchString(entry.Name()) || excludedExt.Contains(filepath.Ext(entry.Name())) { if entry.IsDir() || !licenseRe.MatchString(entry.Name()) || excludedExt[filepath.Ext(entry.Name())] {
return nil return nil
} }
paths = append(paths, path) paths = append(paths, path)

View File

@ -9,7 +9,6 @@ import (
"strings" "strings"
"code.gitea.io/gitea/models/perm" "code.gitea.io/gitea/models/perm"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
) )
@ -319,13 +318,14 @@ var (
// FindUnitTypes give the unit key names and return valid unique units and invalid keys // FindUnitTypes give the unit key names and return valid unique units and invalid keys
func FindUnitTypes(nameKeys ...string) (res []Type, invalidKeys []string) { func FindUnitTypes(nameKeys ...string) (res []Type, invalidKeys []string) {
m := make(container.Set[Type]) m := map[Type]struct{}{}
for _, key := range nameKeys { for _, key := range nameKeys {
t := TypeFromKey(key) t := TypeFromKey(key)
if t == TypeInvalid { if t == TypeInvalid {
invalidKeys = append(invalidKeys, key) invalidKeys = append(invalidKeys, key)
} else if m.Add(t) { } else if _, ok := m[t]; !ok {
res = append(res, t) res = append(res, t)
m[t] = struct{}{}
} }
} }
return res, invalidKeys return res, invalidKeys

View File

@ -16,7 +16,6 @@ import (
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/validation"
"xorm.io/builder" "xorm.io/builder"
) )
@ -162,17 +161,7 @@ func ValidateEmail(email string) error {
return ErrEmailInvalid{email} return ErrEmailInvalid{email}
} }
// if there is no allow list, then check email against block list // TODO: add an email allow/block list
if len(setting.Service.EmailDomainAllowList) == 0 &&
validation.IsEmailDomainListed(setting.Service.EmailDomainBlockList, email) {
return ErrEmailInvalid{email}
}
// if there is an allow list, then check email against allow list
if len(setting.Service.EmailDomainAllowList) > 0 &&
!validation.IsEmailDomainListed(setting.Service.EmailDomainAllowList, email) {
return ErrEmailInvalid{email}
}
return nil return nil
} }

View File

@ -14,7 +14,6 @@ import (
"sort" "sort"
"time" "time"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process" "code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/util"
@ -131,7 +130,7 @@ func readDir(layer *Layer, name string) ([]fs.FileInfo, error) {
// * false: only directories will be returned. // * false: only directories will be returned.
// The returned files are sorted by name. // The returned files are sorted by name.
func (l *LayeredFS) ListFiles(name string, fileMode ...bool) ([]string, error) { func (l *LayeredFS) ListFiles(name string, fileMode ...bool) ([]string, error) {
fileSet := make(container.Set[string]) fileMap := map[string]bool{}
for _, layer := range l.layers { for _, layer := range l.layers {
infos, err := readDir(layer, name) infos, err := readDir(layer, name)
if err != nil { if err != nil {
@ -139,11 +138,14 @@ func (l *LayeredFS) ListFiles(name string, fileMode ...bool) ([]string, error) {
} }
for _, info := range infos { for _, info := range infos {
if shouldInclude(info, fileMode...) { if shouldInclude(info, fileMode...) {
fileSet.Add(info.Name()) fileMap[info.Name()] = true
} }
} }
} }
files := fileSet.Values() files := make([]string, 0, len(fileMap))
for file := range fileMap {
files = append(files, file)
}
sort.Strings(files) sort.Strings(files)
return files, nil return files, nil
} }
@ -159,7 +161,7 @@ func (l *LayeredFS) ListAllFiles(name string, fileMode ...bool) ([]string, error
} }
func listAllFiles(layers []*Layer, name string, fileMode ...bool) ([]string, error) { func listAllFiles(layers []*Layer, name string, fileMode ...bool) ([]string, error) {
fileSet := make(container.Set[string]) fileMap := map[string]bool{}
var list func(dir string) error var list func(dir string) error
list = func(dir string) error { list = func(dir string) error {
for _, layer := range layers { for _, layer := range layers {
@ -170,7 +172,7 @@ func listAllFiles(layers []*Layer, name string, fileMode ...bool) ([]string, err
for _, info := range infos { for _, info := range infos {
path := util.PathJoinRelX(dir, info.Name()) path := util.PathJoinRelX(dir, info.Name())
if shouldInclude(info, fileMode...) { if shouldInclude(info, fileMode...) {
fileSet.Add(path) fileMap[path] = true
} }
if info.IsDir() { if info.IsDir() {
if err = list(path); err != nil { if err = list(path); err != nil {
@ -184,7 +186,10 @@ func listAllFiles(layers []*Layer, name string, fileMode ...bool) ([]string, err
if err := list(name); err != nil { if err := list(name); err != nil {
return nil, err return nil, err
} }
files := fileSet.Values() var files []string
for file := range fileMap {
files = append(files, file)
}
sort.Strings(files) sort.Strings(files)
return files, nil return files, nil
} }

View File

@ -9,7 +9,6 @@ import (
"html/template" "html/template"
"reflect" "reflect"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
) )
@ -52,7 +51,7 @@ func dict(args ...any) (map[string]any, error) {
return m, nil return m, nil
} }
func dumpVarMarshalable(v any, dumped container.Set[uintptr]) (ret any, ok bool) { func dumpVarMarshalable(v any, dumped map[uintptr]bool) (ret any, ok bool) {
if v == nil { if v == nil {
return nil, true return nil, true
} }
@ -62,10 +61,11 @@ func dumpVarMarshalable(v any, dumped container.Set[uintptr]) (ret any, ok bool)
} }
if e.CanAddr() { if e.CanAddr() {
addr := e.UnsafeAddr() addr := e.UnsafeAddr()
if !dumped.Add(addr) { if dumped[addr] {
return "[dumped]", false return "[dumped]", false
} }
defer dumped.Remove(addr) dumped[addr] = true
defer delete(dumped, addr)
} }
switch e.Kind() { switch e.Kind() {
case reflect.Bool, reflect.String, case reflect.Bool, reflect.String,
@ -107,7 +107,7 @@ func dumpVar(v any) template.HTML {
if setting.IsProd { if setting.IsProd {
return "<pre>dumpVar: only available in dev mode</pre>" return "<pre>dumpVar: only available in dev mode</pre>"
} }
m, ok := dumpVarMarshalable(v, make(container.Set[uintptr])) m, ok := dumpVarMarshalable(v, map[uintptr]bool{})
var dumpStr string var dumpStr string
jsonBytes, err := json.MarshalIndent(m, "", " ") jsonBytes, err := json.MarshalIndent(m, "", " ")
if err != nil { if err != nil {

View File

@ -10,8 +10,6 @@ import (
"strings" "strings"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"github.com/gobwas/glob"
) )
var externalTrackerRegex = regexp.MustCompile(`({?)(?:user|repo|index)+?(}?)`) var externalTrackerRegex = regexp.MustCompile(`({?)(?:user|repo|index)+?(}?)`)
@ -50,29 +48,6 @@ func IsValidSiteURL(uri string) bool {
return false return false
} }
// IsEmailDomainListed checks whether the domain of an email address
// matches a list of domains
func IsEmailDomainListed(globs []glob.Glob, email string) bool {
if len(globs) == 0 {
return false
}
n := strings.LastIndex(email, "@")
if n <= 0 {
return false
}
domain := strings.ToLower(email[n+1:])
for _, g := range globs {
if g.Match(domain) {
return true
}
}
return false
}
// IsAPIURL checks if URL is current Gitea instance API URL // IsAPIURL checks if URL is current Gitea instance API URL
func IsAPIURL(uri string) bool { func IsAPIURL(uri string) bool {
return strings.HasPrefix(strings.ToLower(uri), strings.ToLower(setting.AppURL+"api")) return strings.HasPrefix(strings.ToLower(uri), strings.ToLower(setting.AppURL+"api"))

View File

@ -874,10 +874,8 @@ remove_account_link=連携アカウントの削除
remove_account_link_desc=連携アカウントを削除し、Giteaアカウントへのアクセス権を取り消します。 続行しますか? remove_account_link_desc=連携アカウントを削除し、Giteaアカウントへのアクセス権を取り消します。 続行しますか?
remove_account_link_success=連携アカウントを削除しました。 remove_account_link_success=連携アカウントを削除しました。
hooks.desc=あなたが所有する<strong>すべてのリポジトリ</strong>でトリガーされるWebhookを追加します。
orgs_none=あなたはどの組織のメンバーでもありません。 orgs_none=あなたはどの組織のメンバーでもありません。
repos_none=あなたはリポジトリを所有していません。
delete_account=アカウントを削除 delete_account=アカウントを削除
delete_prompt=この操作により、あなたのユーザーアカウントは恒久的に抹消されます。 取り消すことは<strong>できません</strong>。 delete_prompt=この操作により、あなたのユーザーアカウントは恒久的に抹消されます。 取り消すことは<strong>できません</strong>。
@ -894,14 +892,11 @@ email_notifications.andyourown=自分に関する通知も含める
visibility=ユーザーの公開範囲 visibility=ユーザーの公開範囲
visibility.public=パブリック visibility.public=パブリック
visibility.public_tooltip=全員に表示されます visibility.public_tooltip=全員に表示ます
visibility.limited=限定 visibility.limited=限定
visibility.limited_tooltip=認証されたユーザーのみに表示されます
visibility.private=プライベート visibility.private=プライベート
visibility.private_tooltip=あなたが参加した組織のメンバーのみに表示されます
[repo] [repo]
new_repo_helper=リポジトリには、プロジェクトのすべてのファイルとリビジョン履歴が入ります。 すでにほかの場所でホストしていますか? <a href="%s">リポジトリを移行</a> もどうぞ。
owner=オーナー owner=オーナー
owner_helper=リポジトリ数の上限により、一部の組織はドロップダウンに表示されない場合があります。 owner_helper=リポジトリ数の上限により、一部の組織はドロップダウンに表示されない場合があります。
repo_name=リポジトリ名 repo_name=リポジトリ名
@ -913,7 +908,6 @@ template_helper=テンプレートリポジトリにする
template_description=テンプレートリポジトリは、同じディレクトリ構成、同じファイル、同じオプション設定でユーザーが新しいリポジトリを作成できるようにするものです。 template_description=テンプレートリポジトリは、同じディレクトリ構成、同じファイル、同じオプション設定でユーザーが新しいリポジトリを作成できるようにするものです。
visibility=公開/非公開 visibility=公開/非公開
visibility_description=オーナー、または権限を持つ組織のメンバーだけが、リポジトリを見ることができます。 visibility_description=オーナー、または権限を持つ組織のメンバーだけが、リポジトリを見ることができます。
visibility_helper=リポジトリをプライベートにする
visibility_helper_forced=サイト管理者の設定により、新しいリポジトリは強制的にプライベートになります。 visibility_helper_forced=サイト管理者の設定により、新しいリポジトリは強制的にプライベートになります。
visibility_fork_helper=(この変更はすべてのフォークに適用されます) visibility_fork_helper=(この変更はすべてのフォークに適用されます)
clone_helper=クローンに関してお困りであれば<a target="_blank" rel="noopener noreferrer" href="%s">ヘルプ</a>を参照しましょう。 clone_helper=クローンに関してお困りであれば<a target="_blank" rel="noopener noreferrer" href="%s">ヘルプ</a>を参照しましょう。
@ -958,8 +952,6 @@ mirror_interval_invalid=ミラー間隔が不正です。
mirror_sync_on_commit=コミットがプッシュされたときに同期 mirror_sync_on_commit=コミットがプッシュされたときに同期
mirror_address=クローンするURL mirror_address=クローンするURL
mirror_address_desc=必要な資格情報は「認証」セクションに設定してください。 mirror_address_desc=必要な資格情報は「認証」セクションに設定してください。
mirror_address_url_invalid=入力したURLは無効です。 URLの構成要素はすべて正しくエスケープする必要があります。
mirror_address_protocol_invalid=入力したURLは無効です。 ミラーできるのは、http(s):// または git:// からだけです。
mirror_lfs=Large File Storage (LFS) mirror_lfs=Large File Storage (LFS)
mirror_lfs_desc=LFS データのミラーリングを有効にする。 mirror_lfs_desc=LFS データのミラーリングを有効にする。
mirror_lfs_endpoint=LFS エンドポイント mirror_lfs_endpoint=LFS エンドポイント
@ -987,12 +979,10 @@ delete_preexisting_success=%s の未登録ファイルを削除しました
blame_prior=この変更より前のBlameを表示 blame_prior=この変更より前のBlameを表示
author_search_tooltip=最大30人までのユーザーを表示 author_search_tooltip=最大30人までのユーザーを表示
transfer.accept=移転を承認 transfer.accept=転送を承認
transfer.accept_desc=`"%s" に移転` transfer.accept_desc=`"%s" に転送`
transfer.reject=移転を拒否 transfer.reject=転送を拒否
transfer.reject_desc=`"%s" への移転をキャンセル` transfer.reject_desc=`"%s" への転送をキャンセル`
transfer.no_permission_to_accept=この移転を承認する権限がありません。
transfer.no_permission_to_reject=この移転を拒否する権限がありません。
desc.private=プライベート desc.private=プライベート
desc.public=公開 desc.public=公開
@ -1013,8 +1003,6 @@ template.issue_labels=イシューラベル
template.one_item=最低一つはテンプレート項目を選択する必要があります template.one_item=最低一つはテンプレート項目を選択する必要があります
template.invalid=テンプレートリポジトリを選択する必要があります template.invalid=テンプレートリポジトリを選択する必要があります
archive.title=このリポジトリはアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
archive.title_date=このリポジトリは%sにアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
archive.issue.nocomment=このリポジトリはアーカイブされています。 イシューにコメントを追加することはできません。 archive.issue.nocomment=このリポジトリはアーカイブされています。 イシューにコメントを追加することはできません。
archive.pull.nocomment=このリポジトリはアーカイブされています。 プルリクエストにコメントを追加することはできません。 archive.pull.nocomment=このリポジトリはアーカイブされています。 プルリクエストにコメントを追加することはできません。
@ -1031,7 +1019,6 @@ migrate_options_lfs=LFS ファイルのマイグレート
migrate_options_lfs_endpoint.label=LFS エンドポイント migrate_options_lfs_endpoint.label=LFS エンドポイント
migrate_options_lfs_endpoint.description=マイグレーションでは、リモート側のGitをもとに<a target="_blank" rel="noopener noreferrer" href="%s">LFSサーバーを決定</a>しようとします。 リポジトリのLFSデータがほかの場所に保存されている場合は、独自のエンドポイントを指定することができます。 migrate_options_lfs_endpoint.description=マイグレーションでは、リモート側のGitをもとに<a target="_blank" rel="noopener noreferrer" href="%s">LFSサーバーを決定</a>しようとします。 リポジトリのLFSデータがほかの場所に保存されている場合は、独自のエンドポイントを指定することができます。
migrate_options_lfs_endpoint.description.local=ローカルサーバーのパスもサポートされています。 migrate_options_lfs_endpoint.description.local=ローカルサーバーのパスもサポートされています。
migrate_options_lfs_endpoint.placeholder=空にするとエンドポイントはクローン URL から決定されます
migrate_items=移行する項目 migrate_items=移行する項目
migrate_items_wiki=Wiki migrate_items_wiki=Wiki
migrate_items_milestones=マイルストーン migrate_items_milestones=マイルストーン
@ -1398,7 +1385,6 @@ issues.filter_sort.moststars=スターが多い順
issues.filter_sort.feweststars=スターが少ない順 issues.filter_sort.feweststars=スターが少ない順
issues.filter_sort.mostforks=フォークが多い順 issues.filter_sort.mostforks=フォークが多い順
issues.filter_sort.fewestforks=フォークが少ない順 issues.filter_sort.fewestforks=フォークが少ない順
issues.keyword_search_unavailable=現在キーワード検索は利用できません。 サイト管理者にお問い合わせください。
issues.action_open=オープン issues.action_open=オープン
issues.action_close=クローズ issues.action_close=クローズ
issues.action_label=ラベル issues.action_label=ラベル
@ -1515,7 +1501,6 @@ issues.tracking_already_started=`<a href="%s">別のイシュー</a>で既にタ
issues.stop_tracking=タイマー 終了 issues.stop_tracking=タイマー 終了
issues.stop_tracking_history=`が作業を終了 %s` issues.stop_tracking_history=`が作業を終了 %s`
issues.cancel_tracking=中止 issues.cancel_tracking=中止
issues.cancel_tracking_history=`がタイムトラッキングを中止 %s`
issues.add_time=手で時間を入力 issues.add_time=手で時間を入力
issues.del_time=このタイムログを削除 issues.del_time=このタイムログを削除
issues.add_time_short=時間入力 issues.add_time_short=時間入力
@ -1539,7 +1524,6 @@ issues.due_date_form=yyyy-mm-dd
issues.due_date_form_add=期日の追加 issues.due_date_form_add=期日の追加
issues.due_date_form_edit=変更 issues.due_date_form_edit=変更
issues.due_date_form_remove=削除 issues.due_date_form_remove=削除
issues.due_date_not_writer=イシューの期日を変更するには、リポジトリへの書き込み権限が必要です。
issues.due_date_not_set=期日は未設定です。 issues.due_date_not_set=期日は未設定です。
issues.due_date_added=が期日 %s を追加 %s issues.due_date_added=が期日 %s を追加 %s
issues.due_date_modified=が期日を %[2]s から %[1]s に変更 %[3]s issues.due_date_modified=が期日を %[2]s から %[1]s に変更 %[3]s
@ -1665,12 +1649,6 @@ pulls.is_empty=このブランチの変更は既にターゲットブランチ
pulls.required_status_check_failed=いくつかの必要なステータスチェックが成功していません。 pulls.required_status_check_failed=いくつかの必要なステータスチェックが成功していません。
pulls.required_status_check_missing=必要なステータスチェックが見つかりません。 pulls.required_status_check_missing=必要なステータスチェックが見つかりません。
pulls.required_status_check_administrator=管理者であるため、このプルリクエストをマージすることは可能です。 pulls.required_status_check_administrator=管理者であるため、このプルリクエストをマージすることは可能です。
pulls.blocked_by_approvals=このプルリクエストはまだ承認数が足りません。 %[1]d/%[2]dの承認を得ています。
pulls.blocked_by_rejection=このプルリクエストは公式レビューアにより変更要請されています。
pulls.blocked_by_official_review_requests=このプルリクエストには公式レビュー依頼があります。
pulls.blocked_by_outdated_branch=このプルリクエストは遅れのためブロックされています。
pulls.blocked_by_changed_protected_files_1=このプルリクエストは保護しているファイルを変更するためブロックされています:
pulls.blocked_by_changed_protected_files_n=このプルリクエストは保護しているファイルを変更するためブロックされています:
pulls.can_auto_merge_desc=このプルリクエストは自動的にマージできます。 pulls.can_auto_merge_desc=このプルリクエストは自動的にマージできます。
pulls.cannot_auto_merge_desc=コンフリクトが存在するため、このプルリクエストは自動的にマージできません。 pulls.cannot_auto_merge_desc=コンフリクトが存在するため、このプルリクエストは自動的にマージできません。
pulls.cannot_auto_merge_helper=コンフリクトを解消するため手動でマージしてください。 pulls.cannot_auto_merge_helper=コンフリクトを解消するため手動でマージしてください。
@ -1753,7 +1731,6 @@ milestones.update_ago=%sに更新
milestones.no_due_date=期日なし milestones.no_due_date=期日なし
milestones.open=オープン milestones.open=オープン
milestones.close=クローズ milestones.close=クローズ
milestones.new_subheader=マイルストーンを使うとイシューの整理や進捗確認がしやすくなります。
milestones.completeness=%d%%消化 milestones.completeness=%d%%消化
milestones.create=マイルストーンを作成 milestones.create=マイルストーンを作成
milestones.title=タイトル milestones.title=タイトル
@ -1982,13 +1959,13 @@ settings.convert_fork_notices_1=この操作によりフォークから通常の
settings.convert_fork_confirm=リポジトリを変換 settings.convert_fork_confirm=リポジトリを変換
settings.convert_fork_succeed=フォークを通常のリポジトリに変換しました。 settings.convert_fork_succeed=フォークを通常のリポジトリに変換しました。
settings.transfer=オーナー移転 settings.transfer=オーナー移転
settings.transfer.rejected=リポジトリの転は拒否されました。 settings.transfer.rejected=リポジトリのは拒否されました。
settings.transfer.success=リポジトリの転が成功しました。 settings.transfer.success=リポジトリのが成功しました。
settings.transfer_abort=転送をキャンセル settings.transfer_abort=転送をキャンセル
settings.transfer_abort_invalid=存在しないリポジトリの転はキャンセルできません。 settings.transfer_abort_invalid=存在しないリポジトリのはキャンセルできません。
settings.transfer_desc=別のユーザーやあなたが管理者権限を持っている組織にリポジトリを移転します。 settings.transfer_desc=別のユーザーやあなたが管理者権限を持っている組織にリポジトリを移転します。
settings.transfer_form_title=確認のためリポジトリ名を入力: settings.transfer_form_title=確認のためリポジトリ名を入力:
settings.transfer_in_progress=現在進行中の転があります。このリポジトリを別のユーザーに転したい場合はキャンセルしてください。 settings.transfer_in_progress=現在進行中のがあります。このリポジトリを別のユーザーに転したい場合はキャンセルしてください。
settings.transfer_notices_1=- 個人ユーザーに移転すると、あなたはリポジトリへのアクセス権を失います。 settings.transfer_notices_1=- 個人ユーザーに移転すると、あなたはリポジトリへのアクセス権を失います。
settings.transfer_notices_2=- あなたが所有(または共同で所有)している組織に移転すると、リポジトリへのアクセス権は維持されます。 settings.transfer_notices_2=- あなたが所有(または共同で所有)している組織に移転すると、リポジトリへのアクセス権は維持されます。
settings.transfer_notices_3=- プライベートリポジトリを個人ユーザーに移転した場合は、最低限そのユーザーが読み取り権限を持つよう設定されます (必要に応じて権限が変更されます)。 settings.transfer_notices_3=- プライベートリポジトリを個人ユーザーに移転した場合は、最低限そのユーザーが読み取り権限を持つよう設定されます (必要に応じて権限が変更されます)。

View File

@ -10,7 +10,6 @@ import (
actions_model "code.gitea.io/gitea/models/actions" actions_model "code.gitea.io/gitea/models/actions"
secret_model "code.gitea.io/gitea/models/secret" secret_model "code.gitea.io/gitea/models/secret"
actions_module "code.gitea.io/gitea/modules/actions" actions_module "code.gitea.io/gitea/modules/actions"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
@ -198,7 +197,10 @@ func findTaskNeeds(ctx context.Context, task *actions_model.ActionTask) (map[str
if len(task.Job.Needs) == 0 { if len(task.Job.Needs) == 0 {
return nil, nil return nil, nil
} }
needs := container.SetOf(task.Job.Needs...) needs := map[string]struct{}{}
for _, v := range task.Job.Needs {
needs[v] = struct{}{}
}
jobs, _, err := actions_model.FindRunJobs(ctx, actions_model.FindRunJobOptions{RunID: task.Job.RunID}) jobs, _, err := actions_model.FindRunJobs(ctx, actions_model.FindRunJobOptions{RunID: task.Job.RunID})
if err != nil { if err != nil {
@ -207,7 +209,7 @@ func findTaskNeeds(ctx context.Context, task *actions_model.ActionTask) (map[str
ret := make(map[string]*runnerv1.TaskNeed, len(needs)) ret := make(map[string]*runnerv1.TaskNeed, len(needs))
for _, job := range jobs { for _, job := range jobs {
if !needs.Contains(job.JobID) { if _, ok := needs[job.JobID]; !ok {
continue continue
} }
if job.TaskID == 0 || !job.Status.IsDone() { if job.TaskID == 0 || !job.Status.IsDone() {

View File

@ -567,9 +567,12 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
// Remove repositories that should not be shown, // Remove repositories that should not be shown,
// which are repositories that have no issues and are not selected by the user. // which are repositories that have no issues and are not selected by the user.
selectedRepos := container.SetOf(selectedRepoIDs...) selectedReposMap := make(map[int64]struct{}, len(selectedRepoIDs))
for _, repoID := range selectedRepoIDs {
selectedReposMap[repoID] = struct{}{}
}
for k, v := range issueCountByRepo { for k, v := range issueCountByRepo {
if v == 0 && !selectedRepos.Contains(k) { if _, ok := selectedReposMap[k]; !ok && v == 0 {
delete(issueCountByRepo, k) delete(issueCountByRepo, k)
} }
} }

View File

@ -13,7 +13,6 @@ import (
"code.gitea.io/gitea/models/organization" "code.gitea.io/gitea/models/organization"
user_model "code.gitea.io/gitea/models/user" user_model "code.gitea.io/gitea/models/user"
auth_module "code.gitea.io/gitea/modules/auth" auth_module "code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/util"
source_service "code.gitea.io/gitea/services/auth/source" source_service "code.gitea.io/gitea/services/auth/source"
@ -42,7 +41,7 @@ func (source *Source) Sync(ctx context.Context, updateExisting bool) error {
usernameUsers := make(map[string]*user_model.User, len(users)) usernameUsers := make(map[string]*user_model.User, len(users))
mailUsers := make(map[string]*user_model.User, len(users)) mailUsers := make(map[string]*user_model.User, len(users))
keepActiveUsers := make(container.Set[int64]) keepActiveUsers := make(map[int64]struct{})
for _, u := range users { for _, u := range users {
usernameUsers[u.LowerName] = u usernameUsers[u.LowerName] = u
@ -98,7 +97,7 @@ func (source *Source) Sync(ctx context.Context, updateExisting bool) error {
} }
if usr != nil { if usr != nil {
keepActiveUsers.Add(usr.ID) keepActiveUsers[usr.ID] = struct{}{}
} else if len(su.Username) == 0 { } else if len(su.Username) == 0 {
// we cannot create the user if su.Username is empty // we cannot create the user if su.Username is empty
continue continue
@ -209,7 +208,7 @@ func (source *Source) Sync(ctx context.Context, updateExisting bool) error {
// Deactivate users not present in LDAP // Deactivate users not present in LDAP
if updateExisting { if updateExisting {
for _, usr := range users { for _, usr := range users {
if keepActiveUsers.Contains(usr.ID) { if _, ok := keepActiveUsers[usr.ID]; ok {
continue continue
} }

View File

@ -13,10 +13,10 @@ import (
"code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/validation"
"code.gitea.io/gitea/modules/web/middleware" "code.gitea.io/gitea/modules/web/middleware"
"gitea.com/go-chi/binding" "gitea.com/go-chi/binding"
"github.com/gobwas/glob"
) )
// InstallForm form for installation page // InstallForm form for installation page
@ -103,6 +103,29 @@ func (f *RegisterForm) Validate(req *http.Request, errs binding.Errors) binding.
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
} }
// IsEmailDomainListed checks whether the domain of an email address
// matches a list of domains
func IsEmailDomainListed(globs []glob.Glob, email string) bool {
if len(globs) == 0 {
return false
}
n := strings.LastIndex(email, "@")
if n <= 0 {
return false
}
domain := strings.ToLower(email[n+1:])
for _, g := range globs {
if g.Match(domain) {
return true
}
}
return false
}
// IsEmailDomainAllowed validates that the email address // IsEmailDomainAllowed validates that the email address
// provided by the user matches what has been configured . // provided by the user matches what has been configured .
// The email is marked as allowed if it matches any of the // The email is marked as allowed if it matches any of the
@ -110,10 +133,10 @@ func (f *RegisterForm) Validate(req *http.Request, errs binding.Errors) binding.
// domains in the blocklist, if any such list is not empty. // domains in the blocklist, if any such list is not empty.
func (f *RegisterForm) IsEmailDomainAllowed() bool { func (f *RegisterForm) IsEmailDomainAllowed() bool {
if len(setting.Service.EmailDomainAllowList) == 0 { if len(setting.Service.EmailDomainAllowList) == 0 {
return !validation.IsEmailDomainListed(setting.Service.EmailDomainBlockList, f.Email) return !IsEmailDomainListed(setting.Service.EmailDomainBlockList, f.Email)
} }
return validation.IsEmailDomainListed(setting.Service.EmailDomainAllowList, f.Email) return IsEmailDomainListed(setting.Service.EmailDomainAllowList, f.Email)
} }
// MustChangePasswordForm form for updating your password after account creation // MustChangePasswordForm form for updating your password after account creation

View File

@ -14,7 +14,6 @@ import (
"strings" "strings"
"time" "time"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
base "code.gitea.io/gitea/modules/migration" base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/structs"
@ -674,15 +673,16 @@ func (g *GitlabDownloader) GetReviews(reviewable base.Reviewable) ([]*base.Revie
func (g *GitlabDownloader) awardsToReactions(awards []*gitlab.AwardEmoji) []*base.Reaction { func (g *GitlabDownloader) awardsToReactions(awards []*gitlab.AwardEmoji) []*base.Reaction {
result := make([]*base.Reaction, 0, len(awards)) result := make([]*base.Reaction, 0, len(awards))
uniqCheck := make(container.Set[string]) uniqCheck := make(map[string]struct{})
for _, award := range awards { for _, award := range awards {
uid := fmt.Sprintf("%s%d", award.Name, award.User.ID) uid := fmt.Sprintf("%s%d", award.Name, award.User.ID)
if uniqCheck.Add(uid) { if _, ok := uniqCheck[uid]; !ok {
result = append(result, &base.Reaction{ result = append(result, &base.Reaction{
UserID: int64(award.User.ID), UserID: int64(award.User.ID),
UserName: award.User.Username, UserName: award.User.Username,
Content: award.Name, Content: award.Name,
}) })
uniqCheck[uid] = struct{}{}
} }
} }
return result return result

View File

@ -195,10 +195,6 @@ func adoptRepository(ctx context.Context, repoPath string, u *user_model.User, r
return fmt.Errorf("updateRepository: %w", err) return fmt.Errorf("updateRepository: %w", err)
} }
if err = repo_module.SyncReleasesWithTags(repo, gitRepo); err != nil {
return fmt.Errorf("SyncReleasesWithTags: %w", err)
}
return nil return nil
} }

View File

@ -31,7 +31,7 @@
<tr> <tr>
<th></th> <th></th>
<th colspan="5"> <th colspan="5">
<form class="gt-float-right" method="post" action="{{AppSubUrl}}/admin/notices/empty"> <form class="ui right" method="post" action="{{AppSubUrl}}/admin/notices/empty">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<button type="submit" class="ui red small button">{{.locale.Tr "admin.notices.delete_all"}}</button> <button type="submit" class="ui red small button">{{.locale.Tr "admin.notices.delete_all"}}</button>
</form> </form>

View File

@ -1,11 +1,15 @@
{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings labels")}} {{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings labels")}}
<div class="org-setting-content"> <div class="org-setting-content">
<div class="gt-df gt-ac"> <div class="ui grid">
<div class="gt-f1"> <div class="left floated twelve wide column">
{{$.locale.Tr "org.settings.labels_desc" | Str2html}} {{$.locale.Tr "org.settings.labels_desc" | Str2html}}
</div> </div>
<div class="right floated three wide column">
<div class="ui right">
<button class="ui small green new-label button">{{.locale.Tr "repo.issues.new_label"}}</button> <button class="ui small green new-label button">{{.locale.Tr "repo.issues.new_label"}}</button>
</div> </div>
</div>
</div>
<div class="divider"></div> <div class="divider"></div>
{{template "repo/issue/labels/label_new" .}} {{template "repo/issue/labels/label_new" .}}
{{template "repo/issue/labels/label_list" .}} {{template "repo/issue/labels/label_list" .}}

View File

@ -41,7 +41,7 @@
{{if $canAddRemove}} {{if $canAddRemove}}
<form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/remove"> <form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/remove">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<button type="submit" class="ui red small button" name="repoid" value="{{.ID}}">{{$.locale.Tr "remove"}}</button> <button type="submit" class="ui red small button right" name="repoid" value="{{.ID}}">{{$.locale.Tr "remove"}}</button>
</form> </form>
{{end}} {{end}}
</div> </div>

View File

@ -87,7 +87,7 @@
{{end}} {{end}}
<div class="divider"></div> <div class="divider"></div>
<strong>{{.locale.Tr "packages.versions"}} ({{.TotalVersionCount}})</strong> <strong>{{.locale.Tr "packages.versions"}} ({{.TotalVersionCount}})</strong>
<a class="gt-float-right" href="{{$.PackageDescriptor.PackageWebLink}}/versions">{{.locale.Tr "packages.versions.view_all"}}</a> <a class="ui right" href="{{$.PackageDescriptor.PackageWebLink}}/versions">{{.locale.Tr "packages.versions.view_all"}}</a>
<div class="ui relaxed list"> <div class="ui relaxed list">
{{range .LatestVersions}} {{range .LatestVersions}}
<div class="item gt-df"> <div class="item gt-df">

View File

@ -13,7 +13,7 @@
{{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}} {{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}}
<span class="shabox gt-df gt-ac gt-float-right"> <span class="ui float right shabox gt-df gt-ac">
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $.root}} {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $.root}}
{{$class := "ui sha label"}} {{$class := "ui sha label"}}
{{if .Signature}} {{if .Signature}}

View File

@ -22,7 +22,7 @@
<div class="field footer gt-mx-3"> <div class="field footer gt-mx-3">
<span class="markup-info">{{svg "octicon-markup"}} {{$.root.locale.Tr "repo.diff.comment.markdown_info"}}</span> <span class="markup-info">{{svg "octicon-markup"}} {{$.root.locale.Tr "repo.diff.comment.markdown_info"}}</span>
<div class="gt-text-right"> <div class="ui right">
{{if $.reply}} {{if $.reply}}
<button class="ui submit green tiny button btn-reply" type="submit">{{$.root.locale.Tr "repo.diff.comment.reply"}}</button> <button class="ui submit green tiny button btn-reply" type="submit">{{$.root.locale.Tr "repo.diff.comment.reply"}}</button>
<input type="hidden" name="reply" value="{{$.reply}}"> <input type="hidden" name="reply" value="{{$.reply}}">

View File

@ -5,7 +5,9 @@
<div class="navbar gt-mb-4"> <div class="navbar gt-mb-4">
{{template "repo/issue/navbar" .}} {{template "repo/issue/navbar" .}}
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}
<div class="ui right">
<button class="ui small green new-label button">{{.locale.Tr "repo.issues.new_label"}}</button> <button class="ui small green new-label button">{{.locale.Tr "repo.issues.new_label"}}</button>
</div>
{{end}} {{end}}
</div> </div>
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}

View File

@ -5,7 +5,9 @@
<div class="navbar gt-mb-4"> <div class="navbar gt-mb-4">
{{template "repo/issue/navbar" .}} {{template "repo/issue/navbar" .}}
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}
<div class="ui right">
<a class="ui small green button" href="{{$.Link}}/new">{{.locale.Tr "repo.milestones.new"}}</a> <a class="ui small green button" href="{{$.Link}}/new">{{.locale.Tr "repo.milestones.new"}}</a>
</div>
{{end}} {{end}}
</div> </div>
{{template "base/alert" .}} {{template "base/alert" .}}

View File

@ -19,7 +19,7 @@
</a> </a>
</div> </div>
<div class="gt-p-3 gt-df gt-ac"> <div class="gt-p-3 gt-df gt-ac">
<span class="ui text grey">{{.Size | FileSize}}</span> <span class="ui text grey right">{{.Size | FileSize}}</span>
</div> </div>
</div> </div>
{{end -}} {{end -}}

View File

@ -477,7 +477,7 @@
</div> </div>
<div> <div>
{{if or $invalid $resolved}} {{if or $invalid $resolved}}
<button id="show-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="{{if not $resolved}}gt-hidden {{end}}ui compact labeled button show-outdated gt-df gt-ac"> <button id="show-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="{{if not $resolved}}gt-hidden {{end}}ui compact right labeled button show-outdated gt-df gt-ac">
{{svg "octicon-unfold" 16 "gt-mr-3"}} {{svg "octicon-unfold" 16 "gt-mr-3"}}
{{if $resolved}} {{if $resolved}}
{{$.locale.Tr "repo.issues.review.show_resolved"}} {{$.locale.Tr "repo.issues.review.show_resolved"}}
@ -485,7 +485,7 @@
{{$.locale.Tr "repo.issues.review.show_outdated"}} {{$.locale.Tr "repo.issues.review.show_outdated"}}
{{end}} {{end}}
</button> </button>
<button id="hide-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="{{if $resolved}}gt-hidden {{end}}ui compact labeled button hide-outdated gt-df gt-ac"> <button id="hide-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="{{if $resolved}}gt-hidden {{end}}ui compact right labeled button hide-outdated gt-df gt-ac">
{{svg "octicon-fold" 16 "gt-mr-3"}} {{svg "octicon-fold" 16 "gt-mr-3"}}
{{if $resolved}} {{if $resolved}}
{{$.locale.Tr "repo.issues.review.hide_resolved"}} {{$.locale.Tr "repo.issues.review.hide_resolved"}}
@ -698,7 +698,7 @@
{{end}} {{end}}
</span> </span>
{{if and .IsForcePush $.Issue.PullRequest.BaseRepo.Name}} {{if and .IsForcePush $.Issue.PullRequest.BaseRepo.Name}}
<span class="gt-float-right comparebox"> <span class="ui float right comparebox">
<a href="{{$.Issue.PullRequest.BaseRepo.Link}}/compare/{{PathEscape .OldCommit}}..{{PathEscape .NewCommit}}" rel="nofollow" class="ui compare label">{{$.locale.Tr "repo.issues.force_push_compare"}}</a> <a href="{{$.Issue.PullRequest.BaseRepo.Link}}/compare/{{PathEscape .OldCommit}}..{{PathEscape .NewCommit}}" rel="nofollow" class="ui compare label">{{$.locale.Tr "repo.issues.force_push_compare"}}</a>
</span> </span>
{{end}} {{end}}

View File

@ -1,7 +1,7 @@
{{if .comment.Time}} {{/* compatibility with time comments made before v1.14 */}} {{if .comment.Time}} {{/* compatibility with time comments made before v1.14 */}}
{{if (not .comment.Time.Deleted)}} {{if (not .comment.Time.Deleted)}}
{{if (or .ctxData.IsAdmin (and .ctxData.IsSigned (eq .ctxData.SignedUserID .comment.PosterID)))}} {{if (or .ctxData.IsAdmin (and .ctxData.IsSigned (eq .ctxData.SignedUserID .comment.PosterID)))}}
<span class="gt-float-right"> <span class="ui float right">
<div class="ui mini modal issue-delete-time-modal" data-id="{{.comment.Time.ID}}"> <div class="ui mini modal issue-delete-time-modal" data-id="{{.comment.Time.ID}}">
<form method="post" class="delete-time-form" action="{{.ctxData.RepoLink}}/issues/{{.ctxData.Issue.Index}}/times/{{.comment.TimeID}}/delete"> <form method="post" class="delete-time-form" action="{{.ctxData.RepoLink}}/issues/{{.ctxData.Issue.Index}}/times/{{.comment.TimeID}}/delete">
{{.ctxData.CsrfTokenHtml}} {{.ctxData.CsrfTokenHtml}}

View File

@ -4,7 +4,7 @@
<div class="ui container padded"> <div class="ui container padded">
<div class="gt-df gt-sb gt-ac gt-mb-4"> <div class="gt-df gt-sb gt-ac gt-mb-4">
{{template "repo/issue/navbar" .}} {{template "repo/issue/navbar" .}}
<a class="ui small green button" href="{{.RepoLink}}/issues/new/choose?project={{.Project.ID}}">{{ctx.Locale.Tr "repo.issues.new"}}</a> <a class="ui right small green button item" href="{{.RepoLink}}/issues/new/choose?project={{.Project.ID}}">{{ctx.Locale.Tr "repo.issues.new"}}</a>
</div> </div>
{{template "projects/view" .}} {{template "projects/view" .}}
</div> </div>

View File

@ -93,7 +93,7 @@
{{if .Attachments}} {{if .Attachments}}
{{range .Attachments}} {{range .Attachments}}
<li> <li>
<span class="gt-float-right"> <span class="ui text middle aligned right">
<span class="ui text grey">{{.Size | FileSize}}</span> <span class="ui text grey">{{.Size | FileSize}}</span>
<span data-tooltip-content="{{$.locale.Tr "repo.release.download_count" ($.locale.PrettyNumber .DownloadCount)}}"> <span data-tooltip-content="{{$.locale.Tr "repo.release.download_count" ($.locale.PrettyNumber .DownloadCount)}}">
{{svg "octicon-info"}} {{svg "octicon-info"}}

View File

@ -61,18 +61,20 @@
)}} )}}
</div> </div>
{{range .attachments}} {{range .attachments}}
<div class="field flex-text-block" id="attachment-{{.ID}}"> <div class="field" id="attachment-{{.ID}}">
<div class="flex-text-inline gt-f1"> <div class="ui right gt-df gt-ac wrap_remove">
<input name="attachment-edit-{{.UUID}}" class="attachment_edit" required value="{{.Name}}"> <a class="ui mini compact red button remove-rel-attach" data-id="{{.ID}}" data-uuid="{{.UUID}}">
{{$.locale.Tr "remove"}}
</a>
</div>
<div class="gt-df gt-ac">
<input name="attachment-edit-{{.UUID}}" class="gt-mr-3 attachment_edit" required value="{{.Name}}">
<input name="attachment-del-{{.UUID}}" type="hidden" value="false"> <input name="attachment-del-{{.UUID}}" type="hidden" value="false">
<span class="ui text grey gt-whitespace-nowrap">{{.Size | FileSize}}</span> <span class="ui text grey gt-mr-3">{{.Size | FileSize}}</span>
<span data-tooltip-content="{{$.locale.Tr "repo.release.download_count" ($.locale.PrettyNumber .DownloadCount)}}"> <span data-tooltip-content="{{$.locale.Tr "repo.release.download_count" ($.locale.PrettyNumber .DownloadCount)}}">
{{svg "octicon-info"}} {{svg "octicon-info"}}
</span> </span>
</div> </div>
<a class="ui mini compact red button remove-rel-attach" data-id="{{.ID}}" data-uuid="{{.UUID}}">
{{$.locale.Tr "remove"}}
</a>
</div> </div>
{{end}} {{end}}
{{if .IsAttachmentEnabled}} {{if .IsAttachmentEnabled}}

View File

@ -15,7 +15,7 @@
{{end}} {{end}}
</div> </div>
{{if and (not .PageIsTagList) .CanCreateRelease}} {{if and (not .PageIsTagList) .CanCreateRelease}}
<a class="ui small green button" href="{{$.RepoLink}}/releases/new"> <a class="ui right small green button" href="{{$.RepoLink}}/releases/new">
{{.locale.Tr "repo.release.new_release"}} {{.locale.Tr "repo.release.new_release"}}
</a> </a>
{{end}} {{end}}

View File

@ -41,9 +41,13 @@
<div class="ui bottom attached segment"> <div class="ui bottom attached segment">
<form class="ui form" id="repo-collab-form" action="{{.Link}}" method="post"> <form class="ui form" id="repo-collab-form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div id="search-user-box" class="ui search input gt-vm"> <div class="inline field ui left">
<div id="search-user-box" class="ui search">
<div class="ui input">
<input class="prompt" name="collaborator" placeholder="{{.locale.Tr "repo.settings.search_user_placeholder"}}" autocomplete="off" autofocus required> <input class="prompt" name="collaborator" placeholder="{{.locale.Tr "repo.settings.search_user_placeholder"}}" autocomplete="off" autofocus required>
</div> </div>
</div>
</div>
<button class="ui green button">{{.locale.Tr "repo.settings.add_collaborator"}}</button> <button class="ui green button">{{.locale.Tr "repo.settings.add_collaborator"}}</button>
</form> </form>
</div> </div>
@ -89,9 +93,13 @@
{{if $allowedToChangeTeams}} {{if $allowedToChangeTeams}}
<form class="ui form" id="repo-collab-team-form" action="{{.Link}}/team" method="post"> <form class="ui form" id="repo-collab-team-form" action="{{.Link}}/team" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div id="search-team-box" class="ui search input gt-vm"> <div class="inline field ui left">
<div id="search-team-box" class="ui search" data-org="{{.OrgName}}">
<div class="ui input">
<input class="prompt" name="team" placeholder="{{$.locale.Tr "repo.settings.search_team"}}" autocomplete="off" autofocus required> <input class="prompt" name="team" placeholder="{{$.locale.Tr "repo.settings.search_team"}}" autocomplete="off" autofocus required>
</div> </div>
</div>
</div>
<button class="ui green button">{{$.locale.Tr "repo.settings.add_team"}}</button> <button class="ui green button">{{$.locale.Tr "repo.settings.add_team"}}</button>
</form> </form>
{{else}} {{else}}

View File

@ -12,7 +12,7 @@
<div class="item truncated-item-container"> <div class="item truncated-item-container">
<span class="text {{if .IsActive}}green{{else}}grey{{end}} gt-mr-3">{{svg "octicon-dot-fill" 22}}</span> <span class="text {{if .IsActive}}green{{else}}grey{{end}} gt-mr-3">{{svg "octicon-dot-fill" 22}}</span>
<span class="text truncate gt-f1 gt-mr-3">{{.Name}}</span> <span class="text truncate gt-f1 gt-mr-3">{{.Name}}</span>
<a class="muted gt-float-right gt-p-3" href="{{$.RepoLink}}/settings/hooks/git/{{.Name|PathEscape}}"> <a class="muted ui right gt-p-3" href="{{$.RepoLink}}/settings/hooks/git/{{.Name|PathEscape}}">
{{svg "octicon-pencil"}} {{svg "octicon-pencil"}}
</a> </a>
</div> </div>

View File

@ -11,19 +11,19 @@
<div class="ui list"> <div class="ui list">
{{range .History}} {{range .History}}
<div class="item"> <div class="item">
<div class="flex-text-block gt-sb"> <div class="meta">
<div class="flex-text-inline">
{{if .IsSucceed}} {{if .IsSucceed}}
<span class="text green">{{svg "octicon-check"}}</span> <span class="text green">{{svg "octicon-check"}}</span>
{{else}} {{else}}
<span class="text red">{{svg "octicon-alert"}}</span> <span class="text red">{{svg "octicon-alert"}}</span>
{{end}} {{end}}
<a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a> <a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a>
</div> <div class="ui right">
<span class="text grey"> <span class="text grey time">
{{TimeSince .Delivered.AsTime $.locale}} {{TimeSince .Delivered.AsTime $.locale}}
</span> </span>
</div> </div>
</div>
<div class="info gt-hidden" id="info-{{.ID}}"> <div class="info gt-hidden" id="info-{{.ID}}">
<div class="ui top attached tabular menu"> <div class="ui top attached tabular menu">
<a class="item active" data-tab="request-{{.ID}}">{{$.locale.Tr "repo.settings.webhook.request"}}</a> <a class="item active" data-tab="request-{{.ID}}">{{$.locale.Tr "repo.settings.webhook.request"}}</a>

View File

@ -3,10 +3,12 @@
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
{{template "base/alert" .}} {{template "base/alert" .}}
<div class="ui header flex-text-block gt-sb"> <div class="ui header">
{{.locale.Tr "repo.wiki.new_page"}} {{.locale.Tr "repo.wiki.new_page"}}
{{if .PageIsWikiEdit}} {{if .PageIsWikiEdit}}
<div class="ui right gt-mb-3">
<a class="ui green tiny button" href="{{.RepoLink}}/wiki?action=_new">{{.locale.Tr "repo.wiki.new_page_button"}}</a> <a class="ui green tiny button" href="{{.RepoLink}}/wiki?action=_new">{{.locale.Tr "repo.wiki.new_page_button"}}</a>
</div>
{{end}} {{end}}
</div> </div>
<form class="ui form" action="{{.Link}}?action={{if .PageIsWikiEdit}}_edit{{else}}_new{{end}}" method="post"> <form class="ui form" action="{{.Link}}?action={{if .PageIsWikiEdit}}_edit{{else}}_new{{end}}" method="post">

View File

@ -79,7 +79,7 @@
{{if .sidebarPresent}} {{if .sidebarPresent}}
<div class="markup wiki-content-sidebar"> <div class="markup wiki-content-sidebar">
{{if and .CanWriteWiki (not .Repository.IsMirror)}} {{if and .CanWriteWiki (not .Repository.IsMirror)}}
<a class="gt-float-right muted" href="{{.RepoLink}}/wiki/_Sidebar?action=_edit" aria-label="{{.locale.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a> <a class="ui right floated muted" href="{{.RepoLink}}/wiki/_Sidebar?action=_edit" aria-label="{{.locale.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a>
{{end}} {{end}}
{{template "repo/unicode_escape_prompt" dict "EscapeStatus" .sidebarEscapeStatus "root" $}} {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .sidebarEscapeStatus "root" $}}
{{.sidebarContent | Safe}} {{.sidebarContent | Safe}}
@ -91,7 +91,7 @@
{{if .footerPresent}} {{if .footerPresent}}
<div class="markup wiki-content-footer"> <div class="markup wiki-content-footer">
{{if and .CanWriteWiki (not .Repository.IsMirror)}} {{if and .CanWriteWiki (not .Repository.IsMirror)}}
<a class="gt-float-right muted" href="{{.RepoLink}}/wiki/_Footer?action=_edit" aria-label="{{.locale.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a> <a class="ui right floated muted" href="{{.RepoLink}}/wiki/_Footer?action=_edit" aria-label="{{.locale.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a>
{{end}} {{end}}
{{template "repo/unicode_escape_prompt" dict "footerEscapeStatus" .sidebarEscapeStatus "root" $}} {{template "repo/unicode_escape_prompt" dict "footerEscapeStatus" .sidebarEscapeStatus "root" $}}
{{.footerContent | Safe}} {{.footerContent | Safe}}

View File

@ -7,29 +7,29 @@
<div class="ui secondary vertical filter menu gt-bg-transparent"> <div class="ui secondary vertical filter menu gt-bg-transparent">
<a class="{{if eq .ViewType "your_repositories"}}active{{end}} item" href="{{.Link}}?type=your_repositories&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}"> <a class="{{if eq .ViewType "your_repositories"}}active{{end}} item" href="{{.Link}}?type=your_repositories&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{.locale.Tr "home.issues.in_your_repos"}} {{.locale.Tr "home.issues.in_your_repos"}}
<strong>{{CountFmt .IssueStats.YourRepositoriesCount}}</strong> <strong class="ui right">{{CountFmt .IssueStats.YourRepositoriesCount}}</strong>
</a> </a>
<a class="{{if eq .ViewType "assigned"}}active{{end}} item" href="{{.Link}}?type=assigned&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}"> <a class="{{if eq .ViewType "assigned"}}active{{end}} item" href="{{.Link}}?type=assigned&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{.locale.Tr "repo.issues.filter_type.assigned_to_you"}} {{.locale.Tr "repo.issues.filter_type.assigned_to_you"}}
<strong>{{CountFmt .IssueStats.AssignCount}}</strong> <strong class="ui right">{{CountFmt .IssueStats.AssignCount}}</strong>
</a> </a>
<a class="{{if eq .ViewType "created_by"}}active{{end}} item" href="{{.Link}}?type=created_by&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}"> <a class="{{if eq .ViewType "created_by"}}active{{end}} item" href="{{.Link}}?type=created_by&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{.locale.Tr "repo.issues.filter_type.created_by_you"}} {{.locale.Tr "repo.issues.filter_type.created_by_you"}}
<strong>{{CountFmt .IssueStats.CreateCount}}</strong> <strong class="ui right">{{CountFmt .IssueStats.CreateCount}}</strong>
</a> </a>
{{if .PageIsPulls}} {{if .PageIsPulls}}
<a class="{{if eq .ViewType "review_requested"}}active{{end}} item" href="{{.Link}}?type=review_requested&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}"> <a class="{{if eq .ViewType "review_requested"}}active{{end}} item" href="{{.Link}}?type=review_requested&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{.locale.Tr "repo.issues.filter_type.review_requested"}} {{.locale.Tr "repo.issues.filter_type.review_requested"}}
<strong>{{CountFmt .IssueStats.ReviewRequestedCount}}</strong> <strong class="ui right">{{CountFmt .IssueStats.ReviewRequestedCount}}</strong>
</a> </a>
<a class="{{if eq .ViewType "reviewed_by"}}active{{end}} item" href="{{.Link}}?type=reviewed_by&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}"> <a class="{{if eq .ViewType "reviewed_by"}}active{{end}} item" href="{{.Link}}?type=reviewed_by&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{.locale.Tr "repo.issues.filter_type.reviewed_by_you"}} {{.locale.Tr "repo.issues.filter_type.reviewed_by_you"}}
<strong>{{CountFmt .IssueStats.ReviewedCount}}</strong> <strong class="ui right">{{CountFmt .IssueStats.ReviewedCount}}</strong>
</a> </a>
{{end}} {{end}}
<a class="{{if eq .ViewType "mentioned"}}active{{end}} item" href="{{.Link}}?type=mentioned&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}"> <a class="{{if eq .ViewType "mentioned"}}active{{end}} item" href="{{.Link}}?type=mentioned&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{.locale.Tr "repo.issues.filter_type.mentioning_you"}} {{.locale.Tr "repo.issues.filter_type.mentioning_you"}}
<strong>{{CountFmt .IssueStats.MentionCount}}</strong> <strong class="ui right">{{CountFmt .IssueStats.MentionCount}}</strong>
</a> </a>
<div class="divider"></div> <div class="divider"></div>
<a class="{{if not $.RepoIDs}}active{{end}} repo name item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&q={{$.Keyword}}"> <a class="{{if not $.RepoIDs}}active{{end}} repo name item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&q={{$.Keyword}}">

View File

@ -7,7 +7,7 @@
<div class="ui secondary vertical filter menu gt-bg-transparent"> <div class="ui secondary vertical filter menu gt-bg-transparent">
<div class="item"> <div class="item">
{{.locale.Tr "home.issues.in_your_repos"}} {{.locale.Tr "home.issues.in_your_repos"}}
<strong>{{.Total}}</strong> <strong class="ui right">{{.Total}}</strong>
</div> </div>
<div class="divider"></div> <div class="divider"></div>
{{range .Repos}} {{range .Repos}}

View File

@ -32,7 +32,7 @@
{{else}} {{else}}
<span class="icon gt-dib gt-pt-3">{{svg "octicon-file-directory-fill"}}</span> <span class="icon gt-dib gt-pt-3">{{svg "octicon-file-directory-fill"}}</span>
<span class="name gt-dib gt-pt-3">{{$.ContextUser.Name}}/{{$dir}}</span> <span class="name gt-dib gt-pt-3">{{$.ContextUser.Name}}/{{$dir}}</span>
<div class="gt-float-right"> <div class="ui right">
{{if $.allowAdopt}} {{if $.allowAdopt}}
<button class="ui button green show-modal gt-p-3" data-modal="#adopt-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-plus"}}</span><span class="label">{{$.locale.Tr "repo.adopt_preexisting_label"}}</span></button> <button class="ui button green show-modal gt-p-3" data-modal="#adopt-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-plus"}}</span><span class="label">{{$.locale.Tr "repo.adopt_preexisting_label"}}</span></button>
<div class="ui g-modal-confirm modal" id="adopt-unadopted-modal-{{$dirI}}"> <div class="ui g-modal-confirm modal" id="adopt-unadopted-modal-{{$dirI}}">

View File

@ -1175,8 +1175,14 @@ img.ui.avatar,
color: var(--color-gold) !important; color: var(--color-gold) !important;
} }
.text.small { /* FIXME: this is a serious pollution, do not use this for "float: left" anymore */
font-size: 0.75em; .ui.left:not(.action) {
float: left;
}
/* FIXME: this is a serious pollution, do not use this for "float: right" anymore */
.ui.right:not(.action) {
float: right;
} }
.ui.form .ui.button { .ui.form .ui.button {
@ -1251,6 +1257,10 @@ img.ui.avatar,
text-align: right !important; text-align: right !important;
} }
.ui .text.small {
font-size: 0.75em;
}
.ui .text.normal { .ui .text.normal {
font-weight: var(--font-weight-normal); font-weight: var(--font-weight-normal);
} }

View File

@ -1907,6 +1907,24 @@
flex-wrap: wrap; flex-wrap: wrap;
} }
.repository.settings.collaboration #repo-collab-form #search-user-box .results {
left: 7px;
}
.repository.settings.collaboration #repo-collab-form .ui.button {
margin-left: 5px;
margin-top: -3px;
}
.repository.settings.collaboration #repo-collab-team-form #search-team-box .results {
left: 7px;
}
.repository.settings.collaboration #repo-collab-team-form .ui.button {
margin-left: 5px;
margin-top: -3px;
}
/* if the element is for a checkbox, then it should have a padding-left to align to the checkbox's text */ /* if the element is for a checkbox, then it should have a padding-left to align to the checkbox's text */
.repository.settings.branches .branch-protection .ui.checkbox .help, .repository.settings.branches .branch-protection .ui.checkbox .help,
.repository.settings.branches .branch-protection .checkbox-sub-item { .repository.settings.branches .branch-protection .checkbox-sub-item {

View File

@ -126,8 +126,12 @@
} }
} }
.repository.new.release .field .wrap_remove {
height: 38px;
}
.repository.new.release .field .attachment_edit { .repository.new.release .field .attachment_edit {
max-width: 48em; width: 450px !important;
} }
.repository.new.release .markup { .repository.new.release .markup {

View File

@ -19372,3 +19372,138 @@ input::selection {
/******************************* /*******************************
Site Overrides Site Overrides
*******************************/ *******************************/
/*!
* # Fomantic-UI - Text
* http://github.com/fomantic/Fomantic-UI/
*
*
* Released under the MIT license
* https://github.com/fomantic/Fomantic-UI/blob/master/LICENSE.md
*
*/
/*******************************
Text
*******************************/
span.ui.text {
line-height: 1;
}
span.ui.primary.text {
color: #2185D0;
}
span.ui.secondary.text {
color: #1B1C1D;
}
span.ui.red.text {
color: #DB2828;
}
span.ui.orange.text {
color: #F2711C;
}
span.ui.yellow.text {
color: #FBBD08;
}
span.ui.olive.text {
color: #B5CC18;
}
span.ui.green.text {
color: #21BA45;
}
span.ui.teal.text {
color: #00B5AD;
}
span.ui.blue.text {
color: #2185D0;
}
span.ui.violet.text {
color: #6435C9;
}
span.ui.purple.text {
color: #A333C8;
}
span.ui.pink.text {
color: #E03997;
}
span.ui.brown.text {
color: #A5673F;
}
span.ui.grey.text {
color: #767676;
}
span.ui.black.text {
color: #1B1C1D;
}
span.ui.error.text {
color: #DB2828;
}
span.ui.info.text {
color: #31CCEC;
}
span.ui.success.text {
color: #21BA45;
}
span.ui.warning.text {
color: #F2C037;
}
span.ui.disabled.text {
opacity: var(--opacity-disabled);
}
/* Sizes */
span.ui.medium.text {
font-size: 1em;
}
span.ui.mini.text {
font-size: 0.4em;
}
span.ui.tiny.text {
font-size: 0.5em;
}
span.ui.small.text {
font-size: 0.75em;
}
span.ui.large.text {
font-size: 1.5em;
}
span.ui.big.text {
font-size: 2em;
}
span.ui.huge.text {
font-size: 4em;
}
span.ui.massive.text {
font-size: 8em;
}
/*******************************
Theme Overrides
*******************************/

View File

@ -40,6 +40,7 @@
"segment", "segment",
"site", "site",
"tab", "tab",
"table" "table",
"text"
] ]
} }

View File

@ -1,9 +1,11 @@
import {joinPaths} from './utils.js';
// DO NOT IMPORT window.config HERE! // DO NOT IMPORT window.config HERE!
// to make sure the error handler always works, we should never import `window.config`, because some user's custom template breaks it. // to make sure the error handler always works, we should never import `window.config`, because some user's custom template breaks it.
// This sets up the URL prefix used in webpack's chunk loading. // This sets up the URL prefix used in webpack's chunk loading.
// This file must be imported before any lazy-loading is being attempted. // This file must be imported before any lazy-loading is being attempted.
__webpack_public_path__ = `${window.config?.assetUrlPrefix ?? '/assets'}/`; __webpack_public_path__ = joinPaths(window?.config?.assetUrlPrefix ?? '/', '/');
export function showGlobalErrorMessage(msg) { export function showGlobalErrorMessage(msg) {
const pageContent = document.querySelector('.page-content'); const pageContent = document.querySelector('.page-content');

View File

@ -15,7 +15,7 @@
</a> </a>
</h4> </h4>
<div class="ui attached segment repos-search"> <div class="ui attached segment repos-search">
<div class="ui fluid action left icon input" :class="{loading: isLoading}"> <div class="ui fluid right action left icon input" :class="{loading: isLoading}">
<input type="search" spellcheck="false" maxlength="255" @input="changeReposFilter(reposFilter)" v-model="searchQuery" ref="search" @keydown="reposFilterKeyControl" :placeholder="textSearchRepos"> <input type="search" spellcheck="false" maxlength="255" @input="changeReposFilter(reposFilter)" v-model="searchQuery" ref="search" @keydown="reposFilterKeyControl" :placeholder="textSearchRepos">
<i class="icon"><svg-icon name="octicon-search" :size="16"/></i> <i class="icon"><svg-icon name="octicon-search" :size="16"/></i>
<div class="ui dropdown icon button" :title="textFilter"> <div class="ui dropdown icon button" :title="textFilter">

View File

@ -33,7 +33,7 @@
<div class="ui label" v-if="item.name===defaultBranch && mode === 'branches'"> <div class="ui label" v-if="item.name===defaultBranch && mode === 'branches'">
{{ textDefaultBranchLabel }} {{ textDefaultBranchLabel }}
</div> </div>
<a v-show="enableFeed && mode === 'branches'" role="button" class="rss-icon gt-float-right" :href="rssURLPrefix + item.url" target="_blank" @click.stop> <a v-show="enableFeed && mode === 'branches'" role="button" class="rss-icon ui compact right" :href="rssURLPrefix + item.url" target="_blank" @click.stop>
<!-- creating a lot of Vue component is pretty slow, so we use a static SVG here --> <!-- creating a lot of Vue component is pretty slow, so we use a static SVG here -->
<svg width="14" height="14" class="svg octicon-rss"><use href="#svg-symbol-octicon-rss"/></svg> <svg width="14" height="14" class="svg octicon-rss"><use href="#svg-symbol-octicon-rss"/></svg>
</a> </a>

View File

@ -11,6 +11,16 @@ export function extname(path = '') {
return ext || ''; return ext || '';
} }
// join a list of path segments with slashes, ensuring no double slashes
export function joinPaths(...parts) {
let str = '';
for (const part of parts) {
if (!part) continue;
str = !str ? part : `${str.replace(/\/$/, '')}/${part.replace(/^\//, '')}`;
}
return str;
}
// test whether a variable is an object // test whether a variable is an object
export function isObject(obj) { export function isObject(obj) {
return Object.prototype.toString.call(obj) === '[object Object]'; return Object.prototype.toString.call(obj) === '[object Object]';

View File

@ -1,6 +1,6 @@
import {expect, test} from 'vitest'; import {expect, test} from 'vitest';
import { import {
basename, extname, isObject, stripTags, parseIssueHref, basename, extname, isObject, stripTags, joinPaths, parseIssueHref,
parseUrl, translateMonth, translateDay, blobToDataURI, parseUrl, translateMonth, translateDay, blobToDataURI,
toAbsoluteUrl, encodeURLEncodedBase64, decodeURLEncodedBase64, toAbsoluteUrl, encodeURLEncodedBase64, decodeURLEncodedBase64,
} from './utils.js'; } from './utils.js';
@ -18,6 +18,45 @@ test('extname', () => {
expect(extname('file.js')).toEqual('.js'); expect(extname('file.js')).toEqual('.js');
}); });
test('joinPaths', () => {
expect(joinPaths('', '')).toEqual('');
expect(joinPaths('', 'b')).toEqual('b');
expect(joinPaths('', '/b')).toEqual('/b');
expect(joinPaths('', '/b/')).toEqual('/b/');
expect(joinPaths('a', '')).toEqual('a');
expect(joinPaths('/a', '')).toEqual('/a');
expect(joinPaths('/a/', '')).toEqual('/a/');
expect(joinPaths('a', 'b')).toEqual('a/b');
expect(joinPaths('a', '/b')).toEqual('a/b');
expect(joinPaths('/a', '/b')).toEqual('/a/b');
expect(joinPaths('/a', '/b')).toEqual('/a/b');
expect(joinPaths('/a/', '/b')).toEqual('/a/b');
expect(joinPaths('/a', '/b/')).toEqual('/a/b/');
expect(joinPaths('/a/', '/b/')).toEqual('/a/b/');
expect(joinPaths('', '', '')).toEqual('');
expect(joinPaths('', 'b', '')).toEqual('b');
expect(joinPaths('', 'b', 'c')).toEqual('b/c');
expect(joinPaths('', '', 'c')).toEqual('c');
expect(joinPaths('', '/b', '/c')).toEqual('/b/c');
expect(joinPaths('/a', '', '/c')).toEqual('/a/c');
expect(joinPaths('/a', '/b', '')).toEqual('/a/b');
expect(joinPaths('', '/')).toEqual('/');
expect(joinPaths('a', '/')).toEqual('a/');
expect(joinPaths('', '/', '/')).toEqual('/');
expect(joinPaths('/', '/')).toEqual('/');
expect(joinPaths('/', '')).toEqual('/');
expect(joinPaths('/', 'b')).toEqual('/b');
expect(joinPaths('/', 'b/')).toEqual('/b/');
expect(joinPaths('/', '', '/')).toEqual('/');
expect(joinPaths('/', 'b', '/')).toEqual('/b/');
expect(joinPaths('/', 'b/', '/')).toEqual('/b/');
expect(joinPaths('a', '/', '/')).toEqual('a/');
expect(joinPaths('/', '/', 'c')).toEqual('/c');
expect(joinPaths('/', '/', 'c/')).toEqual('/c/');
});
test('isObject', () => { test('isObject', () => {
expect(isObject({})).toBeTruthy(); expect(isObject({})).toBeTruthy();
expect(isObject([])).toBeFalsy(); expect(isObject([])).toBeFalsy();