feat(caldav) Import caldav categories as Labels #1413
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "ce72/api:1274_import_caldav_categories"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #1274
1274_import_caldav_categoriesto feat(caldav) Import caldav categories as Labelsfeat(caldav) Import caldav categories as Labelsto WIP: feat(caldav) Import caldav categories as Labels92415c1c38
toce47ef1270
@ -197,0 +195,4 @@
return getLabelByExampleSimple(s, &Label{ID: labelID})
}
func getLabelByExampleSimple(s *xorm.Session, l *Label) (*Label, error) {
by example?
ok
@ -276,0 +276,4 @@
for _, label := range vTask.Labels {
// Find or create Labels by title
err = label.ReadOne(s, vcls.user)
if err != nil {
Can you explicitley check for a LabelDoesNotExist error here?
ok
@ -276,0 +282,4 @@
_ = s.Rollback()
return nil, err
}
err = label.ReadOne(s, vcls.user)
I think we don't need to read explicitely after creating the label.
ok
@ -318,6 +341,29 @@ func (vcls *VikunjaCaldavListStorage) UpdateResource(rpath, content string) (*da
return nil, errs.ForbiddenError
}
for _, label := range vTask.Labels {
This looks like it's duplicated, can you extract it in a new function?
ok
5824bc02ce
to2b5cc71809
2b5cc71809
to1cb1655c0d
WIP: feat(caldav) Import caldav categories as Labelsto feat(caldav) Import caldav categories as LabelsMassive +1 for adding tests! That's awesome!
@ -148,0 +156,4 @@
rec, c := testRequestSetup(t, method, payload, queryParams, urlParams)
c.Request().Header.Set(echo.HeaderContentType, echo.MIMETextPlain)
result, _ := caldav.BasicAuth(user.Username, "1234", c)
The password might get changed but it's completely fine to have it hardcoded in here - just a mental not to think of this in future.
@ -177,3 +177,3 @@
// @Router /labels/{id} [get]
func (l *Label) ReadOne(s *xorm.Session, a web.Auth) (err error) {
label, err := getLabelByIDSimple(s, l.ID)
label, err := getLabelSimple(s, l)
Please use
getLabelByIDSimple
.ok
@ -370,0 +385,4 @@
func persistLabels(s *xorm.Session, a web.Auth, task *models.Task, labels []*models.Label) (err error) {
// Find or create Labels by title
for _, label := range labels {
err = label.ReadOne(s, a)
Can you use
getLabelSimple
here and only pass in the label's title?ok
764ef33fa4
to1b3aa1b5a4
Looks good now, thanks!