Page MenuHomePhabricator

Allow users to withdraw an application
Open, LowPublic

Description

Task

If a user wishes to withdraw their application for a resource, for example because they applied by mistake or filed a duplicate application, there should be some mechanism for them to do so without requiring intervention from coordinators. There is currently no way for them to do so.

We should add a new button to the My Applications page (https://github.com/WikipediaLibrary/TWLight/blob/master/TWLight/users/views.py#L786) next to any Pending or Under Discussion applications with the text "Withdraw". The button should change that application's status to Invalid and provide the user with a message which says "Your application to {partner} has been withdrawn."

Good first task

This task has been placed in the #good-first-task category. This means it has been scoped and written in a way that makes it simpler for folks who haven’t contributed to the tool’s development or open source software in the past.

If that’s you, welcome! Please feel free to ask questions here about this specific task or the codebase more generally. We’ll be more than happy to help you and clarify the steps needed to complete the task, whether that’s setting up the repository, implementing the necessary changes, or pushing your changes to Github.

If you have experience contributing to this project or similar ones, please consider leaving this one for someone new, and taking a look at the Open Tasks column of the workboard for another task. Also feel free to help out if you see unanswered questions here!

How to contribute

Assign yourself to this task: Click the ‘Add Action’ dropdown menu below and then select Assign / Claim. The box should fill your username in automatically, then click Submit!

To submit your changes, you should fork the repository and create a new branch. After pushing your changes to your Github branch, you can open a pull request. Please link your pull request in a comment here when it has been submitted, and include the Phabricator task number in the pull request. Experienced contributors to the project will review your code and either provide feedback or merge it in!

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 19 2020, 3:48 AM
Samwalton9 updated the task description. (Show Details)Feb 12 2020, 11:30 AM
Samwalton9 renamed this task from Withdraw applications to Allow users to withdraw an application.May 20 2020, 11:27 AM
Samwalton9 triaged this task as Low priority.
Samwalton9 moved this task from Incoming tasks to Open tasks on the Library-Card-Platform board.
Samwalton9 updated the task description. (Show Details)Jun 5 2020, 10:32 AM
Lutrome claimed this task.Jun 5 2020, 10:38 AM
Lutrome added a subscriber: Lutrome.

Taking this task, along with T242196.

Hey @Lutrome - any luck making progress on this? Anything you need help with?

Samwalton9 removed Lutrome as the assignee of this task.Aug 7 2020, 10:41 AM

Unassigning this due to lack of response. Feel free to reassign if you plan to work on this task :)

Samwalton9 updated the task description. (Show Details)
Restricted Application added a subscriber: Sadads. · View Herald TranscriptAug 7 2020, 10:47 AM
Saloniig claimed this task.EditedSep 8 2020, 7:54 AM
Saloniig added a subscriber: Saloniig.

{F32250266}Hi I want to contribute to this project but I am facing problem. I have installed the project on localhost and I am not able to login as when I click on login button it shows "You tried to log in but presented an invalid access token". Kindly help me.
Thanks

jsn.sherman added a subscriber: jsn.sherman.EditedSep 8 2020, 3:10 PM

This looks like a clock drift or latency issue between the local twlight oauth service provider and the remote wikimedia oauth identity provider.

Try this change:

-            identity = handshaker.identify(access_token, 15)
+            identity = handshaker.identify(access_token, 600)

In TWLight/TWLight/users/oauth.py

Don't commit this change, but let us know if it resolves the issue for you.

Thank you! now the project is working fine and I am working on the task now and I will report to you here about the progress :)

Thanks for letting us know, I've filed a separate task (T262395) for configuring this value correctly for local development.

@Saloniig How are you progressing with this task? :)

Hi @Samwalton9 ! I'd like to take up the task if it's not being done by @Saloniig right now.

Samwalton9 removed Saloniig as the assignee of this task.Sep 28 2020, 9:18 AM

Please feel free :)

Yash4357 claimed this task.Oct 6 2020, 8:38 AM
Yash4357 added a subscriber: Yash4357.

Hi @Samwalton9! I'd like to work on this task

Yash4357 added a comment.EditedOct 6 2020, 2:12 PM

Hi @Samwalton9,
I have one doubt in this question that,
when user will click on the withdraw button, then the application which was there should be deleted from the my application page or not.

If yes then do I need to delete that application from the database??

If the application should be deleted then there is no need to change the status of the application.

Good question!

I think you're right that deletion would be a preferable way of handling this. So yes, instead of changing the application status, simply deleting the application object makes sense to me.

Do I need to delete that application from the database???

Yes, that would make sense :)

This comment was removed by Yash4357.

Hey Sam,
Can you tell me how I can use Print() in terminal ??
Because I want to do some debugging..

Hi Sam,
**url(

    r"^my_applications/(?P<pk>\d+)/$",
    login_required(views.ListApplicationsUserView.as_view()),
    name="my_applications",
),**

I want to redierect my withdraw button to above url after deletion how I can do these.
I had tried

return redirect ** permanent = True

url  = reverse_lazy("users:my_applications")**

but it did not work because my_applications also have primary key.
Can you help me out..

Can you tell me how I can use Print() in terminal ??

The easiest way to print out for debugging is to use the logger. You can do so with:

import logging
logger = logging.getLogger(__name__)

(If this isn't already set up in the file you're in)

Then print debug messages to the Docker log with:
logger.info("Your debug string here")

but it did not work because my_applications also have primary key.

To add the primary key in here you can do something like:

url  = reverse_lazy("users:my_applications", kwargs={"pk": user.pk})

Can I use function base view instead of class base view.

We're using class based views wherever possible in this project. Can I help with that at all?

Hi Sam,
I had solve this issue and created a pull request.
Please! have a look and suggest if any more changes or improvements needed...