This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/views/excerpt/excerpt_user_view.js.coffee
2013-02-07 16:45:24 +01:00

19 lines
791 B
CoffeeScript

window.Discourse.ExcerptUserView = Ember.View.extend
privateMessage: (e) ->
$target = @get("link")
postView = Ember.View.views[$target.closest('.ember-view')[0].id]
post = postView.get("post")
url = post.get("url")
username = post.get("username")
Discourse.router.route('/users/' + Discourse.currentUser.username.toLowerCase() + "/private-messages")
# TODO figure out a way for it to open the composer cleanly AFTER the navigation happens.
composerController = Discourse.get('router.composerController')
composerController.open
action: Discourse.Composer.PRIVATE_MESSAGE
usernames: username
archetypeId: 'private_message'
draftKey: 'new_private_message'
reply: window.location.href.split("/").splice(0,3).join("/") + url