api,db: add page attributes and thread locking
This commit is contained in:
committed by
Adhityaa Chandrasekar
parent
0a03a2c6fc
commit
299649cea2
@@ -13,6 +13,16 @@ func commentNew(commenterHex string, domain string, path string, parentHex strin
|
||||
return "", errorMissingField
|
||||
}
|
||||
|
||||
p, err := pageGet(domain, path)
|
||||
if err != nil {
|
||||
logger.Errorf("cannot get page attributes: %v", err)
|
||||
return "", errorInternal
|
||||
}
|
||||
|
||||
if p.IsLocked {
|
||||
return "", errorThreadLocked
|
||||
}
|
||||
|
||||
commentHex, err := randomHex(32)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -31,6 +41,10 @@ func commentNew(commenterHex string, domain string, path string, parentHex strin
|
||||
return "", errorInternal
|
||||
}
|
||||
|
||||
if err = pageNew(domain, path); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return commentHex, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user