It's feedback Tuesday

* give some feedback to the user when they create a reddit
* give some feedback to the user when creating their reddit fails
* tell the user how to complain to feedback if their reddit is banned
* give some feedback to the user when they send feedback (yo dawg)
This commit is contained in:
ketralnis
2009-02-24 15:26:53 -08:00
parent 8af369539f
commit c3cc83d041
6 changed files with 35 additions and 17 deletions

View File

@@ -125,7 +125,7 @@ class ApiController(RedditController):
else:
emailer.ad_inq_email(email, message, name = name or '',
reply_to = replyto or '')
form.set_html(".success", _("thanks for your message! "
form.set_html(".status", _("thanks for your message! "
"you should hear back from us shortly."))
form.set_inputs(personal = "", captcha = "")
@@ -946,7 +946,10 @@ class ApiController(RedditController):
c.errors.add(errors.USED_CNAME)
if not sr and form.has_errors(None, errors.RATELIMIT):
pass
# this form is a little odd in that the error field
# doesn't occur within the form, so we need to manually
# set this text
form.parent().find('.RATELIMIT').html(c.errors[errors.RATELIMIT].message).show()
elif not sr and form.has_errors("name", errors.SUBREDDIT_EXISTS,
errors.BAD_SR_NAME):
form.find('#example_name').hide()
@@ -968,7 +971,7 @@ class ApiController(RedditController):
sr._incr('_ups', 1)
sr.add_moderator(c.user)
sr.add_contributor(c.user)
redir = sr.path + "about/edit/"
redir = sr.path + "about/edit/?created=true"
if not c.user_is_admin:
VRatelimit.ratelimit(rate_user=True,
rate_ip = True,

View File

@@ -26,6 +26,7 @@ from pylons.middleware import error_document_template, media_path
from pylons import c, request, g
from pylons.i18n import _
import random as rand
from r2.lib.filters import safemarkdown, unsafe
try:
# place all r2 specific imports in here. If there is a code error, it'll get caught and
@@ -33,7 +34,7 @@ try:
from reddit_base import RedditController
from r2.models.subreddit import Default, Subreddit
from r2.lib import pages
from r2.lib.strings import rand_strings
from r2.lib.strings import strings, rand_strings
except Exception, e:
if g.debug:
# if debug mode, let the error filter up to pylons to be handled
@@ -113,7 +114,10 @@ class ErrorController(RedditController):
def send404(self):
c.response.status_code = 404
if c.site._spam and not c.user_is_admin:
res = pages.RedditError(_("this reddit has been banned."))
message = (strings.banned_subreddit % dict(link = '/feedback'))
res = pages.RedditError(_('this reddit has been banned'),
unsafe(safemarkdown(message)))
return res.render()
else:
return pages.Reddit404().render()

View File

@@ -227,8 +227,10 @@ class FrontController(RedditController):
return self.abort404()
@base_listing
@validate(location = nop('location'))
def GET_editreddit(self, location, num, after, reverse, count):
@validate(location = nop('location'),
created = VOneOf('created', ('true','false'),
default = 'false'))
def GET_editreddit(self, location, num, after, reverse, count, created):
"""Edit reddit form."""
if isinstance(c.site, FakeSubreddit):
return self.abort404()
@@ -237,7 +239,10 @@ class FrontController(RedditController):
is_moderator = c.user_is_loggedin and c.site.is_moderator(c.user) or c.user_is_admin
if is_moderator and location == 'edit':
pane = CreateSubreddit(site = c.site)
pane = PaneStack()
if created == 'true':
pane.append(InfoBar(message = _('your reddit has been created')))
pane.append(CreateSubreddit(site = c.site))
elif location == 'moderators':
pane = ModList(editable = is_moderator)
elif is_moderator and location == 'banned':

View File

@@ -624,10 +624,12 @@ class InfoBar(Wrapped):
class RedditError(BoringPage):
site_tracking = False
def __init__(self, msg):
BoringPage.__init__(self, msg, loginbox=False,
def __init__(self, title, message = None):
if not message:
message = title
BoringPage.__init__(self, title, loginbox=False,
show_sidebar = False,
content=ErrorPage(msg))
content=ErrorPage(message))
class Reddit404(BoringPage):
site_tracking = False
@@ -1192,4 +1194,3 @@ class PromoteLinkForm(Wrapped):
timedeltatext = timedeltatext,
listing = listing,
*a, **kw)

View File

@@ -89,7 +89,7 @@ string_dict = dict(
moderator = _('below are the reddits that you have moderator access to.')
),
sr_subscribe = _('click the ![add](/static/sr-add-button.png) or ![remove](/static/sr-remove-button.png) buttons to choose which reddits appear on your front page.'),
sr_subscribe = _('click the `add` or `remove` buttons to choose which reddits appear on your front page.'),
searching_a_reddit = _('you\'re searching within the [%(reddit_name)s](%(reddit_link)s) reddit. '+
'you can also search within [all reddits](%(all_reddits_link)s)'),
@@ -107,6 +107,11 @@ string_dict = dict(
submit_box_text = _('to anything interesting: news article, blog entry, video, picture...'),
permalink_title = _("%(author)s comments on %(title)s"),
link_info_title = _("%(title)s : %(site)s"),
banned_subreddit = _("""this reddit has been banned. please inform [feedback](%(link)s)
if you feel that this is in error, or that you are the target
of a well-coordinated international conspiracy to silence you
and your kind. but if it's the latter, it's probably already
too late. who can you trust?"""),
)
class StringHandler(object):

View File

@@ -22,9 +22,6 @@
<%namespace file="utils.html" import="error_field"/>
<p id="success" class="error">${thing.success or ''}
</p>
%if thing.title:
<h1>${thing.title}</h1>
%endif
@@ -38,8 +35,11 @@
action=''
%endif
method="post" class="content" id="feedback">
<p class="success" class="error">${thing.success or ''}
</p>
%if c.user_is_loggedin:
<input type="hidden" name="whodunnit" value="${c.user.name}" />
<input type="hidden" name="whodunnit" value="${c.user.name}" />
%endif
<input type="hidden" name="reason" value="${thing.action}" />
<div>