# Discussions

### Topics & Comments

A `DiscussionActivity` consists of topics. A `Topic` contains a connection to `Comment`, which contains the top-level comments, then every `Comment` contains a connection to `Comment` for replies.

{% hint style="info" %}
Comment replies in Eduflow go one level deep only.
{% endhint %}

### API Example

Topics and Comments are available via a pageable [GraphQL Connection](https://graphql.org/learn/pagination/#end-of-list-counts-and-connections):

{% content-ref url="../graphql/pagination" %}
[pagination](https://docs.eduflow.com/graphql/pagination)
{% endcontent-ref %}

{% tabs %}
{% tab title="Query" %}

```graphql
{
  activity(id: "ae8f3183-0fd0-48e1-b52d-2f455cd78db7") {
    ... on DiscussionActivity {
      title
      topics(first: 2) {
        edges {
          node {
            title
            content
            likesCount
            author {
              name
            }
            commentsCount
            comments {
              edges {
                node {
                  content
                  likesCount
                  repliesCount
                  author {
                    name
                  }
                  replies {
                    edges {
                      node {
                        content
                        author {
                          name
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    'data': {
        'activity': {
            'topics': {
                'totalCount': 2,
                'edges': [
                    {
                        'node': {
                            'title': 'Topic 2',
                            'content': '<p>Topic 2</p>',
                            'author': {
                                'name': 'Ryan Howard'
                            },
                            'commentsCount': 0,
                            'comments': {
                                'edges': [
                                ]
                            },
                            'likesCount': 0
                        }
                    },
                    {
                        'node': {
                            'title': 'Topic 1',
                            'content': '<p>Topic 1</p>',
                            'author': {
                                'name': 'Ryan Howard'
                            },
                            'likesCount': 2,
                            'commentsCount': 4,
                            'comments': {
                                'edges': [
                                    {
                                        'node': {
                                            'author': {
                                                'name': 'Ryan Howard'
                                            },
                                            'content': '<p>Comment 1</p>',
                                            'likesCount': 2,
                                            'replies': {
                                                'edges': [
                                                    {
                                                        'node': {
                                                            'author': {
                                                                'name': 'Ryan Howard'
                                                            },
                                                            'content': '<p>Reply 1</p>'
                                                        }
                                                    },
                                                    {
                                                        'node': {
                                                            'author': {
                                                                'name': 'Ryan Howard'
                                                            },
                                                            'content': '<p>Reply 2</p>'
                                                        }
                                                    }
                                                ]
                                            },
                                            'repliesCount': 2
                                        }
                                    },
                                    {
                                        'node': {
                                            'author': {
                                                'name': 'Pam Beesley'
                                            },
                                            'content': '<p>Comment 2</p>',
                                            'likesCount': 0,
                                            'replies': {
                                                'edges': [
                                                ]
                                            },
                                            'repliesCount': 0
                                        }
                                    }
                                ]
                            }
                        }
                    }
                ]
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}
