Compare commits

..

No commits in common. "c613e18c7a8e30a7f7924ea31f419e6b96f6c70e" and "48080bca77ece06031d013534d8a9399f2bbae0c" have entirely different histories.

2 changed files with 4 additions and 20 deletions

View File

@ -228,10 +228,11 @@ func (b *memoryBackend) feedItems(fetchURL, contentType string, body io.Reader)
//r["_id"] = "" // generate random value //r["_id"] = "" // generate random value
} }
// mapToItem adds published if _, e := r["published"]; e {
item := mapToItem(r) item := mapToItem(r)
items = append(items, item) items = append(items, item)
} }
}
} else if strings.HasPrefix(contentType, "application/json") { // json feed? } else if strings.HasPrefix(contentType, "application/json") { // json feed?
var feed JSONFeed var feed JSONFeed
dec := json.NewDecoder(body) dec := json.NewDecoder(body)
@ -328,14 +329,6 @@ func (b *memoryBackend) feedItems(fetchURL, contentType string, body io.Reader)
items[i] = v items[i] = v
} }
} }
for _, item := range items {
log.Printf("ID=%s Name=%s\n", item.ID, item.Name)
log.Printf("Author=%#v\n", item.Author)
log.Printf("Text=%s\n", item.Content.Text)
log.Printf("HTML=%s\n", item.Content.HTML)
}
return items, nil return items, nil
} }
@ -372,10 +365,6 @@ func (b *memoryBackend) channelAddItem(channel string, item microsub.Item) {
channelKey := fmt.Sprintf("channel:%s:posts", channel) channelKey := fmt.Sprintf("channel:%s:posts", channel)
zchannelKey := fmt.Sprintf("zchannel:%s:posts", channel) zchannelKey := fmt.Sprintf("zchannel:%s:posts", channel)
if item.Published == "" {
item.Published = time.Now().Format(time.RFC3339)
}
data, err := json.Marshal(item) data, err := json.Marshal(item)
if err != nil { if err != nil {
log.Printf("error while creating item for redis: %v\n", err) log.Printf("error while creating item for redis: %v\n", err)
@ -389,9 +378,6 @@ func (b *memoryBackend) channelAddItem(channel string, item microsub.Item) {
Data: data, Data: data,
} }
log.Printf("Adding item to channel %s\n", channel)
log.Printf("%#v\n", forRedis)
itemKey := fmt.Sprintf("item:%s", item.ID) itemKey := fmt.Sprintf("item:%s", item.ID)
_, err = redis.String(conn.Do("HMSET", redis.Args{}.Add(itemKey).AddFlat(&forRedis)...)) _, err = redis.String(conn.Do("HMSET", redis.Args{}.Add(itemKey).AddFlat(&forRedis)...))
if err != nil { if err != nil {

View File

@ -346,8 +346,6 @@ func mapToItem(result map[string]interface{}) microsub.Item {
if published, e := result["published"]; e { if published, e := result["published"]; e {
item.Published = published.(string) item.Published = published.(string)
} else {
item.Published = time.Now().Format(time.RFC3339)
} }
if updated, e := result["updated"]; e { if updated, e := result["updated"]; e {