Skip to content

Commit e166d49

Browse files
authored
Merge branch 'master' into oauth2-auto-register
2 parents 7b2ff29 + b56c19d commit e166d49

Some content is hidden

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

72 files changed

+592
-113
lines changed

‎.github/issue_template.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
<!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini -->
3131

3232
## Description
33+
<!-- If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please
34+
disable the proxy/CDN fully and connect to gitea directly to confirm
35+
the issue still persists without those services. -->
3336

3437
...
3538

‎Makefile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,6 @@ release-windows: | $(DIST_DIRS)
573573
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
574574
GO111MODULE=off $(GO) get -u src.techknowlogick.com/xgo; \
575575
fi
576-
@echo "Warning: windows version is built using golang 1.14"
577576
CGO_CFLAGS="$(CGO_CFLAGS)" GO111MODULE=off xgo -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
578577
ifeq ($(CI),drone)
579578
cp /build/* $(DIST)/binaries
@@ -709,7 +708,7 @@ pr\#%: clean-all
709708
golangci-lint:
710709
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
711710
export BINARY="golangci-lint"; \
712-
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.35.2; \
711+
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.37.0; \
713712
fi
714713
golangci-lint run --timeout 10m
715714

‎docs/content/doc/usage/command-line.en-us.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Generates a self-signed SSL certificate. Outputs to `cert.pem` and `key.pem` in
232232
directory and will overwrite any existing files.
233233

234234
- Options:
235-
- `--host value`: Comma seperated hostnames and ips which this certificate is valid for.
235+
- `--host value`: Comma separated hostnames and ips which this certificate is valid for.
236236
Wildcards are supported. Required.
237237
- `--ecdsa-curve value`: ECDSA curve to use to generate a key. Optional. Valid options
238238
are P224, P256, P384, P521.

‎integrations/api_admin_test.go‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,18 @@ func TestAPIEditUser(t *testing.T) {
192192
errMap := make(map[string]interface{})
193193
json.Unmarshal(resp.Body.Bytes(), &errMap)
194194
assert.EqualValues(t, "email is not allowed to be empty string", errMap["message"].(string))
195+
196+
user2 := models.AssertExistsAndLoadBean(t, &models.User{LoginName: "user2"}).(*models.User)
197+
assert.Equal(t, false, user2.IsRestricted)
198+
bTrue := true
199+
req = NewRequestWithJSON(t, "PATCH", urlStr, api.EditUserOption{
200+
// required
201+
LoginName: "user2",
202+
SourceID: 0,
203+
// to change
204+
Restricted: &bTrue,
205+
})
206+
session.MakeRequest(t, req, http.StatusOK)
207+
user2 = models.AssertExistsAndLoadBean(t, &models.User{LoginName: "user2"}).(*models.User)
208+
assert.Equal(t, true, user2.IsRestricted)
195209
}

‎integrations/api_settings_test.go‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ func TestAPIExposedSettings(t *testing.T) {
4343

4444
DecodeJSON(t, resp, &repo)
4545
assert.EqualValues(t, &api.GeneralRepoSettings{
46-
MirrorsDisabled: setting.Repository.DisableMirrors,
47-
HTTPGitDisabled: setting.Repository.DisableHTTPGit,
48-
MigrationsDisabled: setting.Repository.DisableMigrations,
46+
MirrorsDisabled: setting.Repository.DisableMirrors,
47+
HTTPGitDisabled: setting.Repository.DisableHTTPGit,
48+
MigrationsDisabled: setting.Repository.DisableMigrations,
49+
TimeTrackingDisabled: false,
50+
LFSDisabled: !setting.LFS.StartServer,
4951
}, repo)
5052

5153
attachment := new(api.GeneralAttachmentSettings)

‎models/action.go‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,13 @@ func (a *Action) GetIssueContent() string {
289289

290290
// GetFeedsOptions options for retrieving feeds
291291
type GetFeedsOptions struct {
292-
RequestedUser *User // the user we want activity for
293-
RequestedTeam *Team // the team we want activity for
294-
Actor *User // the user viewing the activity
295-
IncludePrivate bool // include private actions
296-
OnlyPerformedBy bool // only actions performed by requested user
297-
IncludeDeleted bool // include deleted actions
292+
RequestedUser *User // the user we want activity for
293+
RequestedTeam *Team // the team we want activity for
294+
Actor *User // the user viewing the activity
295+
IncludePrivate bool // include private actions
296+
OnlyPerformedBy bool // only actions performed by requested user
297+
IncludeDeleted bool // include deleted actions
298+
Date string // the day we want activity for: YYYY-MM-DD
298299
}
299300

300301
// GetFeeds returns actions according to the provided options
@@ -380,5 +381,17 @@ func activityQueryCondition(opts GetFeedsOptions) (builder.Cond, error) {
380381
cond = cond.And(builder.Eq{"is_deleted": false})
381382
}
382383

384+
if opts.Date != "" {
385+
dateLow, err := time.Parse("2006-01-02", opts.Date)
386+
if err != nil {
387+
log.Warn("Unable to parse %s, filter not applied: %v", opts.Date, err)
388+
} else {
389+
dateHigh := dateLow.Add(86399000000000) // 23h59m59s
390+
391+
cond = cond.And(builder.Gte{"created_unix": dateLow.Unix()})
392+
cond = cond.And(builder.Lte{"created_unix": dateHigh.Unix()})
393+
}
394+
}
395+
383396
return cond, nil
384397
}

‎models/action_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestAction_GetRepoLink(t *testing.T) {
2626
repo := AssertExistsAndLoadBean(t, &Repository{}).(*Repository)
2727
owner := AssertExistsAndLoadBean(t, &User{ID: repo.OwnerID}).(*User)
2828
action := &Action{RepoID: repo.ID}
29-
setting.AppSubURL = "/suburl/"
29+
setting.AppSubURL = "/suburl"
3030
expected := path.Join(setting.AppSubURL, owner.Name, repo.Name)
3131
assert.Equal(t, expected, action.GetRepoLink())
3232
}

‎models/issue_comment.go‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ type Comment struct {
136136
MilestoneID int64
137137
OldMilestone *Milestone `xorm:"-"`
138138
Milestone *Milestone `xorm:"-"`
139+
TimeID int64
140+
Time *TrackedTime `xorm:"-"`
139141
AssigneeID int64
140142
RemovedAssignee bool
141143
Assignee *User `xorm:"-"`
@@ -541,6 +543,16 @@ func (c *Comment) LoadDepIssueDetails() (err error) {
541543
return err
542544
}
543545

546+
// LoadTime loads the associated time for a CommentTypeAddTimeManual
547+
func (c *Comment) LoadTime() error {
548+
if c.Time != nil || c.TimeID == 0 {
549+
return nil
550+
}
551+
var err error
552+
c.Time, err = GetTrackedTimeByID(c.TimeID)
553+
return err
554+
}
555+
544556
func (c *Comment) loadReactions(e Engine, repo *Repository) (err error) {
545557
if c.Reactions != nil {
546558
return nil
@@ -692,6 +704,7 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
692704
MilestoneID: opts.MilestoneID,
693705
OldProjectID: opts.OldProjectID,
694706
ProjectID: opts.ProjectID,
707+
TimeID: opts.TimeID,
695708
RemovedAssignee: opts.RemovedAssignee,
696709
AssigneeID: opts.AssigneeID,
697710
AssigneeTeamID: opts.AssigneeTeamID,
@@ -859,6 +872,7 @@ type CreateCommentOptions struct {
859872
MilestoneID int64
860873
OldProjectID int64
861874
ProjectID int64
875+
TimeID int64
862876
AssigneeID int64
863877
AssigneeTeamID int64
864878
RemovedAssignee bool

‎models/issue_stopwatch.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ func CreateOrStopIssueStopwatch(user *User, issue *Issue) error {
100100
Repo: issue.Repo,
101101
Content: SecToTime(timediff),
102102
Type: CommentTypeStopTracking,
103+
TimeID: tt.ID,
103104
}); err != nil {
104105
return err
105106
}

‎models/issue_tracked_time.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ func AddTime(user *User, issue *Issue, amount int64, created time.Time) (*Tracke
162162
Doer: user,
163163
Content: SecToTime(amount),
164164
Type: CommentTypeAddTimeManual,
165+
TimeID: t.ID,
165166
}); err != nil {
166167
return nil, err
167168
}

0 commit comments

Comments
 (0)