Activity page shows create events only

This commit is contained in:
2019-08-27 15:03:29 +09:00
parent f1ccc6c0c6
commit b13b337990
6 changed files with 35 additions and 17 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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.

View File

@ -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"