style consistency

This commit is contained in:
Ted Unangst 2019-10-21 01:29:39 -04:00
parent c1b386873d
commit 9d89310be0
4 changed files with 30 additions and 28 deletions

View File

@ -1195,16 +1195,16 @@ func honkworldwide(user *WhatAbout, honk *Honk) {
}
}
if honk.Public {
for _, f := range getdubs(user.ID) {
if f.XID == user.URL {
for _, h := range getdubs(user.ID) {
if h.XID == user.URL {
continue
}
var box *Box
ok := boxofboxes.Get(f.XID, &box)
ok := boxofboxes.Get(h.XID, &box)
if ok && box.Shared != "" {
rcpts["%"+box.Shared] = true
} else {
rcpts[f.XID] = true
rcpts[h.XID] = true
}
}
}

View File

@ -63,15 +63,15 @@ func gethonkers(userid int64) []*Honker {
defer rows.Close()
var honkers []*Honker
for rows.Next() {
var f Honker
h := new(Honker)
var combos string
err = rows.Scan(&f.ID, &f.UserID, &f.Name, &f.XID, &f.Flavor, &combos)
f.Combos = strings.Split(strings.TrimSpace(combos), " ")
err = rows.Scan(&h.ID, &h.UserID, &h.Name, &h.XID, &h.Flavor, &combos)
h.Combos = strings.Split(strings.TrimSpace(combos), " ")
if err != nil {
log.Printf("error scanning honker: %s", err)
return nil
}
honkers = append(honkers, &f)
honkers = append(honkers, h)
}
return honkers
}
@ -85,13 +85,13 @@ func getdubs(userid int64) []*Honker {
defer rows.Close()
var honkers []*Honker
for rows.Next() {
var f Honker
err = rows.Scan(&f.ID, &f.UserID, &f.Name, &f.XID, &f.Flavor)
h := new(Honker)
err = rows.Scan(&h.ID, &h.UserID, &h.Name, &h.XID, &h.Flavor)
if err != nil {
log.Printf("error scanning honker: %s", err)
return nil
}
honkers = append(honkers, &f)
honkers = append(honkers, h)
}
return honkers
}
@ -298,14 +298,14 @@ func donksforhonks(honks []*Honk) {
defer rows.Close()
for rows.Next() {
var hid int64
var d Donk
d := new(Donk)
err = rows.Scan(&hid, &d.FileID, &d.XID, &d.Name, &d.Desc, &d.URL, &d.Media, &d.Local)
if err != nil {
log.Printf("error scanning donk: %s", err)
continue
}
h := hmap[hid]
h.Donks = append(h.Donks, &d)
h.Donks = append(h.Donks, d)
}
rows.Close()

17
fun.go
View File

@ -329,14 +329,15 @@ func memetize(honk *Honk) {
log.Printf("error saving meme: %s", err)
return x
}
var d Donk
d.FileID = fileid
d.XID = ""
d.Name = name
d.Media = ct
d.URL = url
d.Local = false
honk.Donks = append(honk.Donks, &d)
d := &Donk{
FileID: fileid,
XID: "",
Name: name,
Media: ct,
URL: url,
Local: false,
}
honk.Donks = append(honk.Donks, d)
return ""
}
honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl)

15
web.go
View File

@ -1160,13 +1160,14 @@ func submithonk(w http.ResponseWriter, r *http.Request) {
log.Printf("unable to save image: %s", err)
return
}
var d Donk
d.FileID = fileid
d.XID = xid
d.Desc = desc
d.URL = url
d.Local = true
honk.Donks = append(honk.Donks, &d)
d := &Donk{
FileID: fileid,
XID: xid,
Desc: desc,
URL: url,
Local: true,
}
honk.Donks = append(honk.Donks, d)
donkxid = xid
}
} else {