Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👁️ fix: email read only in UserInfoModal #218

Merged
merged 1 commit into from
Jul 2, 2023

Conversation

bxbdev
Copy link
Contributor

@bxbdev bxbdev commented Jun 29, 2023

Why need this change? / Root cause:

  • Not allowed user to change email

Changes made:

  • Removed able to change email

Test Scope / Change impact:

Issue

@github-actions github-actions bot added the bug Fix something in main label Jun 29, 2023
@bxbdev bxbdev self-assigned this Jun 29, 2023
@bxbdev bxbdev changed the title fix: email read only in UserInfoModal 👁️ fix: email read only in UserInfoModal Jun 29, 2023
Copy link
Contributor

@JohnsonMao JohnsonMao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  const handleEmailChange = (value: string) => {
    if (!userInfo) return;
    setUserInfo((prev) => ({ ...prev!, email: value }));
    const regex = /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+$/; // Regex pattern for email
    if (value.length === 0) {
      setErrorMsg((prep) => ({ ...prep, email: "Email 欄位不可空白" }));
    } else if (!regex.test(value)) {
      setErrorMsg((prep) => ({ ...prep, email: "Email 格式錯誤" }));
    } else {
      setErrorMsg((prep) => ({ ...prep, email: "" }));
    }
  };

第 78 行,因為 email 改成只讀,handleEmailChange 這個 function 沒使用到可以先移除

@bxbdev bxbdev force-pushed the fix/email-readonly branch from 9061ddf to c69b0d3 Compare July 1, 2023 12:56
@bxbdev
Copy link
Contributor Author

bxbdev commented Jul 1, 2023

  const handleEmailChange = (value: string) => {
    if (!userInfo) return;
    setUserInfo((prev) => ({ ...prev!, email: value }));
    const regex = /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+$/; // Regex pattern for email
    if (value.length === 0) {
      setErrorMsg((prep) => ({ ...prep, email: "Email 欄位不可空白" }));
    } else if (!regex.test(value)) {
      setErrorMsg((prep) => ({ ...prep, email: "Email 格式錯誤" }));
    } else {
      setErrorMsg((prep) => ({ ...prep, email: "" }));
    }
  };

第 78 行,因為 email 改成只讀,handleEmailChange 這個 function 沒使用到可以先移除

@JohnsonMao
已修正,連同error裡面需要email的部份也都移除了。

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@GaaSBot
Copy link

GaaSBot commented Jul 2, 2023

Knip Scan Result for a206985

