mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Enforce entropy on flag text
This commit is contained in:
parent
1635d8e553
commit
12d3c3b66b
9 changed files with 42 additions and 32 deletions
|
@ -267,19 +267,6 @@ Discourse.TopicController = Ember.ObjectController.extend Discourse.Presence,
|
|||
actionType.loadUsers()
|
||||
false
|
||||
|
||||
like:(e) ->
|
||||
like_action = Discourse.get('site.post_action_types').findProperty('name_key', 'like')
|
||||
e.context.act(like_action.get('id'))
|
||||
|
||||
# log a post action towards this post
|
||||
act: (action) ->
|
||||
action.act()
|
||||
false
|
||||
|
||||
undoAction: (action) ->
|
||||
action.undo()
|
||||
false
|
||||
|
||||
showPrivateInviteModal: ->
|
||||
modal = Discourse.InvitePrivateModalView.create(topic: @get('content'))
|
||||
@get('controllers.modal')?.show(modal)
|
||||
|
|
|
@ -28,12 +28,11 @@ window.Discourse.ActionSummary = Em.Object.extend Discourse.Presence,
|
|||
@set('can_act', false)
|
||||
@set('can_undo', true)
|
||||
|
||||
#TODO: mark all other flag types as acted
|
||||
|
||||
# Add ourselves to the users who liked it if present
|
||||
@users.pushObject(Discourse.get('currentUser')) if @present('users')
|
||||
|
||||
# Create our post action
|
||||
promise = new RSVP.Promise()
|
||||
jQuery.ajax
|
||||
url: "/post_actions",
|
||||
type: 'POST'
|
||||
|
@ -44,8 +43,9 @@ window.Discourse.ActionSummary = Em.Object.extend Discourse.Presence,
|
|||
error: (error) =>
|
||||
@removeAction()
|
||||
errors = jQuery.parseJSON(error.responseText).errors
|
||||
bootbox.alert(errors[0])
|
||||
|
||||
promise.reject(errors)
|
||||
success: -> promise.resolve()
|
||||
promise
|
||||
|
||||
# Undo this action
|
||||
undo: ->
|
||||
|
|
|
@ -55,11 +55,11 @@ window.Discourse.ActionsHistoryView = Em.View.extend Discourse.Presence,
|
|||
return false
|
||||
|
||||
if actionTypeId = $target.data('act')
|
||||
@get('controller').act(@content.findProperty('id', actionTypeId))
|
||||
@content.findProperty('id', actionTypeId).act()
|
||||
return false
|
||||
|
||||
if actionTypeId = $target.data('undo')
|
||||
@get('controller').undoAction(@content.findProperty('id', actionTypeId))
|
||||
@content.findProperty('id', actionTypeId).undo()
|
||||
return false
|
||||
|
||||
false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
window.Discourse.FlagView = Ember.View.extend
|
||||
window.Discourse.FlagView = Discourse.ModalBodyView.extend
|
||||
templateName: 'flag'
|
||||
title: Em.String.i18n('flagging.title')
|
||||
|
||||
|
@ -12,8 +12,9 @@ window.Discourse.FlagView = Ember.View.extend
|
|||
|
||||
createFlag: ->
|
||||
actionType = Discourse.get("site").postActionTypeById(@get('postActionTypeId'))
|
||||
@get("post.actionByName.#{actionType.get('name_key')}")?.act(message: @get('customFlagMessage'))
|
||||
$('#discourse-modal').modal('hide')
|
||||
@get("post.actionByName.#{actionType.get('name_key')}")?.act(message: @get('customFlagMessage')).then ->
|
||||
$('#discourse-modal').modal('hide')
|
||||
, (errors) => @displayErrors(errors)
|
||||
false
|
||||
|
||||
customPlaceholder: (->
|
||||
|
|
|
@ -7,7 +7,7 @@ window.Discourse.ModalBodyView = window.Discourse.View.extend
|
|||
|
||||
# Pass the errors to our errors view
|
||||
displayErrors: (errors, callback) ->
|
||||
@set('parentView.modalErrorsView.errors', errors)
|
||||
@set('parentView.parentView.modalErrorsView.errors', errors)
|
||||
callback?()
|
||||
|
||||
# Just use jQuery to show an alert. We don't need anythign fancier for now
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue