-
Notifications
You must be signed in to change notification settings - Fork 10
T2681 add child's pictures in timeline #206
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
T2681 add child's pictures in timeline #206
Conversation
Summary of ChangesHello @jordyBSK, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the child's timeline feature by incorporating child pictures alongside existing correspondence and gift entries. This provides users with a unified and richer chronological view of a child's journey, making the timeline a more complete record of interactions and milestones. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds child's pictures to the timeline view. The changes include updating the backend controller to fetch picture data from the compassion_child_pictures table and modifying the timeline template to render these new items. My review focuses on improving code maintainability. I've noticed that several docstrings and an important explanatory comment have been removed from my_compassion/controllers/my2_children.py. I recommend restoring them to keep the code well-documented. Additionally, the SQL query formatting in _get_timeline_data has become inconsistent, and I suggest standardizing it for better readability. Finally, the docstring for _get_timeline_count should be updated to reflect the inclusion of child pictures in the count. The implementation for displaying the pictures in the timeline appears correct.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request successfully adds a new feature to display a child's pictures in the timeline. The changes involve updating the backend controller to fetch picture data and modifying the frontend template to render these new timeline items. While the feature implementation is good, I have identified a potential security concern in the data fetching logic that needs to be addressed. Additionally, I've noted some opportunities to improve code maintainability by restoring removed documentation.
| FROM compassion_child_pictures p | ||
| WHERE p.child_id = %(child_id)s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The query for compassion_child_pictures is filtered only by child_id, while the queries for correspondence and sponsorship_gift are also filtered by partner_id. This inconsistency could potentially lead to information disclosure, where a sponsor might see pictures not intended for them if a child has had multiple sponsors over time.
If child pictures are meant to be visible to any sponsor with access to the child's profile, this may be intentional. However, the discrepancy with other timeline items warrants a security review.
If filtering by partner is required, and the compassion_child_pictures table contains a partner_id (or equivalent), please add the additional filter condition. For example:
WHERE p.child_id = %(child_id)s AND p.partner_id = ANY(%(partner_ids)s)A similar change would be needed in the _get_timeline_count method. If the table structure doesn't support this, it might be worth discussing if the data model needs an update to ensure proper access control.
| website=True, | ||
| sitemap=False, | ||
| ) | ||
| def my2_render_child_timeline_page(self, child, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| website=True, | ||
| sitemap=False, | ||
| ) | ||
| def my2_get_child_timeline_items(self, child, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring and an important explanatory comment were removed from this function. This information is valuable for understanding the function's purpose as an API endpoint and the reasoning behind the error handling logic. Please consider restoring them to maintain code clarity.
The removed docstring was:
"""API endpoint for infinite scroll. Returns a rendered HTML snippet."""And the comment:
# For an API, it's better to return an empty or error response
# than to redirect.| auth="user", | ||
| website=True, | ||
| ) | ||
| def get_center_weather(self, child, **kw): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…n-Timeline # Conflicts: # my_compassion/controllers/my2_children.py # my_compassion/templates/components/my2_sponsor_child_timeline_batch.xml
Uh oh!
There was an error while loading. Please reload this page.