Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple codidact from code #968

Draft
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

Taeir
Copy link
Contributor

@Taeir Taeir commented Jan 19, 2023

This pull request decouples the codidact network from a lot of the pages. It does so by defining a helper function which checks the domain of the community for .codidact.[com|org]. It then disables or changes components on pages based on this setting.

TODO

  • Special config file for these settings that do not change often or at all?
  • Email addresses as settings
  • Figure out something for the copyright in the mailer and devise mailer (layout)
  • Network name setting?

Fixes #826

app/helpers/codidact_helper.rb Fixed Show fixed Hide fixed
app/helpers/codidact_helper.rb Fixed Show fixed Hide fixed
@cellio
Copy link
Member

cellio commented Jan 20, 2023

Thanks for working on this! I knew we only got some of them (the easiest ones, naturally) in the previous sweep, and then I lost track of it.

module CodidactHelper
# Whether this server is part of the codidact network.
def codidact?
Rails.cache.fetch 'is_codidact' do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether the Redis cache is going to be faster than checking the string twice. It might be premature optimization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Self-hosted instances
2 participants