Page MenuHomePhabricator

Disallow a user from applying to the same partner more than once (except for partners with collections or specific_title)
Closed, ResolvedPublic

Description

We don't have any checks in place to see if a user has applied to a partner/collection previously, which leads to the possibility of duplicate applications. While we go to some effort to ensure that there's no obvious workflow for applying to a publisher the user already has an application open for, they can still navigate directly to the application URL.

If a user attempts to load the application request view (https://github.com/WikipediaLibrary/TWLight/blob/master/TWLight/applications/views.py#L121), but already has an application with the status PENDING, APPROVED, or QUESTION, we should redirect them to that application. This should only happen for resources with no collections, and which don't have specific_title = True.

Event Timeline

Samwalton9 renamed this task from Disallow a user from applying to the same partner, collection more than once (except for partners with `specific_title`) to Disallow a user from applying to the same partner more than once (except for partners with collections or specific_title).Oct 1 2020, 8:53 AM
Samwalton9 updated the task description. (Show Details)
Samwalton9 removed a subscriber: AVasanth_WMF.

@NirmalaSainsara had claimed this task - how are things progressing?

yes I am working on this, possibly will raise a PR by the end of this week

Hi @Samwalton9 what should we do in the case when this query returns more than one result.
i.e. the user has applied to the same partner more than once.

qs = Application.objects.filter(
    partner=partner, 
    editor=editor,
    status__in=(
        Application.QUESTION,
        Application.PENDING,
        Application.APPROVED,
    ), 
)

in case the same editor tries to apply again on the same partner on which application should we redirect the editor then?

in case the same editor tries to apply again on the same partner on which application should we redirect the editor then?

Good question! In this case I think we should send them to their My Applications page (https://github.com/WikipediaLibrary/TWLight/blob/master/TWLight/users/views.py#L808).