chat: allow admins to remove other people's messages

This commit is contained in:
Tyler Renelle 2013-05-19 15:02:04 +01:00
parent 92e8e5b597
commit ae4c5723e0
2 changed files with 4 additions and 2 deletions

View file

@ -134,7 +134,9 @@ module.exports.app = (appExports, model, app) ->
return next() unless e.keyCode is 13
appExports.tavernSendChat()
appExports.deleteChatMessage = (e) -> e.at().remove() #requires the {#with}
appExports.deleteChatMessage = (e) ->
if confirm("Delete chat message?") is true
e.at().remove() #requires the {#with}
app.on 'render', (ctx) ->
$('#party-tab-link').on 'shown', (e) ->

View file

@ -63,6 +63,6 @@
class="label {{#if @message.npc}}label-success{{else if @message.contributor}}label-inverse{{else if equal(@message.uuid,_user.id)}}label-info{{/}} chat-message"
rel='tooltip' title="{{@message.contributor}}{{@message.npc}}">
{{@message.user}}</span> {{@message.text}} - <span class='muted time'>{relativeDate(@message.timestamp, _currentTime)}
{{#if equal(@message.uuid,_user.id)}}{{#with @message}}<a x-bind="click:deleteChatMessage"><i rel=tooltip title=Delete class=icon-remove></i></a>{{/}}{{/}}
{{#if or(_user.backer.admin,equal(@message.uuid,_user.id))}}{{#with @message}}<a x-bind="click:deleteChatMessage"><i rel=tooltip title=Delete class=icon-remove></i></a>{{/}}{{/}}
</span>
</li>