forked from adamgibbons/ics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SENT-BY property to organizer (adamgibbons#230)
* feat: add sent-by property to organizer * feat: add sentBy to attributes table of README.md --------- Co-authored-by: Adam Gibbons <[email protected]>
- Loading branch information
1 parent
e2be11e
commit 1306072
Showing
5 changed files
with
17 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,7 +263,7 @@ The following properties are accepted: | |
| geo | Geographic coordinates (lat/lon) | `{ lat: 38.9072, lon: 77.0369 }` | ||
| url | URL associated with event | `'http://www.mountainsunpub.com/'` | ||
| status | Three statuses are allowed: `TENTATIVE`, `CONFIRMED`, `CANCELLED` | `CONFIRMED` | ||
| organizer | Person organizing the event | `{ name: 'Adam Gibbons', email: '[email protected]', dir: 'https://linkedin.com/in/adamgibbons' }` | ||
| organizer | Person organizing the event | `{ name: 'Adam Gibbons', email: '[email protected]', dir: 'https://linkedin.com/in/adamgibbons', sentBy: '[email protected]' }` | ||
| attendees | Persons invited to the event | `[{ name: 'Mo', email: '[email protected]', rsvp: true }, { name: 'Bo', email: '[email protected]', dir: 'https://twitter.com/bo1234', partstat: 'ACCEPTED', role: 'REQ-PARTICIPANT' }]` | ||
| categories | Categories associated with the event | `['hacknight', 'stout month']` | ||
| alarms | Alerts that can be set to trigger before, during, or after the event. The following `attach` properties work on Mac OS: Basso, Blow, Bottle, Frog, Funk, Glass, Hero, Morse, Ping, Pop, Purr, Sousumi, Submarine, Tink | `{ action: 'display', description: 'Reminder', trigger: [2000, 1, 4, 18, 30] }` OR `{ action: 'display', description: 'Reminder', trigger: { hours: 2, minutes: 30, before: true } }` OR `{ action: 'display', description: 'Reminder', trigger: { hours: 2, minutes: 30, before: false }` OR `{ action: 'audio', description: 'Reminder', trigger: { hours: 2, minutes: 30, before: true }, repeat: 2, attachType: 'VALUE=URI', attach: 'Glass' }` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
export default function setOrganizer({ name, email, dir }) { | ||
export default function setOrganizer({ name, email, dir, sentBy }) { | ||
let formattedOrganizer = '' | ||
formattedOrganizer += dir ? `DIR="${dir}";` : '' | ||
formattedOrganizer += sentBy ? `SENT-BY="MAILTO:${sentBy}";` : '' | ||
formattedOrganizer += 'CN=' | ||
formattedOrganizer += name || 'Organizer' | ||
formattedOrganizer += email ? `:mailto:${email}` : '' | ||
formattedOrganizer += email ? `:MAILTO:${email}` : '' | ||
|
||
return formattedOrganizer | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import { | |
formatEvent, | ||
buildEvent | ||
} from '../../src/pipeline' | ||
import {foldLine} from "../../src/utils"; | ||
|
||
describe('pipeline.formatEvent', () => { | ||
it('writes default values when no attributes passed', () => { | ||
|
@@ -206,12 +207,13 @@ describe('pipeline.formatEvent', () => { | |
expect(formattedEventAnyClass).to.contain('CLASS:non-standard-property') | ||
}) | ||
it('writes an organizer', () => { | ||
const event = formatEvent({ organizer: { | ||
name: 'Adam Gibbons', | ||
email: '[email protected]' | ||
}}) | ||
const formattedEvent = formatEvent(event) | ||
expect(event).to.contain('ORGANIZER;CN=Adam Gibbons:mailto:[email protected]') | ||
const formattedEvent = formatEvent({ organizer: { | ||
name: 'Adam Gibbons', | ||
email: '[email protected]', | ||
dir: 'test-dir-value', | ||
sentBy: '[email protected]' | ||
}}) | ||
expect(formattedEvent).to.contain(foldLine('ORGANIZER;DIR="test-dir-value";SENT-BY="MAILTO:[email protected]";CN=Adam Gibbons:MAILTO:[email protected]')) | ||
}) | ||
it('writes an alarm', () => { | ||
const formattedEvent = formatEvent({ alarms: [{ | ||
|