import Dispatcher from "dispatchers/Dispatcher";
import BaseStore from "stores/BaseStore";
import HelpLinkCollection from "collections/HelpLinkCollection";

var HelpLinkStore = BaseStore.extend({
    collection: HelpLinkCollection,

    queryParams: {
        page_size: 100
    },

});

var store = new HelpLinkStore();

Dispatcher.register(function(dispatch) {
    var options = dispatch.action.options || options;

    if (!options.silent) {
        store.emitChange();
    }

    return true;
});

export default store;

import _ from "underscore";
import Dispatcher from "dispatchers/Dispatcher";
import BaseStore from "stores/BaseStore";
import HelpLinkCollection from "collections/HelpLinkCollection";

var HelpLinkStore = BaseStore.extend({
    collection: HelpLinkCollection,

    queryParams: {
        page_size: 100
    },

});

var store = new HelpLinkStore();

Dispatcher.register(function(dispatch) {
    var options = dispatch.action.options || options;

    if (_.has(options, "silent") && !options.silent) {
        store.emitChange();
    }

    return true;
});

export default store;

Fix error when updateImageAttributes dispatched
Fix error when updateImageAttributes dispatched

An uncaught error has been occurring when an image creator saves any
changes to image attributes:

```
Uncaught TypeError: Cannot read property 'silent' of undefined
```

It turns out that the HelpLinkStore is performing check for an option,
`option.silent`, to determine if an `emitChange()` call should be made.

Unfortunately, this "check" is done in a manner that generates the
above uncaught type error.

The fix was to use the `_.has(obj, "propName")` call. This could be
replaced with an expression like `obj && obj.hasOwnProperty("prop")`,
but here we opt for `underscore` since it is already available - we
could also move to `lodash`.
