Commit Graph

207 Commits

Author SHA1 Message Date
Developer
65949c7e71 Removed ImageProxyController API route
• Removed:
- ImageProxyController API route
- removed from news reducer for trends.

• Todo:
- Devise solution for integrating cross site images from trends -> social
2021-02-18 13:34:08 -05:00
rubic0n
006322cff7 Remove Hash allocation
merge! takes a Hash as an argument. Rather than allocating a Hash,
just use two different `=` calls, to achieve the same result.
2021-02-18 00:35:31 -06:00
rubic0n
a623252c59 Convert to boolean in C code
casecmp?(str) is 1.5x faster than casecmp(str).zero?
It's 1 less method call in Ruby, and the C code can convert
to boolean, rather than returning a number and determining
if it's zero.
2021-02-17 23:25:10 -06:00
Fosco Marotto
88d8bd2816 Merge remote-tracking branch 'origin/load_rails_6_0_defaults' into develop 2021-02-16 15:10:01 -05:00
Free Speech Forever
92c9092abd Avoid redundant OAuth queries when not signed in
If you aren't signed in, you don't have an auth token.
When you don't have an auth token, React was sending the headers

"Authorization: Bearer null"

This caused 5 Doorkeeper token lookups using
WHERE "oauth_access_tokens"."token" = 'null'
on the Explore page (the root of the app when not signed in).
2021-02-15 23:26:00 +00:00
rubic0n
73c0e50936 Prevent constant ElasticAPM warnings in development by disabling it
No changes are needed in prod, since the `enabled` setting defaults
to "true", and prod obviously isn't setting this ENV.
2021-02-13 23:20:43 -06:00
rubic0n
f472a6154e Mark the replicas as replicas
Rails won't even attempt to write to a replica. Without this option,
a write attempt would actually run against Postgres, and it would
be up to Postgres to throw a readonly error.

Additionally, marking it as a replica teaches ActiveRecord that it
should not attempt to run migrations against this connection.

https://api.rubyonrails.org/classes/ActiveRecord/DatabaseConfigurations.html#method-i-configs_for

I'm actually pretty sure that the lack of `replica: true`
is why there's currently a db/slave1_schema.rb and db/slave2_schema.rb
2021-02-13 23:20:43 -06:00
rubic0n
903b6c7969 Simplify database.yml by merging in default options
Anything in the &default section can be merged in using <<: *default
In this case, the default already specifies that the adapter is
postgresql, the timeout is 5000, the encoding is unicode. It also
already specified the db pool, but the default actually checked 2
different ENVs and provided a fallback if it's not provided.
Lastly, I was able to move the prepared_statements section to the
defaults, because the .env.vagrant file doesn't specify
ENV['PREPARED_STATEMENTS'], development still just sets it to
'false'.
2021-02-13 23:20:43 -06:00
Developer
538bcf21c9 Updated registration page username to disallow unallowed characters
• Updated:
- registration page username to disallow unallowed characters (special characters, spaces, etc.) and rewrite if is written in that field
2021-02-11 00:57:48 -05:00
Developer
488a362129 Updated labels and hints in user registration form
• Updated:
- labels and hints in user registration form
- Made clear requirements for usernames

• Removed:
- question of "Are you human?" in the captcha label as people were answering "yes" in the input instead of the captcha value
2021-02-10 13:48:13 -05:00
Fosco Marotto
729c00a5a9 Bundle of corrections and one doorkeeper writing role change 2021-02-09 22:32:24 -05:00
admin
382fd31ec7 Update database.yml 2021-02-09 19:41:12 +00:00
Free Speech Forever
473c48b2aa Replace Makara with an initial Rails 6 role based splitting method. 2021-02-09 19:38:10 +00:00
admin
7d8ecac125 Update elastic_apm.yml 2021-02-03 15:17:38 +00:00
admin
6a620f388e Merge branch 'develop' of https://code.gab.com/gab/social/gab-social into develop 2021-02-03 10:13:04 -05:00
admin
82bdbbcb5f added elastic apm and fixed session updated_at bug 2021-02-03 10:12:05 -05:00
mgabdev
33f4bc4650 Added button to reset a spam bool on an account
• Added:
- button to reset a spam bool on an account in admin dashboard
2021-02-02 21:11:48 -05:00
Fosco Marotto
e4527e5210 Remove scout apm 2021-02-01 15:04:16 -05:00
rubic0n
87c41ede7a Load Rails 6.0 defaults and remove 6.0 migration initializer 2021-01-31 17:39:13 -06:00
rubic0n
8c018b8088 Don't autoload in initializers: SidekiqErrorHandler
DEPRECATION WARNING: Initialization autoloaded the constant
SidekiqErrorHandler.
2021-01-31 17:39:13 -06:00
rubic0n
497ec0c1db Teach Zeitwerk that REST is the class name, not Rest
Also add a comment about the inflector settings.

