banning: Add the ability to set a note at ban time.

This commit is contained in:
Andre D
2013-05-20 23:33:25 -07:00
committed by Roger Ostrander
parent 3d447c9d18
commit b6607196a6
3 changed files with 20 additions and 2 deletions

View File

@@ -788,6 +788,9 @@ class ApiController(RedditController, OAuth2ResourceController):
# the right one and update its data.
c.user.friend_rels_cache(_update=True)
c.user.add_friend_note(friend, note or '')
if type in ('banned', 'wikibanned'):
container.add_rel_note(type, friend, note)
cls = dict(friend=FriendList,
moderator=ModList,

View File

@@ -5471,6 +5471,11 @@ body:not(.gold) .allminus-link {
.rel-note.edited button[type=submit] { display: inline-block; }
.rel-note.edited input[type=text] { width: 250px; margin-right: 0px; }
.friend-add.edited .ban-reason { display: block; }
.ban-reason {
display: none;
}
.gold-accent h1,
.gold-accent th {

View File

@@ -27,7 +27,7 @@
<% from r2.models import ModeratorPermissionSet %>
<% from r2.lib.pages import ModeratorPermissions %>
<form action="/post/${dest}"
method="post" class="pretty-form medium-text"
method="post" class="pretty-form medium-text friend-add"
onsubmit="return post_form(this, '${dest}')"
id="${add_type}">
<h1>${title}</h1>
@@ -35,7 +35,17 @@
<input type="hidden" name="action" value="add">
<input type="hidden" name="container" value="${container_name}">
<input type="hidden" name="type" value="${add_type}">
<input type="text" name="name" id="name">
%if add_type in ("banned", "wikibanned"):
<label for="name">${_('who to ban?')} &nbsp;</label>
<input type="text" onfocus="$(this).parent('form').addClass('edited')" class="friend-name" name="name" id="name">
<span class="ban-reason">
<label for="note">${_('why the ban?')}</label>
<input type="text" maxlength="300" name="note" id="note">
<span>${_('(will not be visible to user)')}</span>
</span>
%else:
<input type="text" name="name" id="name">
%endif
%if add_type == "moderator_invite":
${ModeratorPermissions(None, 'moderator',
ModeratorPermissionSet(all=True),