From dfbe19595f62cc3d8ac33fe5090c04aa9e5c03ed Mon Sep 17 00:00:00 2001 From: noumantahir Date: Wed, 13 Apr 2022 05:53:59 +0500 Subject: [PATCH] removed implementation of old userCommunityRole prop --- src/components/postCard/view/postCardView.js | 8 +------- .../postsList/container/postsListContainer.tsx | 3 --- .../tabbedPosts/container/tabbedPosts.tsx | 2 -- .../tabbedPosts/services/tabbedPostsModels.ts | 2 -- src/components/tabbedPosts/view/tabContent.tsx | 2 -- .../community/container/communityContainer.js | 16 ---------------- src/screens/community/screen/communityScreen.js | 2 -- 7 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/components/postCard/view/postCardView.js b/src/components/postCard/view/postCardView.js index 90a139d18..379b69fc1 100644 --- a/src/components/postCard/view/postCardView.js +++ b/src/components/postCard/view/postCardView.js @@ -44,7 +44,6 @@ const PostCardView = ({ setImageHeight, isMuted, pageType, - userCommunityRole, }) => { //local state to manage fake upvote if available const activeVotesCount = activeVotes ? activeVotes.length : 0; @@ -122,12 +121,7 @@ const PostCardView = ({ )} - + diff --git a/src/components/postsList/container/postsListContainer.tsx b/src/components/postsList/container/postsListContainer.tsx index 2066e79f7..bac83b254 100644 --- a/src/components/postsList/container/postsListContainer.tsx +++ b/src/components/postsList/container/postsListContainer.tsx @@ -17,7 +17,6 @@ interface postsListContainerProps extends FlatListProps { isLoading:boolean; isRefreshing:boolean; pageType:'main'|'profile'|'ownProfile'|'community'; - userCommunityRole?:string; showQuickReplyModal:(post:any)=>void; } @@ -30,7 +29,6 @@ const postsListContainer = ({ isRefreshing, isLoading, pageType, - userCommunityRole, showQuickReplyModal, ...props }:postsListContainerProps, ref) => { @@ -147,7 +145,6 @@ const postsListContainer = ({ imageHeight={imgHeight} setImageHeight = {_setImageHeightInMap} pageType={pageType} - userCommunityRole={userCommunityRole} showQuickReplyModal={showQuickReplyModal} />, ); diff --git a/src/components/tabbedPosts/container/tabbedPosts.tsx b/src/components/tabbedPosts/container/tabbedPosts.tsx index ed360b0d8..d7e311053 100644 --- a/src/components/tabbedPosts/container/tabbedPosts.tsx +++ b/src/components/tabbedPosts/container/tabbedPosts.tsx @@ -17,7 +17,6 @@ export const TabbedPosts = ({ tabContentOverrides, imagesToggleEnabled, stackedTabs, - userCommunityRole, onTabChange, ...props }:TabbedPostsProps) => { @@ -74,7 +73,6 @@ export const TabbedPosts = ({ pageType={pageType} filterScrollRequest={filterScrollRequest} onScrollRequestProcessed={_onScrollRequestProcessed} - userCommunityRole={userCommunityRole} {...props} /> ) diff --git a/src/components/tabbedPosts/services/tabbedPostsModels.ts b/src/components/tabbedPosts/services/tabbedPostsModels.ts index 0bbbd2fc0..7b4b325bc 100644 --- a/src/components/tabbedPosts/services/tabbedPostsModels.ts +++ b/src/components/tabbedPosts/services/tabbedPostsModels.ts @@ -15,7 +15,6 @@ export interface TabbedPostsProps { imagesToggleEnabled?:boolean, stackedTabs:boolean, pinnedPermlink?:string, - userCommunityRole?:string, onTabChange:(index:number)=>void handleOnScroll:()=>void, } @@ -60,7 +59,6 @@ export interface TabMeta { forceLoadPosts:boolean, filterScrollRequest:string, pinnedPermlink?:string, - userCommunityRole?:string, onScrollRequestProcessed:()=>void handleOnScroll:()=>void; } \ No newline at end of file diff --git a/src/components/tabbedPosts/view/tabContent.tsx b/src/components/tabbedPosts/view/tabContent.tsx index f504549c0..334d14aaa 100644 --- a/src/components/tabbedPosts/view/tabContent.tsx +++ b/src/components/tabbedPosts/view/tabContent.tsx @@ -33,7 +33,6 @@ const TabContent = ({ feedUsername, tag, pinnedPermlink, - userCommunityRole, onScrollRequestProcessed, handleOnScroll, ...props @@ -362,7 +361,6 @@ const TabContent = ({ isLoading={tabMeta.isLoading} ListEmptyComponent={_renderEmptyContent} pageType={pageType} - userCommunityRole={userCommunityRole} showQuickReplyModal={_showQuickReplyModal} /> { const [data, setData] = useState(null); const [isSubscribed, setIsSubscribed] = useState(false); - const [userRole, setUserRole] = useState('guest'); const tag = get(navigation, 'state.params.tag'); const dispatch = useDispatch(); const intl = useIntl(); @@ -31,25 +30,11 @@ const CommunityContainer = ({ children, navigation, currentAccount, pinCode, isL useEffect(() => { if (data) { //check and set user role - let _hasTeamRole = false; - if (data.team && currentAccount) { - const member = data.team.find((m) => m[0] === currentAccount.username); - const role = member ? member[1] : userRole; - _hasTeamRole = !!member; - setUserRole(role); - } - getSubscriptions(currentAccount.username) .then((result) => { if (result) { const _isSubscribed = result.some((item) => item[0] === data.name); setIsSubscribed(_isSubscribed); - - if (_isSubscribed && !_hasTeamRole) { - //if userRole default value is not overwritten, - //means user is not a part of community core team, so setting as member - setUserRole('member'); - } } }) .catch((e) => { @@ -112,7 +97,6 @@ const CommunityContainer = ({ children, navigation, currentAccount, pinCode, isL handleNewPostButtonPress: _handleNewPostButtonPress, isSubscribed, isLoggedIn, - userRole, }) ); }; diff --git a/src/screens/community/screen/communityScreen.js b/src/screens/community/screen/communityScreen.js index 184d5fb55..a9b8a7f14 100644 --- a/src/screens/community/screen/communityScreen.js +++ b/src/screens/community/screen/communityScreen.js @@ -43,7 +43,6 @@ const CommunityScreen = ({ navigation }) => { handleNewPostButtonPress, isSubscribed, isLoggedIn, - userRole, }) => ( { selectedOptionIndex={_getSelectedIndex()} tag={tag} pageType="community" - userCommunityRole={userRole} />