kopia lustrzana https://github.com/friendica/friendica
				
				
				
			Issue 14851: Fix attachments for Lemmy
							rodzic
							
								
									3ea4f1b6cc
								
							
						
					
					
						commit
						84d8b90afc
					
				| 
						 | 
					@ -1609,18 +1609,28 @@ class Transmitter
 | 
				
			||||||
		$attachments = [];
 | 
							$attachments = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$urls = [];
 | 
							$urls = [];
 | 
				
			||||||
		foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO, Post\Media::DOCUMENT, Post\Media::TORRENT]) as $attachment) {
 | 
							foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO, Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::HTML]) as $attachment) {
 | 
				
			||||||
			if (in_array($attachment['url'], $urls)) {
 | 
								if (in_array($attachment['url'], $urls)) {
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			$urls[] = $attachment['url'];
 | 
								$urls[] = $attachment['url'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			$attach = [
 | 
								if ($attachment['type'] == Post\Media::HTML) {
 | 
				
			||||||
				'type'      => 'Document',
 | 
									$attach = [
 | 
				
			||||||
				'mediaType' => $attachment['mimetype'],
 | 
										'type'    => 'Link',
 | 
				
			||||||
				'url'       => $attachment['url'],
 | 
										'href'    => $attachment['url'],
 | 
				
			||||||
				'name'      => $attachment['description']
 | 
										'name'    => $attachment['name'],
 | 
				
			||||||
			];
 | 
										'content' => $attachment['description'],
 | 
				
			||||||
 | 
									];
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									$attach = [
 | 
				
			||||||
 | 
										'type' => 'Document',
 | 
				
			||||||
 | 
										'url'  => $attachment['url'],
 | 
				
			||||||
 | 
										'name' => $attachment['description'],
 | 
				
			||||||
 | 
									];
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								$attach['mediaType'] = $attachment['mimetype'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (!empty($attachment['height'])) {
 | 
								if (!empty($attachment['height'])) {
 | 
				
			||||||
				$attach['height'] = $attachment['height'];
 | 
									$attach['height'] = $attachment['height'];
 | 
				
			||||||
| 
						 | 
					@ -1812,7 +1822,7 @@ class Transmitter
 | 
				
			||||||
			$data['updated'] = DateTimeFormat::utc($item['edited'] . '+00:00', DateTimeFormat::ATOM);
 | 
								$data['updated'] = DateTimeFormat::utc($item['edited'] . '+00:00', DateTimeFormat::ATOM);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$data['url'] = $link ?? $item['plink'];
 | 
							$data['url'] = $item['plink'];
 | 
				
			||||||
		if ($api_mode) {
 | 
							if ($api_mode) {
 | 
				
			||||||
			$data['attributedTo'] = self::getActorArrayByCid($item['author-id']);
 | 
								$data['attributedTo'] = self::getActorArrayByCid($item['author-id']);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Ładowanie…
	
		Reference in New Issue