updateThreadsStatus calculates the aggregate status of a sequence of comment threads. The aggregate status is the conjunction of all of the non-nil child statuses. This has the side-effect of setting the "Resolved" field of all descendant comment threads.
(threads []CommentThread)
| 131 | // |
| 132 | // This has the side-effect of setting the "Resolved" field of all descendant comment threads. |
| 133 | func updateThreadsStatus(threads []CommentThread) *bool { |
| 134 | sort.Stable(byTimestamp(threads)) |
| 135 | noUnresolved := true |
| 136 | var result *bool |
| 137 | for i := range threads { |
| 138 | thread := &threads[i] |
| 139 | thread.updateResolvedStatus() |
| 140 | if thread.Resolved != nil { |
| 141 | noUnresolved = noUnresolved && *thread.Resolved |
| 142 | result = &noUnresolved |
| 143 | } |
| 144 | } |
| 145 | return result |
| 146 | } |
| 147 | |
| 148 | // updateResolvedStatus calculates the aggregate status of a single comment thread, |
| 149 | // and updates the "Resolved" field of that thread accordingly. |