|
26 | 26 | namespace OCA\Gitlab\Search;
|
27 | 27 |
|
28 | 28 | use OCA\Gitlab\AppInfo\Application;
|
| 29 | +use OCA\Gitlab\Db\GitlabAccount; |
29 | 30 | use OCA\Gitlab\Db\GitlabAccountMapper;
|
30 | 31 | use OCA\Gitlab\Service\ConfigService;
|
31 | 32 | use OCA\Gitlab\Service\GitlabAPIService;
|
@@ -111,8 +112,8 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
|
111 | 112 | continue;
|
112 | 113 | }
|
113 | 114 |
|
114 |
| - $formattedResults[] = array_map(function (array $entry): SearchResultEntry { |
115 |
| - $finalThumbnailUrl = $this->getThumbnailUrl($entry); |
| 115 | + $formattedResults[] = array_map(function (array $entry) use ($account): SearchResultEntry { |
| 116 | + $finalThumbnailUrl = $this->getThumbnailUrl($account, $entry); |
116 | 117 | return new SearchResultEntry(
|
117 | 118 | $finalThumbnailUrl,
|
118 | 119 | $this->getMainText($entry),
|
@@ -159,11 +160,11 @@ protected function getLinkToGitlab(array $entry): string {
|
159 | 160 | * @param array $entry
|
160 | 161 | * @return string
|
161 | 162 | */
|
162 |
| - protected function getThumbnailUrl(array $entry): string { |
| 163 | + protected function getThumbnailUrl(GitlabAccount $account, array $entry): string { |
163 | 164 | $projectId = $entry['id'] ?? '';
|
164 | 165 | $avatarUrl = $entry['avatar_url'] ?? '';
|
165 | 166 | return $avatarUrl
|
166 |
| - ? $this->urlGenerator->linkToRoute('integration_gitlab.gitlabAPI.getProjectAvatar', []) . '?projectId=' . urlencode(strval($projectId)) |
| 167 | + ? $this->urlGenerator->linkToRoute('integration_gitlab.gitlabAPI.getProjectAvatar', ['accountId' => $account->getId(), 'projectId' => (string)$projectId]) |
167 | 168 | : '';
|
168 | 169 | }
|
169 | 170 | }
|
0 commit comments