Use group_id if present when getting user thread and comment counts.

TNL-543

@jimabramson @dan-f Please review
`unique_comment_thread_ids` is only used the one time below, so you could inline it and avoid the extra var.