Deleting Posts using the rails console leads to a negative reply count in the Topic list
./discourse-setup not working?
@Everett_Hamilton wrote:
I'm following off this guide https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#install-discourse to install discourse/docker/ on digitalocean. When I get to .the point where I need to type in ./discourse-setup
I get told that there is no such file. I'm in root as well am I suppose to type something before typing ./discourse-setup
Posts: 6
Participants: 2
Setting up webhooks
@fantasticfears wrote:
Webhooks is not merged to master yet, but you can check out
gsoc_webhooks
branch. Please don't hesitate to leave comments on webhooks feedback.Webhook is a way to notify external services about changes on the internet. It's easier to setup, manage and develop than a Discourse plugin. Though, it does require you to program a little bit or understand its technical details.
In this #howto, I'll set up webhook to power a Github bot for referencing pull request brought in a forum. We'll want to see a new comment on Github pull request when a new post has a link to it.
It's a very simple process:
- Publish a new post.
- A webhook event happens, the payload about the new post is sent to the bot on Heroku.
- The bot on heroku parses the payload and check Github for existing comments. Then it creates comment when it feels appropriate.
Setting up the webhook
Firstly, we need a webhook to feed our Github bot. Go to
Webhook
panel and create a new webhook.A webhook will simply
POST
the payload to the given url.https
is strongly recommended. A webhook event may contain sensitive information, for example a reply to message. It may reveal information only available to staff since the payload is generated bysystem
user. You must fully trust this URL. Here we take a heroku app as an example. (No dash allowed in the url, will fix soon.)There are two content types available,
application/json
andapplication/x-www-form-urlencoded
. We prefer json encoding.The secret is an optional secret key for generate a signature for given webhook event. It's shared among you and URL you've set. Once added, there will be a
X-Discourse-Event-Signature
in the HTTP header. It's computed by sha256. It's strongly recommended to set up one and verify as the instruction (see below).For this example, we only make use of post event. You can definitely choose event type you need. Check
Send me everything
to receive every event, even the event type we will add in the future.Triggered categories/groups are advanced features which allows you to filter some event. For example, if only you cares about Staff category, you can add Staff category so that topic event will happen accordingly.
Then, we checked TLS certificate so that we can avoid some network attacks and keep your information secure.
At last, checked active and click create!
Monitor how is the webhook
Click
Go to events
or click status information on the left side of webhook list.
Go to list
andEdit webhook
allows you to jump around.Ping
is a special button to send a empty event (with no actual payload). It can help you to test your configuration. You should check out your service's log to see if you receive a Ping event.You can also read every event to see how it works. We shows the response status code, event id, event happened time and completion time of each event. If you want, the request/response headers and body are available. If you are debugging webhook or your service,
Redeliver
button can help you to send the exact request again.Setting up a Github bot
We want to have a service to notify every mentions to the pull request. We'll achieve that by hosting a bot on Heroku. It receives webhook event from a Discourse instance and process accordingly.
The code is available here. Simply publish this to a Heroku dyno. Then you'll need to set up some config envs in the setting page. Check out readme of that repo.
Try it by a reply!
We'll just need an url to the pull request.
Nailed it!
Verify and parse webhook event
Let's dive in how it works so you can build yourself one. The flow is simple.
- Check out
X-Discourse-Event-Id
andX-Discourse-Event-Type
to see whether you are interested.- Get payload by reading
Content-Length
andContent-Type
.- Compute sha256 HMAC of raw payload.
To be noted,
X-Discourse-Event-Signature
consists ofsha256=
and hmac of raw payload.Webhook event type explanation
The event type is a big category of several
DiscourseEvent
under the hood.Topic event
Can be restricted by categories.
Event:topic_created
,topic_destroyed
,topic_recovered
.Post event
Event:
post_created
,post_destroyed
,post_recovered
,validate_post
.Webhook usages
As you can see, webhook is simply a standard and configured way to notify external services. If you are looking for some kinds of extensions to Discourse based on changes (events) on the forum, consider webhooks. It will be sure to help you with a loosely coupled system. And it shall be much more stable to maintain.
Posts: 1
Participants: 1
Webhooks feedback
@fantasticfears wrote:
Webhook is not merged to master yet, but you can check out
gsoc_webhooks
to try it. See Setting up webhooks for instructions.Webhooks is my GSoC projects which ends in Aug 23. It's fully operating but I would keep improving it on more event types as well as payload improvement. I would like to hear comments about how you like to use it. The question like I need X in the payload and I need more information in the payload is generally welcomed.
This topic works as a progress report and feedback topic. Please leave your comments and questions.
Code
Code is listed in
gsoc_webhooks
branch.Demo bot: https://github.com/fantasticfears/discourse-webhook-github-issue
Highlights
If you are looking for instruction for webhooks, take a look at this #howto.
Event type and event name
For example,
post_created
andpost_destroyed
are two events for plugin authors. Webhooks also take advantage of that. Once such event happens internally, a webhook may be also triggered. Let's assume a webhook enables post event.
So,post_created
orpost_destroyed
happend. The webhook triggered.X-Discourse-Event-Type: post
with post json is sent to you.Do you need event name in the webhook? And how does that helps your application?
- Yes
- No
0voters
Event payload serialization
For example, the payload of post event is the exact same as Ember application gets. But the operator is our system user so that
can_edit?
is also sent to you which I believe there aren't anything useful to your application.Do you want me to omit those fields? Or what else information do you need?
- Yes
- No
0voters
Webhook event list
In our event delivery list, new event is not updated unless you refresh the page. And recent status is updated in the webhook list. Do you think it's necessary to notice those changes in real time? How does that helps?
- Yes
- No
0voters
Posts: 4
Participants: 3
Can i wrote forum software with golang, port code/resources from discourse
@netroby wrote:
Can i wrote forum software with golang, port code/resources from discourse.
I would like to wrote a forum software using golang.
I like discourse. but i do not like ruby. so i want to port discourse with golang.
Can I do this?
Posts: 3
Participants: 2
Redirect to discourse from a route in another domain
@mangelsnc wrote:
Hi!
I need to put the discourse forum under a URL like
https://mydomain.com/forum
.I have installed NGinx in the server which hosts discourse (forum.mydomain.com) , and redirected it to the discourse instance, something similar to this: https://serversforhackers.com/video/installing-discourse-with-docker but without divide it in 3 containers.
In
mydomain.com
server I have the next configuration:location /forum { rewrite ^/forum/(.*) /$1 break; proxy_pass https://forum.mydomain.com; proxy_redirect off; proxy_buffering off; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
And the configuration of
forum.mydomain.com
is:upstream discourse { server 127.0.0.1:8080; } server { listen 80 default_server; server_name mydomain.com/forum; return 301 https://mydomain.com/forum$request_uri; } server { listen 443 default_server ssl; client_body_buffer_size 32k; client_header_buffer_size 8k; large_client_header_buffers 8 64k; root /var/www/discourse/public; index index.html index.htm; access_log /var/log/nginx/discourse.log; error_log /var/log/nginx/discourse.log error; server_name mydomain.com/forum; merge_slashes on; charset utf-8; ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; location ~ /.well-known { allow all; } location / { include proxy_params; proxy_pass http://discourse; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
When I access to
https://mydomain.com/forum
it redirects me to the forum, but fails loading CSS and shows the next error:Oops! That page doesn’t exist or is private.
There's anyone in the room who has did this and succeed?
I'm open to any tutorial or simplest way to do this.
Thanks!
Posts: 1
Participants: 1
Problems with Aruba
@Trash wrote:
One of my user send me a PM because he doesn't receive emails from our forum.
Months ago we disabled the digest mail and set the max emails per day per user to 1 (before this new email setting he have no problem with emails)
In
admin/email/send
I see that the mail was send:He always check the spam folder and also webmail.aruba. but he do not find any emails from the forum.
With other provider (hotmail, gmail etc...) it seems there is no problem.
No errors inadmin/logs
for emails.Is there something wrong?
Posts: 1
Participants: 1
Paginating API search results
@mbajur wrote:
Hello there!
I'm running a forum on which, in one of all the categories, users are posting a lot of youtube links. I would love to build some third-party youtube player on top of that but can't quite invent how could i fetch such data by a third party app.
The most obvious way of doing that would be to use a search API and search for "youtube.com" string in desired category but, if i understand discourse code well, there is a limit of search results that can be fetched. It's hardcoded to 50 results i think.
And with that info given, the only way that comes to my mind is to fetch search results periodically with a CRON and store them on that third-party app side. But, any other ideas are welcome
Anyway - are you guys planning to support search API pagination?
Posts: 3
Participants: 2
How could onebox support m3u8 hls files?
@benyang wrote:
I know mp4 files are supported if I put the direct link of the medea files like:
http://www.example.com/video.mp4.
But how could m3u8 files be supported? I have some self-hosted videos and I would like to embeded them in the post in the form of m3u8.
Posts: 1
Participants: 1
Wordpress not displaying Avatars
@damienbowman wrote:
I'm newish here, but did a search and couldn't find this issue. Wordpress and Discourse are both behind Memberful, but more importantly, the Wordpress site is HTTPs and Discourse is HTTP. Whenever we comment on a column, we see broken avatars. I checked the image source and the avatars are trying to pull HTTPs instead of HTTP.
This is similar to, but not exactly the same as Emojis Not Displaying / Old Avatar Styles, so I'm hoping for a quick solution and/or some suggestions. I did not try the re-write because I'm not sure it will work, but can try if anyone thinks that will work. I'd need to know where to put the re-write and the text to insert.
Wordpress site with comment: https://www.campuspressbox.com/2016/leonard-fournette-skipping-2016-silly/ The comment is at the bottom.
Thanks.
Posts: 4
Participants: 3
"Your search term is too short" message when no search term is entered at all
@meglio wrote:
This might be considered a bit confusing:
I have not entered any text yet, but it already says that my search term is too short (while there is no search term at all).
Maybe for zero-length input we should say something different, e.g.:
Enter at least {n} chars to start the search
Posts: 5
Participants: 4
Sidekiq Gem::ConflictError
@Overgrow wrote:
Hi, I've stumbled upon this issue, hard to tell what I've done wrong and changed in the process. My sidekiq was working well but suddenly I can't start it...
overgrow@axii:~/discourse$ sidekiq
/home/overgrow/.rbenv/versions/2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/specification.rb:2288:in `raise_if_conflicts': Unable to activate actionpack-5.0.0, because rack-1.6.4 conflicts with rack (~> 2.0) (Gem::ConflictError)
overgrow@axii:~/discourse$ gem list --local | grep rack
rack (2.0.1, 1.6.4)
overgrow@axii:~/discourse$ gem list --local | grep actionp
actionpack (5.0.0, 4.2.7)I've already tried running
bundle install
Posts: 3
Participants: 1
Vbulletin to Discourse migration issues(ThreadSubscription & Topic title in img alt)
@junaid_pk14 wrote:
Hello Guys,
We are migrating our forum from Vbulletin to Discourse. We are facing following issues, can you please
review these and share you feedback? Thanksks1- Vbulletin has support of adding title in the attached image alt tags in topic & threads but Discourse don't have such functionality. Is there any
configuration in Discourse to apply this behaviour or any plugin that can help to achieve this?
2- We have around 0.35 million thread subscriptions. Discourse 1.6 import script don't have option to import it. This is very important to
retain traffic as per our Marketing team. Is Discourse team have any plan to import or i can explore code to write migration script for that.Regards,
Junaid
Posts: 2
Participants: 2
Digital Ocean / Discourse Docker Upgrade Fail
@Rick_Leckrone wrote:
Ugh. Really in a bad spot. Was told in admin that I needed to upgrade Docker. Went into Digital Ocean and followed directions. Seemed to run through the upgrade ok. But now my Discourse site is completely offline. Any engineer on the list available to help? This is a vanilla Discourse instance running in DigitalOcean droplet. Has worked perfectly for the past year, but couldn't use Admin to upgrade anymore because Docker needed upgrading. I'm really stuck out here.
Please hit me at rick@blendimages.com if you're a engineer for hire who can take a look for me.
Thanks,
Rick
Posts: 3
Participants: 2
Mbox.rb replacing underscores with spaces
@pfaffman wrote:
Something in one of these files is replacing underscores with spaces in email addresses. I'm 99% sure that the one I forked did too, but I'm including my copy in case I did something boneheaded.
is replacing _ with a space in email addresses.I can't find it, and it's making me crazy. I don't see that any of the
.gsub
s could be doing it.Any ideas where I should look, @eviltrout?
Posts: 5
Participants: 2
Getting repeat topic reply notifications from the same user
@DanielMarquard wrote:
Been having this strange issue on my account on my website (running 1.7.0.beta2 +62) where I seem to randomly get new notifications for the same old posts of just one other user. I get notifications for this user's old replies to my topics every day or so, despite clicking them to read the posts every time. No one else has reported this, so I don't know if I'm the only affected user.
I couldn't really find anything like this when I searched. Any idea how I could troubleshoot this? Thanks!
Posts: 6
Participants: 4
Per Category/post user titles
@Nischayn22 wrote:
If you use Quora you would see how it's so easy to have category level user titles, editable by the users themselves. This helps in bringing value to your answer for your readers.
While Discourse has user titles they are workable only for small set of users as they need to be set manually by the admins or if done through badges they would be less relevant.
When discussing it really helps to know more about the poster just from the user titles. Even here on meta it's very useful to see tester/co-founder etc as user titles as it implies they are the most resourceful but other users don't seem to shine enough.
Posts: 6
Participants: 2
How to force downloading images on imported data
@pfaffman wrote:
I've imported a bunch of data with images. I changed
download remote images max days old
to a big number. Is there a way that I can force them to download? I don't see an obvious process in Sidekiq.Do I need to rebake? Just be patient?
Posts: 1
Participants: 1
Adding custom content to summary emails
@neil wrote:
Today I added a way to insert custom html and text to digest/summary emails. In the past, only the colour scheme could be customized. Now you can insert arbitrary html using the existing Admin > Customize > Text Content interface and searching for "digest.custom". Narrow it down to the html emails with "digest.custom.html".
Setting the
header
field will replace the default header, which is currently your site's logo on the left side.The rest of the fields can be used to insert banner ads, special offers, additional unsubscribe instructions, important announcements, and anything else that should be targeted at users who haven't been on your site for a while.
Posts: 1
Participants: 1
Clone an existing discourse forum, without access to the server itself?
@spikerbond wrote:
Is it possible to clone an existing discourse forum onto/into a new discourse forum?
I am apart of a forum where the owner is starting to be more and more of an a-hole, and some other people on the server and I want to move to a new forum where it is more community controlled, not just one person in charge. But we do not want to lose all of our posts. Is it possible to download the posts from the forum and then put them up on a new forum?
Or if we download our own posts is it possible to add those to a new forum?
Posts: 9
Participants: 5