add a markAllAsRead option on menus

pull/1545/head
Audric Ackermann 4 years ago
parent 02fe7ad753
commit 1f509e003d
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -453,6 +453,10 @@
"unverify": { "unverify": {
"message": "Mark As Not Verified" "message": "Mark As Not Verified"
}, },
"markAllAsRead": {
"message": "Mark All as Read",
"description": "Shown on a menu to mark the whole convo as read."
},
"isNotVerified": { "isNotVerified": {
"message": "You have not verified your safety number with $name$.", "message": "You have not verified your safety number with $name$.",
"description": "Summary state shown at top of the safety number screen if user has not verified contact.", "description": "Summary state shown at top of the safety number screen if user has not verified contact.",

@ -363,6 +363,10 @@
} }
} }
}, },
"markAllAsRead": {
"message": "Tout Marquer Comme Lu",
"description": "Shown on a menu to mark the whole convo as read."
},
"isNotVerified": { "isNotVerified": {
"message": "Vous navez pas vérifié votre numéro de sécurité avec $name$", "message": "Vous navez pas vérifié votre numéro de sécurité avec $name$",
"description": "Summary state shown at top of the safety number screen if user has not verified contact.", "description": "Summary state shown at top of the safety number screen if user has not verified contact.",

@ -42,6 +42,7 @@ type PropsHousekeeping = {
onUnblockContact?: () => void; onUnblockContact?: () => void;
onInviteContacts?: () => void; onInviteContacts?: () => void;
onClearNickname?: () => void; onClearNickname?: () => void;
onMarkAllRead: () => void;
theme: DefaultTheme; theme: DefaultTheme;
}; };
@ -62,7 +63,6 @@ class ConversationListItem extends React.PureComponent<Props> {
public renderAvatar() { public renderAvatar() {
const { const {
avatarPath, avatarPath,
i18n,
name, name,
phoneNumber, phoneNumber,
profileName, profileName,

@ -83,6 +83,8 @@ interface Props {
onAvatarClick?: (userPubKey: string) => void; onAvatarClick?: (userPubKey: string) => void;
onUpdateGroupName: () => void; onUpdateGroupName: () => void;
onMarkAllRead: () => void;
memberAvatars?: Array<ConversationAvatar>; // this is added by usingClosedConversationDetails memberAvatars?: Array<ConversationAvatar>; // this is added by usingClosedConversationDetails
theme: DefaultTheme; theme: DefaultTheme;
} }

@ -434,6 +434,10 @@ export class SessionConversation extends React.Component<Props, State> {
window.Whisper.events.trigger('inviteContacts', conversation); window.Whisper.events.trigger('inviteContacts', conversation);
}, },
onMarkAllRead: () => {
void conversation.markReadBouncy(Date.now());
},
onAddModerators: () => { onAddModerators: () => {
window.Whisper.events.trigger('addModerators', conversation); window.Whisper.events.trigger('addModerators', conversation);
}, },

@ -4,6 +4,7 @@ import {
getAddModeratorsMenuItem, getAddModeratorsMenuItem,
getBlockMenuItem, getBlockMenuItem,
getCopyMenuItem, getCopyMenuItem,
getMarkAllReadMenuItem,
getDeleteContactMenuItem, getDeleteContactMenuItem,
getDeleteMessagesMenuItem, getDeleteMessagesMenuItem,
getDisappearingMenuItem, getDisappearingMenuItem,
@ -31,6 +32,7 @@ export type PropsConversationHeaderMenu = {
onInviteContacts?: () => void; onInviteContacts?: () => void;
onLeaveGroup: () => void; onLeaveGroup: () => void;
onMarkAllRead: () => void;
onAddModerators: () => void; onAddModerators: () => void;
onRemoveModerators: () => void; onRemoveModerators: () => void;
onUpdateGroupName: () => void; onUpdateGroupName: () => void;
@ -55,6 +57,7 @@ export const ConversationHeaderMenu = (props: PropsConversationHeaderMenu) => {
onDeleteMessages, onDeleteMessages,
onDeleteContact, onDeleteContact,
onCopyPublicKey, onCopyPublicKey,
onMarkAllRead,
onLeaveGroup, onLeaveGroup,
onAddModerators, onAddModerators,
onRemoveModerators, onRemoveModerators,
@ -86,6 +89,7 @@ export const ConversationHeaderMenu = (props: PropsConversationHeaderMenu) => {
)} )}
{getCopyMenuItem(isPublic, isGroup, onCopyPublicKey, window.i18n)} {getCopyMenuItem(isPublic, isGroup, onCopyPublicKey, window.i18n)}
{getMarkAllReadMenuItem(onMarkAllRead, window.i18n)}
{getDeleteMessagesMenuItem(isPublic, onDeleteMessages, window.i18n)} {getDeleteMessagesMenuItem(isPublic, onDeleteMessages, window.i18n)}
{getAddModeratorsMenuItem( {getAddModeratorsMenuItem(
isAdmin, isAdmin,

@ -5,6 +5,7 @@ import {
getBlockMenuItem, getBlockMenuItem,
getClearNicknameMenuItem, getClearNicknameMenuItem,
getCopyMenuItem, getCopyMenuItem,
getMarkAllReadMenuItem,
getDeleteContactMenuItem, getDeleteContactMenuItem,
getDeleteMessagesMenuItem, getDeleteMessagesMenuItem,
getInviteContactMenuItem, getInviteContactMenuItem,
@ -25,6 +26,7 @@ export type PropsContextConversationItem = {
onDeleteContact?: () => void; onDeleteContact?: () => void;
onLeaveGroup?: () => void; onLeaveGroup?: () => void;
onBlockContact?: () => void; onBlockContact?: () => void;
onMarkAllRead: () => void;
onCopyPublicKey?: () => void; onCopyPublicKey?: () => void;
onUnblockContact?: () => void; onUnblockContact?: () => void;
onInviteContacts?: () => void; onInviteContacts?: () => void;
@ -48,6 +50,7 @@ export const ConversationListItemContextMenu = (
onBlockContact, onBlockContact,
onClearNickname, onClearNickname,
onCopyPublicKey, onCopyPublicKey,
onMarkAllRead,
onUnblockContact, onUnblockContact,
onInviteContacts, onInviteContacts,
onLeaveGroup, onLeaveGroup,
@ -81,6 +84,8 @@ export const ConversationListItemContextMenu = (
onCopyPublicKey, onCopyPublicKey,
window.i18n window.i18n
)} )}
{getMarkAllReadMenuItem(onMarkAllRead, window.i18n)}
{getDeleteMessagesMenuItem(isPublic, onDeleteMessages, window.i18n)} {getDeleteMessagesMenuItem(isPublic, onDeleteMessages, window.i18n)}
{getInviteContactMenuItem( {getInviteContactMenuItem(
type === 'group', type === 'group',

@ -205,6 +205,13 @@ export function getCopyMenuItem(
return null; return null;
} }
export function getMarkAllReadMenuItem(
action: any,
i18n: LocalizerType
): JSX.Element | null {
return <Item onClick={action}>{i18n('markAllAsRead')}</Item>;
}
export function getDisappearingMenuItem( export function getDisappearingMenuItem(
isPublic: boolean | undefined, isPublic: boolean | undefined,
isKickedFromGroup: boolean | undefined, isKickedFromGroup: boolean | undefined,

@ -423,6 +423,9 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
onInviteContacts: () => { onInviteContacts: () => {
window.Whisper.events.trigger('inviteContacts', this); window.Whisper.events.trigger('inviteContacts', this);
}, },
onMarkAllRead: () => {
void this.markReadBouncy(Date.now());
},
onClearNickname: () => { onClearNickname: () => {
void this.setLokiProfile({ displayName: null }); void this.setLokiProfile({ displayName: null });
}, },
@ -468,7 +471,6 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
} }
public async getUnreadCount() { public async getUnreadCount() {
window.log.warn('getUnreadCount is slow');
const unreadCount = await getUnreadCountByConversation(this.id); const unreadCount = await getUnreadCountByConversation(this.id);
return unreadCount; return unreadCount;

@ -87,15 +87,16 @@ export interface ConversationType {
groupAdmins?: Array<string>; // admins for closed groups and moderators for open groups groupAdmins?: Array<string>; // admins for closed groups and moderators for open groups
members?: Array<string>; // members for closed groups only members?: Array<string>; // members for closed groups only
onClick?: () => any; onClick?: () => void;
onBlockContact?: () => any; onBlockContact?: () => void;
onUnblockContact?: () => any; onUnblockContact?: () => void;
onCopyPublicKey?: () => any; onCopyPublicKey?: () => void;
onDeleteContact?: () => any; onDeleteContact?: () => void;
onLeaveGroup?: () => any; onLeaveGroup?: () => void;
onDeleteMessages?: () => any; onDeleteMessages?: () => void;
onInviteContacts?: () => any; onInviteContacts?: () => void;
onClearNickname?: () => any; onMarkAllRead?: () => void;
onClearNickname?: () => void;
} }
export type ConversationLookupType = { export type ConversationLookupType = {

Loading…
Cancel
Save