Simplify the collaborative creation of a new post in a thread

I find our core group repeating the following workflow pattern:

  • create a wiki-post inside a thread to prepare a new topic
  • work on it, keep the discussion in the same thread
  • move it to a new topic in a different category when ready

While working on it, we write the proposed title for the topic in the first row of the wiki-post as a H1 header:

# new Title

new content

The “move step” is a little tedious:

  • edit the wiki to remove the new heading, keep the title in copy paste memory
  • select the post to be moved to another topic
  • paste the heading
  • choose category
  • publish

I’m dreaming of a simplified workflow

  • select “publish to new thread” from the wrench menu of the post
  • choose category
  • publish

which would remove the first topic line and choose its value as the preset for a new topic automatically.

Would such behaviour be realizable by a theme component?

1 Like

This seems similar to shared drafts.

3 Likes

I think it’s perfectly fine. This only needs to send two ajax requests, one to get the original text, and one to process the content and post it as a post.

Wait a minute, I’ll give a critical part of the code

const post_id = 1327039; // You should do some operations before to get the desired post id

$.ajax(`/posts/${post_id}/raw.json`).then(res => {
  const [text, title, raw] = res.match(/\s*#\s+([^\n]+)([\s\S]*)/);
  $.ajax("/posts.json", {
    type: "POST",
    data: {
      raw,
      title,
      category: YOUR_CATEGORY_ID,
    },
  });
});

Building a good-looking and easy-to-use front end should be the most difficult part of this theme component

2 Likes