Commit Graph

56 Commits

Author SHA1 Message Date
Gerhard Schlager
ae744693d8 FIX: TL2 promotion message from discobot didn't use user locale
Includes a small refactor/fix, because `return` isn't allowed in blocks.
2021-05-31 10:26:36 +08:00
Roman Rizzi
87b5d16c10
UX: Let users know they disabled discobot and they can't interact with it. (#12534)
Discobot will reply to users they need to enable onboarding tips to interact with them when issued a command.
2021-03-29 14:21:30 -03:00
Bianca Nenciu
6eab1e83c3
FIX: Do not fail if Postgres is not available (#12440)
Follow-up to 50f8782def.
2021-03-19 12:07:39 +02:00
Bianca Nenciu
50f8782def
FIX: Fix narrative bot settings in multisites (#12380)
after_initialize is not called for each multisite database, but just
for first (default) database.
2021-03-17 17:41:31 +02:00
Rafael dos Santos Silva
78c775c39e
UX: Remove border from certificate due to iframe (#11935) 2021-02-02 20:05:26 -03:00
Rafael dos Santos Silva
bf5611f7eb
FIX: Make discobot certificate faster/non blocking (#11344)
This moves the way we add the user avatar and site logo
to the discobot certificates from embeded base64 png to
just using the files urls in the href to the image tag.

This will make generation faster and the certificate
smaller overall, but it can't be used in a  `img` tag
anymore, since SVGs in `img` tags don't load the external images

In order to work around that we will move the certificate
in posts to an iframe, which works fine without any user
visible changes. For this to be possible the plugin automatically
adds the site current domain to the list of allowed iframe origins.
2021-02-01 20:49:32 -03:00
Kane York
a88a246c6e
FIX: Discobot exception when site_contact_username is promoted (#11666)
Because the site admin is sending a message to themselves, there is only one user in the topic_allowed_users, and `.last` returns nil.
Attempt to recognize this situation and continue, or bail without doing anything if this somehow happens another way.
2021-01-11 13:07:36 -08:00
Daniel Waterworth
721ee36425
Replace base_uri with base_path (#10879)
DEV: Replace instances of Discourse.base_uri with Discourse.base_path

This is clearer because the base_uri is actually just a path prefix. This continues the work started in 555f467.
2020-10-09 12:51:24 +01:00
Penar Musaraj
d6038ac666
FIX: Clear notification of skipped narrative bot PM (#10792)
Resets a new user's PM count in their badge after skipping user tips.
2020-10-01 20:32:45 -04:00
Krzysztof Kotlarek
902fbd0b7e
FIX: when the user is promoted to TL2 invite to advance training (#10752)
Invitation to advanced training should be sent as a separate private message instead of hooking into TL2 promotion message.
2020-09-28 13:52:33 +10:00
Vinoth Kannan
18f0cef72e DEV: skip topic deletion staff log when user skip new user tips.
Previously, every time when a user skipped the "new user tips" it will add a staff action log since the discobot's welcome post is destroyed.
2020-09-23 12:25:39 +05:30
Penar Musaraj
cfb3f4db13
FIX: Unexpected return during system_message_sent event
Followup to 0bb51dc, should fix an issue with multiple system message events being sent
2020-09-22 12:56:32 -04:00
Krzysztof Kotlarek
0bb51dcbfa
FIX: TL2 promotion message and advance training (#10679)
This is a little bit of refactoring. Core Discourse should have default promotion message for TL2.

In addition, when the Discobot plugin is enabled, the user is invited to advanced training
2020-09-22 10:17:52 +10:00
jbrw
aa815e41e7
FIX - make Discobot new user tutorial a little more robust (#10497)
* FIX - make Discobot new user tutorial a little more robust

Plugin allows reply, regardless of other SiteSettings

Skip image upload step if user can’t upload images, calls new ‘likes’ step instead

* Test that the images step is skipped

* Slight optimization
2020-08-21 13:13:13 -04:00
Vinoth Kannan
f495fca7e8
FIX: user_option option can be nil for new users. 2020-08-20 22:50:58 +05:30
Vinoth Kannan
562180dd9a
FEATURE: add option to skip new user tips in first notification. (#10462) 2020-08-18 13:43:40 +05:30
Blake Erickson
18dad4cfbd FIX: discobot inappropriate flag section
Ensure that the inappropriate flag is used and not some other flag
type. If some other flag is used a message will be posted letting the
user know they used the wrong flag and the original flag will be removed
so that they can try again.

Bug reported on meta: https://meta.discourse.org/t/-/157075
2020-08-03 19:48:45 -06:00
Michael Brown
d9a02d1336
Revert "Revert "Merge branch 'master' of https://github.com/discourse/discourse""
This reverts commit 20780a1eee.

* SECURITY: re-adds accidentally reverted commit:
  03d26cd6: ensure embed_url contains valid http(s) uri
* when the merge commit e62a85cf was reverted, git chose the 2660c2e2 parent to land on
  instead of the 03d26cd6 parent (which contains security fixes)
2020-05-23 00:56:13 -04:00
Jeff Atwood
20780a1eee Revert "Merge branch 'master' of https://github.com/discourse/discourse"
This reverts commit e62a85cf6f, reversing
changes made to 2660c2e21d.
2020-05-22 20:25:56 -07:00
Guo Xiang Tan
234cd5c3e7
FIX: Switch discobot to pull avatar from gravatar. 2020-05-20 10:20:08 +08:00
Guo Xiang Tan
4a74f18e95
PERF: Move fetching of avatar into hijack for discobot certificate 2020-05-11 09:35:06 +08:00
Martin Brennan
628ba9d1e2
FEATURE: Promote bookmarks with reminders to core functionality (#9369)
The main thrust of this PR is to take all the conditional checks based on the `enable_bookmarks_with_reminders` away and only keep the code from the `true` path, making bookmarks with reminders the core bookmarks feature. There is also a migration to create `Bookmark` records out of `PostAction` bookmarks for a site.

### Summary

* Remove logic based on whether enable_bookmarks_with_reminders is true. This site setting is now obsolete, the old bookmark functionality is being removed. Retain the setting and set the value to `true` in a migration.
* Use the code from the rake task to create a database migration that creates bookmarks from post actions.
* Change the bookmark report to read from the new table.
* Get rid of old endpoints for bookmarks
* Link to the new bookmarks list from the user summary page
2020-04-22 13:44:19 +10:00
Martin Brennan
0cb40fe9ed
FIX: Narrative bot not working for bookmarks with reminders (#9289)
Reported https://meta.discourse.org/t/improved-bookmarks-with-reminders/144542/42?u=mjrbrennan

* There was no callback on the bookmark model to trigger the next step of the narrative bot on bookmark.
* Also the translation URL path was hardcoded, needs to be conditional based on whether the site setting is enabled.
2020-03-27 12:17:18 +10:00
Dan Ungureanu
0754c7c404
FIX: Various fixes to support posts with no user (#8877)
* Do not grant badges for posts with no user
* Ensure instructions are correct in Change Owner modal
* Hide user-dependent actions from posts with no user
* Make PostRevisor work with posts with no user
* Ensure posts with no user can be deleted
* discourse-narrative-bot should ignore posts with no user
* Skip TopicLink creation for posts with no user
2020-03-11 14:03:20 +02:00
Régis Hanol
455147cabe DEV: use DB.after_commit instead of delaying the job 2019-11-29 22:48:39 +01:00
Régis Hanol
3807484757 FIX: delay the 'send_advanced_tutorial_message' job to prevent race conditions
When a user accepts an invite with an email address that matches a group
which automatically awards its members Trust Level 2, a race condition might happen
when the 'send_advanced_tutorial_message' job runs.

That job is enqueued inside the 'user_promoted' event which is triggered inside a
transaction on the user record. If the job runs before the transaction is done,
the user record is invisible and this generates an exception.
2019-11-29 22:14:41 +01:00
Blake Erickson
73e33ce243 DEV: send url string to FileHelper and refactor another open-uri call
FileHelper.download requires a string not a URI. I also found another
instance of using open-uri directly and swapped it out to use
FileHelper.

I also updated it to not `read` a file if it comes back nil.

Follow up to: fe01099a38
2019-11-14 08:25:30 -07:00
Blake Erickson
fe01099a38 DEV: Be sure to read the file into string before base64
Follow up to: 08b4753843

If you don't use `read` base64 will error out with: "no implicit
conversion of Tempfile into String"
2019-11-14 05:55:36 -07:00
Blake Erickson
08b4753843 DEV: Use FileHelper instead for downloading narrative bot avatar
Follow up to

b69450bee2

Using FileHelper here allows us to not have to use another require for
open-uri and gives us all the benefits of FileHelper.
2019-11-14 05:23:51 -07:00
Blake Erickson
b69450bee2 FIX: need to require open-uri for discourse-narrative-bot plugin
By requiring open-uri this will fix the following error:

```
NoMethodError (private method `open' called for #<URI::Generic...
```

also switched to the shorter syntax and removed default options. Since
ruby 2.4 redirect is on by default.
2019-11-13 18:11:50 -07:00
Roman Rizzi
c63e84dc62
FEATURE: Send a message to new TL2 users and point them to the advanced tutorial (#8335)
* FEATURE: Send a message to new TL2 users and point them to the advanced tutorial

* DEV: Use a method to find the discobot user
2019-11-13 18:31:49 -03:00
Robin Ward
8b4e71cb21 FIX: Allow avatar downloads to follow redirects 2019-10-24 14:01:54 -04:00
Roman Rizzi
835d2be4da
FIX: Rate limit and hijack certificate generation. (#8215)
To eliminate a DDOS attack vector, we're taking the following measures:

The endpoint will be rate-limited to 3 requests every 60 seconds (per user).
A 24 hours max-age cache header is sent with the response.
The route will be hijacked to generate the certificate in the background.
2019-10-21 13:14:15 -03:00
Vinoth Kannan
5a919c2211 DEV: use 'user_created' discourse event instead of 'after_commit' model callback. 2019-10-04 10:48:49 +05:30
Sam Saffron
30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Robin Ward
c719658f9f human? helper method on a user
This is cleaner than hard coding `id > 0` in ruby code.
2019-02-08 13:34:54 -05:00
Penar Musaraj
3c5fbd3ce1 FIX: do not send welcome message to staged users 2019-01-30 18:03:16 -05:00
Gerhard Schlager
fbd92916e5 FIX: Narrative bot should ignore action on deleted post 2018-12-21 17:43:52 +01:00
Guo Xiang Tan
07d07c7b5f FIX: Make Discobot certificate route require login. 2018-08-20 11:22:59 +08:00
Sam
8b88b71309 Attempt very aggressively to clear cache 2018-06-07 20:10:52 +10:00
Sam
3291f2c0eb move plugin fixture to the front of the queue 2018-06-07 19:56:07 +10:00
Jeff Wong
19605e8b0b Feature: Hide plugins that ship with core from plugins panel 2018-05-15 15:50:17 -07:00
Sam
ff6b47b0cf In development mode narrative bot breaks reload 2018-03-23 12:58:56 +11:00
Gerhard Schlager
d9515c37b3 FIX: Show message from discobot when staged user signs up 2018-01-25 14:58:43 +01:00
Guo Xiang Tan
442d4bff85 Add onceoff job to remap bot images link.
https://meta.discourse.org/t/discobot-tutorial-broken-elipsis-and-bookmark-png-images-appear-to-be-missing-on-my-site/73294/12
2017-11-07 23:36:59 +08:00
Sam
7ca08216bd FIX: ensure we have no dangling db connections on threads
This correct 10 second timeouts in dev mode, when reloader kicks in
2017-10-30 14:24:15 +11:00
Robin Ward
838568cbc3 Refactor flag types for more customization 2017-10-19 13:55:23 -04:00
Guo Xiang Tan
6cb29e3e20 Remove custom symlinks in discourse-narrative-bot. 2017-10-10 13:46:58 +08:00
Guo Xiang Tan
23b787e0a6 Require dependency otherwise it causes Sidekiq to lock up in development. 2017-09-25 13:48:59 +08:00
Guo Xiang Tan
77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00