def after_fork(self, node, fork, user, save=True):
        """After forking, copy user settings if the user is the one who authorized
        the addon.

        :return: A tuple of the form (cloned_settings, message)
        """
        clone, _ = super(AddonOAuthNodeSettingsBase, self).after_fork(
            node=node,
            fork=fork,
            user=user,
            save=False,
        )
        if self.has_auth and self.user_settings.owner == user:
            metadata = None
            if self.complete:
                try:
                    metadata = self.user_settings.oauth_grants[node._id][self.external_account._id]
                except (KeyError, __HOLE__):
                    pass
            clone.set_auth(self.external_account, user, metadata=metadata, log=False)
            message = '{addon} authorization copied to forked {category}.'.format(
                addon=self.config.full_name,
                category=fork.project_or_component,
            )
        else:
            message = (
                u'{addon} authorization not copied to forked {category}. You may '
                u'authorize this fork on the <u><a href="{url}">Settings</a></u> '
                u'page.'
            ).format(
                addon=self.config.full_name,
                url=fork.web_url_for('node_setting'),
                category=fork.project_or_component,
            )
        if save:
            clone.save()
        return clone, message
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/addons/base/__init__.py/AddonOAuthNodeSettingsBase.after_fork