Skip to content

feat: move notifications out of activity log space #35233

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

Merged
merged 18 commits into from
Jul 18, 2025

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Jul 17, 2025

we're going to add some notifications that aren't based on activity log items

so let's move the notifications API out of the activity log view set

that way it isn't surprising when it loads things that aren't in the activity log

(i've not set up redirects because it's an internal API 🙈)

tested by checking the API still works in the UI

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR moves notification functionality out of the activity log space into a dedicated endpoint. The main changes include:

  1. Creating a new /my_notifications API endpoint
  2. Moving ServerTimingsGathered to posthog.api.utils
  3. Updating API routes in frontend and tests
  4. Moving and adapting notification-related tests
  5. Implementing efficient notification handling with deduplication logic

This architectural change prepares the system for future notifications that aren't tied to activity logs, making the codebase more modular and logically organized.

Confidence score: 4/5

  1. The PR is safe to merge as it's a well-structured internal API change with comprehensive test coverage
  2. The score is 4 because while the changes are well-tested and logical, the lack of redirects for old endpoints could cause temporary disruption to internal services
  3. Files needing attention:
    • posthog/api/test/test_my_notifications.py: The API endpoint for bookmarking notifications hasn't moved with the rest of the notifications code
    • frontend/src/scenes/session-recordings/apm/performance-event-utils.test.ts: Test URLs need to be updated for consistency

10 files reviewed, 3 comments
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

github-actions bot commented Jul 17, 2025

Size Change: 0 B

Total Size: 2.62 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 2.62 MB

compressed-size-action

@pauldambra pauldambra requested a review from veryayskiy July 17, 2025 22:25
@fuziontech fuziontech requested a review from Copilot July 17, 2025 22:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR moves the notifications API from the activity log namespace to its own dedicated endpoint to prepare for adding notifications that aren't based on activity log items. The change makes the API structure more logical and reduces confusion when notifications include non-activity-log content.

Key changes:

  • Moved notifications API from /activity_log/important_changes to /my_notifications
  • Created new dedicated MyNotificationsViewSet and related logic
  • Updated frontend components to use the new API endpoint
  • Migrated all notification-related tests to the new structure

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
posthog/api/my_notifications.py New dedicated API viewset for notifications with bookmark functionality
posthog/api/activity_log.py Removed notification-related methods and imports
posthog/api/test/test_my_notifications.py New comprehensive test suite for notifications API
posthog/api/test/test_activity_log.py Removed notification tests, cleaned up imports
posthog/settings/web.py Updated API route pattern for notifications
posthog/api/__init__.py Registered new notifications router
frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic.tsx New frontend logic for notifications
frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelActivityLogic.tsx Removed notification logic from activity panel
frontend/src/layout/navigation-3000/sidepanel/panels/activity/SidePanelActivity.tsx Updated to use separate notifications logic
frontend/src/mocks/handlers.ts Updated mock endpoint
frontend/src/scenes/session-recordings/apm/performance-event-utils.test.ts Updated test URL
frontend/src/scenes/session-recordings/apm/__snapshots__/performance-event-utils.test.ts.snap Updated snapshot
ee/session_recordings/session_summary/summarize_session.py Updated import path
Comments suppressed due to low confidence (2)

posthog/api/test/test_my_notifications.py:273

  • The test name suggests it marks notifications as read, but the implementation marks them as unread. Consider renaming to 'test_reading_notifications_marks_them_unread' or updating the logic to match the name.
        ]

posthog/api/test/test_activity_log.py:73

  • The test name 'test_reading_notifications_marks_them_unread' appears to be incorrect - reading notifications should typically mark them as read, not unread. This test was removed in the refactor, but the naming inconsistency suggests there may have been confusion about the expected behavior.
    def _create_and_edit_things(self):

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

18 snapshot changes in total. 0 added, 18 modified, 0 deleted:

  • chromium: 0 added, 18 modified, 0 deleted (diff for shard 12)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

18 snapshot changes in total. 0 added, 18 modified, 0 deleted:

  • chromium: 0 added, 18 modified, 0 deleted (diff for shard 12)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@pauldambra pauldambra enabled auto-merge (squash) July 18, 2025 09:17
@pauldambra pauldambra merged commit a520d4b into master Jul 18, 2025
259 of 288 checks passed
@pauldambra pauldambra deleted the feat/move-notifications-out-of-activity-log-space branch July 18, 2025 17:53
lricoy pushed a commit that referenced this pull request Jul 18, 2025
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants