Skip to content

Invalid Project Webhook Notification doesn't vanish if the project is deleted. #4854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dojutsu-user opened this issue Nov 2, 2018 · 4 comments

Comments

@dojutsu-user
Copy link
Member

dojutsu-user commented Nov 2, 2018

Steps To Reproduce
While importing a project manually,
Repository URL: https://github.com/dojutsu-user/template.git (Making sure that the webhook set up is invalid)
During the building of the project (or after the build, it doesn't matter), in a new tab, open the same project settings and delete it.

screenshot from 2018-11-02 20-25-18

When clicked on the project integration link, it takes to a 404 page and then the notification gets marked as read and then vanish.
The notification is persistent and doesn't go unless and until the link is clicked.

Expected Result
It should gets vanished immediately after the project is deleted and should not wait for the clicking on the link the project integration.

@dojutsu-user
Copy link
Member Author

@humitos
@stsewd
one way to fix this.
We need to make some changes in project_delete function

https://github.com/rtfd/readthedocs.org/blob/bc248aa6a7d2bb54e88e779fe4f78b9f0266acf4/readthedocs/projects/views/private.py#L172-L189

It can be edited in following manner:

@login_required
def project_delete(request, project_slug):
    """
    Project delete confirmation view.

    Make a project as deleted on POST, otherwise show a form asking for
    confirmation of delete.
    """
    project = get_object_or_404(
        Project.objects.for_admin_user(request.user), slug=project_slug)

    if request.method == 'POST':
        broadcast(type='app', task=tasks.remove_dir, args=[project.doc_path])
        project_str = str(project)
        project.delete()
        messages.success(request, _('Project deleted'))
        msgs_queryset = Message.objects.filter(message__contains=project_str)
        if msgs_queryset.exists():
            msgs_queryset.update(read=True)
        project_dashboard = reverse('projects_dashboard')
        return HttpResponseRedirect(project_dashboard)

    return render(request, 'projects/project_delete.html', {'project': project})

@stsewd
Copy link
Member

stsewd commented Nov 2, 2018

This is the case of #4684, I wonder if we should just put all these cases on the other issue. We need to solve this in a generic way.

@humitos
Copy link
Member

humitos commented Nov 2, 2018

I'm closing this in favor of #4684. I added an explanation there on why this is happening.

@dojutsu-user please, if you want to propose a change into the code, open a PR which is easier to see the differences and follow your changes. Thanks for your collaboration!

@humitos humitos closed this as completed Nov 2, 2018
@dojutsu-user
Copy link
Member Author

@humitos
Sorry for this.
I will take care of it from next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants