Skip to content

Commit 6d57078

Browse files
committed
fix: issues identified by sonar
Signed-off-by: Adam Setch <[email protected]>
1 parent 6857222 commit 6d57078

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

src/renderer/components/avatars/AvatarWithFallback.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const AvatarWithFallback: React.FC<IAvatarWithFallback> = ({
2626
const [isBroken, setIsBroken] = useState(false);
2727

2828
const isNonHuman = isNonHumanUser(userType);
29+
const DefaultUserIcon = isNonHuman ? MarkGithubIcon : FeedPersonIcon;
2930

3031
// TODO explore using AnchoredOverlay component (https://primer.style/components/anchored-overlay/react/alpha) to render Avatar Card on hover
3132
return (
@@ -36,11 +37,7 @@ export const AvatarWithFallback: React.FC<IAvatarWithFallback> = ({
3637
data-testid="avatar"
3738
>
3839
{!src || isBroken ? (
39-
isNonHuman ? (
40-
<MarkGithubIcon size={size} />
41-
) : (
42-
<FeedPersonIcon size={size} />
43-
)
40+
<DefaultUserIcon size={size} />
4441
) : (
4542
<Avatar
4643
src={src}

src/renderer/components/notifications/NotificationRow.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ export const NotificationRow: FC<INotificationRow> = ({
8585
? `#${notification.subject.number}`
8686
: '';
8787

88-
const notificationTitle =
89-
`${notification.subject.title} ${notificationNumber && `[${notificationNumber}]`}`.trim();
88+
const notificationTitle = notificationNumber
89+
? `${notification.subject.title} [${notificationNumber}]`
90+
: notification.subject.title;
9091

9192
const groupByDate = settings.groupBy === GroupBy.DATE;
9293

src/renderer/typesGitHub.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export type PullRequestReviewAuthorAssociation =
9494
| 'NONE'
9595
| 'OWNER';
9696

97-
// TODO: Add explicit types for GitHub API response vs Gitify Notifications object
97+
// TODO: #828 Add explicit types for GitHub API response vs Gitify Notifications object
9898
export type Notification = GitHubNotification & GitifyNotification;
9999

100100
export interface GitHubNotification {

src/renderer/utils/auth/utils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,7 @@ export function getNewOAuthAppURL(hostname: Hostname): Link {
259259
}
260260

261261
export function isValidHostname(hostname: Hostname) {
262-
return /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/i.test(
263-
hostname,
264-
);
262+
return /^([A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}$/i.test(hostname);
265263
}
266264

267265
export function isValidClientId(clientId: ClientID) {

src/renderer/utils/constants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { Link } from '../types';
2-
import type { ClientID, ClientSecret, Hostname } from '../types';
1+
import type { ClientID, ClientSecret, Hostname, Link } from '../types';
32

43
export const Constants = {
54
REPO_SLUG: 'gitify-app/gitify',

0 commit comments

Comments
 (0)