(self, request, user_docs_by_id)
return user_ids_with_forms
Find users who have ever submitted a form, and add to request.messages if so.
Find users who have ever submitted a form, and add to request.messages if so.
Find users who have ever submitted a form and add to request . messages if so .
def _get_user_ids_with_forms(self, request, user_docs_by_id):
        """
            Find users who have ever submitted a form, and add to request.messages if so.
        """
        user_ids_with_forms = (
            FormES()
            .domain(request.domain)
            .user_id(list(user_docs_by_id))
            .terms_aggregation('form.meta.userID', 'user_id')
        ).run().aggregations.user_id.keys

        if user_ids_with_forms:
            message = _("""
                The following users have form submissions and must be deleted individually: {}.
            """).format(", ".join([raw_username(user_docs_by_id[user_id]['username'])
                                   for user_id in user_ids_with_forms]))
            messages.error(request, message)

        return user_ids_with_forms
def _get_user_ids_with_forms ( self , request , user_docs_by_id ) : user_ids_with_forms = ( FormES ( ) . domain ( request . domain ) . user_id ( list ( user_docs_by_id ) ) . terms_aggregation ( 'form.meta.userID' , 'user_id' ) ) . run ( ) . aggregations . user_id . keys if user_ids_with_forms : message = _ ( """
                The following users have form submissions and must be deleted individually: {}.
            """ ) . format ( ", " . join ( [ raw_username ( user_docs_by_id [ user_id ] [ 'username' ] ) for user_id in user_ids_with_forms ] ) ) messages . error ( request , message ) return user_ids_with_forms