kopia lustrzana https://github.com/snarfed/bridgy-fed
				
				
				
			fix tests for 3dd265d (AS2/AP tweaks for Mastodon)
				
					
				
			
							rodzic
							
								
									3dd265d741
								
							
						
					
					
						commit
						b8bdde7cef
					
				|  | @ -99,6 +99,7 @@ class WebmentionTest(testutil.TestCase): | ||||||
|             '@type': 'Create', |             '@type': 'Create', | ||||||
|             'type': 'Create', |             'type': 'Create', | ||||||
|             'object': { |             'object': { | ||||||
|  |                 '@context': 'https://www.w3.org/ns/activitystreams', | ||||||
|                 '@type': 'Note', |                 '@type': 'Note', | ||||||
|                 'type': 'Note', |                 'type': 'Note', | ||||||
|                 'url': 'http://a/reply', |                 'url': 'http://a/reply', | ||||||
|  |  | ||||||
|  | @ -31,8 +31,8 @@ import models | ||||||
| def prepare_as2(activity): | def prepare_as2(activity): | ||||||
|     """Prepare an AS2 object to be sent via ActivityPub.""" |     """Prepare an AS2 object to be sent via ActivityPub.""" | ||||||
|     activity.update({ |     activity.update({ | ||||||
|         'type': activity['@type'],  # for Mastodon |         'type': activity.get('@type'),  # for Mastodon | ||||||
|         'id': activity['@id'],      # " |         'id': activity.get('@id'),      # " | ||||||
|         'cc': (activity.get('cc', []) + |         'cc': (activity.get('cc', []) + | ||||||
|                [activitypub.PUBLIC_AUDIENCE] + |                [activitypub.PUBLIC_AUDIENCE] + | ||||||
|                util.get_list(activity, 'inReplyTo')), |                util.get_list(activity, 'inReplyTo')), | ||||||
|  | @ -50,16 +50,16 @@ def prepare_as2(activity): | ||||||
|                             'Only using the first: %s' % in_reply_tos[0]) |                             'Only using the first: %s' % in_reply_tos[0]) | ||||||
|         activity['inReplyTo'] = in_reply_tos[0] |         activity['inReplyTo'] = in_reply_tos[0] | ||||||
| 
 | 
 | ||||||
|     if activity.get('@type') in as2.TYPE_TO_VERB: |     if activity.get('@type') not in as2.TYPE_TO_VERB: | ||||||
|         return activity |         activity = { | ||||||
|     else: |  | ||||||
|         return { |  | ||||||
|             '@context': as2.CONTEXT, |             '@context': as2.CONTEXT, | ||||||
|             '@type': 'Create', |             '@type': 'Create', | ||||||
|             'type': 'Create', |             'type': 'Create', | ||||||
|             'object': activity, |             'object': activity, | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |     return util.trim_nulls(activity) | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| class WebmentionHandler(webapp2.RequestHandler): | class WebmentionHandler(webapp2.RequestHandler): | ||||||
|     """Handles inbound webmention, converts to ActivityPub or Salmon.""" |     """Handles inbound webmention, converts to ActivityPub or Salmon.""" | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Ryan Barrett
						Ryan Barrett