8000 Show banner when sync fails due to quota error by AbeJellinek · Pull Request #5053 · zotero/zotero · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Show banner when sync fails due to quota error #5053

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AbeJellinek
Copy link
Member
@AbeJellinek AbeJellinek commented Feb 21, 2025

This handles (6) in #2376.

Also:

  • Move strings to Fluent
  • Fix overflow when window is narrow

Simulate a quota error locally for testing:

--- a/chrome/content/zotero/xpcom/storage/zfs.js
+++ b/chrome/content/zotero/xpcom/storage/zfs.js
@@ -449,6 +449,21 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = {
 						debug: true
 					}
 				);
+				// Don't merge me! Simulate a quota error for testing:
+				Object.defineProperty(req, 'status', { value: 413 });
+				let getResponseHeader = ((original, obj) => ((header) => {
+					if (header === 'Zotero-Storage-Usage') {
+						return 999;
+					}
+					if (header === 'Zotero-Storage-Quota') {
+						return 1000;
+					}
+					if (header === 'Zotero-Storage-UserID') {
+						return Zotero.Users.getCurrentUserID();
+					}
+					return original.call(obj, header);
+				}))(req.getResponseHeader, req);
+				Object.defineProperty(req, 'getResponseHeader', { value: getResponseHeader });
 			}
 			catch (e) {
 				if (e instanceof Zotero.HTTP.UnexpectedStatusException) {

@AbeJellinek AbeJellinek force-pushed the 2376-quota-error-reminder branch from 0486516 to 70eb9ec Compare February 21, 2025 17:08
@AbeJellinek AbeJellinek force-pushed the 2376-quota-error-reminder branch 3 times, most recently from 1320be1 to da5ccee Compare March 10, 2025 17:38
@AbeJellinek
Copy link
Member Author

OK, should now be working using the Zotero-Storage-UserID header. I split the reminder into two separate types to reduce code complexity (and because they really are separate issues - you should probably still get informed about quota errors on your own library even if you "Don't Ask Again" on a group).

@AbeJellinek AbeJellinek changed the title Show banner when sync repeatedly fails due to quota error Show banner when sync fails due to quota error Mar 10, 2025
- Store remaining and userID on error
- We need to know the userID on later uploads before a new server-side
  quota error actually occurs, so replace storageRemainingForLibrary
  with lastQuotaErrorForLibrary and store error properties
- Split quota error reminder into two separate reminder types to reduce
  complexity in showSyncReminder()
@AbeJellinek AbeJellinek force-pushed the 2376-quota-error-reminder branch from da5ccee to 1e2305b Compare March 11, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0