From 132135a1754b8c4285ca27476e4bd94e303ee485 Mon Sep 17 00:00:00 2001 From: Tirath Date: Fri, 19 Nov 2021 14:08:39 +0530 Subject: [PATCH 1/2] bug fix --- package.json | 5 ++- .../CometChatOutgoingDirectCall/index.js | 2 +- .../CometChatMessageActions/actions.js | 31 +++++++++++++------ .../composerActions.js | 1 - .../Messages/CometChatMessageThread/index.js | 8 +++-- .../Messages/CometChatMessages/index.js | 1 + .../index.js | 2 +- .../Shared/CometChatSharedMedia/index.js | 1 + .../Users/CometChatUserDetails/index.js | 1 - src/utils/UIKitSettings.js | 2 +- 10 files changed, 34 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 5714425..7c8d502 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cometchat-pro-react-native-ui-kit", - "version": "2.4.0-2", + "version": "2.4.0-3", "description": "Chat UI Kit for React Native App", "main": "./src/index.js", "scripts": { @@ -8,8 +8,7 @@ "lint": "eslint 'src/**/*.{js,jsx}' --quiet --fix" }, "repository": { - "type": "git", - "url": "git@git.geekyants.com:cometchat/react-native.git" + "type": "git" }, "peerDependencies": { "react-native-keep-awake": "^4.0.0", diff --git a/src/components/Calls/CometChatOutgoingDirectCall/index.js b/src/components/Calls/CometChatOutgoingDirectCall/index.js index 1921cd5..9f662b5 100644 --- a/src/components/Calls/CometChatOutgoingDirectCall/index.js +++ b/src/components/Calls/CometChatOutgoingDirectCall/index.js @@ -91,7 +91,7 @@ class CometChatOutgoingDirectCall extends React.Component { this.props.close(); }, onError: (error) => { - this.props.actionGenerated(actions.CALL_ERROR, error); + props.actionGenerated(actions.CALL_ERROR, error); console.log('Call Error: ', error); }, diff --git a/src/components/Messages/CometChatMessageActions/actions.js b/src/components/Messages/CometChatMessageActions/actions.js index 0f59a56..bc27059 100644 --- a/src/components/Messages/CometChatMessageActions/actions.js +++ b/src/components/Messages/CometChatMessageActions/actions.js @@ -24,11 +24,16 @@ export default (props) => { }, []); const checkRestrictions = async () => { - let enableEditMessage = await context.FeatureRestriction.isEditMessageEnabled(); - let enableThreadedChats = await context.FeatureRestriction.isThreadedMessagesEnabled(); - let enableDeleteMessage = await context.FeatureRestriction.isDeleteMessageEnabled(); - let enableDeleteMessageForModerator = await context.FeatureRestriction.isDeleteMemberMessageEnabled(); - let enableMessageInPrivate = await context.FeatureRestriction.isMessageInPrivateEnabled(); + let enableEditMessage = + await context.FeatureRestriction.isEditMessageEnabled(); + let enableThreadedChats = + await context.FeatureRestriction.isThreadedMessagesEnabled(); + let enableDeleteMessage = + await context.FeatureRestriction.isDeleteMessageEnabled(); + let enableDeleteMessageForModerator = + await context.FeatureRestriction.isDeleteMemberMessageEnabled(); + let enableMessageInPrivate = + await context.FeatureRestriction.isMessageInPrivateEnabled(); if ( !enableEditMessage && @@ -100,10 +105,18 @@ export default (props) => { if ( props.message.messageFrom === enums.MESSAGE_FROM_RECEIVER && - (props.item.scope == CometChat.GROUP_MEMBER_SCOPE.MODERATOR || - props.item.scope == CometChat.GROUP_MEMBER_SCOPE.ADMIN - ? !restrictions?.enableDeleteMessageForModerator - : !restrictions?.enableDeleteMessage) + (props.type == CometChat.RECEIVER_TYPE.GROUP + ? props.item.scope == CometChat.GROUP_MEMBER_SCOPE.MODERATOR || + props.item.scope == CometChat.GROUP_MEMBER_SCOPE.ADMIN + ? !restrictions?.enableDeleteMessageForModerator + : true + : true) + ) { + deleteMessage = null; + } + if ( + props.type == CometChat.RECEIVER_TYPE.USER && + !restrictions?.enableDeleteMessage ) { deleteMessage = null; } diff --git a/src/components/Messages/CometChatMessageComposer/composerActions.js b/src/components/Messages/CometChatMessageComposer/composerActions.js index 9707fc7..aa7303d 100644 --- a/src/components/Messages/CometChatMessageComposer/composerActions.js +++ b/src/components/Messages/CometChatMessageComposer/composerActions.js @@ -129,7 +129,6 @@ export default class ComposerActions extends Component { ? response.uri : response.uri.replace('file://', ''), }; - console.log('file', file); this.props.sendMediaMessage( file, mediaType === 'photo' diff --git a/src/components/Messages/CometChatMessageThread/index.js b/src/components/Messages/CometChatMessageThread/index.js index d53cc8c..571eb39 100644 --- a/src/components/Messages/CometChatMessageThread/index.js +++ b/src/components/Messages/CometChatMessageThread/index.js @@ -71,7 +71,8 @@ class CometChatMessageThread extends React.PureComponent { } checkIsHideDeletedEnabled = async () => { - let hideDeletedEnabled = this.context.FeatureRestriction.isHideDeletedMessagesEnabled(); + let hideDeletedEnabled = + this.context.FeatureRestriction.isHideDeletedMessagesEnabled(); this.setState({ hideDeletedEnabled }); }; @@ -646,6 +647,7 @@ class CometChatMessageThread extends React.PureComponent { return ( {separator} diff --git a/src/components/Messages/CometChatMessages/index.js b/src/components/Messages/CometChatMessages/index.js index 3e92033..eb4a34a 100644 --- a/src/components/Messages/CometChatMessages/index.js +++ b/src/components/Messages/CometChatMessages/index.js @@ -1020,6 +1020,7 @@ class CometChatMessages extends React.PureComponent { ? this.state.user : this.state.item } + type={params.type} loggedInUser={this.loggedInUser} open={!!this.state.messageToReact} message={this.state.messageToReact} diff --git a/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js b/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js index b5e3e3c..d3553d1 100644 --- a/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js +++ b/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js @@ -13,7 +13,7 @@ import * as actions from '../../../../utils/actions'; const CometChatSenderStickerMessageBubble = (props) => { const message = { ...props.message, - messageFrom: enums.MESSAGE_FROM_RECEIVER, + messageFrom: enums.MESSAGE_FROM_SENDER, }; let stickerData = null; let stickerImg = null; diff --git a/src/components/Shared/CometChatSharedMedia/index.js b/src/components/Shared/CometChatSharedMedia/index.js index 16b3cf9..4279c22 100644 --- a/src/components/Shared/CometChatSharedMedia/index.js +++ b/src/components/Shared/CometChatSharedMedia/index.js @@ -49,6 +49,7 @@ export default class CometChatSharedMedia extends React.Component { this.props.item, this.props.type, this.state.messageType, + this.context, ); this.getMessages(); this.SharedMediaManager.attachListeners(this.messageUpdated); diff --git a/src/components/Users/CometChatUserDetails/index.js b/src/components/Users/CometChatUserDetails/index.js index 2458c5c..037add9 100644 --- a/src/components/Users/CometChatUserDetails/index.js +++ b/src/components/Users/CometChatUserDetails/index.js @@ -39,7 +39,6 @@ export default class CometChatUserDetails extends React.Component { } updateUser = (key, user) => { - console.log('updateUser', key, user); switch (key) { case enums.USER_ONLINE: case enums.USER_OFFLINE: { diff --git a/src/utils/UIKitSettings.js b/src/utils/UIKitSettings.js index c0d7e00..b361e4c 100644 --- a/src/utils/UIKitSettings.js +++ b/src/utils/UIKitSettings.js @@ -98,7 +98,7 @@ export class UIKitSettings { this.polls = true; this.messageTranslation = true; - this.allowModeratorToDeleteMemberMessages = false; + this.allowModeratorToDeleteMemberMessages = true; this.setGroupInQnaModeByModerators = false; this.highlightMessageFromModerators = false; this.emailReplies = true; From d695e61cf892e63d27970e4dfbfcd9e9a3a16ee2 Mon Sep 17 00:00:00 2001 From: Tirath Date: Fri, 19 Nov 2021 14:15:01 +0530 Subject: [PATCH 2/2] v2.4.0-2 --- src/components/Calls/CometChatOutgoingDirectCall/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Calls/CometChatOutgoingDirectCall/index.js b/src/components/Calls/CometChatOutgoingDirectCall/index.js index 9f662b5..1921cd5 100644 --- a/src/components/Calls/CometChatOutgoingDirectCall/index.js +++ b/src/components/Calls/CometChatOutgoingDirectCall/index.js @@ -91,7 +91,7 @@ class CometChatOutgoingDirectCall extends React.Component { this.props.close(); }, onError: (error) => { - props.actionGenerated(actions.CALL_ERROR, error); + this.props.actionGenerated(actions.CALL_ERROR, error); console.log('Call Error: ', error); },