Skip to content

Commit d8b4729

Browse files
Add repository name to recent releases (#1274)
* wip * fix type --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
1 parent ad96496 commit d8b4729

File tree

11 files changed

+19
-7
lines changed

11 files changed

+19
-7
lines changed

backend/apps/github/graphql/nodes/release.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class ReleaseNode(BaseNode):
1313

1414
author = graphene.Field(UserNode)
1515
project_name = graphene.String()
16+
repository_name = graphene.String()
1617
url = graphene.String()
1718

1819
class Meta:
@@ -29,6 +30,10 @@ def resolve_project_name(self, info):
2930
"""Return project name."""
3031
return self.repository.project.name.lstrip(OWASP_ORGANIZATION_NAME)
3132

33+
def resolve_repository_name(self, info):
34+
"""Return repository name."""
35+
return self.repository.name
36+
3237
def resolve_url(self, info):
3338
"""Return release URL."""
3439
return self.url

backend/tests/apps/github/graphql/nodes/release_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def test_meta_configuration(self):
2424
"name",
2525
"project_name",
2626
"published_at",
27+
"repository_name",
2728
"tag_name",
2829
"url",
2930
}

frontend/__tests__/e2e/data/mockHomeData.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ export const mockHomeData = {
146146
isPreRelease: true,
147147
name: 'Release 1',
148148
publishedAt: '2025-02-22T10:15:00+00:00',
149-
tagName: 'v1',
149+
repositoryName: 'nest-repository-1',
150150
__typename: 'ReleaseNode',
151151
},
152152
{
153153
author: null,
154154
isPreRelease: false,
155155
name: 'Release 2',
156156
publishedAt: '2025-02-24T10:15:00+00:00',
157-
tagName: 'v3',
157+
repositoryName: 'owasp-repository-2',
158158
__typename: 'ReleaseNode',
159159
},
160160
],

frontend/__tests__/e2e/pages/Home.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test.describe('Home Page', () => {
6464
await expect(page.getByRole('heading', { name: 'Recent Releases' })).toBeVisible()
6565
await expect(page.getByRole('heading', { name: 'Release 1' })).toBeVisible()
6666
await expect(page.getByText('Feb 22,')).toBeVisible()
67-
await expect(page.getByText('v1', { exact: true })).toBeVisible()
67+
await expect(page.getByText('nest-repository-1', { exact: true })).toBeVisible()
6868
})
6969

7070
test('should be able to join OWASP', async ({ page }) => {

frontend/src/api/queries/homeQueries.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const GET_MAIN_PAGE_DATA = gql`
6161
}
6262
name
6363
publishedAt
64+
repositoryName
6465
tagName
6566
url
6667
}

frontend/src/api/queries/projectQueries.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const GET_PROJECT_DATA = gql`
3232
}
3333
name
3434
publishedAt
35+
repositoryName
3536
tagName
3637
url
3738
}

frontend/src/api/queries/repositoryQueries.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const GET_REPOSITORY_DATA = gql`
3232
isPreRelease
3333
name
3434
publishedAt
35+
repositoryName
3536
tagName
3637
}
3738
size

frontend/src/api/queries/userQueries.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const GET_USER_DATA = gql`
1717
isPreRelease
1818
name
1919
publishedAt
20+
repositoryName
2021
tagName
2122
url
2223
}

frontend/src/components/RecentReleases.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { faCalendar, faTag } from '@fortawesome/free-solid-svg-icons'
1+
import { faCalendar, faFileCode } from '@fortawesome/free-solid-svg-icons'
22
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
33
import React from 'react'
44
import { ProjectReleaseType } from 'types/project'
@@ -17,7 +17,7 @@ const RecentReleases: React.FC<RecentReleasesProps> = ({
1717
showSingleColumn = false,
1818
}) => {
1919
return (
20-
<SecondaryCard icon={faTag} title="Recent Releases">
20+
<SecondaryCard icon={faFileCode} title="Recent Releases">
2121
{data && data.length > 0 ? (
2222
<div
2323
className={`grid ${showSingleColumn ? 'grid-cols-1' : 'grid gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3'}`}
@@ -53,8 +53,8 @@ const RecentReleases: React.FC<RecentReleasesProps> = ({
5353
<div className="mt-2 flex items-center text-sm text-gray-600 dark:text-gray-400">
5454
<FontAwesomeIcon icon={faCalendar} className="mr-2 h-4 w-4" />
5555
<span>{formatDate(item.publishedAt)}</span>
56-
<FontAwesomeIcon icon={faTag} className="ml-4 mr-2 h-4 w-4" />
57-
<span>{item.tagName}</span>
56+
<FontAwesomeIcon icon={faFileCode} className="ml-4 mr-2 h-4 w-4" />
57+
<span>{item.repositoryName}</span>
5858
</div>
5959
</div>
6060
</div>

frontend/src/pages/UserDetails.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ const UserDetailsPage: React.FC = () => {
149149
key: user?.login || '',
150150
name: user?.name || user?.login || '',
151151
},
152+
repositoryName: release.repositoryName,
152153
url: release.url,
153154
})) || []
154155
)

0 commit comments

Comments
 (0)