Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(chat): improve naming convention for unread items (#16499)

Mihaela Dumitru47e420f10eb1
diff --git a/react/features/chat/components/native/Chat.tsx b/react/features/chat/components/native/Chat.tsx
index 4e5b2a1ca3..03a654be98 100644
--- a/react/features/chat/components/native/Chat.tsx
+++ b/react/features/chat/components/native/Chat.tsx
@@ -22,17 +22,17 @@ interface IProps extends AbstractProps {
/**
* The number of unread file messages.
*/
- _nbUnreadFiles: number;
+ _unreadFilesCount: number;
/**
* The number of unread messages.
*/
- _nbUnreadMessages: number;
+ _unreadMessagesCount: number;
/**
* The number of unread polls.
*/
- _nbUnreadPolls: number;
+ _unreadPollsCount: number;
/**
* Default prop for navigating between screen components(React Navigation).
@@ -113,25 +113,25 @@ class Chat extends Component<IProps> {
* @private
* @returns {{
* _messages: Array<Object>,
- * _nbUnreadMessages: number,
- * _nbUnreadPolls: number,
- * _nbUnreadFiles: number
+ * _unreadMessagesCount: number,
+ * _unreadPollsCount: number,
+ * _unreadFilesCount: number
* }}
*/
function _mapStateToProps(state: IReduxState, _ownProps: any) {
- const { messages, nbUnreadMessages } = state['features/chat'];
+ const { messages, unreadMessagesCount } = state['features/chat'];
return {
_messages: messages,
- _nbUnreadMessages: nbUnreadMessages,
- _nbUnreadPolls: getUnreadPollCount(state),
- _nbUnreadFiles: getUnreadFilesCount(state)
+ _unreadMessagesCount: unreadMessagesCount,
+ _unreadPollsCount: getUnreadPollCount(state),
+ _unreadFilesCount: getUnreadFilesCount(state)
};
}
export default translate(connect(_mapStateToProps)((props: IProps) => {
- const { _nbUnreadMessages, _nbUnreadPolls, _nbUnreadFiles, dispatch, navigation, t } = props;
- const totalUnread = _nbUnreadMessages + _nbUnreadPolls + _nbUnreadFiles;
+ const { _unreadMessagesCount, _unreadPollsCount, _unreadFilesCount, dispatch, navigation, t } = props;
+ const totalUnread = _unreadMessagesCount + _unreadPollsCount + _unreadFilesCount;
const unreadMessagesNr = totalUnread > 0;
const isFocused = useIsFocused();
@@ -143,14 +143,14 @@ export default translate(connect(_mapStateToProps)((props: IProps) => {
activeUnreadNr = { unreadMessagesNr }
isFocused = { isFocused }
label = { t('chat.tabs.chat') }
- nbUnread = { totalUnread } />
+ unreadCount = { totalUnread } />
)
});
return () => {
isFocused && dispatch(closeChat());
};
- }, [ isFocused, _nbUnreadMessages, _nbUnreadPolls, _nbUnreadFiles ]);
+ }, [ isFocused, _unreadMessagesCount, _unreadPollsCount, _unreadFilesCount ]);
return (
<Chat { ...props } />
diff --git a/react/features/chat/components/web/Chat.tsx b/react/features/chat/components/web/Chat.tsx
index b60eff4041..5498553da5 100644
--- a/react/features/chat/components/web/Chat.tsx
+++ b/react/features/chat/components/web/Chat.tsx
@@ -74,19 +74,19 @@ interface IProps extends AbstractProps {
_isResizing: boolean;
/**
- * Number of unread file sharing messages.
+ * Whether or not to block chat access with a nickname input form.
*/
- _nbUnreadFiles: number;
+ _showNamePrompt: boolean;
/**
- * Number of unread poll messages.
+ * Number of unread file sharing messages.
*/
- _nbUnreadPolls: number;
+ _unreadFilesCount: number;
/**
- * Whether or not to block chat access with a nickname input form.
+ * Number of unread poll messages.
*/
- _showNamePrompt: boolean;
+ _unreadPollsCount: number;
/**
* The current width of the chat panel.
@@ -221,9 +221,9 @@ const Chat = ({
_focusedTab,
_isResizing,
_messages,
- _nbUnreadMessages,
- _nbUnreadPolls,
- _nbUnreadFiles,
+ _unreadMessagesCount,
+ _unreadPollsCount,
+ _unreadFilesCount,
_showNamePrompt,
_width,
dispatch,
@@ -485,7 +485,7 @@ const Chat = ({
{
accessibilityLabel: t('chat.tabs.chat'),
countBadge:
- _focusedTab !== ChatTabs.CHAT && _nbUnreadMessages > 0 ? _nbUnreadMessages : undefined,
+ _focusedTab !== ChatTabs.CHAT && _unreadMessagesCount > 0 ? _unreadMessagesCount : undefined,
id: ChatTabs.CHAT,
controlsId: `${ChatTabs.CHAT}-panel`,
icon: IconMessage,
@@ -496,7 +496,7 @@ const Chat = ({
if (_isPollsEnabled) {
tabs.push({
accessibilityLabel: t('chat.tabs.polls'),
- countBadge: _focusedTab !== ChatTabs.POLLS && _nbUnreadPolls > 0 ? _nbUnreadPolls : undefined,
+ countBadge: _focusedTab !== ChatTabs.POLLS && _unreadPollsCount > 0 ? _unreadPollsCount : undefined,
id: ChatTabs.POLLS,
controlsId: `${ChatTabs.POLLS}-panel`,
icon: IconInfo,
@@ -518,7 +518,7 @@ const Chat = ({
if (_isFileSharingTabEnabled) {
tabs.push({
accessibilityLabel: t('chat.tabs.fileSharing'),
- countBadge: _focusedTab !== ChatTabs.FILE_SHARING && _nbUnreadFiles > 0 ? _nbUnreadFiles : undefined,
+ countBadge: _focusedTab !== ChatTabs.FILE_SHARING && _unreadFilesCount > 0 ? _unreadFilesCount : undefined,
id: ChatTabs.FILE_SHARING,
controlsId: `${ChatTabs.FILE_SHARING}-panel`,
icon: IconShareDoc,
@@ -590,17 +590,17 @@ const Chat = ({
* _isCCTabEnabled: boolean,
* _focusedTab: string,
* _messages: Array<Object>,
- * _nbUnreadMessages: number,
- * _nbUnreadPolls: number,
- * _nbUnreadFiles: number,
+ * _unreadMessagesCount: number,
+ * _unreadPollsCount: number,
+ * _unreadFilesCount: number,
* _showNamePrompt: boolean,
* _width: number,
* _isResizing: boolean
* }}
*/
function _mapStateToProps(state: IReduxState, _ownProps: any) {
- const { isOpen, focusedTab, messages, nbUnreadMessages, nbUnreadFiles, width, isResizing } = state['features/chat'];
- const { nbUnreadPolls } = state['features/polls'];
+ const { isOpen, focusedTab, messages, unreadMessagesCount, unreadFilesCount, width, isResizing } = state['features/chat'];
+ const { unreadPollsCount } = state['features/polls'];
const _localParticipant = getLocalParticipant(state);
return {
@@ -611,9 +611,9 @@ function _mapStateToProps(state: IReduxState, _ownProps: any) {
_isFileSharingTabEnabled: isFileSharingEnabled(state),
_focusedTab: focusedTab,
_messages: messages,
- _nbUnreadMessages: nbUnreadMessages,
- _nbUnreadPolls: nbUnreadPolls,
- _nbUnreadFiles: nbUnreadFiles,
+ _unreadMessagesCount: unreadMessagesCount,
+ _unreadPollsCount: unreadPollsCount,
+ _unreadFilesCount: unreadFilesCount,
_showNamePrompt: !_localParticipant?.name,
_width: width?.current || CHAT_SIZE,
_isResizing: isResizing
diff --git a/react/features/chat/functions.ts b/react/features/chat/functions.ts
index 27ce403554..29bd9680c5 100644
--- a/react/features/chat/functions.ts
+++ b/react/features/chat/functions.ts
@@ -138,7 +138,7 @@ export function getUnreadCount(state: IReduxState) {
* @returns {number} The number of unread files.
*/
export function getUnreadFilesCount(state: IReduxState): number {
- return state['features/chat']?.nbUnreadFiles || 0;
+ return state['features/chat']?.unreadFilesCount || 0;
}
/**
diff --git a/react/features/chat/middleware.ts b/react/features/chat/middleware.ts
index cf50200945..deedbdd47d 100644
--- a/react/features/chat/middleware.ts
+++ b/react/features/chat/middleware.ts
@@ -29,7 +29,7 @@ import { addGif } from '../gifs/actions';
import { extractGifURL, getGifDisplayMode, isGifEnabled, isGifMessage } from '../gifs/function.any';
import { showMessageNotification } from '../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
-import { resetNbUnreadPollsMessages } from '../polls/actions';
+import { resetUnreadPollsCount } from '../polls/actions';
import { ADD_REACTION_MESSAGE } from '../reactions/actionTypes';
import { pushReactions } from '../reactions/actions.any';
import { ENDPOINT_REACTION_NAME } from '../reactions/constants';
@@ -130,7 +130,7 @@ MiddlewareRegistry.register(store => next => action => {
APP.API.notifyChatUpdated(unreadCount, false);
}
} else if (focusedTab === ChatTabs.POLLS) {
- dispatch(resetNbUnreadPollsMessages());
+ dispatch(resetUnreadPollsCount());
}
break;
}
@@ -207,7 +207,7 @@ MiddlewareRegistry.register(store => next => action => {
}
}
} else if (focusedTab === ChatTabs.POLLS) {
- dispatch(resetNbUnreadPollsMessages());
+ dispatch(resetUnreadPollsCount());
}
break;
diff --git a/react/features/chat/reducer.ts b/react/features/chat/reducer.ts
index 45d5db32e3..00569d394b 100644
--- a/react/features/chat/reducer.ts
+++ b/react/features/chat/reducer.ts
@@ -30,8 +30,8 @@ const DEFAULT_STATE = {
messages: [],
notifyPrivateRecipientsChangedTimestamp: undefined,
reactions: {},
- nbUnreadMessages: 0,
- nbUnreadFiles: 0,
+ unreadMessagesCount: 0,
+ unreadFilesCount: 0,
privateMessageRecipient: undefined,
lobbyMessageRecipient: undefined,
isLobbyChatActive: false,
@@ -55,10 +55,10 @@ export interface IChatState {
name: string;
} | ILocalParticipant;
messages: IMessage[];
- nbUnreadFiles: number;
- nbUnreadMessages: number;
notifyPrivateRecipientsChangedTimestamp?: number;
privateMessageRecipient?: IParticipant | IVisitorChatParticipant;
+ unreadFilesCount: number;
+ unreadMessagesCount: number;
width: {
current: number;
userSet: number | null;
@@ -101,7 +101,7 @@ ReducerRegistry.register<IChatState>('features/chat', (state = DEFAULT_STATE, ac
...state,
lastReadMessage:
action.hasRead ? newMessage : state.lastReadMessage,
- nbUnreadMessages: state.focusedTab !== ChatTabs.CHAT ? state.nbUnreadMessages + 1 : state.nbUnreadMessages,
+ unreadMessagesCount: state.focusedTab !== ChatTabs.CHAT ? state.unreadMessagesCount + 1 : state.unreadMessagesCount,
messages
};
}
@@ -238,8 +238,8 @@ ReducerRegistry.register<IChatState>('features/chat', (state = DEFAULT_STATE, ac
return {
...state,
focusedTab: action.tabId,
- nbUnreadMessages: action.tabId === ChatTabs.CHAT ? 0 : state.nbUnreadMessages,
- nbUnreadFiles: action.tabId === ChatTabs.FILE_SHARING ? 0 : state.nbUnreadFiles
+ unreadMessagesCount: action.tabId === ChatTabs.CHAT ? 0 : state.unreadMessagesCount,
+ unreadFilesCount: action.tabId === ChatTabs.FILE_SHARING ? 0 : state.unreadFilesCount
};
case SET_CHAT_WIDTH: {
@@ -279,7 +279,7 @@ ReducerRegistry.register<IChatState>('features/chat', (state = DEFAULT_STATE, ac
case ADD_FILE:
return {
...state,
- nbUnreadFiles: action.shouldIncrementUnread ? state.nbUnreadFiles + 1 : state.nbUnreadFiles
+ unreadFilesCount: action.shouldIncrementUnread ? state.unreadFilesCount + 1 : state.unreadFilesCount
};
case _FILE_LIST_RECEIVED: {
@@ -289,7 +289,7 @@ ReducerRegistry.register<IChatState>('features/chat', (state = DEFAULT_STATE, ac
return {
...state,
- nbUnreadFiles: remoteFilesCount
+ unreadFilesCount: remoteFilesCount
};
}
}
diff --git a/react/features/chat/types.ts b/react/features/chat/types.ts
index aaddc16e89..88c98a0c95 100644
--- a/react/features/chat/types.ts
+++ b/react/features/chat/types.ts
@@ -33,7 +33,7 @@ export interface IChatProps extends WithTranslation {
/**
* Number of unread chat messages.
*/
- _nbUnreadMessages: number;
+ _unreadMessagesCount: number;
/**
* The Redux dispatch function.
diff --git a/react/features/mobile/navigation/components/TabBarLabelCounter.tsx b/react/features/mobile/navigation/components/TabBarLabelCounter.tsx
index 5864b66d72..7c17901716 100644
--- a/react/features/mobile/navigation/components/TabBarLabelCounter.tsx
+++ b/react/features/mobile/navigation/components/TabBarLabelCounter.tsx
@@ -7,10 +7,10 @@ interface ITabBarLabelCounterProps {
activeUnreadNr: boolean;
isFocused: boolean;
label: string;
- nbUnread?: number;
+ unreadCount?: number;
}
-export const TabBarLabelCounter = ({ activeUnreadNr, isFocused, label, nbUnread }: ITabBarLabelCounterProps) => {
+export const TabBarLabelCounter = ({ activeUnreadNr, isFocused, label, unreadCount }: ITabBarLabelCounterProps) => {
const labelStyles = isFocused
? navigationStyles.unreadCounterDescriptionFocused
: navigationStyles.unreadCounterDescription;
@@ -29,7 +29,7 @@ export const TabBarLabelCounter = ({ activeUnreadNr, isFocused, label, nbUnread
style = { navigationStyles.unreadCounterCircle as StyleProp<TextStyle> }>
<Text
style = { navigationStyles.unreadCounter as StyleProp<TextStyle> }>
- { nbUnread }
+ { unreadCount }
</Text>
</View>
)
diff --git a/react/features/mobile/navigation/components/chat/components/ChatAndPollsNavigator.tsx b/react/features/mobile/navigation/components/chat/components/ChatAndPollsNavigator.tsx
index 8e674ef52a..98879726de 100644
--- a/react/features/mobile/navigation/components/chat/components/ChatAndPollsNavigator.tsx
+++ b/react/features/mobile/navigation/components/chat/components/ChatAndPollsNavigator.tsx
@@ -12,7 +12,7 @@ import {
import { setFocusedTab } from '../../../../../chat/actions.any';
import Chat from '../../../../../chat/components/native/Chat';
import { ChatTabs } from '../../../../../chat/constants';
-import { resetNbUnreadPollsMessages } from '../../../../../polls/actions';
+import { resetUnreadPollsCount } from '../../../../../polls/actions';
import PollsPane from '../../../../../polls/components/native/PollsPane';
import { screen } from '../../../routes';
import { chatTabBarOptions } from '../../../screenOptions';
@@ -51,7 +51,7 @@ const ChatAndPolls = () => {
listeners = {{
tabPress: () => {
dispatch(setFocusedTab(ChatTabs.POLLS));
- dispatch(resetNbUnreadPollsMessages);
+ dispatch(resetUnreadPollsCount);
}
}}
name = { screen.conference.chatandpolls.tab.polls } />
diff --git a/react/features/polls/actionTypes.ts b/react/features/polls/actionTypes.ts
index 349976a312..10e8c79c23 100644
--- a/react/features/polls/actionTypes.ts
+++ b/react/features/polls/actionTypes.ts
@@ -77,10 +77,10 @@ export const REMOVE_POLL = 'REMOVE_POLL';
* The type of the action triggered when the poll tab in chat pane is closed
*
* {
- * type: RESET_NB_UNREAD_POLLS,
+ * type: RESET_UNREAD_POLLS_COUNT,
* }
*/
-export const RESET_NB_UNREAD_POLLS = 'RESET_NB_UNREAD_POLLS';
+export const RESET_UNREAD_POLLS_COUNT = 'RESET_UNREAD_POLLS_COUNT';
/**
* The type of the action triggered when the poll is saved.
diff --git a/react/features/polls/actions.ts b/react/features/polls/actions.ts
index 0f83f94774..b2a36309c1 100644
--- a/react/features/polls/actions.ts
+++ b/react/features/polls/actions.ts
@@ -6,7 +6,7 @@ import {
RECEIVE_POLL,
REGISTER_VOTE,
REMOVE_POLL,
- RESET_NB_UNREAD_POLLS,
+ RESET_UNREAD_POLLS_COUNT,
SAVE_POLL
} from './actionTypes';
import { IIncomingAnswerData, IPoll, IPollData } from './types';
@@ -103,12 +103,12 @@ export const registerVote = (pollId: string, answers: Array<boolean> | null) =>
* Action to signal the number reset of unread polls.
*
* @returns {{
- * type: RESET_NB_UNREAD_POLLS
+ * type: RESET_UNREAD_POLLS_COUNT
* }}
*/
-export function resetNbUnreadPollsMessages() {
+export function resetUnreadPollsCount() {
return {
- type: RESET_NB_UNREAD_POLLS
+ type: RESET_UNREAD_POLLS_COUNT
};
}
diff --git a/react/features/polls/components/native/PollsPane.tsx b/react/features/polls/components/native/PollsPane.tsx
index 40992a9bca..1d8eca2d50 100644
--- a/react/features/polls/components/native/PollsPane.tsx
+++ b/react/features/polls/components/native/PollsPane.tsx
@@ -24,10 +24,10 @@ const PollsPane = (props: AbstractProps) => {
const { createMode, isCreatePollsDisabled, onCreate, setCreateMode, t } = props;
const navigation = useNavigation();
const isPollsTabFocused = useSelector((state: IReduxState) => state['features/chat'].focusedTab === ChatTabs.POLLS);
- const { nbUnreadPolls } = useSelector((state: IReduxState) => state['features/polls']);
+ const { unreadPollsCount } = useSelector((state: IReduxState) => state['features/polls']);
useEffect(() => {
- const activeUnreadPollsNr = !isPollsTabFocused && nbUnreadPolls > 0;
+ const activeUnreadPollsNr = !isPollsTabFocused && unreadPollsCount > 0;
navigation.setOptions({
// eslint-disable-next-line react/no-multi-comp
@@ -36,11 +36,11 @@ const PollsPane = (props: AbstractProps) => {
activeUnreadNr = { activeUnreadPollsNr }
isFocused = { isPollsTabFocused }
label = { t('chat.tabs.polls') }
- nbUnread = { nbUnreadPolls } />
+ unreadCount = { unreadPollsCount } />
)
});
- }, [ isPollsTabFocused, nbUnreadPolls ]);
+ }, [ isPollsTabFocused, unreadPollsCount ]);
const createPollButtonStyles = Platform.OS === 'android'
? pollsStyles.createPollButtonAndroid : pollsStyles.createPollButtonIos;
diff --git a/react/features/polls/functions.ts b/react/features/polls/functions.ts
index 182ebfd062..97cc9e355f 100644
--- a/react/features/polls/functions.ts
+++ b/react/features/polls/functions.ts
@@ -36,9 +36,9 @@ export function getPoll(pollId: string) {
* @returns {number} The number of unread messages.
*/
export function getUnreadPollCount(state: IReduxState) {
- const { nbUnreadPolls } = state['features/polls'];
+ const { unreadPollsCount } = state['features/polls'];
- return nbUnreadPolls;
+ return unreadPollsCount;
}
/**
diff --git a/react/features/polls/reducer.ts b/react/features/polls/reducer.ts
index 9a4d71dc30..fc3399f0ab 100644
--- a/react/features/polls/reducer.ts
+++ b/react/features/polls/reducer.ts
@@ -8,7 +8,7 @@ import {
RECEIVE_POLL,
REGISTER_VOTE,
REMOVE_POLL,
- RESET_NB_UNREAD_POLLS,
+ RESET_UNREAD_POLLS_COUNT,
SAVE_POLL
} from './actionTypes';
import { IIncomingAnswerData, IPollData } from './types';
@@ -17,14 +17,14 @@ const INITIAL_STATE = {
polls: {},
// Number of not read message
- nbUnreadPolls: 0
+ unreadPollsCount: 0
};
export interface IPollsState {
- nbUnreadPolls: number;
polls: {
[pollId: string]: IPollData;
};
+ unreadPollsCount: number;
}
const STORE_NAME = 'features/polls';
@@ -63,7 +63,7 @@ ReducerRegistry.register<IPollsState>(STORE_NAME, (state = INITIAL_STATE, action
...state.polls,
[action.poll.pollId]: action.poll
},
- nbUnreadPolls: state.nbUnreadPolls + 1
+ unreadPollsCount: state.unreadPollsCount + 1
};
}
@@ -141,10 +141,10 @@ ReducerRegistry.register<IPollsState>(STORE_NAME, (state = INITIAL_STATE, action
};
}
- case RESET_NB_UNREAD_POLLS: {
+ case RESET_UNREAD_POLLS_COUNT: {
return {
...state,
- nbUnreadPolls: 0
+ unreadPollsCount: 0
};
}