@@ -17,10 +17,13 @@ function getParent (path) {
1717 return parent === '/' ? '/' : `${ parent } /`
1818}
1919
20- function getActivity ( method ) {
20+ function getActivity ( method , path ) {
2121 if ( method === 'DELETE' ) {
2222 return 'Delete'
2323 }
24+ if ( method === 'POST' && path . endsWith ( '/' ) ) {
25+ return 'Add'
26+ }
2427 return 'Update'
2528}
2629
@@ -37,10 +40,10 @@ function getParentActivity (method, status) {
3740function handler ( req , res , next ) {
3841 const { trigger, defaultNotification } = res . events . prep
3942
40- const { method } = req
43+ const { method, path } = req
4144 const { statusCode } = res
4245 const eventID = res . getHeader ( 'event-id' )
43- const fullUrl = new URL ( req . path , `${ req . protocol } ://${ req . hostname } /` )
46+ const fullUrl = new URL ( path , `${ req . protocol } ://${ req . hostname } /` )
4447
4548 // Date is a hack since node does not seem to provide access to send date.
4649 // Date needs to be shared with parent notification
@@ -56,10 +59,10 @@ function handler (req, res, next) {
5659 negotiatedFields
5760 ) {
5861 const mediaType = negotiatedFields [ 'content-type' ]
59-
62+ const activity = getActivity ( method , path )
6063 if ( ALLOWED_RDF_MIME_TYPES . includes ( mediaType ?. [ 0 ] ) ) {
6164 return `${ headerTemplate ( negotiatedFields ) } \r\n${ solidRDFTemplate ( {
62- activity : getActivity ( method ) ,
65+ activity,
6366 eventID,
6467 object : String ( fullUrl ) ,
6568 date : eventDate ,
@@ -81,7 +84,7 @@ function handler (req, res, next) {
8184
8285 // Write a notification to parent container
8386 // POST in Solid creates a child resource
84- const parent = getParent ( req . path )
87+ const parent = getParent ( path )
8588 if ( parent && method !== 'POST' ) {
8689 try {
8790 const parentID = res . setEventID ( parent )
0 commit comments