Skip to content

Commit

Permalink
Merge remote-tracking branch 'giteaofficial/main'
Browse files Browse the repository at this point in the history
* giteaofficial/main:
  Add a new menu in file view to open blame view and fix blame view select range bug (go-gitea#19500)
  Fix two UI bugs: JS error in imagediff.js, 500 error in diff/compare.tmpl
  [skip ci] Updated translations via Crowdin
  Improve Stopwatch behavior (go-gitea#18930)
  Pass gitRepo down to GetRawDiff, since its used for main repo and wiki (go-gitea#19461)
  Use queue instead of memory queue in webhook send service (go-gitea#19390)
  add a directory prefix `gitea-src-VERSION` to release-tar-file (go-gitea#19396)
  • Loading branch information
zjjhot committed Apr 26, 2022
2 parents 430a8fa + 03eba32 commit d589df5
Show file tree
Hide file tree
Showing 49 changed files with 331 additions and 233 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,9 @@ release-sources: | $(DIST_DIRS)
echo $(VERSION) > $(STORED_VERSION_FILE)
# bsdtar needs a ^ to prevent matching subdirectories
$(eval EXCL := --exclude=$(shell tar --help | grep -q bsdtar && echo "^")./)
tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
# use transform to a add a release-folder prefix; in bsdtar the transform parameter equivalent is -s
$(eval TRANSFORM := $(shell tar --help | grep -q bsdtar && echo "-s '/^./gitea-src-$(VERSION)/'" || echo "--transform 's|^./|gitea-src-$(VERSION)/|'"))
tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) $(TRANSFORM) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
rm -f $(STORED_VERSION_FILE)

.PHONY: release-docs
Expand Down
32 changes: 32 additions & 0 deletions models/issue_stopwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,38 @@ func getStopwatch(ctx context.Context, userID, issueID int64) (sw *Stopwatch, ex
return
}

// UserIDCount is a simple coalition of UserID and Count
type UserStopwatch struct {
UserID int64
StopWatches []*Stopwatch
}

// GetUIDsAndNotificationCounts between the two provided times
func GetUIDsAndStopwatch() ([]*UserStopwatch, error) {
sws := []*Stopwatch{}
if err := db.GetEngine(db.DefaultContext).Find(&sws); err != nil {
return nil, err
}
if len(sws) == 0 {
return []*UserStopwatch{}, nil
}

lastUserID := int64(-1)
res := []*UserStopwatch{}
for _, sw := range sws {
if lastUserID == sw.UserID {
lastUserStopwatch := res[len(res)-1]
lastUserStopwatch.StopWatches = append(lastUserStopwatch.StopWatches, sw)
} else {
res = append(res, &UserStopwatch{
UserID: sw.UserID,
StopWatches: []*Stopwatch{sw},
})
}
}
return res, nil
}

// GetUserStopwatches return list of all stopwatches of a user
func GetUserStopwatches(userID int64, listOptions db.ListOptions) ([]*Stopwatch, error) {
sws := make([]*Stopwatch, 0, 8)
Expand Down
27 changes: 27 additions & 0 deletions modules/eventsource/manager_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
"time"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting"
Expand Down Expand Up @@ -80,6 +82,31 @@ loop:
})
}
then = now

if setting.Service.EnableTimetracking {
usersStopwatches, err := models.GetUIDsAndStopwatch()
if err != nil {
log.Error("Unable to get GetUIDsAndStopwatch: %v", err)
return
}

for _, userStopwatches := range usersStopwatches {
apiSWs, err := convert.ToStopWatches(userStopwatches.StopWatches)
if err != nil {
log.Error("Unable to APIFormat stopwatches: %v", err)
continue
}
dataBs, err := json.Marshal(apiSWs)
if err != nil {
log.Error("Unable to marshal stopwatches: %v", err)
continue
}
m.SendMessage(userStopwatches.UserID, &Event{
Name: "stopwatches",
Data: string(dataBs),
})
}
}
}
}
m.UnregisterAll()
Expand Down
15 changes: 2 additions & 13 deletions modules/git/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const (
)