NameError: uninitialized constant InitialStateSerializer::REST
Did you mean?  Rest
/vagrant/app/serializers/initial_state_serializer.rb:7:in `<class:InitialStateSerializer>'
/vagrant/app/serializers/initial_state_serializer.rb:3:in `<main>'
2021-01-31 17:39:13 -06:00
rubic0n
2b9144d50c Fix "NameError: uninitialized constant Exceptions"
Zeitwerk operates on files in the autoload paths. Since the
entire "app" directory is autoloaded, all files inside need to
play by Zeitwerk's rules. Zeitwerk expects that a file named
"exceptions.rb" would define a constant named "Exceptions".

The exceptions file doesn't follow Zeitwerk's conventions.
The easiest way to solve this is to move the execptions out of
app/lib and into lib, where `require_relative` doesn't have
Zeitwerk taken into account.
2021-01-31 17:39:13 -06:00
rubic0n
f77fa3ca4a Fix autoloading in initialization
DEPRECATION WARNING: Initialization autoloaded the constants
ActionText::ContentHelper and ActionText::TagHelper.

https://github.com/rails/rails/issues/36546

Rails has a Railtie that will take the config setting out of Rails
config, and put it onto ActionController when ActionController is
loaded. Calling ActionController in the initializer forces it to
autoload right now. Referencing the setting through the config allows
it to autoload in when it needs to.
2021-01-31 17:04:58 -06:00
rubic0n
2f95b0d67e Enable remaining settings
- use_cookies_with_metadata
  Provided extra options for cookies. Existing cookies will work fine.
  https://github.com/rails/rails/issues/36546
- return_only_media_type_on_content_type
  Include the charset in the content type. Looking at the headers that
  are being returned, it already did this.
- Use Zeitwerk as the autoloader
  https://github.com/fxn/zeitwerk
2021-01-31 17:04:58 -06:00
Fosco Marotto
58cc000b0f [scout] Monitor is off by default. 2021-01-30 22:45:23 -05:00
Fosco Marotto
8b8e8ec8e5 [scout_apm] Add scout apm to Gemfile, add config file 2021-01-30 21:19:12 -05:00
admin
d0b1f28430 Merge branch 'feature/rails_6' into 'develop'
Upgrade to Rails 6

See merge request gab/social/gab-social!52
2021-01-28 17:01:42 +00:00
admin
87138932a0 Merge branch 'gab_provision' of https://code.gab.com/gab/social/gab-social into develop 2021-01-27 16:16:48 -05:00
Fosco Marotto
05e95cf090 [session_activations] Stop needless updated_at changes 2021-01-27 16:08:39 -05:00
mgabdev
4f3df89911 Removed unused chat_messages route from Navigation for admin dashboard
• Removed:
- unused chat_messages route from Navigation for admin dashboard
2021-01-25 13:52:52 -05:00
mgabdev
081f59c872 Removing Chat/Dms for now
• Removing:
- Chat/Dms for now
2021-01-25 12:23:17 -05:00
rubic0n
2952c9f59d Simplify db config 2021-01-24 23:57:30 -06:00
Fosco Marotto
1c647b0b06 [reset] cleanup 2021-01-24 13:50:51 -05:00
admin
5d13162204 Revert "Merge branch 'develop' of https://code.gab.com/gab/social/gab-social into develop"
This reverts commit ccf98d2002
2021-01-24 16:29:57 +00:00
Fosco Marotto
645def5f96 SessionActivation and groups query change 2021-01-23 18:21:31 -05:00
Fosco Marotto
63ad3a1590 [doorkeeper] Attempt to fix oauth connect issues. 2021-01-23 16:33:48 -05:00
rubic0n
28beb28a78 Upgrade to Rails 6
- Added listen gem because rails app:update failed without it
- Removes nsa gem because it requires activesupport < 6
  Oddly, there's a newer version per GitHub that's not on RubyGems
  that raises the requirement to < 7. But, we need a new release
  before we can use that.
