Permalink
Browse files

Fix the "clear all flair templates" button for link flair.

  • Loading branch information...
1 parent f544a14 commit 178da70e434f4f4008bcae647592cb17a0ba99a0 Logan Hanks committed Apr 10, 2012
Showing with 6 additions and 3 deletions.
  1. +5 −3 r2/r2/controllers/api.py
  2. +1 −0 r2/r2/templates/flairtemplatelist.html
View
8 r2/r2/controllers/api.py
@@ -2385,10 +2385,12 @@ def POST_deleteflairtemplate(self, form, jquery, flair_template):
ModAction.create(c.site, c.user, action='editflair',
details='flair_delete_template')
- @validatedForm(VFlairManager(), VModhash())
+ @validatedForm(VFlairManager(), VModhash(),
+ flair_type = VOneOf('flair_type', (USER_FLAIR, LINK_FLAIR),
+ default=USER_FLAIR))
@api_doc(api_section.flair)
- def POST_clearflairtemplates(self, form, jquery):
- FlairTemplateBySubredditIndex.clear(c.site._id)
+ def POST_clearflairtemplates(self, form, jquery, flair_type):
+ FlairTemplateBySubredditIndex.clear(c.site._id, flair_type=flair_type)
jquery.refresh()
ModAction.create(c.site, c.user, action='editflair',
details='flair_clear_template')
View
1 r2/r2/templates/flairtemplatelist.html
@@ -52,6 +52,7 @@
</div>
<form class="clearflairtemplates"
method="post" action="/api/clearflairtemplates">
+ <input type="hidden" name="flair_type" value="${thing.flair_type}" />
<button class="flairtemplateclear">
${_("clear all flair templates")}
</button>

0 comments on commit 178da70

Please sign in to comment.