Permalink
Browse files

Subreddit: Do not show saved text on conflict error

  • Loading branch information...
1 parent 2cf9000 commit 6e976a367e16b8eaea404278ffb40d2494fe1040 @andre-d committed Sep 26, 2012
Showing with 22 additions and 17 deletions.
  1. +22 −17 r2/r2/controllers/api.py
View
@@ -1523,21 +1523,25 @@ def apply_wikid_field(sr, form, pagename, value, prev, field, error):
prev_pubdesc = request.post.get('prev_public_description_id')
def update_wiki_text(sr):
- apply_wikid_field(sr,
- form,
- 'config/sidebar',
- description,
- prev_desc,
- 'description',
- _("Sidebar was not saved"))
-
- apply_wikid_field(sr,
- form,
- 'config/description',
- public_description,
- prev_pubdesc,
- 'public_description',
- _("Description was not saved"))
+ error = False
+ if not apply_wikid_field(sr,
+ form,
+ 'config/sidebar',
+ description,
+ prev_desc,
+ 'description',
+ _("Sidebar was not saved")):
+ error = True
+
+ if not apply_wikid_field(sr,
+ form,
+ 'config/description',
+ public_description,
+ prev_pubdesc,
+ 'public_description',
+ _("Description was not saved")):
+ error = True
+ return not error
#if a user is banned, return rate-limit errors
@@ -1609,7 +1613,7 @@ def update_wiki_text(sr):
#assume sr existed, or was just built
old_domain = sr.domain
- update_wiki_text(sr)
+ success = update_wiki_text(sr)
if not sr.domain:
del kw['css_on_cname']
@@ -1627,7 +1631,8 @@ def update_wiki_text(sr):
# flag search indexer that something has changed
changed(sr)
- form.parent().set_html('.status', _("saved"))
+ if success:
+ form.parent().set_html('.status', _("saved"))
if form.has_error():
return

0 comments on commit 6e976a3

Please sign in to comment.