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

@syl, @Zahra just sent me this which sounds the same as the issue which caused @green-loutre troubles last week :

My understanding is that dcs client needs to be installed and then the plugin imported so it can be accessed by the relevant component first’

I thought that we removed the plugin from the React site and were using the Discourse plugin instead now. Is it possible that the confusion is because the guide they are following in your documentation is for sites which have Docuss installed directly into their React platform, which we moved away from for the Discourse 1st system you created? Or am I misinterpreting what’s catching everyone out? There seems to be something which isn’t intuitive from following the guide you linked.

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

I have added the above code but it does not seem to have fixed the problem. What is the best way to debug this? Maybe the pagename is not being passed in correctly, what should it look like?

1 Like

Did you make the commit to master, and also push to the deploy branches? If not then it could because I’ve not set up Discourse on the testing server yet

@AndyatFocallocal @syl

I have made the change to deploy-btm and now getting a console error when creating a new resource in btm: v.comToPlugin.postCreateDcsTags is not a function

my import looks like this:
import { comToPlugin } from ‘dcs-client’

1 Like

@syl just tagging you here to see if you get notifications again

Yes, I do!

Are you using the latest version of npm package dcs-client? It should be 1.0.20. You can check this in your package.json file.

@syl no we’re on 1.0.13. How do we upgrade that?

@Zahra can you handle that or do you need support from Syl?

1 Like

You need to run npm update in your app folder.

2 Likes

@syl @AndyatFocallocal

I have updated the dsc-client package to 1.0.20 and the function is being called as expected now, but still no notification and no errors.

I’m passing the following to the function:

{
pageName: ‘m_gather’,
triggerIds: [‘photos’, ‘videos’, ‘stories’],
notificationLevel: 3
}

m_gather doesn’t look like an event page name. I think event page names are all of the form m_0, m_1, etc. Here is a sample event url: https://publichappinessmovement.com/docuss/m_0

So would it be m_* to include them all, or is that a single function you are calling as a test @Zahra

Okay it was unclear what the event id should be, will take a look at this later this afternoon.

1 Like

@AndyatFocallocal i have changed this to use the event id and it still is not working - its been pushed to deploy-btm and deploy-phm

1 Like

@syl you can see Zahra’s changes here: https://github.com/focallocal/fl-maps/commits/deploy-btm. Can you see any reason it’s not working?

@Zahra can you please push all changes to Master branch as well. I just wrote up some documentation
here: Getting Started: Making a PR or Commit via Github

@Zahra, in my previous post here, I suggested 2 options to build the Docuss page name corresponding to a newly created event. You chose to implement my second (and simplest) option. However, I’m now realizing this option doesn’t work (I’ve edited my previous post to remove it). So you need to use option 1. Sorry for the confusion.

P.S.: from what I see in your code, you got the event id right.

1 Like

@syl @AndyatFocallocal

Hi guys, i have updated the code to use the route matcher to get the page name instead. It pulls the the page name successfully, the last one i created the page name was ‘m_1q’.

Passing this into postCreateDcsTags still doesnt seem to do the job though. I get a console error when opening the discussion pages:

Latest dcs-d - Docuss Error - Category “General Discussion” not found in Discourse

Is there a step missing from this? Does a particular category need to be sent with the request as well?

1 Like

FYI my changes are only in deploy-btm at the moment

1 Like