Add Published time when it is not set
This commit is contained in:
parent
48080bca77
commit
1a95c882ad
|
@ -365,6 +365,10 @@ 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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user