-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feat: Add a single endpoint to fetch community page data #963
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit includes the creation of new functions that will support loading essential initial site data and site menu items. It also includes the addition of extra verification in the handling section to ensure community_id and subdomain are provided. Various utilities to fetch viable menu items and feature flags for a community were added.
This commit removes the redundant 'confirm.sh' script and enhances the handling of environment variables in 'settings.py'. It introduces standardized environment variable checks and configurations in Makefile, and removes the previously hard coded environment variables.
This commit restructures API utilities and associated components, particularly in the context of loading site data. The changes introduce a more streamlined condition branching for page settings with the introduction of function maps, resulting in cleaner and more readable code. It also updates imported models and enhances data loading methods for different types of content like actions, vendors, testimonials, and others. Additionally, some naming changes and paths adjustments are made for accuracy and compatibility.
Page settings data keys in the api utils have been refactored for standardization. Specific keys for homepage, actions, events, vendors, about, testimonials, about us and contact us page settings have all been changed to 'page_data'. This change simplifies data access and highlights the shared structure of these pages.
Modified the eligibility check logic in user_event_nudge module to compare only the dates instead of the full datetime. This ensures that the comparison between last run time and event published time is done only on the basis of date, disregarding the time part.
…uests Modified several files to improve data fetching, field renaming, and handling of concurrent requests. Updated 'vendor', 'event', 'misc', 'subscriber', 'policy' and 'goal' handlers to adjust field renaming from 'id' to either 'vendor_id', 'event_id', 'subscriber_id', 'policy_id' or 'goal_id'. Optimized 'misc' handler to fetch data from multiple endpoints concurrently using ThreadPoolExecutor. These changes provide more consistent naming across handlers and increases data processing efficiency.
The code modification ensures that duplicate feature flags are eliminated when retrieved. This correction enhances data consistency and prevents any potential confusion or errors due to duplicate flags in the system.
IS_LOCAL has been hardcoded as True to ensure local environment setting. Additionally, the method for env_path selection has been refactored for clarity and simplicity. Now, the path is directly set with corresponding '.env' based on whether IS_PROD, IS_CANARY, or IS_LOCAL is True, defaulting to 'dev.env' otherwise.
The environment condition for LOCAL setup has been updated in settings.py. Instead of setting IS_LOCAL as a boolean constant true, it now compares the DJANGO_ENV with 'local'. This allows more flexibility in managing different environments.
abdullai-t
changed the title
mew-optimized-site-link
Feat: Add a single endpoint to fetch community page data
Apr 24, 2024
BradHN1
reviewed
Apr 24, 2024
BradHN1
reviewed
Apr 24, 2024
BradHN1
reviewed
Apr 24, 2024
BradHN1
reviewed
Apr 24, 2024
BradHN1
reviewed
Apr 24, 2024
The import statements in the file src/api/store/misc.py have been updated to increase readability. Also, the 'load_essential_initial_site_data' method in src/api/store/misc.py and src/api/services/misc.py has been commented out due to being currently unused. This action is taken as part of code clean up and to improve the maintainability of the codebase.
Opoku-Agyemang
requested changes
Apr 25, 2024
The commit involves removing extensive site setup utility code from api_utils.py and other miscellaneous functions from misc.py and services/misc.py. This clean-up greatly simplifies the codebase, removing unused and outdated functions related to loading data for various community features and pages.
This change modifies the validator in misc.py to expect 'endpoints', rather than 'data'. This better reflects the actual intent of the function, improving code readability and maintainability.
The PAGE_SETUP_ESSENTIALS constant, which was found in the 'constants.py' file by the navigation path 'src/api', was unused and hence, has been removed. This cleanup contributes to overall code tidiness and efficiency.
This commit includes cookies in the data payload for the post requests in the fetch_data function. It retrieves cookies from the current request and sends them along with post call to ensure consistent user session management.
The community API now fetches and provides the visibility status of the donation page. This extra property for donation_page_settings is included in the same manner as the settings for other pages like testimonial page, vendors page, and others.
…o mew-optimized-site-link
Increased code readability by including a TODO comment in misc.py, which highlights the need to revert a change and create a new endpoint for user.portal.menu.load.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary / Highlights
This pull request includes:
Details (Give details about what this PR accomplishes, include any screenshots etc)
Testing Steps (Provide details on how your changes can be tested)
Requirements (place an
x
in each[ ]
)Transparency (Project board)