Commit graph

183 commits

Author SHA1 Message Date
Michael Kohl
a49ae729a0
Remove temporary Rake task (#7842) 2020-05-14 11:22:06 +02:00
rhymes
b5ebf8f3dc
Routine rubocop fixes (#7743)
* Rubocop auto fixes

* Fix Capybara/VisibilityMatcher

* Regenerate todo
2020-05-08 19:38:06 +02:00
Michael Kohl
7e6c2b3977
Refactor classified listing social previews (#7679)
* Refactor classified listing social previews

* Rename decorator method

* Fix overeager renaming
2020-05-06 14:00:09 -04:00
Alex
7149070bca
[deploy] Create FastlyConfig & refactor params safe list (#7630)
* Fastly refactor

- Create FastlyConfig
- Create FastlyConfig::Base
- Create FastlyConfig::Snippets
- Move safe_params to its own VCL file
- Rescue unauthorized errors in development
- Add FastlyConfig errors

* Move active version to method

* Update naming option --> config

* Refactor InvalidConfigsFormat msg to Error class

* Refactor active version logic

* Fix log_to_datadog call

* Move get_active_version logic back into method

* Add some specs ¯\_(ツ)_/¯

* Update Fastly rake task

* Remove old Fastly way

* Update docs for Fastly

* Move snippets to config/ & remove old config

* Change update_config to upsert_config

* Change error type to SubclassResponsibility

* Refactor get_updated_files with filter_map

* Refactor update

* Cleanup update_config --> upsert_config

* Fix updater specs
2020-05-01 11:23:48 -04:00
rhymes
2d26318cf9
[deploy] Replace (black|white)list with more inclusive language (#7459)
* Replace isBlacklisted

* Update fastly.rake task

* More renames

* Rename Faslty config file

* More changes

* Replace isForbiddenFromPreloading with isNotPreloadable

* Skip problematic test

* Re-enable
2020-04-27 18:00:12 +02:00
Alex
8b51d8e4b8
[deploy] Fix Fastly rake task spec and Travis CI (#7487)
* Try changing exit to next

* Add breaking test

* Fix search.rake

* Remove test failure
2020-04-23 16:06:57 -04:00
Alex
397734b29c
Generalize Fastly rake task (#7349)
* Generalize Fastly rake task

- Update Rubocop to disable DescribeClass on rake task specs

* Change default Fastly ENV vars to ""

* Move snippet name to ENV

* Update ENV to FASTLY_WHITELIST_PARAMS_SNIPPET_NAME

* Add FASTLY_WHITELIST_PARAMS_SNIPPET_NAME to the docs

* Update docs

* Quick refactor
2020-04-22 11:49:54 -04:00
Alex
cc6249beff
[deploy] Update whitelisted params on Fastly on deployments (#7279)
* Add Fastly whitelisted params

* Create FastlyVCL::WhitelistedParams.update service

* Add specs

* Create rake task to call new service

* Add rake task to setup script

* Add documentatoin

* Move sort inside params_to_array method

* Rename VCL_REGEX to VCL_DELIMITER

* Add PR URL to docs

* Move snippet name to SNIPPET_NAME constant

* Refactor setting content

* Rename params_to_array to params_to_sorted_array

* Change guard and log success on update

- Return early if params are equal
- Log success message to Rails.logger on update
- Log params diff to Datadog

* Return true explicitly

* Move rake task execution from to release-tasks

* Remove unnecessary environment guard in task

* Remove duplicate code param

* Refactor string from build_content

* Remove reliance on sort

* Reorder logging to implicitly return true

* Update docs to reference release-script.sh

* Update docs

* Update whitelisted params

* Fix params_updated? bug and add more specs

* Remove duplicate param...oopsie!
2020-04-16 15:11:57 -04:00
Michael Kohl
ca23b8e1c6
[deploy] Introduce ClassifiedListingCategory model (#7172)
* Add ClassifiedListingCategoryModel

* Add data update script for classified listing categories

* Add foreign key to reference

* Move data update script to temporary rake task

* Update factory

* Add and fix specs

* Fix typo

* Fix migration

* Correctly add unique index

* Fix migration

* Add slug column to classified listing categories

* Add unique index for slug column
2020-04-13 09:01:58 -04:00
Ridhwana
cbff423861
chore: remove script (#7215) 2020-04-10 16:59:09 +02:00
Ridhwana
e626cfa933
[deploy] Split out social media options (Important: post deployment task to be run) (#7173)
* feat: define the different social media handles

* feat: dynamically render all the social media fields

* feat: ensure that the social media handles are permitter and dealt in a separate path from the rest

* test: update  social_networks_handle to social_media_handles

* feat: update the sidebar to use different social media

* feat: update the twitter:site meta handle to be  SiteConfig.social_media_handles["twitter"]

* feat: update the a links to tweets

* feat: make the links dynamic and only show those that there is a value for

* refactor: make @ThePracticalDev dynamic

* refactor: make @ThePracticalDev dynamic

* feat: add dynamic social media handles

* chore: rename values

* chore: remove extra social handles

* chore: some spacing

* chore: remove lines

* rafector: user rails-settings-cached type: :hash to set the type and the defaults

* feat: use nil and blank instead of "" and empty

* chore: move the social media handles into the right box

* refactor: rearrange model placement based on the UI

* chore: code climate

* refactor: comments from PR

* chore: rename the ff

* chore: amended twitter username

* chore: add a temporary rake task

* feat: update names

* chore: why am i using the old syntax :(

* chore: revert dynamic erb variable in offline.html
2020-04-09 19:51:11 +02:00
Mac Siri
b5fa02bf33
Create Broadcasts.rake (#7010) 2020-04-02 17:24:39 -04:00
Mac Siri
217ee6c3f4
Organize rake tasks (#7005) 2020-04-01 12:39:40 -04:00
Alex
129cd3ba83
Log Elasticsearch index counts to Datadog (#6845) [deploy] 2020-03-25 15:52:54 -05:00
Ben Halpern
5bd042e7d6
Prune old field tests for ongoing tests (#6540) [deploy] 2020-03-09 16:22:42 -04:00
Alex
bbec492844
Remove more Algolia from ClassifiedListing (#6463) [deploy]
* Remove ClassifiedListing from algolia initializer

* Remove reference to remove_from_index
2020-03-05 09:23:22 -08:00
rhymes
e27c9b77a3
Refactor Elasticsearch client access (#6307) [deploy]
* Add Transport module to Search
* Test public methods only
* Add Search::Client with exception handling
* Remove Transport and request do
* Replace SearchClient with Search::Client
2020-02-28 11:38:37 -05:00
rhymes
f3c2adfa45
Routine rubocop fixes (#6138) 2020-02-18 11:21:42 -05:00
Molly Struve
0bfbd9bb1f
Set Up Framework For Running Data Update Scripts (#6025) [deploy] 2020-02-13 10:48:23 -05:00
Molly Struve
acfdd11b50
update cluster settings to prevent auto index creation, update destroy to remove ALL indexes (#6042) 2020-02-12 15:21:38 -05:00
Juanito Fatas
33b8014677
Fix indentation in search.rake (#5971)
lib/tasks/search.rake:9:3: C: Layout/IndentationWidth: Use 2 (not 3) spaces for indentation. (https://rubystyle.guide#spaces-indentation)
     Search::Cluster.update_mappings
  ^^^
2020-02-10 09:09:23 -05:00
Maykon Menezes
01dc81afa9
Move Podcasts::GetEpisodesJob to Sidekiq (#5443) [deploy]
* Refactored Podcast::GetEpisodesJob to sidekiq

* fixing specs

* removing env keys

* Change arguments to Hash

* Update specs and add spec for queue

* Update references for Hash argument

* Add comment to explain parameters of #perform

Co-authored-by: Alex <alexandersmith223@gmail.com>
2020-02-06 09:42:55 -08:00
Molly Struve
00fefe5865
Add Code To Setup the Elasticsearch Tag Index (#5919) [deploy] 2020-02-06 11:46:11 -05:00
rhymes
3260270103
Have counters:update_users use a transaction per user and customizable batch size (#5912) [deploy] 2020-02-05 12:26:03 -05:00
rhymes
a1835ae5b9
User counters using PostgreSQL JSON (#5373) [deploy]
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-02-03 10:35:08 -05:00
Ben Halpern
a4b86e3ff1
Add initial usage metrics for datatog (#5544) [deploy]
* Add initial usage metrics for datatog

* Make measurable name more clear

* Change name of daily usage worker

* Fix test names
2020-01-16 12:59:17 -05:00
Molly Struve
5962d52a61
record background queue stats in a worker (#5533) [deploy] 2020-01-15 14:44:57 -05:00
Molly Struve
2e5a36e538
Log DB Table sizes in a Sidekiq Worker (#5518) 2020-01-15 12:33:14 -05:00
rhymes
9b2886979a ActiveRecord count optimizations (#5478) [deploy]
* Do not load messages in memory, just to count them
* Add Model.estimated_count
* Use Model.estimated_count in task record_db_table_counts
* Use size and estimated_count
* Use table_name so that .estimated_count works with all models
* Add comment to explain the .load.size + .each pattern
2020-01-14 12:03:38 -05:00
Michael Kohl
dba7e6ca60 Move Twitch webhook registration from ActiveJob to Sidekiq (#5414) 2020-01-14 11:55:35 -05:00
rhymes
c267526ed2 Remove temporary site config script and unused ENV var (#5455) [deploy] 2020-01-14 09:49:31 -06:00
rhymes
102e1a6b9c Routine rubocop fixes (#5386) 2020-01-08 09:05:12 -05:00
Molly Struve
6b23e327aa
Track Queue sizes and latency for Sidekiq (#5352) [deploy] 2020-01-07 11:57:13 -05:00
Molly Struve
bc8c177966
Record db table sizes in datadog where we can use them to generate relevant alerts (#5377) 2020-01-06 15:52:47 -05:00
Molly Struve
660852b711 record counts for important db tables to help track growth (#5253) [deploy] 2019-12-27 11:29:47 -05:00
Molly Struve
f86f93bc8a
Create rake Task to Destroy Old Notifications (#5180) [deploy] 2019-12-26 13:17:34 -06:00
Molly Struve
fb17d0e079
fix title_with_timeframe to handle invalid timeframe and update rake task to not use return (#5241) [deploy] 2019-12-26 08:43:46 -06:00
Ben Halpern
cd9805bc22 Fix tag badge task logic (#5189) [deploy] 2019-12-20 14:39:28 -05:00
Ben Halpern
c6d94d4049
Add rake task to reward tag badges weekly (#5183) [deploy] 2019-12-19 16:34:22 -05:00
rhymes
c9a07faf6a Add script to display and migrate environment variables to SiteConfig (#4865) [deploy] 2019-11-22 10:18:22 -05:00
Michael Kohl
b57ced5466 CacheBuster refactoring (#4766)
* Turn CacheBuster into a module

This class used no internal state, so repeatedly creating short-lived objects seems wasteful.

* Consistently use string interpolation and parenthesis

* Destructure arrays into meaningful names, formatting

* Fix request spec for internal classified listings controller

Interestingly this works when asserting directly on the module, but not on a double.
Asserting directly in the module seems sufficient for this test so the indirection
was removed.

* Turn CacheBuster into a module

This class used no internal state, so repeatedly creating short-lived objects seems wasteful.

* Fix specs after rebasing
2019-11-13 10:51:23 -05:00
rhymes
c8abbe9d60 Pro: memberships (#3461)
* Add ProMembership model

* Implement ProMembershipsController#create

* Implement basic ProMembershipsController#show

* Add ProMembership to ledger

* Populate user history after pro subscription is created

* Add fields for expiration notifications

* Add ProMemberships::ExpirationNotifier to notify users of expiring memberships

* Add tasks for recurring jobs to notify users of expiration

* Add auto_recharge column to ProMembership

* Add ProMemberships::Biller (incomplete)

* Fix specs

* Add ProMembership to Administrate

* Fix spec

* Add has_enough_credits? to User and Organization

* Add Payments::Customer class

* Finish ProMembership::Biller functionality

* Fix ProMemberships::Creator check for credits

* Disable destroy actions for ProMembershipsController

* Correctly authenticate ProMembershipsController actions

* Make sure only pro user's history can be indexed

* Add ProMembershipsController#update action for auto recharge

* Use regular AR to save new credits and add touch to the purchaser

* Clarify Pro membership create policy

* Display information about an existing pro membership

* Add UI to show page

* Add system test for Pro membership creation

* Implement edit membership

* Make sure users with pro memberships can access history and dashboard pro

* Fix padding issue

* Show a different text for a user that has credits but not enough for Pro

* Move Pro Membership functionality inside settings

* Update Pro Membership link in email notifications

* Bust all relevant caches

* Add the Pro checkmark around the website

* Use Users::ResaveArticlesJob instead of delay

* Add/remove user from pro-members chat channel

* Use the appropriate Pro checkmark

* Remove unfinished pro elements

* Remove checkmark JS
2019-09-24 10:38:54 -07:00
Jess Lee
65fccf00a9 add rake task for fixing credit counter cache (#3962) 2019-09-06 13:08:39 -04:00
Ben Halpern
66f72c091a Fix rake task with repeated name (#3845) [ci skip] 2019-08-26 17:33:00 -04:00
Mario See
47c2885810 Listings set custom expiry date (#3770)
* add expire_on column to classified_listings

* add expire_on to valid listing params

* add expire_on to model

* add expire date to new listing form

* add field in edit form

* add expiry dates to dashboard

* update expiry date in listing toolkit

* WIP unpublish job and test

test still has to run properly

* add job to class name

* change job to rake task

* revert snap change

* delete migration file

will add new one and revert schema changes to rename column

* reset schema

* add new migration to schema 'expires_at'

* change expire_on to expires_at
2019-08-23 17:33:50 -04:00
Anna Buianova
fabaeb5461 Introduced published field to podcasts (#3593)
* Published field for podcasts

* Add podcasts migration

* More specs for podcasts availability

* Show published in podcasts internal

* Update schema.rb with db:migrate
2019-08-01 09:29:13 -04:00
Anna Buianova
95a9e13922 Remove logic relying on old podcast status (#3505) 2019-07-19 09:30:51 -04:00
Anna Buianova
a8227b3048 A temp rake task to update podcast statuses (#3496) 2019-07-17 11:10:02 -04:00
Anna Buianova
94ab4e23fe Update podcast episode statuses #2952 (#3450) 2019-07-16 13:36:25 -04:00
rhymes
611f4b8675 Sponsorship: remove old columns (step 3) (#3446)
* Remove old sponsorship columns

* Rename redundant param names
2019-07-11 15:35:24 -04:00