Skip to content

Commit

Permalink
Merge changes from upstream Zotero master
Browse files Browse the repository at this point in the history
  • Loading branch information
fbennett committed Jun 12, 2017
2 parents 2e6528c + 98544ed commit 1d797b4
Show file tree
Hide file tree
Showing 73 changed files with 5,648 additions and 12,695 deletions.
46 changes: 46 additions & 0 deletions .babelrc
@@ -0,0 +1,46 @@
{
"compact": false,
"retainLines": true,
"presets": [],
"ignore": [
"resource/require.js",
"chrome/content/zotero/include.js",
"resource/tinymce/tinymce.js",
"chrome/content/zotero/xpcom/citeproc.js",
"resource/csl-validator.js",
"resource/react.js",
"resource/react-dom.js",
"resource/bluebird.js",
"resource/bluebird/*.js",
"test/resource/httpd.js",
"test/resource/mocha.js",
"test/resource/co-mocha.js"
],
"plugins": [
"syntax-flow",
"syntax-jsx",
"syntax-async-generators",
"syntax-class-properties",
"syntax-decorators",
"syntax-do-expressions",
"syntax-export-extensions",
"syntax-flow",
"syntax-jsx",
"syntax-object-rest-spread",
"transform-react-jsx",
"transform-react-display-name",
[
"transform-async-to-module-method",
{
"module": "resource://zotero/bluebird.js",
"method": "coroutine"
}
],
[
"transform-es2015-modules-commonjs",
{
"strictMode": false
}
]
]
}
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
.DS_Store
node_modules
build
6 changes: 0 additions & 6 deletions .gitmodules
Expand Up @@ -4,12 +4,6 @@
[submodule "styles"]
path = styles
url = https://github.com/Juris-M/jm-styles.git
[submodule "test/resource/chai"]
path = test/resource/chai
url = https://github.com/chaijs/chai.git
[submodule "test/resource/mocha"]
path = test/resource/mocha
url = https://github.com/mochajs/mocha.git
[submodule "csl-locale-submodule"]
path = chrome/content/zotero/locale/csl
url = https://github.com/citation-style-language/locales.git
Expand Down
35 changes: 29 additions & 6 deletions .travis.yml
@@ -1,9 +1,12 @@
sudo: false
language: cpp
compiler:
- gcc
language: node_js
node_js:
- "node"
cache:
directories:
- "node_modules"
env:
- FX_VERSION="50.1.0"
- FX_VERSION="54.0b"
- FX_VERSION="45.0.2esr"
matrix:
fast_finish: true
Expand All @@ -15,12 +18,32 @@ install:
- if [ $FX_VERSION = "45.0.2esr" ]; then
wget -O tarball "https://archive.mozilla.org/pub/firefox/releases/45.0.2esr/linux-x86_64/en-US/firefox-45.0.2esr.tar.bz2";
fi
- if [ $FX_VERSION = "50.1.0" ]; then
wget -O tarball "http://archive.mozilla.org/pub/firefox/tinderbox-builds/mozilla-release-linux64-add-on-devel/1481240107/firefox-50.1.0.en-US.linux-x86_64-add-on-devel.tar.bz2";
- if [ $FX_VERSION = "54.0b" ]; then
wget -O tarball "https://archive.mozilla.org/pub/firefox/tinderbox-builds/mozilla-beta-linux64-add-on-devel/1496339244/firefox-54.0.en-US.linux-x86_64-add-on-devel.tar.bz2";
fi
- tar xf tarball
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm i
- node_modules/.bin/gulp build
script:
- test/runtests.sh -x firefox/firefox
before_deploy:
- mkdir build-zip
- cd build
- zip -r ../build-zip/$TRAVIS_COMMIT.zip *
- cd ..
deploy:
provider: s3
access_key_id: AKIAJFDVJ54MCAEXPQ5Q
secret_access_key:
secure: YXRlWOAMELuCmArVTR50NH3HHEK/nwltmiS5iIEIVx0hFtI/GJCZWjWH0eQ5ro1V1GgYyEGT+Miud9SXNDeejYFNpR80G4gBSSpbngvT/CBYE5IIN/rvlykklCy5+HEgAZEt72zowBDzlX2DBRYPjryKXjL0Ahcz/H7NGvtS5Hk=
bucket: zotero-download
skip_cleanup: true
local-dir: build-zip
upload-dir: ci/client
acl: public-read
on:
repo: zotero/zotero
condition: "$FX_VERSION = 54.0b"
4 changes: 2 additions & 2 deletions chrome/content/zotero/bindings/noteeditor.xml
Expand Up @@ -442,7 +442,7 @@
// If editable and no existing tags, open new empty row
var tagsBox = this.id('tags');
if (tagsBox.mode == 'edit' && tagsBox.count == 0) {
this.id('tags').new();
this.id('tags').newTag();
}
]]></body>
</method>
Expand Down Expand Up @@ -573,7 +573,7 @@
tagsbox and tagsLabel above, so be sure to update fixPopup() if it changes
-->
<xul:menupopup id="tagsPopup" ignorekeys="true"
onpopupshown="if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.tagName=='xul:label'){ /* DEBUG: it would be nice to make this work -- if (this.firstChild.count==0){ this.firstChild.new(); } */ this.setAttribute('showing', 'true'); }"
onpopupshown="if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.tagName=='xul:label'){ /* DEBUG: it would be nice to make this work -- if (this.firstChild.count==0){ this.firstChild.newTag(); } */ this.setAttribute('showing', 'true'); }"
onpopuphidden="if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.tagName=='xul:label'){ this.setAttribute('showing', 'false'); }">
<xul:tagsbox id="tags" flex="1" mode="edit"/>
</xul:menupopup>
Expand Down
2 changes: 1 addition & 1 deletion chrome/content/zotero/bindings/relatedbox.xml
Expand Up @@ -193,7 +193,7 @@
var remove = document.createElement("label");
remove.setAttribute('value','-');
remove.setAttribute('onclick',
"document.getBindingParent(this).remove('" + id + "');");
"document.getBindingParent(this).remove(" + id + ");");
remove.setAttribute('class','zotero-clicky zotero-clicky-minus');
}
Expand Down
6 changes: 3 additions & 3 deletions chrome/content/zotero/bindings/tagsbox.xml
Expand Up @@ -725,7 +725,7 @@
</method>


