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

I found a way to do this a while back for our wordpress articles, but then found an alternative solution: https://meta.discourse.org/t/how-to-create-a-follow-button-for-a-topic-and-post-it-on-an-external-website/91266/2

  1. It looks like it should work in our maps/docus integration, if we can automate it to fire for the current user on each thread created when creating a new post.

  2. Another possibility would be to automatically create a ‘general’ post from the user in each Discourse thread created, when posting something new to the maps.

  3. Discourse does allow post creation via email so that’s also an option.

@syl did you put any more thought into this?

@AndyatFocallocal, I will start working on this today.

1 Like

Thank you. Sorry for not getting around to testing out the WordPress plugin. Atm is just me working on the WordPress site, and I’m very much swamped with other tasks

@AndyatFocallocal, the feature is now implemented. See here: https://github.com/sylque/docuss/issues/10#issuecomment-529235980.

You will need to upgrade both the Docuss plugin and the dcs-client Meteor package in fl-maps.

1 Like

That’s awesome!

@SuperTom @ArtyS could either of you upgrade that for us?

@msgfxeg this would be number 2 priority task as its a usability breaking issue on both maps (they use the same code and differences are defined in i18n).

it will require a little reading on #docuss. basically what we have now on the maps is a system where users can post, and others can comment using our discourse integration. right now the person who filled in the form to post the resource/event onto the map will not receive notifications when someone comments on their post. Syl’s change above means OP will be automatically subscribed to the discourse threads created.

The integration will probably take a little time to wrap your head around. Fortunately the creator of discourse @syl is here and is very eager to help and knowledgeable. @ArtyS is also an excellent developer who has a good understanding of our code and the integration. He’s going through a busy period and isn’t coding right now, but always eager to answer questions - and i have a basic understanding and will help as much as i can :slight_smile:

1 Like

@AndyatFocallocal Actually I could not understand a word!
Would you kindly send me a documentation to the whole system so that I can read and understand your whole system first so that I may be able to understand the details of any task.

1 Like

I just found this. Weird that I missed it. I think I already sent your link in DMs didn’t I?

Just to update this as we are about to push out BTM in a few days to help with the COVID 19 crisis.

Task: Please Add this code so users receive notifications. The code author is @syl who doesn’t want to get his hands into Reactjs code, but is very happy to answer any questions we may have. Sylvain would that be added to this file?

No, it needs to be added in the JavaScript code (client-side): when the user creates a new events, the corresponding Docuss tags (in your case “photos”, “videos” and “stories”) have to be created right away.

1 Like

Hello @syl ! Where this code should be added exactly ?

1 Like

@ArtyS might also be able to answer this

@syl @green-loutre i’m just connecting you both here :slight_smile:

@green-loutre, the code should be called whenever someone creates a new event.
Please tell me when you found the location in the app code and I will check how the Docuss API should be called.

1 Like

that sounds like it’ll be connected to the form code here: https://github.com/focallocal/fl-maps/tree/master/imports/client/ui/pages/NewEvent/FormWizard

I guess it’s there:

callNewEvent = model => {
Meteor.call(‘Events.newEvent’, model, (err, res) => {
if (!err) {
this.setState({ currentStep: 0 }) // return to first step
window.__recentEvent = { …model, _id: res }
this.props.history.push(’/thank-you’)
}
window.NProgress.done()
if (Meteor.isDevelopment) { console.log(err) }
})
}

So what is the new code and what it is supposed to do?

1 Like

When a user posts something on the map three new Discourse threads are created. This code will subscribe the poster to those threads meaning that they get notified if anyone comments on their post

You would just code it directly into the Masterwithout_DCS branch in GitHub. Let me know and I’ll approve your PR. Then we wait 15mins for compiling to finish and then test it

@zofrex unless your testing server is better?