This changes the way item types, item fields, creator types, and CSL
mappings are defined and handled, in preparation for updated types and
fields.
Instead of being predefined in SQL files or code, type/field info is
read from a bundled JSON file shared with other parts of the Zotero
ecosystem [1], referred to as the "global schema". Updates to the
bundled schema file are automatically applied to the database at first
run, allowing changes to be made consistently across apps.
When syncing, invalid JSON properties are now rejected instead of being
ignored and processed later, which will allow for schema changes to be
made without causing problems in existing clients. We considered many
alternative approaches, but this approach is by far the simplest,
safest, and most transparent to the user.
For now, there are no actual changes to types and fields, since we'll
first need to do a sync cut-off for earlier versions that don't reject
invalid properties.
For third-party code, the main change is that type and field IDs should
no longer be hard-coded, since they may not be consistent in new
installs. For example, code should use `Zotero.ItemTypes.getID('note')`
instead of hard-coding `1`.
[1] https://github.com/zotero/zotero-schema
- Move 5xx retries and connection checking out of the sync API client
and into HTTP.request() so that they apply to all requests. 429 handling
remains in the API client, since not all callers necessarily want to
handle that the same way. Callers can still handle 5xx themselves by
including the relevant 5xx status codes in `successCodes` or by passing
`errorDelayMax: 0`.
- Add `cancellerReceiver` option, which is a callback that receives a
function that will cancel the request, whether it's an active request
or an automatic delay before a 5xx retry.
This also updates Sinon to 7.3.2.
- nsIURI is now immutable, so it's necessary to use nsIURIMutator via
mutate() to change it
- .path is replaced with .pathQueryRef
- Only nsIURL has .fileName
The XBL prefwindow bindings are removed in Firefox 60, so this adds them
back, along with necessary styling, to allow the existing preferences to
work until the preferences are rewritten with React. The preferences.xml
file in the Mozilla source has platform ifdefs, but since this is a
temporary hack I've just duplicated the file for each platform with the
necessary lines included.
I haven't yet tested the styling on Windows/Linux.
In particular, remove code related to opening/closing the Zotero pane,
which affects tests. The pane is now opened by default in Firefox, which
brings its behavior closer to the main version.
As of Fx60, XPathResult is no longer available as nsIDOMXPathResult in
XPCOM, so just shim its constants, which are all we need, when adding it
to the sandbox.
`nsIFilePicker::show()` is removed in Firefox 60 in favor of `open()`,
which takes a callback (and apparently has been preferred for a long
time).
There's no point switching to that, so this module is a version of
nsIFilePicker with an async `show()` that returns a promise and some
XPCOM-isms replaced (e.g., string paths instead of nsIFile).
Legacy/unsigned add-on warnings are now hidden via CSS in the Firefox
build, so remove the code that tries to do that, and instead add a class
to any other warnings so they can be selectively shown.
StopIteration is no longer supported in Firefox 60, so instead of taking
a generator function that might throw StopIteration for the second
parameter, take a function that is passed to iterator.forEach() that
receives an OS.File.DirectoryIterator.Entry for each directory entry. If
the function returns a promise, it's waited for.
Also update other direct uses of OS.File.DirectoryIterator to remove
StopIteration use.
nsIURL doesn't seem to work anymore, so add Zotero.Utilities.parseURL(),
which uses the `url` package from NPM and adds fileName, fileExtension,
and fileBaseName.
fetch_xulrunner.sh updates the built-in path to point to this file, but
it's not currently being read properly for some reason (and I'm not sure
it does anything we need).
- getStringPref/setStringPref are now used for strings instead of
getComplexValue/setComplexValue
- Remove nsIPrefBranch2 reference
- If there was a pref failure during initialization, nothing was logged
to the terminal
- The Mozilla CommonJS loader is no longer available, so bundle the
Fx52 version of it
- Strict mode is enforced
- `this` is only defined as a global object in .jsm files, not .js files
- `this` can't be converted to a string for BackstagePass test, so check
for presence of Components.utils.import instead
- The return value from import() is no longer available
The menu includes all user interface options from the General
preferences (now removed from the preferences), toggles for the
collections pane, item pane, and tag selector, and, at long last, a
toggle for recursive collections ("Display Items from Subcollections").
The collections pane and item pane no longer reopen automatically when
restarting Zotero. People might still close them by mistake and not find
this menu, but we'll see how it goes.
Closes#1372
When the filename limit isn't 255 on Linux, it's probably because of
eCryptfs, but we were checking the character length instead of the byte
length before shortening the filename to 143 bytes.
If a parent item was expanded and all items in the tree, including the
item's child items, were selected, Cmd + Left Arrow would break the
items tree until restart.
This will cause a conflict and need to be applied to the new tree.
(Worth noting that collapseSelectedRows() is currently only called on
Cmd-left-arrow because the XUL tree seemingly swallows a regular
left-arrow (and only applies the collapse to the last-selected row). The
comment in the keypress listener where collapseSelectedRows() is called
suggests that that was meant to be used for all left-arrow keypresses,
but either that stopped working at some point or it only ever worked for
Cmd + Left Arrow because it bypasses the normal tree handling of left-
arrow. In any case, it would be better if left-arrow always collapsed
selected rows, with or without Cmd.)
https://forums.zotero.org/discussion/78515/bug-collapsing-all-items-in-a-collection-breaks-display-of-items-in-all-collections
And move Error Console and Run JavaScript to a Developer menu that's
shown in Tools if that option is enabled.
The Memory Info button is now behind its own undefined
extensions.zotero.debug.memoryInfo pref.
Zotero.Translate::setTranslatorProviderMethods(methods) can be used to
provide custom 'get' and 'getAllForType' methods that override the
default Zotero.Translators methods.
I don't know how this is happening -- people are ending up with an
updated DB version but missing schema changes, despite the DB version
being updated after the schema updates and in the same transaction --
but until we figure it out, apply the schema update steps in
Zotero.Retractions.init() if necessary.
Separate flags for hiding the retraction altogether and for hiding
citation warnings for it
New functions:
Zotero.Retractions.hideRetraction(item)
Zotero.Retractions.shouldShowCitationWarning(item)
Zotero.Retractions.disableCitationWarningsForItem(item)
Addresses #1710
If a retracted item was in the trash at startup or when detected and
there were no other retracted items in the library, an error would occur
if the item was modified.
This shouldn't be possible, but there've been a couple reports of people
ending up on version 103 without the table, so create it again with IF
NOT EXISTS. This is obviously a bad fix, but until we know how this
happened it's the best we can do.
- Fix don't-show-again checkbox for non-DB items
- Tweak warning text
- Don't show comma after year if year is missing (which it shouldn't be)
- Remove redundant try/catch
I'm not sure a double-quote actually appears in any DOIs, but it's
technically valid and would result in an invalid URL.
Follow-up to 782c2a1d1
Addresses #295
- Fix list download logic
- Close bar when clicking "View Item"
- Don't show "Move to Trash" if item isn't editable
- Download new list if cached version differs from client
- Reduce height of notification bar
- Switch to a slightly darker red
- Check for retracted items using data from Retraction Watch
- Show an X next to retracted items in the items list, and show a
scary message at the top of the item pane with more info and links.
- Lookup is done in a privacy-preserving manner using k-anonymity --
the server is unable to determine the specific items that exist in
the client, so people who don't sync don't need to share any library
data (though the server doesn't log the lookups anyway).
TODO:
- Pop up an alert when new items are found
- Show a confirmation prompt when citing a retracted item
- Support items without DOIs or PMIDs
- Add a proper PMID field and expand DOI to more item types so these
values don't need to be parsed out of Extra
- Clear the banner immediately when all possible fields are cleared
instead of waiting a few seconds
When doing Restore to Online Library from a backup that was never
file-synced, 'mtime' and 'md5' can be null, but we don't want to clear
existing properties on the server.
- Support items within collections and searches:
zotero://select/library/collections/:collectionKey/items/:itemKey
zotero://select/groups/:groupID/collections/:collectionKey/items/:itemKey
- Fix the 'itemKey' parameter:
zotero://select/library/collections/:collectionKey/items?itemKey=:itemKey1,:itemKey2
- Select library root if collection/search not specified
If an object changed on both sides and the changes were either
non-conflicting or identical but there were other local changes, the
local object was incorrectly being marked as synced, causing it not to
be uploaded until it was next modified locally.
- Revert to single-line mode after closing
- Don't add newline if Shift-Enter is pressed in an empty textbox
- Hide progress meter in multi-line mode until beginning search
Applied to all styles with ids matching 'apa($|-)'
Currently limited to colons, but Juris-M/citeproc-js#74 may extend this
to other punctuation
Closes#1681
This adds "English (UK)" to the locale list, which allows for "tag
colours" and allows dates to be recognized in d/m/y form.
I changed "color" and "license" on Transifex, but I'll leave other words
for others to change. If we stick to Oxford spelling, there probably
won't be too much else.
The error is triggered upon initial interaction with a doc after Zotero
restart or if new external citations (copied into the document) are
peresnt and `session.updateSession()` is called without a subsequent
`session.updateDocument()` call. `session.updateSession()` is called
without a subsequent `session.updateDocument()` call every time the
user cancels a citation insert.
More specifically, `session.updateSession()` is called every time a
citation dialog is invoked. It retrieves all citations and writes them
into a local `session.citationsByIndex` object. Moreover, it marks
each citation that hasn't seen before in a `session.newIndices` object.
`session.newIndices` is there to ensure that we load every new citation
into citeproc upon document update. This object is built by marking any
citation that does not appear in the previous invocation's list of
citations as new. However, if the document is never updated (because the
user cancels the insertion) then the new indices are not loaded
into citeproc. This commit fixes that, by excluding citeproc unloaded
items from the previous invocation's citation list.
- Don't cut off bottom of tags on Windows
- Fix appearance of search bar on Windows/Linux
- Fix cancel button on Windows/Linux
- Don't cut off right-hand pane of bottom bar when narrowing pane
- Use react-virtualized to render tags on demand, reducing the number
of DOM elements from potentially tens of thousands to <100. This
requires tags to be absolutely positioned, so sizing and
positioning need to be precomputed rather than relying on CSS.
- Avoid unnecessary refreshes, speed up tag retrieval, and optimize
sorting
- Debounce reflowing when resizing tag selector
Also:
- Scroll to top when changing collections
- Allow tags to take up full width of tag selector without truncation
Closes#1649Closes#281
Due to a typo in d0f7fd6df7, linked files were still being renamed even
with the pref off if metadata was found for the file. The test I added
was only for adding a file to an existing item, which didn't trigger
metadata retrieval.
This also adds a hook for stubbing the actual PDF recognition process so
we can test certain behaviors without making HTTP requests.
Since 9c0f5998a3, depending on your timezone the day could be off by
one if the access date didn't have a timestamp (so only for manual
entries or imports).
Using a regexp meant that an invalid regexp pattern would crash the tag
selector, and even if we caught that it would produce unexpected results
for some searches (e.g., anything with a period).
Even after cdf9d7ff32, the tag selector was still being initialized if
it was closed at startup, which meant that keeping it closed didn't fix
performance problems in large libraries. This hopefully finally brings
the tag selector in line with pre-Reactification behavior.
This also moves initIntlStrings() logic to Zotero.Intl so that strings
are accessible from React components in separate windows, and it moves
container initialization to ZoteroPane since most of what it does will
need to interact with ZoteroPane anyway.
This adds selectItems() to ZoteroPane and collectionTreeView and removes
the ancient, unused 'expand' argument to selectItem(), which didn't
really make sense there. It also includes a new
itemTreeView::ensureRowsAreVisible() that tries to scroll to an
appropriate place (or, better yet, not scroll at all) given the
specified rows and page size.