misc bugfixes: fixed HTML validation error in captcha; no more multi-creation of new subreddits; tab between login form sensical; no submit link on /reddits; ignore/report on subreddits

This commit is contained in:
KeyserSosa
2008-07-30 14:59:30 -07:00
parent 0e14684f28
commit 7737f63cfe
7 changed files with 23 additions and 20 deletions

View File

@@ -527,7 +527,7 @@ class ApiController(RedditController):
def POST_editcomment(self, res, comment, body):
res._update('status_' + comment._fullname, innerHTML = '')
if res._chk_errors((errors.BAD_COMMENT, errors.COMMENT_TOO_LONG, errors.NOT_AUTHOR),
if not res._chk_errors((errors.BAD_COMMENT,errors.COMMENT_TOO_LONG,errors.NOT_AUTHOR),
comment._fullname):
comment.body = body
if not c.user_is_admin: comment.editted = True

View File

@@ -470,7 +470,7 @@ class SubredditsPage(Reddit):
takes the same arguments as SearchBar, which it uses to construct
self.searchbar"""
searchbox = False
submit_box = False
def __init__(self, prev_search = '', num_results = 0, elapsed_time = 0,
title = '', loginbox = True, infotext = None, *a, **kw):
Reddit.__init__(self, title = title, loginbox = loginbox, infotext = infotext,

View File

@@ -72,9 +72,10 @@ class Report(MultiRelation('report',
thing._incr(cls._field)
# mark author as reported
aid = thing.author_id
author = Account._byID(aid)
author._incr(cls._field)
if hasattr(thing, 'author_id'):
aid = thing.author_id
author = Account._byID(aid)
author._incr(cls._field)
# mark user as having made a report
user._incr('report_made')
@@ -104,8 +105,9 @@ class Report(MultiRelation('report',
for a in set((old_amount, amount, None)):
# clear memoizing around this thing's author
if not r._thing2._loaded: r._thing2._load()
clear_memo('report._by_author', cls, r._thing2.author_id,
amount = a)
if hasattr(r._thing2, "author_id"):
clear_memo('report._by_author', cls, r._thing2.author_id,
amount = a)
for t in (r._thing1, r._thing2):
thing_key = cls._cache_prefix(rel, t.__class__,
@@ -144,10 +146,11 @@ class Report(MultiRelation('report',
# update the author and thing field
if getattr(r._thing2, Report._field) > 0:
r._thing2._incr(Report._field, -1)
aid = r._thing2.author_id
author = Account._byID(aid)
if getattr(author, Report._field) > 0:
author._incr(Report._field, -1)
if hasattr(r._thing2, "author_id"):
aid = r._thing2.author_id
author = Account._byID(aid)
if getattr(author, Report._field) > 0:
author._incr(Report._field, -1)
admintools.report(r._thing2, -1)

View File

@@ -64,7 +64,7 @@ ${captchagen(thing.iden, thing.error)}
<script type="text/javascript">
setMessage($('captcha'), '${_("type the letters from the image above")}');
</script>
%if tabulatar:
%if tabular:
</td>
<td>
%else:
@@ -73,7 +73,7 @@ ${captchagen(thing.iden, thing.error)}
%if show_error:
${error_field("BAD_CAPTCHA", "span")}
%endif
%if tabulatar:
%if tabular:
</td>
</tr>
%endif

View File

@@ -63,7 +63,7 @@ function update_title() {
%endif
<form class="pretty-form sr-form" action="/post/site_admin" method="post"
onsubmit="return post_form(this, 'site_admin')">
onsubmit="return post_form(this, 'site_admin', null, null, true)">
%if thing.site:
<input type="hidden" name="sr" value="${thing.site._fullname}"/>
%endif

View File

@@ -1,4 +1,4 @@
## "The contents of this file are subject to the Common Public Attribution
## The contents of this file are subject to the Common Public Attribution
## License Version 1.0. (the "License"); you may not use this file except in
## compliance with the License. You may obtain a copy of the License at
## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public

View File

@@ -1,4 +1,4 @@
## "The contents of this file are subject to the Common Public Attribution
## The contents of this file are subject to the Common Public Attribution
## License Version 1.0. (the "License"); you may not use this file except in
## compliance with the License. You may obtain a copy of the License at
## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
@@ -28,17 +28,17 @@
<input type="hidden" name="op" value="${op}" />
<input name="user_login"
id="user-${op}"
type="text" maxlength="20"/>
type="text" maxlength="20" tabindex="1"/>
<input id="passwd-${op}"
name="passwd_login"
type="password" maxlength="20"/>
type="password" maxlength="20" tabindex="2"/>
${error_field("WRONG_PASSWORD_" + op, "div")}
<div id="status_${op}" class="error"></div>
<div id="remember-me">
<button class="btn" type="submit">${_("login")}</button>
<input type="checkbox" name="rem"
<button class="btn" type="submit" tabindex="4">${_("login")}</button>
<input type="checkbox" name="rem" tabindex="3"
id="rem-${op}" />
<label for="rem-${op}">
${_("remember me")}</label>