Commit graph

8767 commits

Author SHA1 Message Date
Dan Stillman
5a4d78578b Zotero.DataObject updates for changedData fields
changedData is the new approach to updating DataObject data, storing the
new values in a separate object until save so that they don't actually
change the object unless the save goes through.

- Add DataObject._getLatestField() to return either the changed value or
  the last-saved value
- Clarify that _markFieldChange() takes different values depending on
  whether the field uses 'changed' or 'changedData'
- Fix bug calculating hasChanged() when a 'changedData' value is a
  boolean
2021-01-12 04:38:25 -05:00
Dan Stillman
22addb3afd Create logs/upgrade.log in data directory after schema updates
For debugging future problems with schema updates
2021-01-11 23:48:11 -05:00
Dan Stillman
f9c03058f1 Add Zotero.Debug.addListener() and .removeListener()
For getting all log lines during a particular period
2021-01-11 23:48:11 -05:00
Dan Stillman
5edad5f70a Update citeproc-js to 1.4.61 2021-01-11 23:48:11 -05:00
Dan Stillman
2094a6023c Restore fallback DB creation in retractions.js
Removed in 5b9e6497af, but then we reverted missing-table creation via
schema integrity check
2021-01-11 13:29:03 -05:00
Dan Stillman
4003c3d1fc Update locales from Transifex 2021-01-10 14:58:37 -05:00
Dan Stillman
80b8280e9d Update submodules 2021-01-10 14:58:37 -05:00
Dan Stillman
7b9bad1d52 Don't sync group on push notification if not selected for syncing
If a group library was deselected in the "Choose Libraries…" window, a
remote change would still trigger a sync if auto-sync was enabled. (My
Library was not affected.)
2021-01-09 14:58:51 -05:00
Dan Stillman
a1267bc68e Fix rerendering of React-based icons in HiDPI mode
With the variable in the outer scope, "@2x" keeps getting added to the
URL.
2021-01-07 04:11:15 -05:00
Fletcher Hazlehurst
4db61b8dc7 Do not modify saveOptions argument since it may be used again
If we add the notifier queue, another save function will use that queue
but not necessarily know that it needs to commit. Instead, we only use
the notifier queue for this function.
2020-12-30 11:33:07 -07:00
fletcherhaz
98a75931b0
Fix double saving snapshots (#1937)
* Fix double saving snapshots

https://forums.zotero.org/discussion/86796/duplicated-snapshots

I was able to replicate it by adding a 5 second delay here:
a72ae14816/chrome/content/zotero/xpcom/translation/translate_item.js (L196)

This was caused from a race condition and (a72ae14) did not fully
solve the problem. Now this is tested and fixed.
2020-12-27 03:31:30 -05:00
Dan Stillman
591ffcc83e
Merge pull request #1930 from fletcherhaz/ace-editor
Use Ace editor for Run JavaScript
2020-12-24 02:57:01 -05:00
Dan Stillman
c1976098e9 Run JavaScript: Hide spurious linting error 2020-12-24 02:55:33 -05:00
Dan Stillman
874c4044e5 Ace: Add commented-out language_tools lines in case we want them later
We may want this if we enable code completion, though it's a little
dumb. (It seems to show suggestions regardless of context.)
2020-12-24 02:55:00 -05:00
Dan Stillman
1040ba0b5e Run JavaScript: Detect await at the beginning of a line 2020-12-24 02:46:55 -05:00
Dan Stillman
018f04f369 Scaffold: Focus code editor when selecting tab 2020-12-24 02:46:19 -05:00
Dan Stillman
2ed4bb1c8f Ace: Config adjustments in Run JavaScript window
- Use the "Chrome" theme
- Hide the gutter
- Don't highlight the active line
- Remove default iframe borders
- Focus the editor on window open

Ace instances (e.g., Scaffold) are now responsible for setting their own
theme (to avoid a flash of Monokai before a lighter theme appears).
2020-12-24 02:45:37 -05:00
Dan Stillman
e095dbb031 Ace: Fix path to ace.html (#1930) 2020-12-24 02:41:51 -05:00
Dan Stillman
8b9d32c65b Update locales from Transifex and merge new English strings 2020-12-23 23:29:00 -05:00
Dan Stillman
0f36f9a7c3 Remove ellipsis for "Create Parent Items", since no prompt 2020-12-23 23:16:30 -05:00
Fletcher Hazlehurst
a81b494ce1 Add back in ability to create multiple empty parent items
Closes #1934
2020-12-23 15:37:08 -07:00
Dan Stillman
33abc76c88 Remove old unused (and broken) storage function 2020-12-22 23:54:34 -05:00
Adomas Venčkauskas
5798926093 Fix number inputs and adjust linux styling for the prefs pane 2020-12-21 12:20:17 +02:00
Dan Stillman
7a434df539 Disable creation of missing tables/indexes in Schema.integrityCheck()
Originally added in 5b9e6497a. We stopped running the integrity check
before userdata upgrades in c4cc44528 because this new behavior was
breaking upgrades, but it could still be run when coming from the DB
Repair Tool, which could cause problems if, say, you recovered a
database from a computer that had an older version of Zotero and ran the
DB Repair Tool on it. Disabling this for now until we have a better
solution.
2020-12-21 01:50:13 -05:00
Dan Stillman
43e6493997 Don't convert "Type: article" in Extra to Document item
CSL 1.0.2 clarified that type 'article' is meant for preprints and
working papers, so until we have a Preprint item type, just leave it in
Extra.

Discussion: https://github.com/zotero/translators/pull/2248#discussion_r492009958
2020-12-21 01:11:28 -05:00
Dan Stillman
aeceb67a07 Add Zotero.isBigSurOrLater, in case we need it later 2020-12-20 04:25:21 -05:00
Dan Stillman
e918b430b6 Fix Quick Format dialog appearance on Big Sur, and tweak on <=10.15
The Quick Format dialog's shape is based on the OS window corners, and
that changed on Big Sur, which resulted in whitespace along the bottom
edge and a misaligned search results box.

The tops of the citation bubbles were also cut off (at least for me) on
Catalina.
2020-12-20 04:23:38 -05:00
Dan Stillman
7b6b608de7 Update locales from Transifex and merge new English strings 2020-12-20 02:18:30 -05:00
Dan Stillman
44603d1ec6 Add localized strings for Word for Mac ARM warning (#26) 2020-12-20 02:07:58 -05:00
Fletcher Hazlehurst
0bb1588f22 Use Ace for Run JavaScript code editor
Closes #1928
2020-12-18 10:45:52 -07:00
Fletcher Hazlehurst
36d81e839c Use ace-builds NPM package 2020-12-18 10:45:38 -07:00
Dan Stillman
31c928a3ff Don't let invalid translators break all translation
If a translator couldn't be parsed, `_translatorInfo` wouldn't be set,
and that would somehow cause the translator info for subsequent
detections to be out of sync with the code loading, and nothing would
work. Putting a try/catch around the eval() allows subsequent
translators to continue to work normally. (There might be a better fix,
but this seems to work.)

This was happening for Better BibTeX translators that were still
installed without the extension (which they need to be parsed properly),
causing all imports to break.

https://forums.zotero.org/discussion/86613/error-id-1093166052-upload-of-ris-and-bibtex-data-failed
2020-12-10 03:58:17 -05:00
Dan Stillman
558ad20ce6 Scaffold: Improve cookie handling
- Use cookies from browser pane when running detectWeb or doWeb
- Use cookies from document when running or updating tests

This should fix various cases where translators can't be properly
developed or tested in Scaffold (e.g., [1]).

[1] https://github.com/zotero/translators/pull/2296#issuecomment-739116620
2020-12-06 03:09:13 -05:00
Dan Stillman
01646f1f8f Fix regression in 84730e610c
Only switch item types in fromJSON() if one was actually parsed out of
Extra
2020-11-27 18:04:03 -05:00
Dan Stillman
a249cd1608 Update citeproc-js to 1.4.50 2020-11-27 17:50:20 -05:00
Dan Stillman
84730e610c Don't delete valid item/CSL type from Type in Extra on sync
After a local item change, Zotero uploads the JSON and then applies the
saved JSON returned from the API to the local object using `fromJSON()`,
the same as it would apply any other remote change.

`fromJSON()` is meant to migrate Extra lines into real types and fields
after future item type/field changes. It calls
`Z.Utilities.Internal.extractExtraFields()`, which looks for valid item
type or CSL type values in Type lines in Extra, handles the rest of
parsing accordingly, and passes back the parsed item type. `fromJSON()`
wasn't handling `itemType` in the response object, so the item type
didn't get applied and the Type line was stripped. This fixes that.

Since valid type values are now parsed, if you have a Journal Article
item with a Pages field and enter "Type: song" into Extra and sync, the
item will be converted to Audio Recording and `Pages: 123` will be
placed in Extra.

https://forums.zotero.org/discussion/comment/369221/#Comment_369221
2020-11-27 17:50:20 -05:00
Adomas Venčkauskas
ddcbb47538 Fix number inputs and adjust linux styling for feed settings 2020-11-24 15:10:06 +02:00
Dan Stillman
c4cc44528c Fix error upgrading old databases after errors 5b9e6497af
Creating missing tables breaks schema update steps that assume those
tables don't exist, so we'll need another solution here. For now,
disable the automatic integrity check and make a couple recent schema
update steps more forgiving for people on the beta who already triggered
this.
2020-11-23 23:49:50 -05:00
Dan Stillman
304a38083c Update locales from Transifex and merge new English strings 2020-11-20 16:46:10 -05:00
Dan Stillman
75497e14c7 Item context menu: "Create Parent Item" → "Create Parent Item…"
Now that a dialog is displayed asking for further input

Follow-up to #1901
2020-11-20 16:35:29 -05:00
fletcherhaz
86b77cc45e
Add an option to create parent item from identifier (#1901) 2020-11-20 16:17:48 -05:00
Dan Stillman
07874d84bd
Merge pull request #1909 from fletcherhaz/snapshot
Update SingleFile for bug fixes
2020-11-17 16:02:13 -05:00
Dan Stillman
7c0cfd9420 Fix case of data dir not being created for new profile
If there was an existing ~/Zotero directory, another profile was already
pointing to it, and there was a Firefox profile pointing to a custom
data directory or with an embedded 'zotero' directory, the Firefox data
directory would be used instead of creating a new data directory named
after the new profile.

This skips the Firefox logic for new profiles when there's an existing
profile pointing at ~/Zotero and just creates the new data directory.
2020-11-17 15:57:16 -05:00
Dan Stillman
e575097e34 Missing line from 5b9e6497 to check schema integrity after crash 2020-11-17 01:26:46 -05:00
Dan Stillman
5b9e6497af Schema integrity check improvements
- Create userdata tables and indexes that are missing
- Delete tables and triggers that should no longer exist
- Run schema integrity check before user data migration
- Run schema integrity check after restart error

This is meant to address two problems:

1) Database damage, and subsequent use of the DB Repair Tool, that
   results in missing tables

2) A small number of cases of schema update steps somehow not being
   reflected in users' databases despite their having updated userdata
   numbers, which are set within the same transaction. Until we figure
   out how that's happening, we should start adding conditional versions
   of schema update steps to the integrity check.

This is currently only running the update check after a restart error,
which might not occur for all missed schema update steps, so we might
want other triggers for calling setIntegrityCheckRequired().
2020-11-16 18:13:48 -05:00
Dan Stillman
6bcc8af86b Add Zotero.DB.columnExists(table, column) 2020-11-16 17:50:52 -05:00
Dan Stillman
b0e065a4ae Don't return relative path from .attachmentFilename for linked files
https://forums.zotero.org/discussion/86139/zotero-item-attachmentfilename-should-only-return-filename
2020-11-13 11:43:00 -05:00
Dan Stillman
b43bfcaca0 Update locales from Transifex 2020-11-04 15:02:42 -05:00
Fletcher Hazlehurst
a72ae14816 Fix bug with double saving of snapshots. 2020-11-02 17:24:14 -07:00
Fletcher Hazlehurst
c0ec91f26d Fix bug for empty title when a translator does not provide one. 2020-11-02 17:24:14 -07:00