1
mirror of https://gitlab.com/commento/commento.git synced 2025-06-29 22:56:37 -04:00

everywhere: add email notifications

This commit is contained in:
Adhityaa Chandrasekar
2019-02-18 11:23:44 -05:00
parent 69aba94590
commit 06f0f6f014
33 changed files with 872 additions and 30 deletions

28
api/page_title.go Normal file
View File

@ -0,0 +1,28 @@
package main
import ()
func pageTitleUpdate(domain string, path string) (string, error) {
title, err := htmlTitleGet("http://" + domain + path)
if err != nil {
// This could fail due to a variety of reasons that we can't control such
// as the user's URL 404 or something, so let's not pollute the error log
// with messages. Just use a sane title. Maybe we'll have the ability to
// retry later.
logger.Errorf("%v", err)
title = domain
}
statement := `
UPDATE pages
SET title = $3
WHERE domain = $1 AND path = $2;
`
_, err = db.Exec(statement, domain, path, title)
if err != nil {
logger.Errorf("cannot update pages table with title: %v", err)
return "", err
}
return title, nil
}