// GetRawDiff dumps diff results of repository in given commit ID to io.Writer.
func GetRawDiff(ctx context.Context, repoPath, commitID string, diffType RawDiffType, writer io.Writer) error {
return GetRawDiffForFile(ctx, repoPath, "", commitID, diffType, "", writer)
func GetRawDiff(repo *Repository, commitID string, diffType RawDiffType, writer io.Writer) error {
return GetRepoRawDiffForFile(repo, "", commitID, diffType, "", writer)
}

// GetReverseRawDiff dumps the reverse diff results of repository in given commit ID to io.Writer.
Expand All @@ -46,17 +46,6 @@ func GetReverseRawDiff(ctx context.Context, repoPath, commitID string, writer io
return nil
}

// GetRawDiffForFile dumps diff results of file in given commit ID to io.Writer.
func GetRawDiffForFile(ctx context.Context, repoPath, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error {
repo, closer, err := RepositoryFromContextOrOpen(ctx, repoPath)
if err != nil {
return fmt.Errorf("RepositoryFromContextOrOpen: %v", err)
}
defer closer.Close()

return GetRepoRawDiffForFile(repo, startCommit, endCommit, diffType, file, writer)
}

// GetRepoRawDiffForFile dumps diff results of file in given commit ID to io.Writer according given repository
func GetRepoRawDiffForFile(repo *Repository, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error {
commit, err := repo.GetCommit(endCommit)
Expand Down
104 changes: 0 additions & 104 deletions modules/sync/unique_queue.go

This file was deleted.

1 change: 1 addition & 0 deletions options/locale/locale_bg-BG.ini
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ loading=Зареждане…
error404=Страницата, която се опитвате да достъпите, <strong>не съществува</strong> или <strong>не сте оторизирани</strong> да я достъпите.



[error]

[startpage]
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_cs-CZ.ini
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ error404=Stránka, kterou se snažíte zobrazit, buď <strong>neexistuje</strong

never=Nikdy


[error]
missing_csrf=Špatný požadavek: Neexistuje CSRF token

Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_de-DE.ini
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ error404=Die Seite, die du gerade versuchst aufzurufen, <strong>existiert entwed

never=Niemals


[error]
occurred=Ein Fehler ist aufgetreten
report_message=Wenn du dir sicher bist, dass dies ein Fehler von Gitea ist, suche bitte auf <a href="https://github.com/go-gitea/gitea/issues">GitHub</a> nach diesem Fehler und erstelle gegebenenfalls ein neues Issue.
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_el-GR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ error404=Η σελίδα που προσπαθείτε να φτάσετε εί

never=Ποτέ


[error]
occurred=Παρουσιάστηκε ένα σφάλμα
report_message=Αν είστε σίγουροι ότι πρόκειται για ένα πρόβλημα στο Gitea, παρακαλώ αναζητήστε στα ζητήματα στο <a href="https://github.com/go-gitea/gitea/issues" target="_blank">GitHub</a> ή ανοίξτε ένα νέο ζήτημα εάν είναι απαραίτητο.
Expand Down
3 changes: 2 additions & 1 deletion options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ line_unicode = `This line has hidden unicode characters`
escape_control_characters = Escape
unescape_control_characters = Unescape
file_copy_permalink = Copy Permalink
view_git_blame = View Git Blame
video_not_supported_in_browser = Your browser does not support the HTML5 'video' tag.
audio_not_supported_in_browser = Your browser does not support the HTML5 'audio' tag.
stored_lfs = Stored with Git LFS
Expand Down Expand Up @@ -3088,7 +3089,7 @@ settings.link = Link this package to a repository
settings.link.description = If you link a package with a repository, the package is listed in the repository's package list.
settings.link.select = Select Repository
settings.link.button = Update Repository Link
settings.link.success = Repository link was successfully updated.
settings.link.success = Repository link was successfully updated.
settings.link.error = Failed to update repository link.
settings.delete = Delete package
settings.delete.description = Deleting a package is permanent and cannot be undone.
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_es-ES.ini
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ error404=La página a la que está intentando acceder o <strong>no existe</stron

never=Nunca


[error]
occurred=Ha ocurrido un error
report_message=Si estás seguro de que este es un error de Gitea, por favor busca un problema en <a href="https://github.com/go-gitea/gitea/issues" target="_blank">GitHub</a> y abre un nuevo problema si es necesario.
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_fa-IR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ error404=صفحه موردنظر شما یا <strong>وجود ندارد</strong

never=هرگز


[error]
missing_csrf=درخواست بد: بلیط CSRF ندارد

Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_fi-FI.ini
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ loading=Ladataan…
error404=Sivu, jota yrität nähdä, joko <strong>ei löydy</strong> tai <strong>et ole oikeutettu</strong> katsomaan sitä.



[error]

[startpage]
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_fr-FR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ error404=La page que vous essayez d'atteindre <strong>n'existe pas</strong> ou <

never=Jamais


[error]
missing_csrf=Requête incorrecte: aucun jeton CSRF présent

Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_hu-HU.ini
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ step2=2. lépés:
error404=Az elérni kívánt oldal vagy <strong>nem létezik</strong>, vagy <strong>nincs jogosultsága</strong> a megtekintéséhez.



[error]

[startpage]
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_id-ID.ini
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ loading=Memuat…




[error]

[startpage]
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_is-IS.ini
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ error404=Síðan sem þú ert að reyna að fá annað hvort <strong>er ekki til

never=Aldrei


[error]
occurred=Villa kom upp
report_message=Ef þú ert viss um að þetta sé villa í Gitea þá skaltu leita að vandamálum á <a href="https://github.com/go-gitea/gitea/issues" target="_blank">GitHub</a> eða opna nýtt vandamál ef þörf krefst.
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_it-IT.ini
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ step2=Passo 2:
error404=La pagina che stai cercando di raggiungere <strong>non esiste</strong> oppure <strong>non sei autorizzato</strong> a visualizzarla.
[error]
[startpage]
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_ja-JP.ini
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ error404=アクセスしようとしたページは<strong>存在しない</stro

never=無し


[error]
occurred=エラーが発生しました.
report_message=Gitea のバグが疑われる場合は、<a href="https://github.com/go-gitea/gitea/issues" target="_blank">GitHub</a>でIssueを検索して、見つからなければ新しいIssueを作成してください。
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_ko-KR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ loading=불러오는 중...




[error]

[startpage]
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_lv-LV.ini
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ error404=Lapa, ko vēlaties atvērt, <strong>neeksistē</strong> vai arī <stron

never=Nekad


[error]
occurred=Radusies kļūda
report_message=Ja esat pārliecināts, ka šī ir Gitea kļūda, pārbaudiet, ka tā jau nav zināma meklējot <a href="https://github.com/go-gitea/gitea/issues" target="_blank">GitHub</a> vai ziņojiet par jaunu kļūdu, ja nepieciešams.
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_ml-IN.ini
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ loading=ലഭ്യമാക്കുന്നു…




[error]

[startpage]
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_nl-NL.ini
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ error404=De pagina die u probeert te bereiken <strong>bestaat niet</strong> of <

never=Nooit


[error]
missing_csrf=Foutief verzoek: geen CSRF-token aanwezig

Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_pl-PL.ini
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ error404=Strona, do której próbujesz dotrzeć <strong>nie istnieje</strong> lu

never=Nigdy


[error]
occurred=Wystąpił błąd
report_message=Jeśli jesteś pewien, że jest to błąd Gitea, poszukaj już istniejącego zgłoszenia na <a href="https://github.com/go-gitea/gitea/issues" target="_blank">GitHub</a> lub w razie potrzeby otwórz nowy problem.
Expand Down
Loading

0 comments on commit d589df5

Please sign in to comment.