Skip to content

Commit

Permalink
banning: Add the ability to set a note at ban time.
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-d authored and Roger Ostrander committed May 22, 2013
1 parent 3d447c9 commit b660719
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions r2/r2/controllers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,9 @@ def POST_friend(self, form, jquery, ip, friend,
# 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,
Expand Down
5 changes: 5 additions & 0 deletions r2/r2/public/static/css/reddit.less
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 12 additions & 2 deletions r2/r2/templates/userlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,25 @@
<% 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>

<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),
Expand Down

0 comments on commit b660719

Please sign in to comment.