Compare commits

..

No commits in common. "d89d63803f8dda494ae63347348cb05234660a06" and "aee1c25f54d1cd94d1caef309236faeae666ae32" have entirely different histories.

6 changed files with 7 additions and 22 deletions

View File

@ -271,14 +271,13 @@ func nodeUpdate(w http.ResponseWriter, r *http.Request, sess *session.T) { // {{
Content string
CryptoKeyID int
Markdown bool
TimeOffset int
}{}
if err = parseRequest(r, &req); err != nil {
responseError(w, err)
return
}
err = UpdateNode(sess.UserID, req.NodeID, req.TimeOffset, req.Content, req.CryptoKeyID, req.Markdown)
err = UpdateNode(sess.UserID, req.NodeID, req.Content, req.CryptoKeyID, req.Markdown)
if err != nil {
responseError(w, err)
return

View File

@ -323,9 +323,9 @@ func CreateNode(userID, parentID int, name string) (node Node, err error) { // {
node.Crumbs, err = NodeCrumbs(node.ID)
return
} // }}}
func UpdateNode(userID, nodeID, timeOffset int, content string, cryptoKeyID int, markdown bool) (err error) { // {{{
func UpdateNode(userID, nodeID int, content string, cryptoKeyID int, markdown bool) (err error) { // {{{
var scannedSchedules, dbSchedules, add, remove []Schedule
scannedSchedules = ScanForSchedules(timeOffset, content)
scannedSchedules = ScanForSchedules(content)
for i := range scannedSchedules {
scannedSchedules[i].Node.ID = nodeID
scannedSchedules[i].UserID = userID

View File

@ -26,7 +26,7 @@ type Schedule struct {
Acknowledged bool
}
func ScanForSchedules(timeOffset int, content string) (schedules []Schedule) {// {{{
func ScanForSchedules(content string) (schedules []Schedule) {// {{{
schedules = []Schedule{}
rxp := regexp.MustCompile(`\{\s*([0-9]{4}-[0-9]{2}-[0-9]{2}\s+[0-9]{2}:[0-9]{2}(?::[0-9]{2})?)\s*\,\s*([^\]]+?)\s*\}`)
@ -38,18 +38,7 @@ func ScanForSchedules(timeOffset int, content string) (schedules []Schedule) {//
data[1] = data[1] + ":00"
}
var timeTZ string
if timeOffset < 0 {
hours := (-timeOffset) / 60
mins := (-timeOffset) % 60
timeTZ = fmt.Sprintf("%s -%02d%02d", data[1], hours, mins)
} else {
hours := timeOffset / 60
mins := timeOffset % 60
timeTZ = fmt.Sprintf("%s +%02d%02d", data[1], hours, mins)
}
timestamp, err := time.Parse("2006-01-02 15:04:05 -0700", timeTZ)
timestamp, err := time.Parse("2006-01-02 15:04:05", data[1])
if err != nil {
continue
}
@ -73,7 +62,7 @@ func RetrieveSchedules(userID int, nodeID int) (schedules []Schedule, err error)
user_id,
json_build_object('id', node_id) AS node,
schedule_uuid,
time,
time::timestamptz,
description,
acknowledged
FROM schedule

View File

@ -1,2 +0,0 @@
ALTER TABLE public.schedule ALTER COLUMN "time" TYPE timestamptz USING "time"::timestamptz;

View File

@ -485,7 +485,6 @@ export class Node {
Content: this._content,
CryptoKeyID: this.CryptoKeyID,
Markdown: this.Markdown,
TimeOffset: -(new Date().getTimezoneOffset()),
}
this.app.request('/node/update', req)
.then(callback)

View File

@ -1 +1 @@
v24
v23