Commit graph

58 commits

Author SHA1 Message Date
rhymes
300ba1b33f
[deploy] Decouple Twitter authentication from fetching tweets (#7920)
* Add TwitterClient::Client

* Use TwitterClient::Client for Tweet

* Test retweets

* Test assignment to user

* Fix TweetTag spec

* Remove TwitterBot

* Fix some specs

* Fix RSS Reader specs
2020-05-19 18:05:41 -04:00
rhymes
ae8a58fec2
[deploy] Decouple GitHub authentication from fetching GitHub issues (#7660)
* Improve error handling

* Add tests for Github::Client

* Add GithubIssue validation

* Refactor GithubIssue and fix bug with pull requests

* Improve tests

* Fix PR API URL generation

* Improve logic and get rid of the issue fragment

* Fix disappeared avatar

* Improve rendering

* Activate client side caching using Redis

* Remove unnecessary file

* Add RemoveGithubIssues data update script

* Fix comma

* Forgot to disable the approvals verify text

* Apply PR feedback
2020-05-04 16:17:16 -04:00
Alex
edf0e62e96
[deploy] Remove FASTLY_SAFE_PARAMS_SNIPPET_NAME env var (#7669) 2020-05-04 13:13:05 -04:00
Molly Struve
4c779be2ed
[deploy] Remove ALL Algolia Code (#7577) 2020-04-29 10:11:57 -05: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
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
Michael Kohl
c8845e647a
[deploy] Remove Google Analytics page counts (#6969)
* Remove Google Analytics page counts

* Update spec

Co-authored-by: rhymes <rhymesete@gmail.com>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-04-14 10:44:05 -04:00
Ben Halpern
a4a14a5377
[deploy] Make force_ssl an environment variable to make sure new communities can get proper ssl config. (#7090)
* Add conditional for redirect

* Force ssl

* Redis secure

* More push

* Add FORCE_SSL_IN_RAILS env var
2020-04-08 14:23:50 -04:00
Ridhwana
e74890680a
Generalize meta content and copyright year (#6887)
* chore: remove the description

* feat: change the meta og:site_name property from The Practical DEV to The <COMMUNITY_NAME> Community consistently

* refactor: change the canonical link to be more dynamic using the <%= ApplicationConfig["APP_PROTOCOL"] %><%= ApplicationConfig["APP_DOMAIN"] %>

* refactor: update the path to be dynamic

* refactor: change some other meta properties to be dynamic

* refactor: update the index

* refactor: update the sitename to just read <%= ApplicationConfig["COMMUNITY_NAME"] %> Community

* feat: copyright year should be dynamic

* feat: change the meta og:url content to be dynamic by using <%= ApplicationConfig["APP_PROTOCOL"] %><%= ApplicationConfig["APP_DOMAIN"] %> for the former part of the url

* feat: space

* refactor: move the copyright notice to a helper

* refactor: use the community_qualified_name helper!

* refactor: start year is already a string

* refactor: use app url helper instead of <%= ApplicationConfig["APP_PROTOCOL"] %><%= ApplicationConfig["APP_DOMAIN"] %> everywhere

* chore:oops

* refactor: Change  <meta name="twitter:image:src" content="http://i.imgur.com/B4JNl1w.png"> to `<meta name="twitter:image:src" content="<%= SiteConfig.main_social_image %>">` consistently.

* refactor: Replace  `<meta property="og:image" content="http://i.imgur.com/B4JNl1w.png" />` with `  <meta property="og:image" content="<%= SiteConfig.main_social_image %>" />`

* chore: update some other meta's

* feat: replace 'The Practical DEV' with 'DEV Community' and

* test: remove The :)

* test: copyright_notice

* fix: syntax error

* feat: name of community

* refactor: use app url

* fix: template strings

* fix: tag

* feat: update the app url parameters

* feat: add a community_name helper so we don't have to refer to an environment variable in the templates

* feat: take into account the case when the start year is a blank string

* feat: single quotes to double quotes

* test: add a test for the #community_name

* chore: update or codeclimate

* chore: amend the community helper

* refactor: use the community_name helper in here

* feat: update ApplicationConfig["COMMUNITY_NAME"]  with community_name

* fix: Time.current.year needs to be a string :(

* chore: extra space

* chore: change to use community_qualified_name
2020-03-31 16:15:57 +02:00
Vaidehi Joshi
99c87d7a17
Replace WELCOMING_USER_ID with mascot_user_id (#6484) [deploy]
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2020-03-09 08:08:53 -07:00
Molly Struve
cf94f76ccd
Notify slack when release phase fails (#6300) [deploy] 2020-02-27 10:50:59 -05:00
rhymes
aa5f4b8d85
Remove leftover Stripe subscriptions code (#6243) 2020-02-24 08:33:36 -05:00
Vaidehi Joshi
f71c8b16e7
Allow dynamic authoring of welcome notifications (#6045) [deploy]
* Add "Welcome" type to Broadcasts, allow dynamic "authoring" of Broadcasts

This adds a new `type_of` to the Broadcast model: "Welcome". As we begin to create a new "welcome notification" workflow, we'll categorize them by making them all of the same type.

This also adds a concept of a "welcoming user", which can be set via an ENV var. The WELCOMING_USER_ID will allow us to explicitly set (and change) which user in the database is the one that "sends" welcoming notification. In production, we plan for this to be dev.to/sloan.

* Allow WelcomeNotificationWorker to accept + send any kind of broadcast

This abstracts out the logic of deciding which broadcast to send from the woker into the calling method. This will help us send many different kinds of welcome notifications using one, resuable worker class.

* Raise if a Notification can't be created

* Add STAFF_USER_ID as an ENV var

This is in preparation for moving away from SiteConfig.staff_user_id, and replacing it with an ENV var. We will need to set this in production first, and then make a separate PR to replace all instances of staff_user_id with the newly-set ENV var.
2020-02-12 13:50:37 -08:00
Molly Struve
0409722899
Introduce Elasticsearch to DEV env (#5762) [deploy] 2020-02-03 09:12:05 -05:00
Molly Struve
b06ad5064a Remove ENV["USE_NEW_AWS"] and use Orig ENV variables for New Creds (#5771) [deploy]
* Remove temp ENV variable for switching buckets and use original ENV variables

* correctly choose AWS region
2020-01-27 15:46:57 -05:00
Molly Struve
85cd80cb0a Declare new AWS variables in ENV file (#5765) [deploy]
* declare USE_NEW_AWS in ENV file

* declase App config variables in ENV file

* add defaults
2020-01-27 11:01:53 -05:00
Michael Kohl
256448f1f3 Remove unused Envfile variables (#5474)
* Remove unused variables from Envfile

* Remove unused Twitter variables from Envfile

* Also remove GITHUB_TOKEN

* Change Twitter token screenshot URL
2020-01-14 12:05:35 -05:00
rhymes
c267526ed2 Remove temporary site config script and unused ENV var (#5455) [deploy] 2020-01-14 09:49:31 -06:00
Michael Kohl
1cea7a1ef1 Remove env variables handled by SiteConfig (#5400) 2020-01-10 11:42:55 -05:00
Molly Struve
2e661809b6 Introduce Sidekiq For Background Jobs (#5252)
* Introduce Sidekiq to the app and update RateLimitCheckerJob to use it

* fix rate limit checker spec with new sidekiq syntax

* add Sidekiq to tech stack overview

* Remove RateLimitChecker job change, add sidekiq web UI and testing support
2019-12-27 10:39:48 -05:00
Molly Struve
90712f61c6
Remove memcache dalli gem and setup code (#5057) [deploy] 2019-12-09 11:37:53 -06:00
Molly Struve
834eb51e98
Replace Airbrake with Honeybadger (#5007) [deploy] 2019-12-05 11:29:51 -06:00
Molly Struve
1979ad13f3 replace DEPLOYMENT_SIGNATURE with HEROKU_SLUG_COMMIT to bust caches on deploy (#4950) [deploy] 2019-12-02 12:51:04 -05:00
Molly Struve
091392cf1f Remove webpush gem and code (#4883) 2019-11-22 16:46:11 -05:00
Andy Zhao
b2e18aeb72 Use Redis for session storage (#4004) [deploy]
* WIP use redis-session-store for sessions

* Use Redis as session storage

* Add redis-server to Travis

* Use integer for SESSION_EXPIRY_SECONDS env variable

Co-Authored-By: rhymes <rhymesete@gmail.com>

* Remove sessions b/c no custom sessions logic

* Use ApplicationConfig instead

* Rename default value

* Remove rememberable module

* Persist the user for the test

* Remove remember_me related tests

* Revert 'undo remember_me' commits

* Add redis to procfile

* Cleanup devise configuration

* Move REDIS configuration in the basic configuration section

* Make sure the expiration time can't zero

* Restore old order and remove useless comment line

* Delete legacy session cookie after login

Once deployed the server will start using the new session cookie, this makes sure the legacy one is deleted on the user's browser

* Remove redis from Procfile

* Add signed, secure and httponly to the Redis session cookie
2019-11-12 10:10:34 -06:00
rhymes
db04e3b04b Add redis-rails gem and REDIS_SESSIONS_URL env variable (#4789) [deploy] 2019-11-11 13:45:52 -06:00
Omar Bahareth
dca66bd6a8 Rate limit daily user follows to 500 (#4647) [deploy]
* Rate limit daily user follows to 500 per day
Return an error in `POST /follows` JSON response when a user tries to follow more than 500 accounts in a single day.

Other Changes:
- Add a spec for follows#create.

* Turn daily account follow limit into an env var

* Avoid executing today follow count query when possible
user.following_users_count is a counter cache on how many users the person is already following, so if it's less than the limit we don't need to run the query and can just return it instead.

* Simplify today follow count query
Stop needlessly checking into the future, only check from the beginning of the day until now.

* Raise account follow limit error if followable_id count is over limit
Other changes:
- Always return JSON, the `respond_to` block from before was unnecessary since this endpoint always returns JSON.
- Rescue `DailyFollowAccountLimitReached` on the method and remove begin block, since the error can be raised from two places in the same method.

* Index created_at on users table

* Make adding created_at index on users table happen concurrently

* Rename DAILY_ACCOUNT_FOLLOW_LIMIT to RATE_LIMIT_FOLLOW_COUNT_DAILY

* Add RATE_LIMIT_FOLLOW_COUNT_DAILY to Envfile

* Move RATE_LIMIT_FOLLOW_COUNT_DAILY from env var to ApplicationConfig
2019-11-06 16:24:43 -05:00
rhymes
0591362756 Use libhoney explicitly and group initializers (#4699) [deploy]
* Use libhoney explicitly and group initializers

* Use Libhoney TestClient during tests

* Use test client for Honeycomb during tests as well
2019-11-04 11:55:04 +00:00
Mohab Abd El-Dayem
2c80e9da42 Make The Default Email An Enviroment Variable. (#4677)
* Make the default email an enviroment variable

* Added spaces in Envfile for readability
2019-11-01 09:03:06 -04:00
Nadiya Karachevska
06d2fa24f5 Add ability to set favicon through environment variable (#4665) 2019-10-31 15:34:28 -04:00
Molly Struve
dc72b4f1fa Add Honeycomb beeline gem for monitoring and observability (#4649) 2019-10-30 12:02:31 -04:00
Molly Struve
69e35dc1b3 Add Redis gem and Create RedisClient (#4582)
* Add redis gem and client

* use keyword arguments in redis initializer

* check for REDISCLOUD_URL and fallback on REDIS_URL when connecting to redis

* dont parse Redis url in initializer
2019-10-30 10:32:59 -04:00
Ryan Palo
4156f1f9de [deploy] Extract DEV specifics to Env variables (#4561)
* [WIP] Extract DEV specifics to Env variables

* [WIP] Fix sendgrid url that I accidentally changed.  Womp.

* Remove extra colon from 'variable' calls

* Trim :// off of app protocol

* Update Envfile TIMBER_LOGS default comment for accuracy

* Add API doc links for each service
2019-10-28 10:29:57 -04:00
Allan Klaus
4402cc212c Create tests to PingAdmins (#4169) [ci skip] 2019-10-03 11:18:53 -04:00
Andy Zhao
0f46b0deed Add Stack Exchange Liquid tag (#3637)
* Add Stack Exchange Liquid tag

* Add Stack Exchange/Overflow tag

* Convert to integers

* Add better error handling

* Make all links open in new tab

* Adjust names and refactor a bit

* Use key for every API call

* Add new lines to end of svg files

* Add better error handling

* Fix edge case where input is not numeric

* Finalize Stackexhange tag design and functionality

* Fix css typo

* Update snapshots

* Fix snapshot back
2019-08-14 15:01:47 -04:00
Ben Halpern
456931f208
Further generalize pages and site Twitter handle (#3177)
* Further generalize pages and site Twitter handle

* Add footer mod change

* Remove giveaways dead code
2019-06-16 00:59:11 -04:00
Jess Lee
10674aed72 Buffer Listings (#2956)
* add share to buffer button

* wip

* wip

* adds listings to buffer via form

* create migration for buffered timestamp and update seed file

* display when listing was last buffered

* remove annoying spacing

* refactor article script for listings

* social preview wip

* add custom social card for indivdual listings

* add styling

* fix css

* tweak styling

* final css tweaks

* fix branch

* add buffer listings id

* update envfile

* add social previews spec
2019-06-14 19:33:19 -04:00
Ben Halpern
d730e8cb9a
Change social image strings to environment variable (#2763) 2019-05-08 09:31:44 -04:00
Corey Alexander
ec388804df Embed Twitch Live Streaming (#2591)
* Get a job created that can create a webhook subscription for a twitch user login

* Remove ngork url

* Refactor add store the access token in the cache

* Get a controller stood up to recieve the webhooks. Now they just need to be processed

* Get User columns added and got webhook controller bones working

* Update the webhook job to use the User

* Add a way for the User to input their Twitch User Name. Plus a linter fix

* Delay webhook registration when profile is updated

* Don't add _ in username

* Use String columns

* Quick fix and add some more requests specs

* Specs for the webhook job

* Get a show page Twitch Live Streams. Just a straight embed of the Twitch Everything Embed UI. Works surprisingly well responsively, and works on all screen sizes

* Fix Gemfile.lock from merge issues

* Add support for expired tokens and add spec

* Add secrets to webhook registration and clean up spec to remove token logic

* Verify webhook secret and spec it

* Add rake task to enqueue webhook registration for all Users. This can be used from Heroku Scheduler

* Update the lease seconds to be for 5 days

* Actually lets do 7 so we can refresh twice a week and try to make sure that we can always miss one

* Hijack the existing Twitch logo instead of making a duplicate one

* Remove comment and replace with log line

* Remove some white space

* Log to Airbrake when webhook errors occur

* Move to passing in an id instead of User object

* Extract logic from Job to Service object

* Capitilize in the view

* Move out of models and into services

* Remove letover stub

* Remove one usage of Faraday

* Use HTTParty for all the HTTP here
2019-04-29 18:11:53 -04:00
Ben Halpern
78138532c8
Classified Listings (#2545)
* Initial classified listings work

* More work on tags

* Additional work finalizing stripe and getting the listings page along

* Finalize-ish listings 🤞
2019-04-24 16:17:01 -04:00
Ben Halpern
d76a37a6fe
Add GA_FETCH_RATE ENV var to ease rate limiting (#2461) 2019-04-15 14:11:55 -04:00
rhymes
bf33490b04 Removed csv_shaper, bourbon and share_meow_client (#2450)
None of these gems seems to be in usage
2019-04-15 12:05:08 -04:00
Jess Lee
f637d9e02b Manage tag and community mod lists in Mailchimp (#2362)
* add moderation email list columns

* automate tag moderator mailing list

* reorder logic for tag mod list

* add community mod list

* remove trusted privileges when reverting a user to a regular member

* automatically make tag mods community mods

* fix merge conflicts

* add community view

* make methods less complex based on code climate sugggestion

* add specs

* refactor tag moderator module

* fix spec
2019-04-10 14:45:06 -04:00
Ben Halpern
b0ad7f8c74
Some night theme code, other style adjustments, and extracted app name into ENV var (#2289)
* Style, theme adjustments, plus generalization work

* Modify login cta style on home page

* Modify text
2019-04-02 13:10:28 -04:00
Mike Coutermarsh
dd84051ce4 Social Card upgrade - Part 1 (#2090)
* Add HtmlCssToImage for generating images

This will be used by social_previews to convert the templates into images.

Setup a fallback image primarily for local dev, so that this won't cause
errors if authentication is missing.

Caching is setup to use contents of the html/css. So it with
autobust/generate a new image whenever the markup changes.

* Update Article social preview template to not be random

+ Being random breaks caching (since we generate cachekey by a SHA of html content)
+ Use Roboto for when generating via HTML/CSS to Image

* Update Tag social preview template to not be random

+ Make rand deterministic so it doesn't break caching

* Update user social preview template for html/csstoimage

* Update shecoded template to work with both url2png and htmlcsstoimage

* Add ability to respond to .png for social previews controller

When adding .png to the url, these routes will now generate an image and
redirect to it.

This leaves the existing pages as they were, so we're backwards
compatible with all the existing links out in the world.

* Fix merge conflicts

* Remove some duplication

* Improve spec descriptions/read better

* clean up setting template with a ternary
2019-03-22 16:28:02 -04:00
Ben Halpern
c92c77396c
Add ability to set logo via ENV var (#2123) 2019-03-20 11:14:23 -04:00
Jess Lee
49e3878239 Add Stripe Cancellation Webhook (#1682) 2019-02-13 15:56:19 -05:00
Christine Yen
cff6b5d589 Add Honeycomb gem and initial instrumentation (#695)
* Add basic Honeycomb initializers

* Add some basic instrumentation, capture basic IDs

* Correctly alphabetize Gemfile, embed env in dataset names

* Actually reorder Gemfile because I can read

* Add custom tracing instrumentation to RssReader

* Improve timing/tracing info in RssReader

* Even make sure Errors show up in trace if possible

* Make sure we capture this as Rails traffic

* Swap in dev/test Libhoney::Clients as appropriate

* Move context-snagging bits into lib/instrumentation.rb

* Merging Gemfile lines seems to be my Achilles heel
2018-11-28 10:08:27 -05:00
Ben Halpern
db6232adf3
Add initial ios push notifications to server (#1207)
* Add initial push notification logic for iOS

* Adjust notification form css

* Clean up schema.rb

* Add mark-all-as-read functionality for ios notifications

* Update app/models/notification.rb

Fix `find` to `find_by`

Co-Authored-By: benhalpern <bendhalpern@gmail.com>
2018-11-27 17:40:43 -05:00
Andy Zhao
a1010201f2 Notifications part 2 (#1156)
* Remove stream and add new notification views

* Actually remove Stream

* Move followers query to async method

* Remove unused tests and fix query

* Try using without delay instead

* Add without delay and escape HTML

* Make all tests pending for now
2018-11-19 18:14:24 -05:00