removed implementation of old userCommunityRole prop

This commit is contained in:
noumantahir 2022-04-13 05:53:59 +05:00
parent b14cc05784
commit dfbe19595f
7 changed files with 1 additions and 34 deletions

View File

@ -44,7 +44,6 @@ const PostCardView = ({
setImageHeight, setImageHeight,
isMuted, isMuted,
pageType, pageType,
userCommunityRole,
}) => { }) => {
//local state to manage fake upvote if available //local state to manage fake upvote if available
const activeVotesCount = activeVotes ? activeVotes.length : 0; const activeVotesCount = activeVotes ? activeVotes.length : 0;
@ -122,12 +121,7 @@ const PostCardView = ({
<Icon style={styles.pushPinIcon} size={20} name="pin" iconType="MaterialCommunityIcons" /> <Icon style={styles.pushPinIcon} size={20} name="pin" iconType="MaterialCommunityIcons" />
)} )}
<View style={styles.dropdownWrapper}> <View style={styles.dropdownWrapper}>
<PostDropdown <PostDropdown pageType={pageType} content={content} fetchPost={fetchPost} />
pageType={pageType}
userCommunityRole={userCommunityRole}
content={content}
fetchPost={fetchPost}
/>
</View> </View>
</View> </View>
<View style={styles.postBodyWrapper}> <View style={styles.postBodyWrapper}>

View File

@ -17,7 +17,6 @@ interface postsListContainerProps extends FlatListProps<any> {
isLoading:boolean; isLoading:boolean;
isRefreshing:boolean; isRefreshing:boolean;
pageType:'main'|'profile'|'ownProfile'|'community'; pageType:'main'|'profile'|'ownProfile'|'community';
userCommunityRole?:string;
showQuickReplyModal:(post:any)=>void; showQuickReplyModal:(post:any)=>void;
} }
@ -30,7 +29,6 @@ const postsListContainer = ({
isRefreshing, isRefreshing,
isLoading, isLoading,
pageType, pageType,
userCommunityRole,
showQuickReplyModal, showQuickReplyModal,
...props ...props
}:postsListContainerProps, ref) => { }:postsListContainerProps, ref) => {
@ -147,7 +145,6 @@ const postsListContainer = ({
imageHeight={imgHeight} imageHeight={imgHeight}
setImageHeight = {_setImageHeightInMap} setImageHeight = {_setImageHeightInMap}
pageType={pageType} pageType={pageType}
userCommunityRole={userCommunityRole}
showQuickReplyModal={showQuickReplyModal} showQuickReplyModal={showQuickReplyModal}
/>, />,
); );

View File

@ -17,7 +17,6 @@ export const TabbedPosts = ({
tabContentOverrides, tabContentOverrides,
imagesToggleEnabled, imagesToggleEnabled,
stackedTabs, stackedTabs,
userCommunityRole,
onTabChange, onTabChange,
...props ...props
}:TabbedPostsProps) => { }:TabbedPostsProps) => {
@ -74,7 +73,6 @@ export const TabbedPosts = ({
pageType={pageType} pageType={pageType}
filterScrollRequest={filterScrollRequest} filterScrollRequest={filterScrollRequest}
onScrollRequestProcessed={_onScrollRequestProcessed} onScrollRequestProcessed={_onScrollRequestProcessed}
userCommunityRole={userCommunityRole}
{...props} {...props}
/> />
) )

View File

@ -15,7 +15,6 @@ export interface TabbedPostsProps {
imagesToggleEnabled?:boolean, imagesToggleEnabled?:boolean,
stackedTabs:boolean, stackedTabs:boolean,
pinnedPermlink?:string, pinnedPermlink?:string,
userCommunityRole?:string,
onTabChange:(index:number)=>void onTabChange:(index:number)=>void
handleOnScroll:()=>void, handleOnScroll:()=>void,
} }
@ -60,7 +59,6 @@ export interface TabMeta {
forceLoadPosts:boolean, forceLoadPosts:boolean,
filterScrollRequest:string, filterScrollRequest:string,
pinnedPermlink?:string, pinnedPermlink?:string,
userCommunityRole?:string,
onScrollRequestProcessed:()=>void onScrollRequestProcessed:()=>void
handleOnScroll:()=>void; handleOnScroll:()=>void;
} }

View File

@ -33,7 +33,6 @@ const TabContent = ({
feedUsername, feedUsername,
tag, tag,
pinnedPermlink, pinnedPermlink,
userCommunityRole,
onScrollRequestProcessed, onScrollRequestProcessed,
handleOnScroll, handleOnScroll,
...props ...props
@ -362,7 +361,6 @@ const TabContent = ({
isLoading={tabMeta.isLoading} isLoading={tabMeta.isLoading}
ListEmptyComponent={_renderEmptyContent} ListEmptyComponent={_renderEmptyContent}
pageType={pageType} pageType={pageType}
userCommunityRole={userCommunityRole}
showQuickReplyModal={_showQuickReplyModal} showQuickReplyModal={_showQuickReplyModal}
/> />
<ScrollTopPopup <ScrollTopPopup

View File

@ -13,7 +13,6 @@ import ROUTES from '../../../constants/routeNames';
const CommunityContainer = ({ children, navigation, currentAccount, pinCode, isLoggedIn }) => { const CommunityContainer = ({ children, navigation, currentAccount, pinCode, isLoggedIn }) => {
const [data, setData] = useState(null); const [data, setData] = useState(null);
const [isSubscribed, setIsSubscribed] = useState(false); const [isSubscribed, setIsSubscribed] = useState(false);
const [userRole, setUserRole] = useState('guest');
const tag = get(navigation, 'state.params.tag'); const tag = get(navigation, 'state.params.tag');
const dispatch = useDispatch(); const dispatch = useDispatch();
const intl = useIntl(); const intl = useIntl();
@ -31,25 +30,11 @@ const CommunityContainer = ({ children, navigation, currentAccount, pinCode, isL
useEffect(() => { useEffect(() => {
if (data) { if (data) {
//check and set user role //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) getSubscriptions(currentAccount.username)
.then((result) => { .then((result) => {
if (result) { if (result) {
const _isSubscribed = result.some((item) => item[0] === data.name); const _isSubscribed = result.some((item) => item[0] === data.name);
setIsSubscribed(_isSubscribed); 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) => { .catch((e) => {
@ -112,7 +97,6 @@ const CommunityContainer = ({ children, navigation, currentAccount, pinCode, isL
handleNewPostButtonPress: _handleNewPostButtonPress, handleNewPostButtonPress: _handleNewPostButtonPress,
isSubscribed, isSubscribed,
isLoggedIn, isLoggedIn,
userRole,
}) })
); );
}; };

View File

@ -43,7 +43,6 @@ const CommunityScreen = ({ navigation }) => {
handleNewPostButtonPress, handleNewPostButtonPress,
isSubscribed, isSubscribed,
isLoggedIn, isLoggedIn,
userRole,
}) => ( }) => (
<View style={styles.container}> <View style={styles.container}>
<BasicHeader <BasicHeader
@ -117,7 +116,6 @@ const CommunityScreen = ({ navigation }) => {
selectedOptionIndex={_getSelectedIndex()} selectedOptionIndex={_getSelectedIndex()}
tag={tag} tag={tag}
pageType="community" pageType="community"
userCommunityRole={userRole}
/> />
</View> </View>
</View> </View>