chore(deps): update golangci/golangci-lint-action action to v7 (#462)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: kolaente <k@knt.li>
This commit is contained in:
parent
b24058b3e5
commit
4a75f7d4da
|
|
@ -74,9 +74,9 @@ jobs:
|
||||||
mkdir -p frontend/dist
|
mkdir -p frontend/dist
|
||||||
touch frontend/dist/index.html
|
touch frontend/dist/index.html
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6
|
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7
|
||||||
with:
|
with:
|
||||||
version: v1.64.5
|
version: v2.0.0
|
||||||
|
|
||||||
api-check-translations:
|
api-check-translations:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
263
.golangci.yml
263
.golangci.yml
|
|
@ -1,127 +1,160 @@
|
||||||
|
version: "2"
|
||||||
run:
|
run:
|
||||||
timeout: 15m
|
|
||||||
tests: true
|
tests: true
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- gosimple
|
- asasalint
|
||||||
- staticcheck
|
- asciicheck
|
||||||
- unused
|
- bidichk
|
||||||
- govet
|
- bodyclose
|
||||||
|
- contextcheck
|
||||||
|
- err113
|
||||||
|
- errchkjson
|
||||||
|
- errorlint
|
||||||
|
- exhaustive
|
||||||
|
- gocheckcompilerdirectives
|
||||||
|
- gochecksumtype
|
||||||
- gocritic
|
- gocritic
|
||||||
- gocyclo
|
- gocyclo
|
||||||
- err113
|
|
||||||
- goheader
|
- goheader
|
||||||
- gofmt
|
- gosec
|
||||||
- goimports
|
- gosmopolitan
|
||||||
- revive
|
- loggercheck
|
||||||
|
- makezero
|
||||||
- misspell
|
- misspell
|
||||||
|
- nilerr
|
||||||
|
- nilnesserr
|
||||||
|
- noctx
|
||||||
|
- protogetter
|
||||||
|
- reassign
|
||||||
|
- recvcheck
|
||||||
|
- revive
|
||||||
|
- rowserrcheck
|
||||||
|
- spancheck
|
||||||
|
- sqlclosecheck
|
||||||
|
- testifylint
|
||||||
|
- unparam
|
||||||
|
- zerologlint
|
||||||
disable:
|
disable:
|
||||||
- durationcheck
|
- durationcheck
|
||||||
- goconst
|
- goconst
|
||||||
- musttag
|
- musttag
|
||||||
presets:
|
settings:
|
||||||
- bugs
|
goheader:
|
||||||
- unused
|
template-path: code-header-template.txt
|
||||||
fast: false
|
nestif:
|
||||||
|
min-complexity: 6
|
||||||
linters-settings:
|
exclusions:
|
||||||
nestif:
|
generated: lax
|
||||||
min-complexity: 6
|
presets:
|
||||||
goheader:
|
- comments
|
||||||
template-path: code-header-template.txt
|
- common-false-positives
|
||||||
|
- legacy
|
||||||
issues:
|
- std-error-handling
|
||||||
exclude-rules:
|
rules:
|
||||||
# Exclude some linters from running on tests files.
|
- linters:
|
||||||
- path: _test\.go
|
- deadcode
|
||||||
linters:
|
- errorlint
|
||||||
- gocyclo
|
- gocyclo
|
||||||
- deadcode
|
path: _test\.go
|
||||||
- errorlint
|
- linters:
|
||||||
- path: pkg/integrations/*
|
- bodyclose
|
||||||
linters:
|
- deadcode
|
||||||
- gocyclo
|
- gocyclo
|
||||||
- deadcode
|
- unparam
|
||||||
- varcheck
|
- varcheck
|
||||||
- unparam
|
path: pkg/integrations/*
|
||||||
- bodyclose
|
- linters:
|
||||||
- path: pkg/integrations/*
|
- gocritic
|
||||||
text: "unlambda"
|
path: pkg/integrations/*
|
||||||
linters:
|
text: unlambda
|
||||||
- gocritic
|
- linters:
|
||||||
- path: pkg/modules/background/unsplash/unsplash\.go
|
- bodyclose
|
||||||
linters:
|
path: pkg/modules/background/unsplash/unsplash\.go
|
||||||
- bodyclose
|
- linters:
|
||||||
- path: pkg/migration/*
|
- err113
|
||||||
linters:
|
- exhaustive
|
||||||
- exhaustive
|
path: pkg/migration/*
|
||||||
- err113
|
- linters:
|
||||||
- path: pkg/models/task_collection_filter\.go
|
- exhaustive
|
||||||
linters:
|
path: pkg/models/task_collection_filter\.go
|
||||||
- exhaustive
|
- linters:
|
||||||
- path: pkg/utils/random_string\.go
|
- gosec
|
||||||
text: "G404:" # We don't care about cryptographically secure randomness when we're using that utility function.
|
path: pkg/utils/random_string\.go
|
||||||
linters:
|
text: 'G404:' # We don't care about cryptographically secure randomness when we're using that utility function.
|
||||||
- gosec
|
- linters:
|
||||||
- path: pkg/modules/dump/*
|
- err113
|
||||||
linters:
|
path: pkg/modules/dump/*
|
||||||
- err113
|
- linters:
|
||||||
- path: pkg/
|
- err113
|
||||||
text: "do not define dynamic errors, use wrapped static errors instead:"
|
path: pkg/
|
||||||
linters:
|
text: 'do not define dynamic errors, use wrapped static errors instead:'
|
||||||
- err113
|
- linters:
|
||||||
- text: "commentFormatting: put a space between `//` and comment text"
|
- gocritic
|
||||||
linters:
|
text: 'commentFormatting: put a space between `//` and comment text'
|
||||||
- gocritic
|
- linters:
|
||||||
- path: pkg/modules/migration
|
- gocyclo
|
||||||
linters:
|
path: pkg/modules/migration
|
||||||
- gocyclo
|
- linters:
|
||||||
- path: pkg/routes/api/v1/docs.go
|
- goheader
|
||||||
linters:
|
- gosmopolitan
|
||||||
- goheader
|
- misspell
|
||||||
- misspell
|
path: pkg/routes/api/v1/docs.go
|
||||||
- gosmopolitan
|
- linters:
|
||||||
- text: "Missed string"
|
- goheader
|
||||||
linters:
|
text: Missed string
|
||||||
- goheader
|
- linters:
|
||||||
- path: pkg/.*/error.go
|
- errorlint
|
||||||
linters:
|
path: pkg/.*/error.go
|
||||||
- errorlint
|
- linters:
|
||||||
- path: pkg/models/favorites\.go
|
- nilerr
|
||||||
linters:
|
path: pkg/models/favorites\.go
|
||||||
- nilerr
|
- path: pkg/models/project\.go
|
||||||
- path: pkg/models/project\.go
|
text: string `parent_project_id` has 3 occurrences, make it a constant
|
||||||
text: "string `parent_project_id` has 3 occurrences, make it a constant"
|
- linters:
|
||||||
- path: pkg/models/events\.go
|
- musttag
|
||||||
linters:
|
path: pkg/models/events\.go
|
||||||
- musttag
|
- path: pkg/models/task_collection.go
|
||||||
- path: pkg/models/task_collection.go
|
text: append result not assigned to the same slice
|
||||||
text: 'append result not assigned to the same slice'
|
- linters:
|
||||||
- path: pkg/modules/migration/ticktick/ticktick_test.go
|
- testifylint
|
||||||
linters:
|
path: pkg/modules/migration/ticktick/ticktick_test.go
|
||||||
- testifylint
|
- linters:
|
||||||
- path: pkg/migration/*
|
- revive
|
||||||
text: "parameter 'tx' seems to be unused, consider removing or renaming it as"
|
path: pkg/migration/*
|
||||||
linters:
|
text: parameter 'tx' seems to be unused, consider removing or renaming it as
|
||||||
- revive
|
- linters:
|
||||||
- path: pkg/models/typesense.go
|
- govet
|
||||||
text: 'structtag: struct field Position repeats json tag "position" also at'
|
path: pkg/models/typesense.go
|
||||||
linters:
|
text: 'structtag: struct field Position repeats json tag "position" also at'
|
||||||
- govet
|
- linters:
|
||||||
- path: pkg/cmd/user.go
|
- gosec
|
||||||
text: 'G115: integer overflow conversion uintptr -> int'
|
path: pkg/cmd/user.go
|
||||||
linters:
|
text: 'G115: integer overflow conversion uintptr -> int'
|
||||||
- gosec
|
- linters:
|
||||||
- text: 'G115: integer overflow conversion int64 -> uint64'
|
- gosec
|
||||||
linters:
|
text: 'G115: integer overflow conversion int64 -> uint64'
|
||||||
- gosec
|
- linters:
|
||||||
- text: 'G115: integer overflow conversion int -> uint64'
|
- gosec
|
||||||
linters:
|
text: 'G115: integer overflow conversion int -> uint64'
|
||||||
- gosec
|
- linters:
|
||||||
- text: 'the methods of "Right" use pointer receiver and non-pointer receiver.'
|
- recvcheck
|
||||||
linters:
|
text: the methods of "Right" use pointer receiver and non-pointer receiver.
|
||||||
- recvcheck
|
- linters:
|
||||||
- text: 'the methods of "SubscriptionEntityType" use pointer receiver and non-pointer receiver.'
|
- recvcheck
|
||||||
linters:
|
text: the methods of "SubscriptionEntityType" use pointer receiver and non-pointer receiver.
|
||||||
- recvcheck
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
- pkg/routes/api/v1/docs.go
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ func init() {
|
||||||
|
|
||||||
for _, query := range queries {
|
for _, query := range queries {
|
||||||
_, err := tx.Exec(query)
|
_, err := tx.Exec(query)
|
||||||
if err != nil && !(strings.Contains(err.Error(), "Error 1061") && strings.Contains(err.Error(), "Duplicate key name")) {
|
if err != nil && (!strings.Contains(err.Error(), "Error 1061") || !strings.Contains(err.Error(), "Duplicate key name")) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ func (bt *BulkTask) Update(s *xorm.Session, a web.Auth) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// And because a false is considered to be a null value, we need to explicitly check that case here.
|
// And because a false is considered to be a null value, we need to explicitly check that case here.
|
||||||
if !bt.Task.Done {
|
if !bt.Done {
|
||||||
oldtask.Done = false
|
oldtask.Done = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -825,10 +825,7 @@ func checkProjectBeforeUpdateOrDelete(s *xorm.Session, project *Project) (err er
|
||||||
// Check if there's a cycle in the parent relation
|
// Check if there's a cycle in the parent relation
|
||||||
parentsVisited := make(map[int64]bool)
|
parentsVisited := make(map[int64]bool)
|
||||||
parentsVisited[project.ID] = true
|
parentsVisited[project.ID] = true
|
||||||
for {
|
for parent.ParentProjectID != 0 {
|
||||||
if parent.ParentProjectID == 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
parent = allProjects[parent.ParentProjectID]
|
parent = allProjects[parent.ParentProjectID]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ func (lu *ProjectUser) ReadAll(s *xorm.Session, a web.Auth, search string, page
|
||||||
|
|
||||||
// Obfuscate all user emails
|
// Obfuscate all user emails
|
||||||
for _, u := range all {
|
for _, u := range all {
|
||||||
u.User.Email = ""
|
u.Email = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
numberOfTotalItems, err = s.
|
numberOfTotalItems, err = s.
|
||||||
|
|
|
||||||
|
|
@ -395,7 +395,7 @@ ORDER BY t.id, sh.user_id`,
|
||||||
subscriptions = make(map[int64][]*SubscriptionWithUser)
|
subscriptions = make(map[int64][]*SubscriptionWithUser)
|
||||||
for _, sub := range rawSubscriptions {
|
for _, sub := range rawSubscriptions {
|
||||||
|
|
||||||
if sub.Subscription.EntityID == 0 {
|
if sub.EntityID == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -404,7 +404,7 @@ ORDER BY t.id, sh.user_id`,
|
||||||
subscriptions[sub.OriginalEntityID] = []*SubscriptionWithUser{}
|
subscriptions[sub.OriginalEntityID] = []*SubscriptionWithUser{}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub.Subscription.ID = sub.SubscriptionID
|
sub.ID = sub.SubscriptionID
|
||||||
if sub.User != nil {
|
if sub.User != nil {
|
||||||
sub.User.ID = sub.UserID
|
sub.User.ID = sub.UserID
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -461,7 +461,7 @@ func addAssigneesToTasks(s *xorm.Session, taskIDs []int64, taskMap map[int64]*Ta
|
||||||
// Put the assignees in the task map
|
// Put the assignees in the task map
|
||||||
for i, a := range taskAssignees {
|
for i, a := range taskAssignees {
|
||||||
if a != nil {
|
if a != nil {
|
||||||
a.User.Email = "" // Obfuscate the email
|
a.Email = "" // Obfuscate the email
|
||||||
taskMap[a.TaskID].Assignees = append(taskMap[a.TaskID].Assignees, &taskAssignees[i].User)
|
taskMap[a.TaskID].Assignees = append(taskMap[a.TaskID].Assignees, &taskAssignees[i].User)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,9 @@ func TestTask_Create(t *testing.T) {
|
||||||
Title: "Lorem",
|
Title: "Lorem",
|
||||||
Description: "Lorem Ipsum Dolor",
|
Description: "Lorem Ipsum Dolor",
|
||||||
ProjectID: 1,
|
ProjectID: 1,
|
||||||
DueDate: time.Date(2023, time.March, 7, 22, 5, 0, 0, time.Local),
|
DueDate: time.Date(2023, time.March, 7, 22, 5, 0, 0, time.UTC),
|
||||||
StartDate: time.Date(2023, time.March, 7, 22, 5, 10, 0, time.Local),
|
StartDate: time.Date(2023, time.March, 7, 22, 5, 10, 0, time.UTC),
|
||||||
EndDate: time.Date(2023, time.March, 7, 22, 5, 20, 0, time.Local),
|
EndDate: time.Date(2023, time.March, 7, 22, 5, 20, 0, time.UTC),
|
||||||
Reminders: []*TaskReminder{
|
Reminders: []*TaskReminder{
|
||||||
{
|
{
|
||||||
RelativeTo: "due_date",
|
RelativeTo: "due_date",
|
||||||
|
|
@ -98,19 +98,19 @@ func TestTask_Create(t *testing.T) {
|
||||||
RelativePeriod: -1,
|
RelativePeriod: -1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Reminder: time.Date(2023, time.March, 7, 23, 0, 0, 0, time.Local),
|
Reminder: time.Date(2023, time.March, 7, 23, 0, 0, 0, time.UTC),
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
err := task.Create(s, usr)
|
err := task.Create(s, usr)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 1, 0, time.Local), task.Reminders[0].Reminder)
|
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 1, 0, time.UTC), task.Reminders[0].Reminder)
|
||||||
assert.Equal(t, int64(1), task.Reminders[0].RelativePeriod)
|
assert.Equal(t, int64(1), task.Reminders[0].RelativePeriod)
|
||||||
assert.Equal(t, ReminderRelationDueDate, task.Reminders[0].RelativeTo)
|
assert.Equal(t, ReminderRelationDueDate, task.Reminders[0].RelativeTo)
|
||||||
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 8, 0, time.Local), task.Reminders[1].Reminder)
|
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 8, 0, time.UTC), task.Reminders[1].Reminder)
|
||||||
assert.Equal(t, ReminderRelationStartDate, task.Reminders[1].RelativeTo)
|
assert.Equal(t, ReminderRelationStartDate, task.Reminders[1].RelativeTo)
|
||||||
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 19, 0, time.Local), task.Reminders[2].Reminder)
|
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 19, 0, time.UTC), task.Reminders[2].Reminder)
|
||||||
assert.Equal(t, ReminderRelationEndDate, task.Reminders[2].RelativeTo)
|
assert.Equal(t, ReminderRelationEndDate, task.Reminders[2].RelativeTo)
|
||||||
assert.Equal(t, time.Date(2023, time.March, 7, 23, 0, 0, 0, time.Local), task.Reminders[3].Reminder)
|
assert.Equal(t, time.Date(2023, time.March, 7, 23, 0, 0, 0, time.UTC), task.Reminders[3].Reminder)
|
||||||
err = s.Commit()
|
err = s.Commit()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
@ -359,9 +359,9 @@ func TestTask_Update(t *testing.T) {
|
||||||
ID: 1,
|
ID: 1,
|
||||||
ProjectID: 1,
|
ProjectID: 1,
|
||||||
Title: "test",
|
Title: "test",
|
||||||
DueDate: time.Date(2023, time.March, 7, 22, 5, 0, 0, time.Local),
|
DueDate: time.Date(2023, time.March, 7, 22, 5, 0, 0, time.UTC),
|
||||||
StartDate: time.Date(2023, time.March, 7, 22, 5, 10, 0, time.Local),
|
StartDate: time.Date(2023, time.March, 7, 22, 5, 10, 0, time.UTC),
|
||||||
EndDate: time.Date(2023, time.March, 7, 22, 5, 20, 0, time.Local),
|
EndDate: time.Date(2023, time.March, 7, 22, 5, 20, 0, time.UTC),
|
||||||
Reminders: []*TaskReminder{
|
Reminders: []*TaskReminder{
|
||||||
{
|
{
|
||||||
RelativeTo: "due_date",
|
RelativeTo: "due_date",
|
||||||
|
|
@ -376,19 +376,19 @@ func TestTask_Update(t *testing.T) {
|
||||||
RelativePeriod: -1,
|
RelativePeriod: -1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Reminder: time.Date(2023, time.March, 7, 23, 0, 0, 0, time.Local),
|
Reminder: time.Date(2023, time.March, 7, 23, 0, 0, 0, time.UTC),
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
err := task.Update(s, u)
|
err := task.Update(s, u)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 1, 0, time.Local), task.Reminders[0].Reminder)
|
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 1, 0, time.UTC), task.Reminders[0].Reminder)
|
||||||
assert.Equal(t, int64(1), task.Reminders[0].RelativePeriod)
|
assert.Equal(t, int64(1), task.Reminders[0].RelativePeriod)
|
||||||
assert.Equal(t, ReminderRelationDueDate, task.Reminders[0].RelativeTo)
|
assert.Equal(t, ReminderRelationDueDate, task.Reminders[0].RelativeTo)
|
||||||
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 8, 0, time.Local), task.Reminders[1].Reminder)
|
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 8, 0, time.UTC), task.Reminders[1].Reminder)
|
||||||
assert.Equal(t, ReminderRelationStartDate, task.Reminders[1].RelativeTo)
|
assert.Equal(t, ReminderRelationStartDate, task.Reminders[1].RelativeTo)
|
||||||
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 19, 0, time.Local), task.Reminders[2].Reminder)
|
assert.Equal(t, time.Date(2023, time.March, 7, 22, 5, 19, 0, time.UTC), task.Reminders[2].Reminder)
|
||||||
assert.Equal(t, ReminderRelationEndDate, task.Reminders[2].RelativeTo)
|
assert.Equal(t, ReminderRelationEndDate, task.Reminders[2].RelativeTo)
|
||||||
assert.Equal(t, time.Date(2023, time.March, 7, 23, 0, 0, 0, time.Local), task.Reminders[3].Reminder)
|
assert.Equal(t, time.Date(2023, time.March, 7, 23, 0, 0, 0, time.UTC), task.Reminders[3].Reminder)
|
||||||
err = s.Commit()
|
err = s.Commit()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
db.AssertCount(t, "task_reminders", builder.Eq{"task_id": 1}, 4)
|
db.AssertCount(t, "task_reminders", builder.Eq{"task_id": 1}, 4)
|
||||||
|
|
@ -426,7 +426,7 @@ func TestTask_Update(t *testing.T) {
|
||||||
taskBefore := &Task{
|
taskBefore := &Task{
|
||||||
Title: "test",
|
Title: "test",
|
||||||
ProjectID: 1,
|
ProjectID: 1,
|
||||||
StartDate: time.Date(2022, time.March, 8, 8, 5, 20, 0, time.Local),
|
StartDate: time.Date(2022, time.March, 8, 8, 5, 20, 0, time.UTC),
|
||||||
Reminders: []*TaskReminder{
|
Reminders: []*TaskReminder{
|
||||||
{
|
{
|
||||||
RelativeTo: "start_date",
|
RelativeTo: "start_date",
|
||||||
|
|
@ -437,16 +437,16 @@ func TestTask_Update(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
err = s.Commit()
|
err = s.Commit()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, time.Date(2022, time.March, 8, 8, 4, 20, 0, time.Local), taskBefore.Reminders[0].Reminder)
|
assert.Equal(t, time.Date(2022, time.March, 8, 8, 4, 20, 0, time.UTC), taskBefore.Reminders[0].Reminder)
|
||||||
|
|
||||||
// when start_date is modified
|
// when start_date is modified
|
||||||
task := taskBefore
|
task := taskBefore
|
||||||
task.StartDate = time.Date(2023, time.March, 8, 8, 5, 0, 0, time.Local)
|
task.StartDate = time.Date(2023, time.March, 8, 8, 5, 0, 0, time.UTC)
|
||||||
err = task.Update(s, u)
|
err = task.Update(s, u)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// then reminder time is updated
|
// then reminder time is updated
|
||||||
assert.Equal(t, time.Date(2023, time.March, 8, 8, 4, 0, 0, time.Local), task.Reminders[0].Reminder)
|
assert.Equal(t, time.Date(2023, time.March, 8, 8, 4, 0, 0, time.UTC), task.Reminders[0].Reminder)
|
||||||
err = s.Commit()
|
err = s.Commit()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ func addMoreInfoToTeams(s *xorm.Session, teams []*Team) (err error) {
|
||||||
if _, exists := teamMap[u.TeamID]; !exists {
|
if _, exists := teamMap[u.TeamID]; !exists {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
u.User.Email = ""
|
u.Email = ""
|
||||||
teamMap[u.TeamID].Members = append(teamMap[u.TeamID].Members, u)
|
teamMap[u.TeamID].Members = append(teamMap[u.TeamID].Members, u)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -520,7 +520,7 @@ func convertTaskToTypesenseTask(task *Task, positions []*TaskPositionWithView, b
|
||||||
if pos == 0 {
|
if pos == 0 {
|
||||||
pos = float64(task.ID)
|
pos = float64(task.ID)
|
||||||
}
|
}
|
||||||
tt.Positions["view_"+strconv.FormatInt(position.ProjectView.ID, 10)] = pos
|
tt.Positions["view_"+strconv.FormatInt(position.ID, 10)] = pos
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, bucket := range buckets {
|
for _, bucket := range buckets {
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ func makeAuthenticatedGetRequest(token, urlPart string, v interface{}) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode > 399 {
|
if resp.StatusCode > 399 {
|
||||||
return fmt.Errorf("Microsoft Graph API Error: Status Code: %d, Response was: %s", resp.StatusCode, buf.String())
|
return fmt.Errorf("microsoft graph api error: status code: %d, response was: %s", resp.StatusCode, buf.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the response is an empty json array, we need to exit here, otherwise this breaks the json parser since it
|
// If the response is an empty json array, we need to exit here, otherwise this breaks the json parser since it
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ func convertTickTickToVikunja(tasks []*tickTickTask) (result []*models.ProjectWi
|
||||||
}
|
}
|
||||||
|
|
||||||
if !t.DueDate.IsZero() && t.Reminder > 0 {
|
if !t.DueDate.IsZero() && t.Reminder > 0 {
|
||||||
task.Task.Reminders = []*models.TaskReminder{
|
task.Reminders = []*models.TaskReminder{
|
||||||
{
|
{
|
||||||
RelativeTo: models.ReminderRelationDueDate,
|
RelativeTo: models.ReminderRelationDueDate,
|
||||||
RelativePeriod: int64((t.Reminder * -1).Seconds()),
|
RelativePeriod: int64((t.Reminder * -1).Seconds()),
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package notifications
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"embed"
|
"embed"
|
||||||
_ "embed"
|
|
||||||
templatehtml "html/template"
|
templatehtml "html/template"
|
||||||
templatetext "text/template"
|
templatetext "text/template"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ func TestNewMail(t *testing.T) {
|
||||||
assert.Equal(t, "test@example.com", mail.from)
|
assert.Equal(t, "test@example.com", mail.from)
|
||||||
assert.Equal(t, "test@otherdomain.com", mail.to)
|
assert.Equal(t, "test@otherdomain.com", mail.to)
|
||||||
assert.Equal(t, "Testmail", mail.subject)
|
assert.Equal(t, "Testmail", mail.subject)
|
||||||
assert.Equal(t, "", mail.greeting)
|
assert.Empty(t, mail.greeting)
|
||||||
assert.Len(t, mail.introLines, 2)
|
assert.Len(t, mail.introLines, 2)
|
||||||
assert.Equal(t, "This is a line", mail.introLines[0].Text)
|
assert.Equal(t, "This is a line", mail.introLines[0].Text)
|
||||||
assert.Equal(t, "And another one", mail.introLines[1].Text)
|
assert.Equal(t, "And another one", mail.introLines[1].Text)
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ func GetAvatar(c echo.Context) error {
|
||||||
return handler.HandleHTTPError(err)
|
return handler.HandleHTTPError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
found := !(err != nil && user.IsErrUserDoesNotExist(err))
|
found := err == nil || !user.IsErrUserDoesNotExist(err)
|
||||||
|
|
||||||
var avatarProvider avatar.Provider
|
var avatarProvider avatar.Provider
|
||||||
switch u.AvatarProvider {
|
switch u.AvatarProvider {
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ func static() echo.MiddlewareFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
var he *echo.HTTPError
|
var he *echo.HTTPError
|
||||||
if !(errors.As(err, &he) && he.Code == http.StatusNotFound) {
|
if !errors.As(err, &he) || he.Code != http.StatusNotFound {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue