Users posting a resource are automatically subscribed ('following') the Discourse topics on their page

There is no need to install anything, as everything is already set up:

  • The dcs-discourse-plugin is already installed in your Discourse instance
  • The dcs-client package is already added to your Meteor build

I think what remains to be done is only to find the right location and insert this code:

import { comToPlugin } from 'dcs-client'

// Get the routeMatcher declared in /imports/client/ui/app.js
const routeMatcher = ...

...
// Place in the code where an event has been successfully created
function onCreateEvent(eventId) {
  // Get the page name from the app route. See the doc here:
  // https://github.com/sylque/dcs-simple-route-matcher
  const pageName = routeMatcher.getPageName('/page/' + eventId)

  // Create the Discourse tags with notificationLevel=Watching. See doc here:
  // https://github.com/sylque/dcs-client/blob/master/comToPlugin.md#create-docuss-tags-in-advance
  comToPlugin.postCreateDcsTags({
    pageName,
    triggerIds: ['photos', 'videos', 'stories'],
    notificationLevel: 3
  })
}

The page name can also be retrieved like this:
EDIT: NOPE, I DON’T THINK THIS CAN WORK
import websiteJSON from ‘…/…/…/public/dcs-website.json’

function onCreateEvent(eventId) {
const pageNamePrefix = websiteJSON.webApp.otherPagesPrefix
const pageName = pageNamePrefix + eventId

}

1 Like