Activity page shows create events only
This commit is contained in:
@ -61,3 +61,16 @@ func StreamActivityCreates() <-chan *ActivityCreate {
|
||||
|
||||
return channel
|
||||
}
|
||||
|
||||
// FilterActivityCreates filters all ActivityCreates by a custom function.
|
||||
func FilterActivityCreates(filter func(Activity) bool) []Activity {
|
||||
var filtered []Activity
|
||||
|
||||
for obj := range StreamActivityCreates() {
|
||||
if filter(obj) {
|
||||
filtered = append(filtered, obj)
|
||||
}
|
||||
}
|
||||
|
||||
return filtered
|
||||
}
|
||||
|
@ -56,6 +56,11 @@ func (post *Post) GetParentID() string {
|
||||
return post.ParentID
|
||||
}
|
||||
|
||||
// GetParentType returns the object type of the parent.
|
||||
func (post *Post) GetParentType() string {
|
||||
return post.ParentType
|
||||
}
|
||||
|
||||
// SetParent sets a new parent.
|
||||
func (post *Post) SetParent(newParent PostParent) {
|
||||
// Remove from old parent
|
||||
|
@ -23,6 +23,7 @@ type Postable interface {
|
||||
GetText() string
|
||||
GetCreated() string
|
||||
GetParentID() string
|
||||
GetParentType() string
|
||||
}
|
||||
|
||||
// ToPostables converts a slice of specific types to a slice of generic postables.
|
||||
|
@ -54,6 +54,11 @@ func (thread *Thread) GetParentID() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetParentType always returns an empty string for threads.
|
||||
func (thread *Thread) GetParentType() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// TypeName returns the type name.
|
||||
func (thread *Thread) TypeName() string {
|
||||
return "Thread"
|
||||
|
Reference in New Issue
Block a user