Commit Graph
100 Commits
Author SHA1 Message Date
Guo Xiang Tan a3dfd553a1 Revert "Bump redis to 4.2.0."
This reverts commit 98bc28cea2.
2020-06-10 14:52:05 +08:00
Guo Xiang Tan 98bc28cea2 Bump redis to 4.2.0. 2020-06-10 14:28:56 +08:00
Guo Xiang Tan 2ce829cc01 DEV: Allow multisite apps to boot with reading connection handler. 2020-06-10 14:18:29 +08:00
Guo Xiang Tan 31a527a293 FIX: Return 400 when invalid topic_id is provided when creating invite. 2020-06-10 09:29:28 +08:00
Guo Xiang Tan 45fd668dc5 DEV: Render a proper response that can be handled on the client side. 2020-06-10 09:25:58 +08:00
Guo Xiang Tan edc940ce3e DEV: Fix incorrect messagebus redis config for rails_failover. 2020-06-09 17:05:14 +08:00
Guo Xiang Tan c35649ccf1 DEV: Remove Redis noop logging.
When Redis drops into readonly mode, it floods the log. The log isn't
actionable and we have other means of knowing that an app is in readonly
mode.
2020-06-09 16:45:34 +08:00
Guo Xiang Tan a1c13eb3c6 DEV: Redis failover should only clear redis recently readonly. 2020-06-09 16:36:31 +08:00
Guo Xiang Tan 8b434531e4 Bump message_bus to 3.3.1. 2020-06-09 14:12:14 +08:00
Guo Xiang Tan 4065cd198a DEV: Print backtrace of error when plugin fails to initialize. 2020-06-09 10:25:43 +08:00
Guo Xiang Tan 4ce618e55b Bump rails_failover. 2020-06-08 17:04:58 +08:00
Guo Xiang Tan f6628e4f43 DEV: Disable messageBus keepalive when Redis fails over. 2020-06-08 12:33:08 +08:00
Guo Xiang Tan 2ffda2b320 Bump rails_failover. 2020-06-08 12:19:33 +08:00
Guo Xiang Tan dc8b773765 Update rails_failover. 2020-06-08 11:03:25 +08:00
Guo Xiang Tan 320b1e95bf DEV: Silence all freedom patches trace in verbose query logs. 2020-06-05 09:09:54 +08:00
Guo Xiang Tan e82d4d8a75 DEV: Update rails_failover to avoid monkey patching Rails config. 2020-06-05 09:05:19 +08:00
Guo Xiang Tan 87673e6571 DEV: Fix moving of rails_failover middleware. 2020-06-04 20:29:47 +08:00
Guo Xiang Tan d3c972c30c FIX: Rescue from readonly errors when looking up auth tokens.
Since this is rare, we don't want to check for
`Discourse.pg_readonly_mode?` on every request since we have to reach
for Redis. Instead, just rescue the error here.
2020-06-04 09:12:49 +08:00
Guo Xiang Tan 76ce814a62 DEV: Use safe_each_connection patch when preloading Rails.
This is to ensure we still boot even if there is a problem with any of
the databases.
2020-06-03 15:36:50 +08:00
Guo Xiang Tan a4a33fccb0 DEV: Update rails_failover. 2020-06-03 14:31:11 +08:00
Guo Xiang Tan 04a291ceea DEV: Fix race conditions due to directory removal for uploads spec. 2020-06-03 12:28:39 +08:00
Guo Xiang Tan 141fba8866 UX: Ensure that select-kit is hidden consistently. 2020-06-03 11:51:01 +08:00
Guo Xiang Tan 062db10c52 FIX: EmailValidator needs to validate format of email. 2020-06-03 10:34:37 +08:00
Guo Xiang Tan 439db7ca1e DEV: Add REDIS_RAILS_FAILOVER env to test our new redis failover. 2020-06-02 17:24:14 +08:00
Guo Xiang Tan deb84017f2 Update rails_failover. 2020-06-02 17:01:45 +08:00
Guo Xiang Tan 4120ef7305 Bump rails_multisite to 2.2.2. 2020-06-02 16:49:33 +08:00
Guo Xiang Tan 426b62a04a DEV: Add silencer for verbose query logs in development. 2020-06-02 12:15:31 +08:00
Guo Xiang Tan 3dd1778199 PERF: Reduce number of queries from 3 -> 1 when fetching web manifest. 2020-06-02 12:04:02 +08:00
Guo Xiang Tan e4cd4f7e0b DEV: Avoid reaching for Redis#_client which is considered deprecated. 2020-06-02 11:46:55 +08:00
Guo Xiang Tan fe9c82994d DEV: Actually disconnect from Redis connections after fork. 2020-06-02 11:40:16 +08:00
Guo Xiang Tan ade60b0cbc DEV: Enable readonly mode for all multisite sites when PG goes down.
The risk here is that the database for one site goes down in the multisite setup and we drop everything to readonly mode. However, I discussed this with Sam and we agree that one database having problem is very rare. Most of the time, it is the entire DB cluster that goes down.
2020-06-02 11:32:07 +08:00
Guo Xiang Tan 7897010dfd Fix lint. 2020-06-02 10:45:18 +08:00
Guo Xiang Tan 370cba451d DEV: Refactor away conditionals that we don't need. 2020-06-02 10:40:29 +08:00
Guo Xiang Tan c21e3bbd1b DEV: Prefer create! over create when not checking return value.
We don't want stuff to silently fail.
2020-06-02 10:34:05 +08:00
Guo Xiang Tan 326d6d5b0f DEV: Pause Sidekiq when forcing pg readonly mode. 2020-06-02 09:20:03 +08:00
Guo Xiang Tan 32735be5bd DEV: Fix publish to message_bus when forcing pg readonly. 2020-06-01 13:26:12 +08:00
Guo Xiang Tan 389bdcf5ab DEV: Fix implementation for DiscourseRedis#exists. 2020-06-01 13:11:32 +08:00
Guo Xiang Tan 2c3ff3e524 DEV: Missing readonly mode banner when forcing PG readonly. 2020-06-01 12:25:27 +08:00
Guo Xiang Tan b0b37bf5a3 DEV: Add force rails_over switch via Redis. 2020-06-01 11:23:58 +08:00
Guo Xiang Tan df62407f35 DEV: Implement multiple keys support for DiscourseRedis#exists. 2020-06-01 11:20:26 +08:00
Guo Xiang Tan 3894555b2e DEV: Prefer Discourse.redis.reconnct. 2020-06-01 10:55:53 +08:00
Guo Xiang Tan 5c24f83a6b DEV: Bump rails_failover. 2020-06-01 10:22:04 +08:00
Guo Xiang Tan 81de592804 PERF: Use more efficient query when checking for existence. 2020-05-29 15:47:05 +08:00
Guo Xiang Tan ca28ad8f9a DEV: Remove db_id from sample multisite config.
See https://github.com/discourse/rails_multisite/commit/2bb4d5170cbf462708eb32bb85c035fb1700f7b4
2020-05-29 10:48:29 +08:00
Guo Xiang Tan 3b311f6b15 DEV: Bump rails_failover. 2020-05-29 09:02:34 +08:00
Guo Xiang Tan 6491db579b DEV: Add discourse-staff-alias to official plugin list. 2020-05-28 16:43:15 +08:00
Guo Xiang Tan 8c86a109bb DEV: Add ENV flag to test out ActiveRecord::Failover. 2020-05-28 16:24:22 +08:00
Guo Xiang Tan 26c7fa2c29 FIX: rescue_from doesn't bubble up.
See https://github.com/rails/rails/blob/a47e0c19e60b17c3d0dcae240ef85de52113ea57/actionpack/lib/action_controller/metal/rescue.rb#L25
2020-05-26 22:43:29 +08:00
Guo Xiang Tan 878f06f1fe DEV: Remove custom connection reaper.
Rails 6 fixed the reaper to use one thread to reap all the connection pools.
2020-05-26 09:09:46 +08:00
Guo Xiang Tan a2d939608d Bump rails_failover to 0.2.0. 2020-05-21 11:41:58 +08:00
Guo Xiang Tan f4b82f1dc0 DEV: Fix randomly failing spec.
If a user is created with an id of 999, a `upload.user_id ==
user_avatar.user_id` will return true. This fix increases the id of the
upload to something that we will not hit in the foreseeable future.
2020-05-21 11:41:07 +08:00
Guo Xiang Tan 68db5deaec FIX: Badge granter was disabled by default. 2020-05-21 06:55:22 +08:00
Guo Xiang Tan 3aecc1990b DEV: Review follow up to 234cd5c3e7. 2020-05-20 16:17:59 +08:00
Guo Xiang Tan 2f03a879f9 DEV: Require rails_failover before global settings. 2020-05-20 16:06:40 +08:00
Guo Xiang Tan f7f436e536 DEV: Install rails_failover gem to test our Redis changes. 2020-05-20 15:40:27 +08:00
Guo Xiang Tan 37983a7815 Fix lint. 2020-05-20 10:33:34 +08:00
Guo Xiang Tan b7387d4611 DEV: Remove code unused code when seeding narrative bot. 2020-05-20 10:22:51 +08:00
Guo Xiang Tan 234cd5c3e7 FIX: Switch discobot to pull avatar from gravatar. 2020-05-20 10:20:08 +08:00
Guo Xiang Tan 062cb1e1cb UX: Remove caret from notifications-button. 2020-05-19 13:41:13 +08:00
Guo Xiang Tan 05beaa7f45 DEV: Remove override of flushdb in DiscourseRedis. 2020-05-19 10:26:23 +08:00
Guo Xiang Tan 96c02caba7 DEV: Change use of Redis flushall to flushdb.
FLUSHALL removes all keys from all databases. Instead we only want to
remove keys from the current Redis database.
2020-05-19 10:20:00 +08:00
Guo Xiang Tan d01c336899 DEV: Clean up some Redis leaks in test env. 2020-05-18 17:27:37 +08:00
Alan Guo Xiang Tan 7f07c513a7 FIX: Switching composer action does not refresh composer actions content (#9791) 2020-05-15 13:54:44 -04:00
Guo Xiang Tan d1146ccb7b Revert "FIX: Correct plugin api version bump."
This reverts commit 6a96c424b7.

False alarm. I was deploying on a docker image which was still on 0.9.0.
2020-05-15 21:22:44 +08:00
Guo Xiang Tan 6a96c424b7 FIX: Correct plugin api version bump.
It doesn't seem to be following semver.
2020-05-15 21:17:50 +08:00
Guo Xiang Tan 162d125b83 Fix lint. 2020-05-15 20:23:17 +08:00
Guo Xiang Tan dada1fc417 UX: Better composer-action icon when creating new topic. 2020-05-15 16:40:49 +08:00
Guo Xiang Tan f9a9bd136b FEATURE: Expose Composer.serializeToTopic in client side plugin api. 2020-05-15 16:16:58 +08:00
Guo Xiang Tan 858735b5da DEV: Fix broken test due to 9ab5801a1b. 2020-05-15 15:00:04 +08:00
Guo Xiang Tan 9ab5801a1b FIX: Allow post migrations using #change to carry out unsafe migration 2020-05-15 14:23:27 +08:00
Guo Xiang Tan 165fa13c9d FIX: Always return 0 for non-human user current DraftSequence. 2020-05-15 10:40:36 +08:00
Guo Xiang Tan 245e8212ca Revert "FIX: don't compute draft for (ro)bots 🤖 in topics list"
This reverts commit ec8f08d0da.
2020-05-15 10:40:35 +08:00
Guo Xiang Tan e37ea4a4a1 Revert "FIX: don't compute draft for bots on categories index route"
This reverts commit 1b7f23a1bc.
2020-05-15 10:40:35 +08:00
Guo Xiang Tan 9a18bacbe3 DEV: Fix lint. 2020-05-14 16:10:51 +08:00
Guo Xiang Tan a1a798ac7d DEV: Expose Composer.serializeOnUpdate in client side plugin api.
Also expose `Composer.serializeOnCreate` as well.
2020-05-14 16:06:29 +08:00
Guo Xiang Tan fdea969f14 DEV: Minor follow up to d7e230c1b9 2020-05-14 16:02:54 +08:00
Guo Xiang Tan 95a80525ae DEV: Remove erroneous code introduced in d7e230c1b9 2020-05-14 15:58:44 +08:00
Guo Xiang Tan d7e230c1b9 UX: Introduce composer-actions when editing a post. 2020-05-14 15:56:08 +08:00
Guo Xiang Tan d226783405 Revert "DEV: Add add_controller_callback server side plugin api."
This reverts commit 8233610d92.

Too much messy around with blocks to support `before_action` and
`around_action`.
2020-05-14 15:26:50 +08:00
Guo Xiang Tan a849bdf0c9 FIX: Don't publish typing presence if composer isn't opened.
Hitting cancel on composer will set composer's reply and title to null
causing our observer to fire.
2020-05-14 12:52:10 +08:00
Guo Xiang Tan 3d5589e026 DEV: Remove assertions that are not required. 2020-05-14 10:07:55 +08:00
Guo Xiang Tan c5ef465179 DEV: Avoid relative paths when importing in plugins. 2020-05-14 10:05:16 +08:00
Guo Xiang Tan c405b15914 DEV: Add plugin outlet revision-user-details-after. 2020-05-13 15:40:37 +08:00
Guo Xiang Tan 623920f13d FEATURE: Introduce a staff only override key for discourse-presence.
Merge remote-tracking branch 'origin/coding-standards'
This uses the composer as a bridge for other plugins.
2020-05-13 14:13:31 +08:00
Guo Xiang Tan ca8d11635c Add missing export in 15e32dc1af. 2020-05-13 13:57:12 +08:00
Guo Xiang Tan 15e32dc1af FIX: Composer presence shows user as editing when replying. 2020-05-13 13:41:03 +08:00
Guo Xiang Tan aa40a07d73 FIX: Throttle typing function in discourse-presence. 2020-05-13 13:31:06 +08:00
Guo Xiang Tan 34c39b65bb PERF: Avoid executing the same query twice. 2020-05-13 11:10:09 +08:00
Guo Xiang Tan 822e594fc8 UX: Improve display of site setting validation message.
Previously, the validation message is shown inline with the label which
leads to the available width for both element being reduced.
2020-05-13 11:10:08 +08:00
Guo Xiang Tan 8fb99f218d FEATURE: Allow plugins to register a callback to ignore DraftSequence. 2020-05-12 14:25:20 +08:00
Guo Xiang Tan d301af39bd PERF: Avoid hitting DB when fetching draft sequence of bot user. 2020-05-12 13:56:58 +08:00
Guo Xiang Tan 3c423faafd DEV: Avoid repeating draft key logic in multiple places. 2020-05-12 11:14:03 +08:00
Guo Xiang Tan f293b28198 FEATURE: Pass instance of revisor to post_edited DiscourseEvent. 2020-05-11 16:45:40 +08:00
Guo Xiang Tan 8233610d92 DEV: Add add_controller_callback server side plugin api. 2020-05-11 16:45:08 +08:00
Guo Xiang Tan a3a464b838 DEV: Improve description of addPosterIcon plugin api. 2020-05-11 16:44:47 +08:00
Guo Xiang Tan 4a74f18e95 PERF: Move fetching of avatar into hijack for discobot certificate 2020-05-11 09:35:06 +08:00
Guo Xiang Tan 6359a5f8a9 DEV: Fix poll plugin causing error when server reloads in dev env. 2020-05-08 14:59:55 +08:00
Guo Xiang Tan efd0e4d02b FIX: Don't trigger user_updated event for bot users. 2020-05-08 09:28:16 +08:00
Guo Xiang Tan 1062dbc3e9 FIX: Discobot has not been created with our custom avatar.
Previously the image was imported from a Discourse hosted CDN but the
URL has since become invalid. However, it was not caught since all
errors are rescued. This commit fixes the issue by shipping the user
avatar with the plugin.
2020-05-06 09:25:01 +08:00
Guo Xiang Tan b299f5f491 DEV: Use Ember.Service over manually registering a factory.
Follow up to 9e827eb420
2020-05-06 09:24:49 +08:00