Skip to content

Conversation

grantfitzsimmons
Copy link
Member

@grantfitzsimmons grantfitzsimmons commented Jul 16, 2025

Fixes #4566

This change fixes an issue where users in timezones with an offset larger than one set for Django (by default, America/Chicago) would not receive new notifications due to the fetching logic using the date of the user's browser locale and not the server time (which is used when creating new notification_message records), resulting in them not being fetched.

This PR adds a new API endpoint to fetch the current server time and integrates it into the notifications polling mechanism to ensure consistent time-based queries.

  • Adds Django view and URL pattern to expose /context/server_time.json
  • Introduces fetchServerTime utility to retrieve and parse server time
  • Updates useNotificationsFetch to use server time in its polling URL

Since I see you requested a self-review, @melton-jason: please feel free to edit this PR however you see fit!


Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add relevant issue to release milestone
  • Add relevant documentation (Tester - Dev)
  • Add automated tests

Testing instructions

Test the behavior in this PR against the latest tagged release:

  • Use a browser extension to set your timezone to be something in the future relative to where you are (using a browser extension like https://change-timezone.pdfwork.com/ (for testing, I used the Pacific/Apia locale which has an offset of 780 , which is the time zone difference from UTC (in minutes) (with daylight consideration))
  • Open the query builder and run a query. After it has been run, click "Export to CSV"
    • In v7 with a time zone set far in the future, you should not receive any notification even after Specify fetches new notifications. When you reload the page, the new notification would be visible then.
    • In issue-4566-time, you should receive a notification once the browser sends a request to fetch notifications. You should be able to either wait for a notification to appear or click on the "Notifications" navigation menu item.

Copilot

This comment was marked as outdated.

@grantfitzsimmons grantfitzsimmons requested a review from Copilot July 17, 2025 02:15
Copilot

This comment was marked as resolved.

@grantfitzsimmons grantfitzsimmons changed the title Add time zone API endpoint Fetch notifications using the current server time Jul 17, 2025
@melton-jason melton-jason self-requested a review July 17, 2025 02:35
@grantfitzsimmons grantfitzsimmons added this to the 7.11.2 milestone Jul 22, 2025
@grantfitzsimmons grantfitzsimmons marked this pull request as ready for review July 22, 2025 16:25
@grantfitzsimmons grantfitzsimmons requested a review from a team August 19, 2025 19:24
Copy link
Collaborator

@emenslin emenslin left a comment

Choose a reason for hiding this comment

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

  • Use a browser extension to set your timezone to be something in the future relative to where you are (using a browser extension like https://change-timezone.pdfwork.com/ (for testing, I used the Pacific/Apia locale which has an offset of 780 , which is the time zone difference from UTC (in minutes) (with daylight consideration))
  • Open the query builder and run a query. After it has been run, click "Export to CSV"
    • In v7 with a time zone set far in the future, you should not receive any notification even after Specify fetches new notifications. When you reload the page, the new notification would be visible then.
    • In issue-4566-time, you should receive a notification once the browser sends a request to fetch notifications. You should be able to either wait for a notification to appear or click on the "Notifications" navigation menu item.

Looks good, I receive the notifications instantly on the issue branch!

@emenslin emenslin requested a review from a team August 20, 2025 19:48
Copy link
Collaborator

@lexiclevenger lexiclevenger left a comment

Choose a reason for hiding this comment

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

  • Use a browser extension to set your timezone to be something in the future relative to where you are (using a browser extension like https://change-timezone.pdfwork.com/ (for testing, I used the Pacific/Apia locale which has an offset of 780 , which is the time zone difference from UTC (in minutes) (with daylight consideration))
  • Open the query builder and run a query. After it has been run, click "Export to CSV"
    • In v7 with a time zone set far in the future, you should not receive any notification even after Specify fetches new notifications. When you reload the page, the new notification would be visible then.
    • In issue-4566-time, you should receive a notification once the browser sends a request to fetch notifications. You should be able to either wait for a notification to appear or click on the "Notifications" navigation menu item.

Looks good! I received the notification without needing to refresh.

Triggered by 7001dc6 on branch refs/heads/issue-4566-time
Copy link
Collaborator

@bhumikaguptaa bhumikaguptaa left a comment

Choose a reason for hiding this comment

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

  • Use a browser extension to set your timezone to be something in the future relative to where you are (using a browser extension like https://change-timezone.pdfwork.com/ (for testing, I used the Pacific/Apia locale which has an offset of 780 , which is the time zone difference from UTC (in minutes) (with daylight consideration))
  • Open the query builder and run a query. After it has been run, click "Export to CSV"
    • In v7 with a time zone set far in the future, you should not receive any notification even after Specify fetches new notifications. When you reload the page, the new notification would be visible then.
    • In issue-4566-time, you should receive a notification once the browser sends a request to fetch notifications. You should be able to either wait for a notification to appear or click on the "Notifications" navigation menu item.

Works as expected!

Triggered by 328b3d4 on branch refs/heads/issue-4566-time
@grantfitzsimmons grantfitzsimmons merged commit bd4cd83 into main Sep 3, 2025
9 checks passed
@grantfitzsimmons grantfitzsimmons deleted the issue-4566-time branch September 3, 2025 13:43
@github-project-automation github-project-automation bot moved this from 📋Back Log to ✅Done in General Tester Board Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Exported CSV files from queries do not always notify the user
4 participants