Skip to content

Commit d589df5

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* 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)
2 parents 430a8fa + 03eba32 commit d589df5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+331
-233
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,9 @@ release-sources: | $(DIST_DIRS)
646646
echo $(VERSION) > $(STORED_VERSION_FILE)
647647
# bsdtar needs a ^ to prevent matching subdirectories
648648
$(eval EXCL := --exclude=$(shell tar --help | grep -q bsdtar && echo "^")./)
649-
tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
649+
# use transform to a add a release-folder prefix; in bsdtar the transform parameter equivalent is -s
650+
$(eval TRANSFORM := $(shell tar --help | grep -q bsdtar && echo "-s '/^./gitea-src-$(VERSION)/'" || echo "--transform 's|^./|gitea-src-$(VERSION)/|'"))
651+
tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) $(TRANSFORM) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
650652
rm -f $(STORED_VERSION_FILE)
651653

652654
.PHONY: release-docs

models/issue_stopwatch.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,38 @@ func getStopwatch(ctx context.Context, userID, issueID int64) (sw *Stopwatch, ex
6666
return
6767
}
6868

69+
// UserIDCount is a simple coalition of UserID and Count
70+
type UserStopwatch struct {
71+
UserID int64
72+
StopWatches []*Stopwatch
73+
}
74+
75+
// GetUIDsAndNotificationCounts between the two provided times
76+
func GetUIDsAndStopwatch() ([]*UserStopwatch, error) {
77+
sws := []*Stopwatch{}
78+
if err := db.GetEngine(db.DefaultContext).Find(&sws); err != nil {
79+
return nil, err
80+
}
81+
if len(sws) == 0 {
82+
return []*UserStopwatch{}, nil
83+
}
84+
85+
lastUserID := int64(-1)
86+
res := []*UserStopwatch{}
87+
for _, sw := range sws {
88+
if lastUserID == sw.UserID {
89+
lastUserStopwatch := res[len(res)-1]
90+
lastUserStopwatch.StopWatches = append(lastUserStopwatch.StopWatches, sw)
91+
} else {
92+
res = append(res, &UserStopwatch{
93+
UserID: sw.UserID,
94+
StopWatches: []*Stopwatch{sw},
95+
})
96+
}
97+
}
98+
return res, nil
99+
}
100+
69101
// GetUserStopwatches return list of all stopwatches of a user
70102
func GetUserStopwatches(userID int64, listOptions db.ListOptions) ([]*Stopwatch, error) {
71103
sws := make([]*Stopwatch, 0, 8)

modules/eventsource/manager_run.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import (
99
"time"
1010

1111
"code.gitea.io/gitea/models"
12+
"code.gitea.io/gitea/modules/convert"
1213
"code.gitea.io/gitea/modules/graceful"
14+
"code.gitea.io/gitea/modules/json"
1315
"code.gitea.io/gitea/modules/log"
1416
"code.gitea.io/gitea/modules/process"
1517
"code.gitea.io/gitea/modules/setting"
@@ -80,6 +82,31 @@ loop:
8082
})
8183
}
8284
then = now
85+
86+
if setting.Service.EnableTimetracking {
87+
usersStopwatches, err := models.GetUIDsAndStopwatch()
88+
if err != nil {
89+
log.Error("Unable to get GetUIDsAndStopwatch: %v", err)
90+
return
91+
}
92+
93+
for _, userStopwatches := range usersStopwatches {
94+
apiSWs, err := convert.ToStopWatches(userStopwatches.StopWatches)
95+
if err != nil {
96+
log.Error("Unable to APIFormat stopwatches: %v", err)
97+
continue
98+
}
99+
dataBs, err := json.Marshal(apiSWs)
100+
if err != nil {
101+
log.Error("Unable to marshal stopwatches: %v", err)
102+
continue
103+
}
104+
m.SendMessage(userStopwatches.UserID, &Event{
105+
Name: "stopwatches",
106+
Data: string(dataBs),
107+
})
108+
}
109+
}
83110
}
84111
}
85112
m.UnregisterAll()

modules/git/diff.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const (
2828
)
2929

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

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

49-
// GetRawDiffForFile dumps diff results of file in given commit ID to io.Writer.
50-
func GetRawDiffForFile(ctx context.Context, repoPath, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error {
51-
repo, closer, err := RepositoryFromContextOrOpen(ctx, repoPath)
52-
if err != nil {
53-
return fmt.Errorf("RepositoryFromContextOrOpen: %v", err)
54-
}
55-
defer closer.Close()
56-
57-
return GetRepoRawDiffForFile(repo, startCommit, endCommit, diffType, file, writer)
58-
}
59-
6049
// GetRepoRawDiffForFile dumps diff results of file in given commit ID to io.Writer according given repository
6150
func GetRepoRawDiffForFile(repo *Repository, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error {
6251
commit, err := repo.GetCommit(endCommit)

modules/sync/unique_queue.go

Lines changed: 0 additions & 104 deletions
This file was deleted.

options/locale/locale_bg-BG.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ loading=Зареждане…
7272
error404=Страницата, която се опитвате да достъпите, <strong>не съществува</strong> или <strong>не сте оторизирани</strong> да я достъпите.
7373

7474

75+
7576
[error]
7677

7778
[startpage]

options/locale/locale_cs-CZ.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ error404=Stránka, kterou se snažíte zobrazit, buď <strong>neexistuje</strong
8686

8787
never=Nikdy
8888

89+
8990
[error]
9091
missing_csrf=Špatný požadavek: Neexistuje CSRF token
9192

options/locale/locale_de-DE.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ error404=Die Seite, die du gerade versuchst aufzurufen, <strong>existiert entwed
103103

104104
never=Niemals
105105

106+
106107
[error]
107108
occurred=Ein Fehler ist aufgetreten
108109
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.

options/locale/locale_el-GR.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ error404=Η σελίδα που προσπαθείτε να φτάσετε εί
105105

106106
never=Ποτέ
107107

108+
108109
[error]
109110
occurred=Παρουσιάστηκε ένα σφάλμα
110111
report_message=Αν είστε σίγουροι ότι πρόκειται για ένα πρόβλημα στο Gitea, παρακαλώ αναζητήστε στα ζητήματα στο <a href="https://github.com/go-gitea/gitea/issues" target="_blank">GitHub</a> ή ανοίξτε ένα νέο ζήτημα εάν είναι απαραίτητο.

options/locale/locale_en-US.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,7 @@ line_unicode = `This line has hidden unicode characters`
10411041
escape_control_characters = Escape
10421042
unescape_control_characters = Unescape
10431043
file_copy_permalink = Copy Permalink
1044+
view_git_blame = View Git Blame
10441045
video_not_supported_in_browser = Your browser does not support the HTML5 'video' tag.
10451046
audio_not_supported_in_browser = Your browser does not support the HTML5 'audio' tag.
10461047
stored_lfs = Stored with Git LFS
@@ -3088,7 +3089,7 @@ settings.link = Link this package to a repository
30883089
settings.link.description = If you link a package with a repository, the package is listed in the repository's package list.
30893090
settings.link.select = Select Repository
30903091
settings.link.button = Update Repository Link
3091-
settings.link.success = Repository link was successfully updated.
3092+
settings.link.success = Repository link was successfully updated.
30923093
settings.link.error = Failed to update repository link.
30933094
settings.delete = Delete package
30943095
settings.delete.description = Deleting a package is permanent and cannot be undone.

0 commit comments

Comments
 (0)