Vulcan/packages/nova-subscribe
Xavier Cazalot 7f99b48953 devel - revert commits related to simpl-schema (#1537)
* Revert "add note link to issue in collection2 on mutation insert, remove debug console logs on mutation edit"

This reverts commit 7a15103de7.

* Revert "node simpl-schema + collection2-core: fix vote by specifying the right type of the array (dont use blackbox in the end!)"

This reverts commit e894c3224c.

* Revert "add graphql date type (fix problem with node simple schema), fix an update bug on date picker,  add edit check on custom post item, add `blackbox: true` for arrays field (validation problem with simple-schema)"

This reverts commit 9d84fbec98.

* Revert "use node `simpl-schema` by aldeed to replace `meteor/aldeed:simple-schema` ; use the meteor collection2 core package as recommended"

This reverts commit 016935f4fa.

* revert before node-simple-schema, fix obj.hasOwnProperty undefined error thrown by simple-schema & collection2

* CustomPostsItem: check on renderActions; withDocument/List: pollInterval 20seconds by default; DateTime form component enhancement + GraphQLDate type
2017-01-11 18:02:12 +01:00
..
lib devel - revert commits related to simpl-schema (#1537) 2017-01-11 18:02:12 +01:00
package.js semver bump: 1.0.0 🚀 2016-12-27 11:58:58 +01:00
README.md Give doc to nova:subscribe 📖 2016-08-16 17:04:04 +02:00

nova:subscribe

This optional package for Nova lets your users subscribe to the different domains (collections) of your application.

Dependencies & usage

Explicit dependency on nova:users to enable permissions.

If nova:posts is enabled, your users will be able to subscribe to:

  • new posts from users they follow (subscribed to)
  • new comments on a post they are subscribed to

If nova:categories is enabled, your users will be able to subscribe to new posts in a category.

Basic usage

This package gives you access to several methods of the type collection.subscribe & collection.unsubscribe. Default group of users can subscribe to any activated domain (see above) with the following methods (action) :

users.subscribe
users.unsubscribe
posts.subscribe
posts.unsubscribe
categories.subscribe
categories.unsubscribe

This package also provides a reusable component called SubscribeTo to subscribe to an document of collection.

This component takes two props, document & documentType. It can trigger any method described below:

// for example, in PostItem.jsx
<Telescope.components.SubscribeTo document={post} documentType={"posts"} />

// for example, in UsersProfile.jsx
<Telescope.components.SubscribeTo document={user} documentType={"users"} />

// for example, in Category.jsx
<Telescope.components.SubscribeTo document={category} documentType={"categories"} />

Extend to other collections than Users, Posts, Categories

This package export a function called subscribeMethodsGenerator that takes a collection as an argument and create the associated methods code :

// in my custom package
import subscribeMethodsGenerator from 'meteor/nova:subscribe';
import Movies from './collection.js';

// the function creates the code, then you have to associate it to the Meteor namespace:
Meteor.methods(subscribeMethodsGenerator(Movies)); 

This will creates for you the methods movies.subscribe & movies.unsubscribe than can be used in the SubscribeTo component:

// in my custom component
<Telescope.components.SubscribeTo document={movie} documentType={"movies"} />

You'll also need to write the relevant callbacks, custom fields & permissions to run whenever a user is subscribed to your custom collection's item. See these files for inspiration. Note: it's more or less always the same thing

Reusable component to show a list of subscribed items

There was formerly a component that showed a list of subscribed posts. While reducing the depencies to other packages, it broke. It's on the roadmap to re-enable it. Feel free to discuss about it on the Slack channel if you want to build it!

Subscribe all the things

Original PR & discussion can be found here: https://github.com/TelescopeJS/Telescope/pull/1425