From 6ca678e0130682c4f8f13b774a0da781ec220a15 Mon Sep 17 00:00:00 2001 From: Logan Hanks Date: Wed, 25 Jul 2012 11:13:12 -0700 Subject: [PATCH] Let developers remove themselves from apps. --- r2/r2/controllers/api.py | 7 +++++-- r2/r2/templates/prefapps.html | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 314478489..efd6fd530 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -2912,12 +2912,15 @@ class ApiController(RedditController, OAuth2ResourceController): @validatedForm(VUser(), VModhash(), client=VOAuth2ClientDeveloper(), - account=VExistingUnameNotSelf('name')) + account=VExistingUname('name')) @api_doc(api_section.apps) def POST_removedeveloper(self, form, jquery, client, account): if client and account and not form.has_errors('name'): client.remove_developer(account) - jquery('li#app-dev-%s-%s' % (client._id, account._id)).fadeOut() + if account._id == c.user._id: + jquery('#developed-app-%s' % client._id).fadeOut() + else: + jquery('li#app-dev-%s-%s' % (client._id, account._id)).fadeOut() @noresponse(VUser(), VModhash(), diff --git a/r2/r2/templates/prefapps.html b/r2/r2/templates/prefapps.html index 51c03bcc6..3c75b6b90 100644 --- a/r2/r2/templates/prefapps.html +++ b/r2/r2/templates/prefapps.html @@ -32,10 +32,9 @@ ${dev.name} %if c.user == dev: ${_("(that's you!)")} - %else: - ${ajax_ynbutton(_("remove"), "removedeveloper", - hidden_data=dict(client_id=app._id, name=dev.name))} %endif + ${ajax_ynbutton(_("remove"), "removedeveloper", + hidden_data=dict(client_id=app._id, name=dev.name))}