Commit graph

1024 commits

Author SHA1 Message Date
Dan Stillman
e33a2d730d Fix tag type handling when merging items
Most importantly, don't change all tags to manual on the merged item.
2019-05-29 05:43:33 -04:00
Adomas Ven
48778f2847 Document export-import UI and integration code (#1501) 2019-05-14 21:06:18 -04:00
Dan Stillman
3fbb17a2e6 Properly upload local changes after automatic conflict resolution
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.
2019-05-08 04:34:21 -04:00
Dan Stillman
ec0b993a17 Fix erroneous sync conflict if creators are changed in the same way 2019-05-03 01:15:27 -04:00
Adomas Venčkauskas
78c3d5808b Fix citeproc errors due to improper citeproc state updates
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.
2019-04-08 17:43:52 +03:00
Frank Bennett
e618410eb2 Export CSL JSON with title-short rather than shortTitle 2019-04-04 00:45:32 +09:00
Dan Stillman
9ed48f3837 Keep earliest Date Added when merging items
Closes #1669
2019-04-02 14:01:25 -04:00
Dan Stillman
d9cee322cd Tag selector performance overhaul
- 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 #1649
Closes #281
2019-03-28 06:28:34 -04:00
Dan Stillman
71f9420cff Fix linked-file rename pref when retrieving metadata
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.
2019-03-27 06:43:07 -04:00
Dan Stillman
49226edd07 Temporarily ignore collection-title for podcast in itemFromCSLJSON test
See #1667
2019-03-21 02:22:07 -04:00
Dan Stillman
8f1f1f1fba Update itemFromCSLJSON test for podcast broadcast mapping
Follow up to bf4deeff8f
2019-03-21 02:20:38 -04:00
Dan Stillman
03941dafe0 Fix tests after 42667e7090
It seems like the Zotero.Utilities.debounce() on handleSearch() in
tagSelector.jsx was somehow causing the function to be run without being
triggered from the onSearch events, resulting in an extra render. I'm
not sure why that was happening, but it's fixed now that there's no
longer a debounce() there.
2019-03-20 08:54:48 -04:00
Dan Stillman
a92b29cebf Fix race conditions in tag selector tests
And take an optional second parameter in waitForTagSelector() to
indicate how many updates to wait for, since certain operations trigger
two updates, one from notify() and the other from onItemViewChanged().
2019-03-18 04:58:50 -04:00
Dan Stillman
b30d31c4ee Fix tag selector test 2019-03-15 21:57:38 -04:00
Dan Stillman
7717df637e Fix hang in server_connector test after 94ccba45b
The test incorrectly contained an item wait for an attachment that
doesn't get saved to the group library, but the test was passing because
the main item was being moved to the group twice. 94ccba45b somehow
fixed that, and since the behavior during the test is now correct, I'm
not going to worry about this unless we notice a problem.
2019-03-15 21:01:12 -04:00
Dan Stillman
94ccba45b9 Avoid unnecessary tag queries (regression from React tag selector) 2019-03-15 12:46:27 -04:00
Adomas Venčkauskas
72fb67d15b Restore "Delete All Automatic Tags" menu option for tag selector. Closes #1660 2019-03-06 16:22:05 +02:00
Dan Stillman
b20bf345e6 Address race condition in tag selector tests (#1659) 2019-03-06 07:27:11 -05:00
Adomas Venčkauskas
e8f186479f Address tag selector tests race conditions. Addresses #1659 2019-03-06 13:13:40 +02:00
Dan Stillman
d7dc5670d5 When clearing automatic tags, don't delete manual tags with same name 2019-03-05 07:55:00 -05:00
Dan Stillman
fc43514ff0 Deselect tags when deleted (regression from Reactification) 2019-03-05 07:55:00 -05:00
Dan Stillman
04779d8d1c Add import option for storing or linking files
This allows files in Mendeley imports to be stored and files in
RIS/BibTeX/etc. to be linked.

Closes #329
2019-03-02 06:24:33 -05:00
Dan Stillman
d0f7fd6df7 Add separate "Rename linked files" pref for auto-renaming
Defaulting to false

People who've been relying on auto-renaming of linked files for the last
year will have to turn this back on.
2019-02-26 22:23:43 -05:00
Dan Stillman
945c413c42 Closes #1644, Allow selecting multiple items with zotero://select
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.
2019-02-23 17:35:09 -05:00
Dan Stillman
4d3625f101 Fix tests after removing RECOGNIZE_URL 2019-02-19 04:37:22 -05:00
Dan Stillman
1061893998 "Attachment Content" search improvements
- Fix incorrect results for ANY search with multiple "Attachment
  Content" conditions and no other conditions
- Dramatically speed up single-word searches by avoiding unnecessary
  text scans (which probably addresses #1595)
- Clean up code
2019-02-19 04:10:25 -05:00
Frank Bennett
2c136ffbb0 Add test of multiple new insertions with implicit update on the first 2019-02-13 10:18:05 +02:00
Frank Bennett
bffbe00399 Test of implicit citation update 2019-02-13 10:17:58 +02:00
Frank Bennett
0e18c5f1de Test for bibliography sort update on change to item 2019-02-10 11:07:10 +09:00
Dan Stillman
3942b0e0d5 Fix a tag selector test after b1fad505d7 2019-01-30 04:44:16 -05:00
Dan Stillman
b1fad505d7 Fix sorting of colored tags after Reactification
Regressed to alphabetic sorting instead of number-key sorting
2019-01-29 22:18:49 -05:00
Dan Stillman
2d71b13ce0 Fix some spurious failures in PDF retrieval test 2019-01-29 07:35:39 -05:00
Dan Stillman
c2a637472e Fix foreign key constraint error for collections with all-numeric keys
This was like a lottery where instead of winning something your library
stopped syncing.
2019-01-29 05:09:00 -05:00
Dan Stillman
8b4bb62efc Don't load linked URLs during import
Regression from 5a6a772ca2, I think
2019-01-26 00:20:26 -05:00
Adomas Venčkauskas
f59f3c5f7e Fix a failing /connector/updateSession test (regr 90a70f7) 2019-01-22 12:25:15 +02:00
Dan Stillman
eb5d28b626
Merge pull request #1606 from adomasven/feature/reactify
Reactified Tag Selector
2019-01-21 04:07:28 -05:00
Adomas Venčkauskas
a24cada451 React Tag Selector polish, i18n and tests
- Added icon-button UI code for the menubutton
- Upgrade to React 16 to allow non-standard attrs, such as `tooltiptext`
to support XUL tooltips
- Add i18n support for React UI elements
- Update tests for reactified tag selector
2019-01-21 11:01:27 +02:00
Philipp Zumstein
97e53c5230 Fix some typos found by codespell (#1570)
$ codespell --skip="./.git,./styles,./translators,./chrome/locale,./resource,./chrome/content/zotero/xpcom/xregexp,./chrome/content/zotero/xpcom/rdf,./chrome/content/zotero/xpcom/citeproc.js,./test/resource,./node_modules" -q 2 -i 3 -w
2019-01-20 20:39:27 -05:00
Dan Stillman
9c2d0d7272 Add skipped test for importing related items from Zotero RDF
This is hard to do currently because the natural place to do it (and
where the previous seeAlso stuff was done) is translate_item.js, but
with async import translators that now only gets one item at a time,
whereas saving item relations requires all items to be saved. So this
would probably need to be done in the import code in translate.js.

It might also require undoing
https://github.com/zotero/zotero/pull/453 so that getResourceURI() works
on notes and figuring out another solution for the problem that was
trying to solve.
2019-01-14 02:36:59 -05:00
Dan Stillman
c8fb2ecd1f Add test for exporting related items in Zotero RDF
These aren't currently imported, but better to at least include them.
2019-01-14 02:29:09 -05:00
Dan Stillman
0d5abb018a Ignore invalid paths during export
Invalid paths, including Windows UNC paths on other OSes, caused exports
to fail. Now they're ignored, which is what we do for other missing
attachment files.

Fixes #1622
2019-01-12 02:34:31 -05:00
Dan Stillman
9c0f5998a3 Use correct time-zone offset for access dates in bibliographies
Fixes #1069
2019-01-10 03:14:28 -05:00
Dan Stillman
5a6a772ca2 Fix linked-URL attachments not being saved to groups without files
It looks like this may have been broken for years.
2019-01-08 03:45:26 -05:00
Dan Stillman
506ed313da Fix moving item via connector to library with files from one without
Broken in ce5be0bc75 for non-webpage items
2019-01-07 05:16:17 -05:00
Dan Stillman
7575cd8b29 Don't accept keyboard input before new-collection prompt appears
Fixes #1613
2018-12-27 07:11:15 -05:00
Adomas Venčkauskas
4072d444e7 Ensure Test Import Translator.js #doImport() does not rely on #detectImport() 2018-12-21 15:16:27 +02:00
Dan Stillman
37c51242d2 Add test for copying collection to another library 2018-12-16 02:24:21 -05:00
Dan Stillman
80f6b857f6 Add Utilities.Internal.getNextName(name, existingNames)
Function to get the next available name when duplicating something
2018-12-16 02:24:21 -05:00
Dan Stillman
223f582aa7 Fix search error on nonexistent collection in recursive mode
And don't return results for a nonexistent parent search
2018-11-28 15:31:57 -07:00
Dan Stillman
6137aeddb8 Follow meta redirects for Find Available PDF
This fixes direct and VPN-based retrieval of PDFs for Elsevier (e.g.,
ScienceDirect) items that have a DOI but no URL, since Elsevier resolves
DOIs through an intermediate page.
2018-11-26 00:57:48 -07:00
Dan Stillman
4b81e03f28 Improve reliability of PDF retrieval delay tests 2018-10-09 19:14:59 -04:00
Dan Stillman
477c28b1e3 Fix another PDF retrieval test after be8db4fc50 2018-10-09 19:03:06 -04:00
Dan Stillman
f3aef41c90 Update tests for auto-recognizing dragged PDFs after be8db4fc50 2018-10-09 18:25:30 -04:00
Dan Stillman
1b9811c31d Fix test failures after 18f79f9796 2018-10-06 01:38:32 -04:00
Martynas Bagdonas
ae7ef109b7 Add universal progress queues (#1573) 2018-10-05 01:56:46 -04:00
Martynas Bagdonas
ec5424d5ae Follow meta redirects and use the final URL when processing documents (#1568) 2018-10-03 22:24:39 -04:00
Dan Stillman
d899134e7c Automatically delay between PDF retrieval requests to the same domain
Delay requests to the same domain by 1 second, respect a Retry-After
header if present for 429 and 503, and delay for 10 seconds on 429 or
5xx otherwise.
2018-09-22 04:03:25 -04:00
Dan Stillman
b782120840 Add followRedirects: false option to Zotero.HTTP.request()
Currently only .status and .getResponseHeader() (for getting 'Location')
are available in the returned object, but we could make the body
available if necessary.
2018-09-22 04:03:25 -04:00
Dan Stillman
7cf466a0b6 Save OA PDFs when the DOI resolves directly to the file 2018-09-06 16:44:11 -04:00
Dan Stillman
18821984e0 Accept a Blob as input in Zotero.File.putContentsAsync() 2018-09-06 16:44:11 -04:00
Dan Stillman
05d8e7a8a3 Check Extra field for DOIs for PDF retrieval
E.g., a book with a DOI in Extra

Closes #1551
2018-08-30 16:52:24 -04:00
Dan Stillman
6cb4057fee Disable updates of bundled files in tests 2018-08-25 16:55:13 -04:00
Dan Stillman
e7e681c113 Set retrieved OA PDF title to reflect version
"Full Text", "Accepted Version", or "Submitted Version"
2018-08-25 16:48:17 -04:00
Dan Stillman
d5e7bae254 Fix broken test after ec76575645 2018-08-19 04:31:40 -04:00
Dan Stillman
e48a1a2abb Remove lots of old Zotero for Firefox code
We still run tests in Firefox, so not everything can be removed.
2018-08-17 03:17:08 -04:00
Dan Stillman
c2ca70055c Merge branch 'electron' 2018-08-16 19:16:46 -04:00
Dan Stillman
ce5be0bc75 Automatically download open-access PDFs when saving via the connector
If there's no translated PDF or the translated PDF fails and the item
has a DOI, check Zotero's Unpaywall mirror for possible sources and try
to download one of those.

Unlike with "Add Item by Identifier" and "Find Available PDF" in the
item context menu, this does not try the DOI/URL page, since it would
result in more data leakage and most of the time you'd be saving from
the DOI page already. We could consider offering it as an option, but
for it to be useful, you'd have to have an institutional subscription,
be on-campus or connected via VPN (for now), and be saving from
somewhere other than the main page.

A new connector endpoint, sessionProgress, takes the place of
attachmentProgress. Unlike attachmentProgress, sessionProgress can show
new attachments that have been added to the save, and with a little more
work should also be able to show when a parent item has been recognized
for a directly saved PDF.

This also adds support for custom PDF resolvers, available to all PDF
retrieval methods. I'll document those separately.

Closes #1542
2018-08-16 00:57:22 -04:00
Dan Stillman
bcf94942f9 Don't include "Zotero" in User-Agent sent to non-Zotero sites 2018-08-16 00:57:22 -04:00
Adomas Venčkauskas
01f3159b2f Ensure all failing integration tests are fixed (8d8410ff). Closes #1546 2018-08-14 11:40:19 +03:00
Dan Stillman
11f8bd20d6 Fix title display when installing style via connector (broken in 0f1687f1c7) 2018-08-13 18:17:35 -04:00
Adomas Venčkauskas
8d8410ffa0 Fix failing integration test (regr 0f1687f). Closes #1546 2018-08-13 14:22:15 +03:00
Dan Stillman
11701f68a0 Fix more tests after 6478a375e3 2018-08-09 18:47:29 -04:00
Dan Stillman
6478a375e3 Fix WebDAV tests after 276bb99fc9 2018-08-09 18:20:02 -04:00
Dan Stillman
679a6d5cc7 PDF retrieval improvements
- Add the ability to extract a PDF URL from a given webpage using the
  translation framework
- Add the ability to get open-access PDFs from landing pages from
  Unpaywall data in addition to direct PDF URLs
- Use the above functionality to improve PDF retrieval for "Add Item by
  Identifier"
- Add "Find Available PDFs" option to the item context menu to retrieve
  PDFs for existing items from the DOI or URL page or using Unpaywall
  data. The option appears for single items with a DOI or URL and no PDF,
  and it always appears when selecting multiple top-level items (but
  skips ineligible items).

PDF extraction from DOI/URL pages will currently only work with
unauthenticated access (i.e., on-campus or VPN, but not via a web-based
proxy).

Supersedes and closes #948
2018-08-07 04:58:15 -04:00
Sylvester Keil
aa908516eb
Use spy.resetHistory instead of reset
Reset was deprecated in 4.1.4 and removed in 5.0.
2018-08-04 22:07:27 +02:00
Sylvester Keil
37412c68ff
Fix style download stub 2018-08-03 13:42:15 +02:00
Sylvester Keil
aa94a62a74
Make test more independent of db state
If there are library ids above 9 string sorting may not put the
highest id last in the array.
2018-08-03 11:53:54 +02:00
Sylvester Keil
824e9c78d6
Move localeCompare tests to Zotero.Intl tests 2018-08-01 15:41:54 +02:00
Sylvester Keil
8e6896c27d
Move Zotero.getString() test to Zotero.Intl tests 2018-07-30 10:20:05 +02:00
Sylvester Keil
143fdd5f2b
Revert "Remove legacy iterator protocol use in Zotero.DB"
Reverting this until we can use Fx60 for testing.

This reverts commit dfe412d448.
2018-07-30 10:18:11 +02:00
Sylvester Keil
dfe412d448
Remove legacy iterator protocol use in Zotero.DB 2018-07-19 12:21:01 +02:00
Dan Stillman
1f8cf22a35 Delete group files when deleting group
Fixes #1532
2018-07-15 23:09:34 -04:00
Sylvester Keil
53522c2cbe Add Zotero.File.getResource for local resources
Use `getResource` in Zotero.Date.init (this turns it into a
synchronous function). Zotero.File.getResource makes it easier
to load local files on platforms that do not support the
`resource://` URLs.
2018-07-11 14:08:45 +03:00
Dan Stillman
99584dc918 Import base-directory-relative linked files
Zotero RDF contained 'attachments:' paths when files weren't included
but they weren't imported properly
2018-06-30 09:19:09 +02:00
Dan Stillman
3c82263082 Fix Add Item by Identifier test failure due to capitalization change 2018-06-27 16:28:38 +02:00
Dan Stillman
2a7f31813e Disable JS in hidden browser when indexing HTML files without a charset
This could cause imports that linked to HTML files to hang, possibly
from network requests that failed.
2018-06-18 20:19:02 -04:00
Dan Stillman
4554998798 Add Zotero.File.moveToUnique(), replacing Zotero.moveToUnique()
New function takes string paths instead of nsIFile instances
2018-06-17 18:08:03 -04:00
Dan Stillman
f3a62f5a63 Automatically download open-access PDFs via Add Item by Identifier
When the associated-files pref is enabled, Add Item by Identifier uses a
Zotero Unpaywall mirror to find available open-access PDFs. No details
about the contents of searches are logged.
2018-06-16 14:35:44 -04:00
Dan Stillman
5ddbe433b9 Fix Backoff and Retry-After header parsing 2018-06-12 15:17:46 -04:00
Dan Stillman
3241faf503 Fix tag saving for intercepted imports from connector
Save tags in intercepted files as automatic tags
2018-05-23 21:16:18 -04:00
Dan Stillman
4acd178819 Fix user-agent handling for faked UAs from connector 2018-05-15 20:18:41 -04:00
Martynas Bagdonas
9165a0247f Fix PMID and arXiv identifiers extraction (#1498) 2018-05-07 06:04:11 -04:00
Martynas Bagdonas
c0a4fa43f0 Add a test for PDF recognition by DOI (#1496) 2018-05-04 03:14:26 -04:00
Dan Stillman
8f39e9cb36 Rename PDF recognizer tests to reflect arXiv ID lookup
Addresses #1494 and #1495
2018-05-04 01:16:04 -04:00
Dan Stillman
d0e42a1186 Automatically switch to My Library on connector save in noneditable view 2018-04-27 18:27:06 -04:00
Dan Stillman
d573a5b639 Merge pull request #1476 from adomasven:feature/connector-doc-integration
Doc Integration Endpoint for the Connector
2018-04-24 01:37:48 -04:00
Adomas Venčkauskas
593153eebe Adds a progress bar for non quick-format integration actions
The progress percentage is based on the most recent transaction
(or undeterminate if this is the first session transaction)

Fix undefined function call error
2018-04-24 01:37:10 -04:00
Dan Stillman
33f8fcfafb Fix syncing of saved search changes
Condition changes were only uploaded after every other change + sync
2018-04-22 17:27:33 -04:00
Adomas Venčkauskas
5e5b567782 Add a connector document integration endpoint
Specifically for google docs via the connector, but could potentially be
used for any integration via HTTP or connector.
2018-04-20 13:08:34 +03:00
Martynas Bagdonas
fa0576a4dd Add arXiv identifier support (#1486) 2018-04-18 13:03:10 -04:00
Dan Stillman
3835bc9110 Assign merge-tracking relations properly when merging >2 items
https://forums.zotero.org/discussion/71459/incorrect-document-refresh-after-three-item-merge
2018-04-15 17:05:55 -04:00
Frank Bennett
94271325d7 Asyncify Zotero.Relations.getByObject(), called only from item merge. (#1480)
Use getAsync() to acquire subject in Zotero.Relations.getByObject()
2018-04-14 10:26:16 -04:00
Dan Stillman
6f1833f936 Remove items from trash and My Publications when removed via sync
Zotero.Item::fromJSON() wasn't properly accounting for missing 'deleted'
or 'inPublications' properties.
2018-04-13 23:36:59 -04:00
Dan Stillman
9a304b6699 Better handling of remotely changed items in locally missing collections 2018-04-07 17:04:35 -04:00
Dan Stillman
ac4abf0ebb Avoid race conditions in conflict resolution tests 2018-04-07 17:04:00 -04:00
Dan Stillman
4f9847da04 Save parent item to correct library when recognizing PDF without DOI 2018-04-02 15:34:22 -04:00
Dan Stillman
9e955bde99 Add Zotero.Item.prototype.moveToLibrary()
Move an item and its attachments to another library. Attachments are
removed as necessary if linked files or all files aren't supported in
the target library.
2018-03-31 08:26:36 -04:00
Dan Stillman
bc141ce36b Add .allowsLinkedFiles property to Zotero.Library objects 2018-03-31 08:26:36 -04:00
Adomas Venčkauskas
bff7cee374 Add a test case for copied citations (for 9c7271c6) 2018-03-28 14:55:46 +03:00
Adomas Venčkauskas
3445519714 Fix citationByIndex[i].sortedItem errors during citation insertion
Caused by inproper handling of copy-pasted citations in documents
2018-03-26 15:31:26 +03:00
Dan Stillman
1f320e1f5d Be more lenient about Extra field values than citeproc-js
Allow fields like "Original Date: 2018" and convert them to
"original-date: 2018" when sending to citeproc-js.

For reference:

http://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html#cheater-syntax-for-odd-fields
2018-03-01 17:05:24 -05:00
Dan Stillman
e1e5178869 Shorten auto-renaming pref
So we now have autoRecognizeFiles and autoRenameFiles.
2018-03-01 04:09:17 -05:00
Dan Stillman
18d0e980d1 Increase Travis test timeout to 15 seconds
Though it probably won't help, since I imagine most timeouts are hangs
caused by race conditions
2018-03-01 03:38:46 -05:00
Dan Stillman
1cfc90186f Serialize attachment indexing
Add newly added attachments to a queue, start processing it after five
seconds have passed since the last attachment was added, and process
another every half second after that unless another is added.

This queue won't survive a restart, so the queue should really be in the
DB, but this should avoid problems when adding multiple attachments at
once.

Addresses #1284
2018-03-01 01:28:28 -05:00
Dan Stillman
97661539dc Automatically retrieve metadata when saving PDFs
Applies to dragging to the collections pane or the items pane, adding
via New Item menu, or saving via the connector server

If the renaming pref is enabled, the PDF is renamed after recognition.

Can be disabled in the preferences

Closes #917
2018-03-01 01:28:28 -05:00
Dan Stillman
3cc92fe1e9 Fix PDF recognition within collection (broken by f8b41c971c) 2018-03-01 01:20:29 -05:00
Dan Stillman
f99038fd37 Fix recognizer dialog with multiple tests
Do cleanup on 'unload' rather than 'close' (which is limited to a click
on the close button and doesn't get called for win.close()) and clear
the queue after each test.
2018-03-01 01:20:29 -05:00
Dan Stillman
f8b41c971c Automatic attachment file renaming changes
Automatic renaming is now done for dragging of an external file onto an
item (as added in 7cb95f41) as well as dragging as a linked file,
dragging a non-native (not text or HTML) URL, "Attach Link to File…",
"Attach Stored Copy of File…", and "Retrieve Metadata for PDF". It only
applies if a single file is being added and if the parent item has no
non-HTML attachments. By default, the renaming only applies to PDFs, but
this can be changed with the renameAttachmentFiles.automatic.fileTypes
hidden pref.

A new General pref, "Automatically rename attachment files using parent
metadata", controls whether the renaming happens.

Files saved via web translators are renamed regardless of this pref,
because they would often be gibberish otherwise.

Closes #113
2018-02-27 18:45:03 -05:00
Dan Stillman
f5b1ee44f3 Add Zotero.File.rename() (extracted from Zotero.Item::renameAttachmentFile()) 2018-02-27 14:24:26 -05:00
Dan Stillman
c0b63e5928 Better handling of 403 for attachment metadata upload
Check file-editing access for the group from the API before offering to
reset, update the filesEditable setting properly, and restart the sync
automatically after resetting.
2018-02-23 17:59:32 -05:00
Martynas Bagdonas
991a50d090 New PDF recognizer 2018-02-20 09:32:06 +02:00
Martynas Bagdonas
d810deaa9c Update PDF tools version and fix fulltext test 2018-02-14 04:00:02 -05:00
Dan Stillman
3f6ecc0021 Fix "Can't queue event outside of a transaction"
If a transaction took over 30 seconds and another transaction timed out
waiting for it, the second transaction would reset the notifier queue,
but if the first transaction then tried to queue an event, it would fail
with this error and roll back. (It would be nice to figure out why
transactions are taking over 30 seconds, though.)
2018-02-08 02:07:44 -05:00
Dan Stillman
c8cf9b9e6f Support for connector-based save target selection
- Updates /saveItems and /saveSnapshot to take a sessionID
- Provides a list of editable collections in the current library
- Adds an /updateSession method that takes a sessionID and updates the
  collection and tags of any items saved via that operation (and changes
  the currently selected collection)

Cross-library changes are not yet supported
2018-02-07 04:04:37 -05:00
Dan Stillman
4731b8f905 Remove fail() override in Mocha
I'm not sure what this was for, but at least with an async test function
it seems to be causing spurious "the string 'x' was thrown, throw an
Error :)" messages that hide the real error.
2018-02-07 04:04:37 -05:00
Dan Stillman
45ddf9827c Reset PDF tools path for tests in resetDB()
And include path on error when running PDF tool
2018-02-07 04:04:37 -05:00
Dan Stillman
38411fb56c Allow dragging parent items to collection if children are selected
This is a simplified version of the fix from #872. Unlike the proposal
in #36, this doesn't require all child items to be selected, since in a
search some children might be grayed out. If the child of an unselected
parent item is included, the drag isn't allowed.

Closes #36
2018-02-03 04:15:09 -05:00
Dan Stillman
ad216bcf97 Allow parentItemID as a createDataObject() parameter in tests
Not just `parentID`
2018-02-03 04:15:09 -05:00
Dan Stillman
c5fa1303e3 Prompt to reset local group files on 403 for file attachment upload
And reset modified file attachments when resetting files
2018-01-26 03:37:57 -05:00
Dan Stillman
d67c654245 Add version option to toResponseJSON() 2018-01-26 03:37:57 -05:00
Adomas Venčkauskas
d857a813b9 Fix integration test errors. Closes #1426 2018-01-25 12:48:12 +02:00
Dan Stillman
37eb597ee8 Cache PDF tools in the source directory between test runs
This avoids having to download a 13 MB file on every test run.
2018-01-18 19:24:09 -05:00
Dan Stillman
db2ddfd493 Fix Zotero.Fulltext.setItemContent() test 2018-01-18 18:55:24 -05:00
Martynas Bagdonas
723b4d32e5 Fix Zotero.Fulltext tests 2018-01-18 18:54:54 -05:00
Martynas Bagdonas
5815088586 Fix PDF tools usage in tests 2018-01-18 12:23:27 +02:00
Martynas Bagdonas
0d5ea8520a Use the bundled PDF tools 2018-01-17 13:33:18 +02:00
Dan Stillman
0cd50b5560
Merge pull request #1242 from adomasven/feature/delay-updating-citatations
Refactor integration and delay citation updates
2018-01-16 09:11:21 -05:00
Dan Stillman
7cb95f4129 Automatically rename dragged file attachments from parent metadata
Rename happens if only one file is dragged and the parent item has no
existing file attachments.

Closes #1405
2018-01-10 00:39:47 -05:00
Dan Stillman
c83de8a6ea Increase save time for Accessed test for Travis 2018-01-05 06:04:53 -05:00
Dan Stillman
3f6ef7fb01 Allow "now" in Accessed field to use current time
Closes #1340
2018-01-05 03:41:08 -05:00
Dan Stillman
fdb9e20076 Clear parentKey change marker after save
Fixes #1325, Field editor closes during auto-sync of newly created
parent item
2018-01-04 19:10:41 -05:00
Adomas Venčkauskas
2827f70daa Option to delay updating citation in document.
The checkbox in doc prefs is hidden until an update takes 5s or longer
after which the user is prompted to enable delaying.
2018-01-03 14:27:16 +02:00
Adomas Venčkauskas
6d05c3472b Add more integration tests 2018-01-03 14:27:16 +02:00
Adomas Venčkauskas
f44d563a15 Add Zotero.Integration.Citation
- Moves a bunch of citation related processing from Integration.Session
- Replaces missing item handling with a function instead of exception
- Solves some really confusing flow issues in _processFields
2018-01-03 14:27:16 +02:00
Adomas Venčkauskas
a1acbd4038 Make current session globally available
Decoupling! Sessions can be instantiated without
Zotero.Integration.Interface
2018-01-03 14:27:16 +02:00
Adomas Venčkauskas
41c93ab034 Rename Integration.Document to Integration.Interface 2018-01-03 14:27:16 +02:00
Dan Stillman
a1c96f1db1 Fix deletion of tags across libraries
https://forums.zotero.org/discussion/comment/296384/#Comment_296384
2017-12-20 21:48:36 -05:00
Dan Stillman
df38f4ded7 Avoid upload retry loops
- Don't try uploading an object more than 5 times
- Don't retry a child item if the parent item failed too
2017-12-10 03:45:08 -05:00
Dan Stillman
f353b7ca61 API-based "Restore to Online Library"
Restores the "Restore to Zotero Server" functionality, now using the
API:

1. Get all remote keys and send `DELETE` for any that don't exist
   locally.
2. Upload all local objects in full (non-patch) mode using only library
   version so that the remotes are overwritten.
3. Reset file sync history, causing all files to be uploaded (or, more
   likely, reassociated with existing remote files).

Since these are treated as regular updates on the server, they'll sync
down to other clients normally. Unsynced changes by other clients might
still trigger conflicts.

This and Reset File Sync History can also now be run on group libraries,
with a library selector in the Reset pane (which I forgot to do with
React).

The full sync option is now removed from the Reset pane, since there
wasn't ever really a reason to run it manually.

We should be able to reimplement Restore from Online Library (#1386)
using the inverse of this approach.

Closes #914
2017-12-08 00:42:03 -05:00
Dan Stillman
da1dd75265 Don't compress uploaded data in tests
It would be better to handle this automatically in Sinon, but as it is
uploads are compressed if they're bigger than an arbitrary limit, which
can break tests unexpectedly if they check req.requestBody.
2017-12-08 00:42:03 -05:00