2.0.0-alpha.11 • Published 1 year ago
@activitypods/announcer v2.0.0-alpha.11
Announcer Service
An ActivityPods service to announce (share) objects, and give the right to other users to announce.
Usage
The AnnouncerService is included in the CoreService. The easiest way to make use of it is to import the AnnouncerMixin along with the ControlledContainerMixin.
const { ControlledContainerMixin } = require('@semapps/ldp');
const { AnnouncerMixin } = require('@activitypods/announcer');
module.exports = {
name: 'events',
mixins: [AnnouncerMixin, ControlledContainerMixin], // In that order
settings: {
path: '/events',
acceptedTypes: ['Event'],
// If you wish to customize the notification sent when an object is announced, you can change any of the properties below
notificationMapping: {
key: 'announce',
title: {
en: `{{emitterProfile.vcard:given-name}} shared with you "{{activity.object.name}}"`,
fr: `{{emitterProfile.vcard:given-name}} a partagé avec vous "{{activity.object.name}}"`
},
actionName: {
en: 'View',
fr: 'Voir'
},
actionLink: "/e/{{encodeUri activity.object.id}}"
}
}
}Actions
watch
Watch a new type of object. If the acceptedTypes setting is set, it will call the watch actions at the start of the service.
Parameters
| Property | Type | Default | Description |
|---|---|---|---|
type | String or Array | required | The type of resource we want to watch |
Handled activities
Announce an object
{
"type": "Announce",
"object": {
"type": "[WATCHED TYPES]"
}
}Emitter's side effects
- The recipients are added to the
/announcescollection. - The recipients are added to a WebACL group which is allowed to view (
acl:Read) the object.
Recipients' side effects
- The object is cached in the recipients' PODs
- Notifications are sent to the recipients (see
notificationMappingsetting above)
Offer to announce an object
{
"type": "Offer",
"object": {
"type": "Announce",
"object": {
"type": "[WATCHED TYPES]"
}
}
}Emitter's side effects
- If the activity is sent by the object creator, it means he wants to give the right to share this object
- The recipients are added to the
/announcerscollection. - The recipients are added to a WebACL group which can view the
/announcescollection.
- The recipients are added to the
Recipients' side effects
- If the activity is sent to the object creator, it means we are an announcer and want the creator to announce the object to one of our contacts
- The object creator sends an
Announceactivity to the actor specified by the announcer - The announcer is informed that his offer has been accepted (via an
Acceptactivity)
- The object creator sends an
2.0.0-alpha.7
2 years ago
2.0.0-alpha.8
2 years ago
2.0.0-alpha.9
1 year ago
2.0.0-alpha.11
1 year ago
2.0.0-alpha.3
2 years ago
2.0.0-alpha.10
1 year ago
2.0.0-alpha.4
2 years ago
2.0.0-alpha.5
2 years ago
2.0.0-alpha.6
2 years ago
2.0.0-alpha.1
2 years ago
2.0.0-alpha.2
2 years ago
2.0.0-alpha.0
2 years ago
1.5.1
2 years ago
1.1.0
4 years ago