kopia lustrzana https://github.com/nextcloud/social
				
				
				
			Merge branch 'feature/797/interact-with-remote-item' of https://github.com/nextcloud/social into feature/797/interact-with-remote-item
						commit
						779be9a212
					
				|  | @ -141,10 +141,10 @@ class OStatusController extends Controller { | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		try { | 		try { | ||||||
| 			$post = $this->streamService->getStreamById($uri, true, true); | 			$this->streamService->getStreamById($uri, true, true); | ||||||
| 
 | 
 | ||||||
| 			$link = $this->urlGenerator->linkToRouteAbsolute('social.SocialPub.displayRemotePost') | 			$link = $this->urlGenerator->linkToRouteAbsolute('social.SocialPub.displayRemotePost') | ||||||
| 					. '?id=' . $uri; | 					. '?id=' . $uri . '&type=' . $this->parseRefererType(); | ||||||
| 
 | 
 | ||||||
| 			return new RedirectResponse($link); | 			return new RedirectResponse($link); | ||||||
| 		} catch (Exception $e) { | 		} catch (Exception $e) { | ||||||
|  | @ -243,5 +243,34 @@ class OStatusController extends Controller { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * @return string | ||||||
|  | 	 */ | ||||||
|  | 	private function parseRefererType(): string { | ||||||
|  | 		$referer = $this->request->getHeader('Referer'); | ||||||
|  | 		$params = explode('&', parse_url($referer, PHP_URL_QUERY)); | ||||||
|  | 		$type = ''; | ||||||
|  | 		foreach ($params as $param) { | ||||||
|  | 			list($key, $value) = explode('=', $param); | ||||||
|  | 			if ($key === 'type') { | ||||||
|  | 				$type = $value; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		switch ($type) { | ||||||
|  | 			case 'reblog': | ||||||
|  | 				return 'boost'; | ||||||
|  | 
 | ||||||
|  | 			case 'favourite': | ||||||
|  | 				return 'like'; | ||||||
|  | 
 | ||||||
|  | 			case 'reply': | ||||||
|  | 				return 'reply'; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		return ''; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -255,7 +255,6 @@ class SocialPubController extends Controller { | ||||||
| 	 * @param string $id | 	 * @param string $id | ||||||
| 	 * | 	 * | ||||||
| 	 * @return TemplateResponse | 	 * @return TemplateResponse | ||||||
| 	 * @throws SocialAppConfigException |  | ||||||
| 	 * @throws StreamNotFoundException | 	 * @throws StreamNotFoundException | ||||||
| 	 */ | 	 */ | ||||||
| 	public function displayRemotePost(string $id): TemplateResponse { | 	public function displayRemotePost(string $id): TemplateResponse { | ||||||
|  | @ -280,9 +279,7 @@ class SocialPubController extends Controller { | ||||||
| 			], | 			], | ||||||
| 			'application' => 'Social' | 			'application' => 'Social' | ||||||
| 		]; | 		]; | ||||||
| 
 | 		 | ||||||
| 		$this->miscService->log('----- ' . json_encode($data)); |  | ||||||
| 
 |  | ||||||
| 		return new TemplateResponse(Application::APP_NAME, 'stream', $data); | 		return new TemplateResponse(Application::APP_NAME, 'stream', $data); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -241,8 +241,6 @@ class StreamRequest extends StreamRequestBuilder { | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
| 		$qb = $this->getStreamSelectSql(); | 		$qb = $this->getStreamSelectSql(); | ||||||
| 		$expr = $qb->expr(); |  | ||||||
| 
 |  | ||||||
| 		$qb->limitToIdPrim($qb->prim($id)); | 		$qb->limitToIdPrim($qb->prim($id)); | ||||||
| 		$qb->linkToCacheActors('ca', 's.attributed_to_prim'); | 		$qb->linkToCacheActors('ca', 's.attributed_to_prim'); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Cyrille Bollu
						Cyrille Bollu