#NEWLINE# def get_paginated_response( self , data ) : #NEWLINE# #INDENT# 'Add number of unread comments to links.meta when viewing list of comments filtered by\n        a target node, file or wiki page.' #NEWLINE# response = super ( CommentPagination , self ) . get_paginated_response ( data ) #NEWLINE# response_dict = response . data #NEWLINE# kwargs = self . request . parser_context [ 'kwargs' ] . copy ( ) #NEWLINE# if self . request . query_params . get ( 'related_counts' , False ) : #NEWLINE# #INDENT# target_id = self . request . query_params . get ( 'filter[target]' , None ) #NEWLINE# node_id = kwargs . get ( 'node_id' , None ) #NEWLINE# node = Node . load ( node_id ) #NEWLINE# user = self . request . user #NEWLINE# if ( target_id and ( not user . is_anonymous ( ) ) and node . is_contributor ( user ) ) : #NEWLINE# #INDENT# root_target = Guid . load ( target_id ) #NEWLINE# page = getattr ( root_target . referent , 'root_target_page' , None ) #NEWLINE# if page : #NEWLINE# #INDENT# if ( not len ( data ) ) : #NEWLINE# #INDENT# unread = 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# unread = Comment . find_n_unread ( user = user , node = node , page = page , root_id = target_id ) #NEWLINE# #UNINDENT# response_dict [ 'links' ] [ 'meta' ] [ 'unread' ] = unread #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return Response ( response_dict )