cleanup some old mistakes and cruft from the database
This commit is contained in:
parent
14bc7f5cec
commit
211ab9a97a
|
@ -850,9 +850,6 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
targ, _ := obj.GetString("target")
|
targ, _ := obj.GetString("target")
|
||||||
content += string(templates.Sprintf(`<p>Moved to <a href="%s">%s</a>`, targ, targ))
|
content += string(templates.Sprintf(`<p>Moved to <a href="%s">%s</a>`, targ, targ))
|
||||||
}
|
}
|
||||||
if what == "honk" && rid != "" {
|
|
||||||
what = "tonk"
|
|
||||||
}
|
|
||||||
if len(content) > 90001 {
|
if len(content) > 90001 {
|
||||||
ilog.Printf("content too long. truncating")
|
ilog.Printf("content too long. truncating")
|
||||||
content = content[:90001]
|
content = content[:90001]
|
||||||
|
@ -1239,8 +1236,6 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
|
||||||
switch h.What {
|
switch h.What {
|
||||||
case "update":
|
case "update":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "tonk":
|
|
||||||
fallthrough
|
|
||||||
case "event":
|
case "event":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "honk":
|
case "honk":
|
||||||
|
|
|
@ -504,8 +504,6 @@ func donksforhonks(honks []*Honk) {
|
||||||
elog.Printf("error parsing badonks: %s", err)
|
elog.Printf("error parsing badonks: %s", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
case "wonkles":
|
|
||||||
case "guesses":
|
|
||||||
case "oldrev":
|
case "oldrev":
|
||||||
default:
|
default:
|
||||||
elog.Printf("unknown meta genus: %s", genus)
|
elog.Printf("unknown meta genus: %s", genus)
|
||||||
|
@ -1158,7 +1156,7 @@ func prepareStatements(db *sql.DB) {
|
||||||
stmtUserHonks = preparetodie(db, selecthonks+"where honks.honkid > ? and (whofore = 2 or whofore = ?) and username = ? and dt > ?"+smalllimit)
|
stmtUserHonks = preparetodie(db, selecthonks+"where honks.honkid > ? and (whofore = 2 or whofore = ?) and username = ? and dt > ?"+smalllimit)
|
||||||
myhonkers := " and honker in (select xid from honkers where userid = ? and (flavor = 'sub' or flavor = 'peep' or flavor = 'presub') and combos not like '% - %')"
|
myhonkers := " and honker in (select xid from honkers where userid = ? and (flavor = 'sub' or flavor = 'peep' or flavor = 'presub') and combos not like '% - %')"
|
||||||
stmtHonksForUser = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ?"+myhonkers+butnotthose+limit)
|
stmtHonksForUser = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ?"+myhonkers+butnotthose+limit)
|
||||||
stmtHonksForUserFirstClass = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and (what <> 'tonk')"+myhonkers+butnotthose+limit)
|
stmtHonksForUserFirstClass = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and (rid = '' or what = 'bonk')"+myhonkers+butnotthose+limit)
|
||||||
stmtHonksForMe = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and whofore = 1"+butnotthose+limit)
|
stmtHonksForMe = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and whofore = 1"+butnotthose+limit)
|
||||||
stmtHonksFromLongAgo = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and dt < ? and whofore = 2"+butnotthose+limit)
|
stmtHonksFromLongAgo = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and dt < ? and whofore = 2"+butnotthose+limit)
|
||||||
stmtHonksISaved = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and flags & 4 order by honks.honkid desc")
|
stmtHonksISaved = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and flags & 4 order by honks.honkid desc")
|
||||||
|
|
2
fun.go
2
fun.go
|
@ -66,7 +66,7 @@ func reverbolate(userid int64, honks []*Honk) {
|
||||||
somenumberedusers.Get(userid, &user)
|
somenumberedusers.Get(userid, &user)
|
||||||
for _, h := range honks {
|
for _, h := range honks {
|
||||||
h.What += "ed"
|
h.What += "ed"
|
||||||
if h.What == "tonked" {
|
if h.What == "honked" && h.RID != "" {
|
||||||
h.What = "honked back"
|
h.What = "honked back"
|
||||||
h.Style += " subtle"
|
h.Style += " subtle"
|
||||||
}
|
}
|
||||||
|
|
1
honk.go
1
honk.go
|
@ -155,7 +155,6 @@ const (
|
||||||
flagIsSaved = 4
|
flagIsSaved = 4
|
||||||
flagIsUntagged = 8
|
flagIsUntagged = 8
|
||||||
flagIsReacted = 16
|
flagIsReacted = 16
|
||||||
flagIsWonked = 32
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (honk *Honk) IsAcked() bool {
|
func (honk *Honk) IsAcked() bool {
|
||||||
|
|
|
@ -148,9 +148,6 @@ func importMastotoots(user *WhatAbout, source string) {
|
||||||
Format: "html",
|
Format: "html",
|
||||||
Precis: toot.Object.Summary,
|
Precis: toot.Object.Summary,
|
||||||
}
|
}
|
||||||
if honk.RID != "" {
|
|
||||||
honk.What = "tonk"
|
|
||||||
}
|
|
||||||
if !loudandproud(honk.Audience) {
|
if !loudandproud(honk.Audience) {
|
||||||
honk.Whofore = 3
|
honk.Whofore = 3
|
||||||
}
|
}
|
||||||
|
@ -387,13 +384,11 @@ func importTwitter(username, source string) {
|
||||||
noise := ""
|
noise := ""
|
||||||
if parent := tweetmap[t.Tweet.InReplyToStatusID]; parent != nil {
|
if parent := tweetmap[t.Tweet.InReplyToStatusID]; parent != nil {
|
||||||
t.convoy = parent.convoy
|
t.convoy = parent.convoy
|
||||||
what = "tonk"
|
|
||||||
} else {
|
} else {
|
||||||
t.convoy = "data:,acoustichonkytonk-" + t.Tweet.IdStr
|
t.convoy = "data:,acoustichonkytonk-" + t.Tweet.IdStr
|
||||||
if t.Tweet.InReplyToScreenName != "" {
|
if t.Tweet.InReplyToScreenName != "" {
|
||||||
noise = fmt.Sprintf("re: https://twitter.com/%s/status/%s\n\n",
|
noise = fmt.Sprintf("re: https://twitter.com/%s/status/%s\n\n",
|
||||||
t.Tweet.InReplyToScreenName, t.Tweet.InReplyToStatusID)
|
t.Tweet.InReplyToScreenName, t.Tweet.InReplyToStatusID)
|
||||||
what = "tonk"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
audience := []string{thewholeworld}
|
audience := []string{thewholeworld}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
var myVersion = 42
|
var myVersion = 43
|
||||||
|
|
||||||
type dbexecer interface {
|
type dbexecer interface {
|
||||||
Exec(query string, args ...interface{}) (sql.Result, error)
|
Exec(query string, args ...interface{}) (sql.Result, error)
|
||||||
|
@ -82,6 +82,11 @@ func upgradedb() {
|
||||||
doordie(db, "update config set value = 42 where key = 'dbversion'")
|
doordie(db, "update config set value = 42 where key = 'dbversion'")
|
||||||
fallthrough
|
fallthrough
|
||||||
case 42:
|
case 42:
|
||||||
|
doordie(db, "update honks set what = 'honk', flags = flags & ~ 32 where what = 'tonk' or what = 'wonk'")
|
||||||
|
doordie(db, "delete from honkmeta where genus = 'wonkles' or genus = 'guesses'")
|
||||||
|
doordie(db, "update config set value = 43 where key = 'dbversion'")
|
||||||
|
fallthrough
|
||||||
|
case 43:
|
||||||
|
|
||||||
default:
|
default:
|
||||||
elog.Fatalf("can't upgrade unknown version %d", dbversion)
|
elog.Fatalf("can't upgrade unknown version %d", dbversion)
|
||||||
|
|
3
web.go
3
web.go
|
@ -1708,9 +1708,6 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk {
|
||||||
} else {
|
} else {
|
||||||
xid := fmt.Sprintf("%s/%s/%s", user.URL, honkSep, xfiltrate())
|
xid := fmt.Sprintf("%s/%s/%s", user.URL, honkSep, xfiltrate())
|
||||||
what := "honk"
|
what := "honk"
|
||||||
if rid != "" {
|
|
||||||
what = "tonk"
|
|
||||||
}
|
|
||||||
honk = &Honk{
|
honk = &Honk{
|
||||||
UserID: userinfo.UserID,
|
UserID: userinfo.UserID,
|
||||||
Username: userinfo.Username,
|
Username: userinfo.Username,
|
||||||
|
|
Loading…
Reference in New Issue