'Insert entries into the users_who_share_rooms table. The first
user should be a local user.
Args:
room_id (str)
share_private (bool): Is the room private
user_id_tuples([(str, str)]): iterable of 2-tuple of user IDs.'

def add_users_who_share_room(self, room_id, share_private, user_id_tuples):

    def _add_users_who_share_room_txn(txn):
        self._simple_insert_many_txn(txn, table='users_who_share_rooms', values=[{'user_id': user_id, 'other_user_id': other_user_id, 'room_id': room_id, 'share_private': share_private} for (user_id, other_user_id) in user_id_tuples])
        for (user_id, other_user_id) in user_id_tuples:
            txn.call_after(self.get_users_who_share_room_from_dir.invalidate, (user_id,))
            txn.call_after(self.get_if_users_share_a_room.invalidate, (user_id, other_user_id))
    return self.runInteraction('add_users_who_share_room', _add_users_who_share_room_txn)
