Import posts using author's discourse username

(Justin Leveck) #1

I have developed a feature to allow users to specify a xml key that contains the discourse_username to embed a particular post as. I have added additional functionality to allow discourse to know which discourse_username to embed a post under when importing on-the-fly through adding an additional javascript variable to the embed.js code.

This is my first contribution to Discourse. Hopefully this can get merged in as it applies to our particular use case where we are using discourse to provide commenting for our internal tech blog (middleman) where there are multiple authors who all need to be contacted when someone makes a comment on the articles they have written.

The current feature requires that one discourse_username is used which all imported topics are created on behalf of.

The contributing doc seems to suggest a topic be created before submitting a pull request. The code I intend to submit for initial review is on a branch in my forked copy.

<script type="text/javascript">
  var discourseUrl = '',
      discourseUserName = 'justin_leveck',
      discourseEmbedUrl = '';

  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);

(Justin Leveck) #2