<method name="new">
<method name="newTag">
<body>
<![CDATA[
var rowsElement = this.id('tagRows');
Expand Down Expand Up @@ -954,7 +954,7 @@
next.click();
}
else {
next = this.new();
next = this.newTag();
next = next.firstChild.nextSibling;
}
Expand Down Expand Up @@ -1056,7 +1056,7 @@
<xul:label id="tagsNum"/>
<xul:button id="addButton" label="&zotero.item.add;"
onkeypress="return document.getBindingParent(this)._onAddButtonKeypress(event)"
oncommand="document.getBindingParent(this).new();"/>
oncommand="document.getBindingParent(this).newTag();"/>
</xul:hbox>
<xul:grid>
<xul:columns>
Expand Down
4 changes: 2 additions & 2 deletions chrome/content/zotero/bindings/tagselector.xml
Expand Up @@ -805,7 +805,7 @@
</method>


<method name="delete">
<method name="deleteTag">
<parameter name="name"/>
<body><![CDATA[
return Zotero.spawn(function* () {
Expand Down Expand Up @@ -1090,7 +1090,7 @@
<menuitem label="&zotero.tagSelector.renameTag;"
oncommand="document.getBindingParent(this).rename(_popupNode.textContent); event.stopPropagation()"/>
<menuitem label="&zotero.tagSelector.deleteTag;"
oncommand="document.getBindingParent(this).delete(_popupNode.textContent); event.stopPropagation()"/>
oncommand="document.getBindingParent(this).deleteTag(_popupNode.textContent); event.stopPropagation()"/>
</menupopup>

<deck id="tags-deck">
Expand Down
12 changes: 9 additions & 3 deletions chrome/content/zotero/icon.js
Expand Up @@ -259,10 +259,16 @@ function getTooltipText(button) {
// Use defaults if necessary
if (!text) {
// Get the stringbundle manually
Components.utils.import("resource://gre/modules/Services.jsm");
let appLocale;
if (Services.locale.getAppLocale) {
appLocale = Services.locale.getAppLocale();
}
// Fx <=53
else {
appLocale = Services.locale.getApplicationLocale();
}
let src = 'chrome://zotero/locale/zotero.properties';
let localeService = Components.classes['@mozilla.org/intl/nslocaleservice;1']
.getService(Components.interfaces.nsILocaleService);
let appLocale = localeService.getApplicationLocale();
let stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
let stringBundle = stringBundleService.createBundle(src, appLocale);
Expand Down
7 changes: 6 additions & 1 deletion chrome/content/zotero/include.js
@@ -1,5 +1,10 @@
var Zotero = Components.classes["@zotero.org/Zotero;1"]
/* global Components:false */
/* eslint-disable no-unused-vars */

var Zotero = Components.classes['@zotero.org/Zotero;1']
// Currently uses only nsISupports
//.getService(Components.interfaces.chnmIZoteroService).
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;

Components.utils.import('resource://zotero/require.js');
4 changes: 2 additions & 2 deletions chrome/content/zotero/note.js
Expand Up @@ -37,8 +37,8 @@ function onLoad() {
if (window.arguments) {
var io = window.arguments[0];
}
var itemID = io.itemID;
var collectionID = io.collectionID;
var itemID = parseInt(io.itemID);
var collectionID = parseInt(io.collectionID);
var parentItemKey = io.parentItemKey;

return Zotero.spawn(function* () {
Expand Down
17 changes: 11 additions & 6 deletions chrome/content/zotero/standalone/standalone.js
Expand Up @@ -156,12 +156,17 @@ const ZoteroStandalone = new function() {
* Handles help menu requests
*/
this.openHelp = function(type) {
if(type === "troubleshooting") {
ZoteroPane.loadURI("http://www.zotero.org/support/getting_help");
} else if(type === "feedback") {
ZoteroPane.loadURI("http://forums.zotero.org/categories/");
} else {
ZoteroPane.loadURI("http://www.zotero.org/support/");
switch (type) {
case "troubleshooting":
ZoteroPane.loadURI(ZOTERO_CONFIG.TROUBLESHOOTING_URL);
break;

case "feedback":
ZoteroPane.loadURI(ZOTERO_CONFIG.FEEDBACK_URL);
break;

default:
ZoteroPane.loadURI(ZOTERO_CONFIG.SUPPORT_URL);
}
}

Expand Down
21 changes: 11 additions & 10 deletions chrome/content/zotero/xpcom/data/dataObject.js
Expand Up @@ -801,16 +801,6 @@ Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options =
env.options.tx = true;
}

var proceed = yield this._initSave(env);
if (!proceed) return false;

if (env.isNew) {
Zotero.debug('Saving data for new ' + this._objectType + ' to database', 4);
}
else {
Zotero.debug('Updating database with new ' + this._objectType + ' data', 4);
}

if (env.options.skipAll) {
[
'skipDateModifiedUpdate',
Expand All @@ -821,6 +811,17 @@ Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options =
'skipSelect'
].forEach(x => env.options[x] = true);
}

var proceed = yield this._initSave(env);
if (!proceed) return false;

if (env.isNew) {
Zotero.debug('Saving data for new ' + this._objectType + ' to database', 4);
}
else {
Zotero.debug('Updating database with new ' + this._objectType + ' data', 4);
}

try {
if (Zotero.DataObject.prototype._finalizeSave == this._finalizeSave) {
throw new Error("_finalizeSave not implemented for Zotero." + this._ObjectType);
Expand Down
12 changes: 9 additions & 3 deletions chrome/content/zotero/xpcom/data/dataObjects.js
Expand Up @@ -172,14 +172,20 @@ Zotero.DataObjects.prototype.getAsync = Zotero.Promise.coroutine(function* (ids,

for (let i=0; i<ids.length; i++) {
let id = ids[i];

if (!Number.isInteger(id)) {
// TEMP: Re-enable test when removed
let e = new Error(`${this._ZDO_object} ID '${id}' is not an integer (${typeof id})`);
Zotero.logError(e);
id = parseInt(id);
//throw new Error(`${this._ZDO_object} ID '${id}' is not an integer (${typeof id})`);
}

// Check if already loaded
if (this._objectCache[id]) {
toReturn.push(this._objectCache[id]);
}
else {
if (!Number.isInteger(id)) {
throw new Error(`Invalid ${this._ZDO_object} ID '${id}' (${typeof id})`);
}
toLoad.push(id);
}
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/content/zotero/xpcom/data/item.js
Expand Up @@ -2333,7 +2333,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
if (reloadParentChildItems) {
for (let parentItemID in reloadParentChildItems) {
// Keep in sync with Zotero.Items.trash()
let parentItem = yield this.ObjectsClass.getAsync(parentItemID);
let parentItem = yield this.ObjectsClass.getAsync(parseInt(parentItemID));
yield parentItem.reload(['primaryData', 'childItems'], true);
parentItem.clearBestAttachmentState();
}
Expand Down

0 comments on commit 1d797b4

Please sign in to comment.