Search code examples
laravel-5.4getstream-io

GetStream - Group likes together, but make others behave like non-aggregated timeline


I need to group all likes so that it will act similar to LinkedIn likes (Imonoid, Stackoverflower, and 2 others liked a post) but would want other activities to show as single (non grouped) similar to a non-aggregated timeline feed.

{% if verb.infinitive == 'like' %}
{{ target }}{{ verb.id }}{{ time.strftime('%j') }}
{% elif verb.infinitive == 'articlelike' %}
{{ target }}{{ verb.id }}{{ time.strftime('%j') }}
{% elif verb.infinitive == 'company_post_like' %}
{{ target }}{{ verb.id }}{{ time.strftime('%j') }}
{% elif verb.infinitive == 'company_post_c_like' %}
{{ target }}{{ verb.id }}{{ time.strftime('%j') }}
{% elif verb.infinitive == 'like_post_comment' %}
{{ target }}{{ verb.id }}{{ time.strftime('%j') }}
{% else %}
{{ verb.id }}_{{ time.strftime("%Y-%m-%d") }}
{% endif %}

Solution

  • Change your else condition to something like the following and you should be all set:

    {% else %}
    {{ id }}
    {% endif %}
    

    This will have the effect of taking every other activity and putting it into its own group, effectively isolating the activity. The JSON payload won't look the same as your flat feed, but should still be manageable.