Unused files (8)
Unused files (8)
.bundlewatch.config.js
components/shared/Modal/index.tsx
components/shared/Modalow/Example.tsx
components/shared/Toast/CtxToastQueue.tsx
lighthouserc.js
mocks/rooms.ts
scripts/knipScanReporter.js
scripts/lhciScanReporter.js
Unused dependencies (3)
Unused dependencies (3)
@svgr/webpack package.json
sharp package.json
swr package.json
Unused devDependencies (4)
Unused devDependencies (4)
@actions/github package.json
@octokit/core package.json
@storybook/blocks package.json
@storybook/testing-library package.json
Unused exports (3)
Unused exports (3)
RoomsListTitle components/rooms/RoomsList.tsx
setFlags components/shared/Modal/ModalManager/src/ModalManagerBase.tsx
createNicknameEndpoint requests/users/index.ts
Unused exports in namespaces (7)
Unused exports in namespaces (7)
dotSizeVariants components/shared/Badge/Badge.tsx
textSizeVariants components/shared/Badge/Badge.tsx
INITIAL_TOAST_POSITION components/shared/Toast/ToastQueueContext.tsx
MAX_TOAST_MOUNT_SIZE components/shared/Toast/ToastQueueContext.tsx
MAX_TOAST_QUEUE_SIZE components/shared/Toast/ToastQueueContext.tsx
TOAST_QUEUE_STATE components/shared/Toast/ToastQueueContext.tsx
ToastQueueContext components/shared/Toast/ToastQueueContext.tsx
Unused exported types (22)
Unused exported types (22)
GameListProp interface components/lobby/CreateRoomModal/GameListModal/GameList/index.tsx
GroupedGamesType type components/lobby/CreateRoomModal/GameListModal/GameList/index.tsx
RoomBreadcrumbType type components/rooms/RoomBreadcrumb.tsx
RoomButtonGroupProps type components/rooms/RoomButtonGroup.tsx
RoomChatroom type components/rooms/RoomChatroom/RoomChatroom.tsx
RoomUserCardListProps type components/rooms/RoomUserCardList/RoomUserCardList.tsx
DisabledUserCardProp interface components/rooms/RoomUserCardList/UserCard/UserCard.tsx
WatingUserCardProp interface components/rooms/RoomUserCardList/UserCard/UserCard.tsx
CarouselArrowButtonProps interface components/shared/Carousel/CarouselArrowButton.tsx
CarouselItemProps interface components/shared/Carousel/CarouselItem.tsx
CoverProps interface components/shared/Cover/index.tsx
IconProps type components/shared/Icon/Icon.tsx
BodyProps interface components/shared/Modalow/Body.tsx
FooterProps interface components/shared/Modalow/Footer.tsx
HeaderProps interface components/shared/Modalow/Header.tsx
MaskProps interface components/shared/Modalow/Mask.tsx
SOCKET_EVENT enum hooks/useChatroom.ts
WS_ReadyState enum hooks/useChatroom.ts
CookieKey enum hooks/useCookie.ts
Game type requests/rooms/index.ts
PageMeta type requests/rooms/index.ts
RoomEntry type requests/rooms/index.ts
Unused exported types in namespaces (33)
Unused exported types in namespaces (33)
AvatarButtonProps interface components/shared/Avatar/Avatar.tsx
AvatarImageProps interface components/shared/Avatar/Avatar.tsx
AvatarLinkProps interface components/shared/Avatar/Avatar.tsx
AvatarProps type components/shared/Avatar/Avatar.tsx
AvatarShape type components/shared/Avatar/Avatar.tsx
AvatarSizeType type components/shared/Avatar/Avatar.tsx
AvatarType type components/shared/Avatar/Avatar.tsx
BaseAvatarProps interface components/shared/Avatar/Avatar.tsx
BadgePositionVariant enum components/shared/Badge/Badge.tsx
BadgeProps interface components/shared/Badge/Badge.tsx
BadgeSizeVariant enum components/shared/Badge/Badge.tsx
BaseButtonProps interface components/shared/Button/Button.tsx
ButtonProps type components/shared/Button/Button.tsx
CarouselProps interface components/shared/Carousel/Carousel.tsx
InputProps interface components/shared/Input/Input.tsx
ModalSizeVariant enum components/shared/Modalow/Modalow.tsx
PortalProps interface components/shared/Portal/Portal.tsx
SearchBarProps interface components/shared/SearchBar/SearchBar.tsx
SubmitHandler type components/shared/SearchBar/SearchBar.tsx
TabProps interface components/shared/Tabs/Tab.tsx
TabSizeType type components/shared/Tabs/Tabs.tsx
TagProps interface components/shared/Tag/Tag.tsx
ToastPropLength type components/shared/Toast/Toast.tsx
ToastPropRounded type components/shared/Toast/Toast.tsx
ToastPropSize type components/shared/Toast/Toast.tsx
ToastPropState type components/shared/Toast/Toast.tsx
CtxToastQueueProviderProps interface components/shared/Toast/ToastQueueContext.tsx
CtxToastQueueValue interface components/shared/Toast/ToastQueueContext.tsx
ToastQueueMap type components/shared/Toast/ToastQueueContext.tsx
ToastQueueMapValue type components/shared/Toast/ToastQueueContext.tsx
ToastQueueState type components/shared/Toast/ToastQueueContext.tsx
ToastQueueValue type components/shared/Toast/ToastQueueContext.tsx
UseToast interface components/shared/Toast/useToast.tsx
Duplicate exports (10)
Duplicate exports (10)
RoomChatroom, default components/rooms/RoomChatroom/RoomChatroom.tsx
Badge, default components/shared/Badge/Badge.tsx
Button, default components/shared/Button/Button.tsx
Input, default components/shared/Input/Input.tsx
Body, default components/shared/Modalow/Body.tsx
Footer, default components/shared/Modalow/Footer.tsx
Header, default components/shared/Modalow/Header.tsx
Mask, default components/shared/Modalow/Mask.tsx
Modalow, default components/shared/Modalow/Modalow.tsx
SearchBar, default components/shared/SearchBar/SearchBar.tsx
Configuration issues (1)
Configuration issues (1)
Unused item in ignoreDependencies: @next/bundle-analyzer

@GaaSBot
Copy link

GaaSBot commented Jul 2, 2023

🤖 Lighthouse Scan Result for a206985

/rooms
Metric Value
Performance 66
Seo 80
Accessibility 78
HTML Report for LHCI Scan Report Link
/rooms/abc
Metric Value
Performance 76
Seo 80
Accessibility 67
HTML Report for LHCI Scan Report Link
/login
Metric Value
Performance 52
Seo 80
Accessibility 94
HTML Report for LHCI Scan Report Link

@Parkerhiphop Parkerhiphop merged commit 4247f5b into main Jul 2, 2023
@Parkerhiphop Parkerhiphop deleted the fix/email-readonly branch July 2, 2023 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fix something in main sprint 5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix: 個人資料 email Readonly
4 participants