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 { if honk.Public {
for _, f := range getdubs(user.ID) { for _, h := range getdubs(user.ID) {
if f.XID == user.URL { if h.XID == user.URL {
continue continue
} }
var box *Box var box *Box
ok := boxofboxes.Get(f.XID, &box) ok := boxofboxes.Get(h.XID, &box)
if ok && box.Shared != "" { if ok && box.Shared != "" {
rcpts["%"+box.Shared] = true rcpts["%"+box.Shared] = true
} else { } else {
rcpts[f.XID] = true rcpts[h.XID] = true
} }
} }
} }

View File

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

17
fun.go
View File

@ -329,14 +329,15 @@ func memetize(honk *Honk) {
log.Printf("error saving meme: %s", err) log.Printf("error saving meme: %s", err)
return x return x
} }
var d Donk d := &Donk{
d.FileID = fileid FileID: fileid,
d.XID = "" XID: "",
d.Name = name Name: name,
d.Media = ct Media: ct,
d.URL = url URL: url,
d.Local = false Local: false,
honk.Donks = append(honk.Donks, &d) }
honk.Donks = append(honk.Donks, d)
return "" return ""
} }
honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl) 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) log.Printf("unable to save image: %s", err)
return return
} }
var d Donk d := &Donk{
d.FileID = fileid FileID: fileid,
d.XID = xid XID: xid,
d.Desc = desc Desc: desc,
d.URL = url URL: url,
d.Local = true Local: true,
honk.Donks = append(honk.Donks, &d) }
honk.Donks = append(honk.Donks, d)
donkxid = xid donkxid = xid
} }
} else { } else {