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

View File

@ -17,7 +17,6 @@ interface postsListContainerProps extends FlatListProps<any> {
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}
/>,
);

View File

@ -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}
/>
)

View File

@ -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;
}

View File

@ -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}
/>
<ScrollTopPopup

View File

@ -13,7 +13,6 @@ import ROUTES from '../../../constants/routeNames';
const CommunityContainer = ({ children, navigation, currentAccount, pinCode, isLoggedIn }) => {
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,
})
);
};

View File

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