From 17938c8892c68e94525f3c3726472074ec373537 Mon Sep 17 00:00:00 2001 From: Muhammad Faisal Amin <53206866+faisalamin9696@users.noreply.github.com> Date: Thu, 9 May 2024 21:51:03 +0500 Subject: [PATCH] fix: Role edit fixes, link parsing fixes, role title in feed added --- src/app/providers.tsx | 2 +- src/components/EditRoleModal.tsx | 8 ++++++-- src/components/NotificationsModal.tsx | 6 +++--- src/components/YoutubePreview.tsx | 2 +- src/components/body/ParsedBody.tsx | 3 ++- src/components/body/SanitizeConfig.ts | 2 +- src/components/comment/components/CommentHeader.tsx | 2 +- src/components/comment/layouts/CommentGridLayout.tsx | 3 +++ src/libs/utils/Links.ts | 1 - src/libs/utils/user.ts | 5 +++++ 10 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/app/providers.tsx b/src/app/providers.tsx index a7c8cea..6d32ef7 100644 --- a/src/app/providers.tsx +++ b/src/app/providers.tsx @@ -78,7 +78,7 @@ export function Providers(props: Props) { serialize: data => compress(JSON.stringify(data)), deserialize: data => JSON.parse(decompress(data)), }), - maxAge: Infinity, + maxAge: 1000 * 60 * 60 * 24 * 1 // 1 day, }); diff --git a/src/components/EditRoleModal.tsx b/src/components/EditRoleModal.tsx index f592824..f6036c7 100644 --- a/src/components/EditRoleModal.tsx +++ b/src/components/EditRoleModal.tsx @@ -146,6 +146,10 @@ export default function EditRoleModal(props: Props) { } + const handleRoleSelectionChange = (e: React.ChangeEvent) => { + setRole(e.target.value as any); + }; + const isPending = roleMutation.isPending || titleMutation.isPending || roleTitleMutation.isPending; return ( setRole(key as any)} + onChange={handleRoleSelectionChange} classNames={{ base: 'items-center' }} > - {(item) => {item.item}} + {(item) => {item.item}} } diff --git a/src/components/NotificationsModal.tsx b/src/components/NotificationsModal.tsx index f720fb6..ea33b42 100644 --- a/src/components/NotificationsModal.tsx +++ b/src/components/NotificationsModal.tsx @@ -187,8 +187,7 @@ export default function NotificationsModal(props: Props) { if (hasSearchFilter) { filteredNotifications = filteredNotifications.filter((notification) => - notification.account.toLowerCase().includes(filterValue.toLowerCase()) || - notification.author.toLowerCase().includes(filterValue.toLowerCase()), + notification.account.toLowerCase().includes(filterValue.toLowerCase()) ); } if (statusFilter !== "all" && Array.from(statusFilter).length !== typeOptions.length) { @@ -298,7 +297,7 @@ export default function NotificationsModal(props: Props) { />
- + @@ -462,6 +461,7 @@ export default function NotificationsModal(props: Props) { return ( { router.push(getTargetUrl(item)); router.refresh(); diff --git a/src/components/YoutubePreview.tsx b/src/components/YoutubePreview.tsx index 20a66d8..468a976 100644 --- a/src/components/YoutubePreview.tsx +++ b/src/components/YoutubePreview.tsx @@ -14,7 +14,7 @@ function YoutubePreview(props: Props): React.ReactElement { width = 640, height = 360, startTime = 0, - dataParams = 'enablejsapi=0&rel=0&origin=https://steemit.com', + dataParams = 'enablejsapi=0&rel=0&origin=https://steempro.com', } = props; const [play, setPlay] = useState(true); diff --git a/src/components/body/ParsedBody.tsx b/src/components/body/ParsedBody.tsx index 18ba62a..fc1633b 100644 --- a/src/components/body/ParsedBody.tsx +++ b/src/components/body/ParsedBody.tsx @@ -44,6 +44,7 @@ export function ParsedBody({ body, isNsfw }: { body: string, isNsfw?: boolean }) {domToReact(domNode.children)} @@ -58,7 +59,7 @@ export function ParsedBody({ body, isNsfw }: { body: string, isNsfw?: boolean }) ; } - + } diff --git a/src/components/body/SanitizeConfig.ts b/src/components/body/SanitizeConfig.ts index 654b4b1..b3afed0 100644 --- a/src/components/body/SanitizeConfig.ts +++ b/src/components/body/SanitizeConfig.ts @@ -201,7 +201,7 @@ export default ({ href = href.trim(); const attys: any = { href }; // If it's not a (relative or absolute) steemit URL... - if (!href.match(/^(\/(?!\/)|https:\/\/steemit.com)/)) { + if (!href.match(/^(\/(?!\/)|https:\/\/steempro.com)/)) { // attys.target = '_blank' // pending iframe impl https://mathiasbynens.github.io/rel-noopener/ attys.rel = highQualityPost ? 'noopener' : 'nofollow noopener'; attys.title = getExternalLinkWarningMessage(); diff --git a/src/components/comment/components/CommentHeader.tsx b/src/components/comment/components/CommentHeader.tsx index 56d0c82..86a6e50 100644 --- a/src/components/comment/components/CommentHeader.tsx +++ b/src/components/comment/components/CommentHeader.tsx @@ -222,7 +222,7 @@ export default memo(function CommentHeader(props: Props) {
} description={
- {isDetail && } +
diff --git a/src/components/comment/layouts/CommentGridLayout.tsx b/src/components/comment/layouts/CommentGridLayout.tsx index 11ef448..812a367 100644 --- a/src/components/comment/layouts/CommentGridLayout.tsx +++ b/src/components/comment/layouts/CommentGridLayout.tsx @@ -19,6 +19,7 @@ import Link from 'next/link'; import { hasNsfwTag } from '@/libs/utils/StateFunctions'; import NsfwOverlay from '@/components/NsfwOverlay'; import { getSettings } from '@/libs/utils/user'; +import RoleTitleCard from '@/components/RoleTitleCard'; export default function CommentGridLayout(props: CommentProps) { @@ -108,6 +109,8 @@ export default function CommentGridLayout(props: CommentProps) {
} description={
+ +
} diff --git a/src/libs/utils/Links.ts b/src/libs/utils/Links.ts index 56d6e4a..e948a21 100644 --- a/src/libs/utils/Links.ts +++ b/src/libs/utils/Links.ts @@ -67,7 +67,6 @@ export default { export const OLD_DOMAINS_LIST = [ 'busy.org', - 'steemit.com', 'esteem.app', 'steempeak.com', 'partiko.app', diff --git a/src/libs/utils/user.ts b/src/libs/utils/user.ts index 994cd8e..727a87d 100644 --- a/src/libs/utils/user.ts +++ b/src/libs/utils/user.ts @@ -130,7 +130,12 @@ export function saveCredentials(username: string, const existAuth = getUserAuth() as User; if (!existAuth || current || (existAuth?.username === username)) { addToCurrent(username, encryptedKey, keyType); + + if (username !== existAuth.username) { + removeSessionToken(existAuth.username); + } } + addToAccounts(username, encryptedKey, keyType); return { username: username,