- Upgrade rails-i18n to v6, for Rails 6 compatibility
- Remove redis-rails since it requires Rails < 6, but we can just use
  the regular Rails :redis_cache_store that was introduced in 5.2.
- Run `rails app:update`
  - Had to weed through the `config/environments` changes to pick up
    newly added settings, while not losing settings that were
    intentionally configured
  - This generated config/initializers/new_framework_defaults_6_0.rb.
    The goal is to uncomment all of the settings in that file. Once
    they're all uncommented, delete the file and edit
    config/application.rb's load_defaults to be 6.0.
  - force_ssl controller method is deprecated in favor of a Rails
    config setting.
  - bin/setup was generated by Rails
  - Verbose query logging in development is really helpful. It shows
    you what line of code caused a query to execute.
  - Calling establish_connection after worker boot isn't necessary
    with ActiveRecord anymore. ActiveRecord handles it gracefully.
  - Rails generated a migration to add a foreign key for ActiveStorage.
    Gab currently doesn't use ActiveStorage, and instead uses Paperclip
    (since ActiveStorage didn't exist when Mastadon started). So, this
    change isn't relevant to Gab.
- Added ` || ''` in the profiles controller, because I was unable
  to save a change to a newly created profile. (This probably
  explains the 500 error I received on prod Gab recently.)
2021-01-23 09:01:31 -06:00
rubic0n
70c29c6cbd Fix "ERR! error: password authentication failed for user "vagrant"" 2021-01-23 09:00:35 -06:00
mgabdev
406cbbe747 Updated statuses route in admin Navigation to be viewable only by admins
• Updated:
- statuses route in admin Navigation to be viewable only by admins
2021-01-19 01:28:38 -05:00
mgabdev
51fa8f2eb4 Added/Updated admin dashboard tables
• Added:
- New Account filtering
- PreviewCard viewing/sorting/filtering deleting (todo)
- DeletePreviewCardWorker, Service
- Status viewing/sorting/filtering deleting
- ChatMessage viewing/sorting/filtering deleting (todo)
- Account > Follows view

• Updated:
- LinkBlock to sort alphabetically
- Groups to be under "Moderation" instead of "Admin" in navigation.rb
- Status in admin to have group name/link
- Reports reset button
- Group filtering/sorting
- LinkBlock filtering/sorting
- Account now has bio and few more data points in dashboard
2021-01-19 01:25:25 -05:00
Fosco Marotto
c9da516af6 Update hiredis driver and add a default REDIS_POOL_SIZE 2021-01-16 13:22:15 -05:00
mgabdev
7bc93ff98f Removed all occurances of "theme" from backend, settings
• Removed:
- all occurances of "theme" from backend, settings

Theme is set in WebSettings through client. And set in <Display />.
2021-01-15 14:35:50 -05:00
mgabdev
c33013cccf Added routes for trending_hashtags, expenses
• Added:
- routes for trending_hashtags, expenses
2021-01-15 14:28:52 -05:00
mgabdev
7c6ef8bb9d Removed some Rack configs and moved RackAttack rate limits, headers
• Removed:
- some Rack configs and moved RackAttack rate limits, headers
2021-01-14 13:37:38 -05:00
mgabdev
fb75f33b12 Updated account, groups relationships routes to post data instead of get
• Updated:
- account, groups relationships routes to post data instead of get
2021-01-13 23:51:44 -05:00
admin
1ed29ddd53 Update redis.rb 2021-01-14 04:33:49 +00:00
mgabdev
3c252e0f4c Removed unused CommunityTimeline references, public timeline route
• Removed:
- unused CommunityTimeline references, public timeline route
2021-01-13 21:43:18 -05:00
mgabdev
89a16b101f Updated admin dashboard for ChatConversationAccounts
• Updated:
- admin dashboard for ChatConversationAccounts
2021-01-13 19:12:57 -05:00
mgabdev
b15c905143 Removed API route for v1/search, only using v2/search now
• Removed:
- API route for v1/search, only using v2/search now
- v2/search requires user (for now)
2021-01-13 18:14:57 -05:00
mgabdev
8aeae9c45d Updated routes for admins dashboard
• Updated:
- routes for admins dashboard (expenses, group categories, promotions, trending hashtags) that were in the /settings path but are now in the /admin path
- /filters to be in /settings/filters

• Removed:
- authorize_follow route
2021-01-13 18:06:45 -05:00