Skip to content

Commit

Permalink
Merge pull request #9 from session-foundation/qa/release/1.15.0
Browse files Browse the repository at this point in the history
fix: QA issues for group
  • Loading branch information
Bilb authored Dec 8, 2024
2 parents 9507cde + 3b18d6a commit b731ffc
Show file tree
Hide file tree
Showing 95 changed files with 964 additions and 609 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
build_linux:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
# this needs to be a valid target of https://www.electron.build/linux#target
pkg_to_build: ['deb', 'rpm', 'freebsd', 'AppImage']
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"fs-extra": "9.0.0",
"glob": "10.3.10",
"image-type": "^4.1.0",
"libsession_util_nodejs": "https://github.com/session-foundation/libsession-util-nodejs/releases/download/v0.4.6/libsession_util_nodejs-v0.4.6.tar.gz",
"libsession_util_nodejs": "https://github.com/session-foundation/libsession-util-nodejs/releases/download/v0.4.7/libsession_util_nodejs-v0.4.7.tar.gz",
"libsodium-wrappers-sumo": "^0.7.9",
"linkify-it": "^4.0.1",
"lodash": "^4.17.21",
Expand Down
4 changes: 4 additions & 0 deletions ts/components/AboutView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,26 @@ export const AboutView = () => {
className="version"
text={versionInfo}
buttonType={SessionButtonType.Simple}
showToast={false}
/>
<CopyToClipboardButton
className="os"
text={systemInfo}
buttonType={SessionButtonType.Simple}
showToast={false}
/>
<CopyToClipboardButton
className="commitHash"
text={commitInfo}
buttonType={SessionButtonType.Simple}
showToast={false}
/>
{environmentStates.length ? (
<CopyToClipboardButton
className="environment"
text={environmentStates.join(' - ')}
buttonType={SessionButtonType.Simple}
showToast={false}
/>
) : null}
<a href="https://getsession.org">https://getsession.org</a>
Expand Down
6 changes: 2 additions & 4 deletions ts/components/NoticeBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { SessionIconButton, SessionIconType } from './icon';
import { StyledRootDialog } from './dialog/StyledRootDialog';

const StyledNoticeBanner = styled(Flex)`
position: relative;
background-color: var(--primary-color);
color: var(--black-color);
font-size: var(--font-size-md);
Expand All @@ -15,14 +14,13 @@ const StyledNoticeBanner = styled(Flex)`
cursor: pointer;
.session-icon-button {
position: absolute;
right: var(--margins-sm);
pointer-events: none;
}
`;

const StyledText = styled.span`
margin-right: var(--margins-xl);
margin-right: var(--margins-sm);
`;

type NoticeBannerProps = {
Expand Down Expand Up @@ -65,7 +63,7 @@ const StyledGroupInviteBanner = styled(Flex)`
// when part a a dialog, invert it and make it narrower (as the dialog grows to make it fit)
${StyledRootDialog} & {
background-color: unset;
color: var(--orange-color);
color: var(--text-primary-color);
max-width: 300px;
}
`;
Expand Down
3 changes: 1 addition & 2 deletions ts/components/basic/SessionToast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export enum SessionToastType {

type Props = {
description: string;

id?: string;
type?: SessionToastType;
icon?: SessionIconType;
Expand All @@ -28,7 +27,7 @@ type Props = {

const DescriptionDiv = styled.div`
font-size: var(--font-size-sm);
color: var(--text-secondary-color);
color: var(--text-primary-color);
text-overflow: ellipsis;
font-family: var(--font-default);
padding-top: var(--margins-xs);
Expand Down
14 changes: 9 additions & 5 deletions ts/components/buttons/CopyToClipboardButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ type CopyProps = {
copyContent?: string;
onCopyComplete?: (copiedValue: string | undefined) => void;
hotkey?: boolean;
showToast?: boolean;
};

type CopyToClipboardButtonProps = Omit<SessionButtonProps, 'children' | 'onClick'> & CopyProps;

export const CopyToClipboardButton = (props: CopyToClipboardButtonProps) => {
const { copyContent, onCopyComplete, hotkey = false, text } = props;
const { copyContent, onCopyComplete, hotkey = false, text, showToast = true } = props;
const [copied, setCopied] = useState(false);

const onClick = () => {
Expand All @@ -27,8 +28,9 @@ export const CopyToClipboardButton = (props: CopyToClipboardButtonProps) => {
}

clipboard.writeText(toCopy);

ToastUtils.pushCopiedToClipBoard();
if (showToast) {
ToastUtils.pushCopiedToClipBoard();
}
setCopied(true);
if (onCopyComplete) {
onCopyComplete(text);
Expand All @@ -54,11 +56,13 @@ type CopyToClipboardIconProps = Omit<SessionIconButtonProps, 'children' | 'onCli
CopyProps;

export const CopyToClipboardIcon = (props: CopyToClipboardIconProps & { copyContent: string }) => {
const { copyContent, onCopyComplete, hotkey = false } = props;
const { copyContent, onCopyComplete, hotkey = false, showToast = true } = props;

const onClick = () => {
clipboard.writeText(copyContent);
ToastUtils.pushCopiedToClipBoard();
if (showToast) {
ToastUtils.pushCopiedToClipBoard();
}
if (onCopyComplete) {
onCopyComplete(copyContent);
}
Expand Down
2 changes: 1 addition & 1 deletion ts/components/conversation/AddMentions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Mention = (props: MentionProps) => {

return (
<StyledMentionAnother>
@{foundConvo?.getContactProfileNameOrShortenedPubKey() || PubKey.shorten(props.text)}
@{foundConvo?.getNicknameOrRealUsernameOrPlaceholder() || PubKey.shorten(props.text)}
</StyledMentionAnother>
);
};
Expand Down
2 changes: 1 addition & 1 deletion ts/components/conversation/StagedAttachmentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const StagedAttachmentList = (props: Props) => {
if (!conversationKey) {
return;
}
dispatch(removeAllStagedAttachmentsInConversation({ conversationKey }));
dispatch(removeAllStagedAttachmentsInConversation({ conversationId: conversationKey }));
};

const onRemoveByFilename = (filename: string) => {
Expand Down
36 changes: 27 additions & 9 deletions ts/components/conversation/SubtleNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import {
useSelectedConversationKey,
useSelectedHasDisabledBlindedMsgRequests,
useSelectedIsApproved,
useSelectedIsGroupOrCommunity,
useSelectedIsGroupV2,
useSelectedIsNoteToSelf,
useSelectedIsPrivate,
useSelectedIsPublic,
useSelectedNicknameOrProfileNameOrShortenedPubkey,
} from '../../state/selectors/selectedConversation';
import {
Expand Down Expand Up @@ -204,6 +206,7 @@ export const NoMessageInConversation = () => {
const selectedConversation = useSelectedConversationKey();
const hasMessages = useSelectedHasMessages();
const isGroupV2 = useSelectedIsGroupV2();
const isGroupOrCommunity = useSelectedIsGroupOrCommunity();
const isInvitePending = useLibGroupInvitePending(selectedConversation);

const isMe = useSelectedIsNoteToSelf();
Expand All @@ -215,27 +218,42 @@ export const NoMessageInConversation = () => {
const isKickedFromGroup = useLibGroupKicked(selectedConversation);
const isGroupDestroyed = useLibGroupDestroyed(selectedConversation);
const name = useSelectedNicknameOrProfileNameOrShortenedPubkey();
const isPublic = useSelectedIsPublic();

const getHtmlToRender = () => {
// First, handle the "noteToSelf and various "private" cases
if (isMe) {
return localize('noteToSelfEmpty').toString();
}

if (canWrite) {
return localize('groupNoMessages').withArgs({ group_name: name }).toString();
}

if (privateBlindedAndBlockingMsgReqs) {
return localize('messageRequestsTurnedOff').withArgs({ name }).toString();
}
if (isPrivate) {
// "You have no messages from X. Send a message to start the conversation!"
return localize('groupNoMessages').withArgs({ group_name: name }).toString();
}

if (isGroupV2 && isGroupDestroyed) {
return localize('groupDeletedMemberDescription').withArgs({ group_name: name }).toString();
if (isPublic) {
return localize('conversationsEmpty').withArgs({ conversation_name: name }).toString();
}

if (isGroupV2 && isKickedFromGroup) {
return localize('groupRemovedYou').withArgs({ group_name: name }).toString();
// a "group but not public" is a legacy or a groupv2 (isPublic is handled just above)
if (isGroupOrCommunity) {
if (isGroupDestroyed) {
return localize('groupDeletedMemberDescription').withArgs({ group_name: name }).toString();
}

if (isKickedFromGroup) {
return localize('groupRemovedYou').withArgs({ group_name: name }).toString();
}
if (canWrite) {
// "You have no messages from X. Send a message to start the conversation!"
return localize('groupNoMessages').withArgs({ group_name: name }).toString();
}
// if we cannot write for some reason, don't show the "send a message" part
return localize('conversationsEmpty').withArgs({ conversation_name: name }).toString();
}

return localize('conversationsEmpty').withArgs({ conversation_name: name }).toString();
};

Expand Down
2 changes: 1 addition & 1 deletion ts/components/conversation/composition/CompositionBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ class CompositionBoxInner extends Component<Props, State> {

window.inboxStore?.dispatch(
removeAllStagedAttachmentsInConversation({
conversationKey: this.props.selectedConversationKey,
conversationId: this.props.selectedConversationKey,
})
);
// Empty composition box and stagedAttachments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const ClickToTrustSender = (props: { messageId: string }) => {
i18nMessage: {
token: 'attachmentsAutoDownloadModalDescription',
args: {
conversation_name: convo.getContactProfileNameOrShortenedPubKey(),
conversation_name: convo.getNicknameOrRealUsernameOrPlaceholder(),
},
},
closeTheme: SessionButtonColor.Danger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function useIsExpired(
dispatch(
messagesExpired([
{
conversationKey: convoId,
conversationId: convoId,
messageId,
},
])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { compact, flatten, isEqual } from 'lodash';
import { useEffect, useState } from 'react';
import { SessionDataTestId, useEffect, useState } from 'react';

import { useDispatch } from 'react-redux';
import useInterval from 'react-use/lib/useInterval';
Expand Down Expand Up @@ -317,7 +317,7 @@ export const OverlayRightPanelSettings = () => {
groupInfoActions.triggerFakeAvatarUpdate({ groupPk: selectedConvoKey }) as any
);
}}
dataTestId="edit-group-name"
dataTestId={'' as SessionDataTestId}
/>
<PanelIconButton
iconType={'group'}
Expand All @@ -333,7 +333,7 @@ export const OverlayRightPanelSettings = () => {
}) as any
);
}}
dataTestId="edit-group-name"
dataTestId={'' as SessionDataTestId}
/>
<PanelIconButton
iconType={'group'}
Expand All @@ -349,7 +349,7 @@ export const OverlayRightPanelSettings = () => {
}) as any
);
}}
dataTestId="edit-group-name"
dataTestId={'' as SessionDataTestId}
/>
</>
) : null}
Expand Down
45 changes: 23 additions & 22 deletions ts/components/dialog/InviteContactsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const InviteContactsDialogInner = (props: Props) => {
const isGroupV2 = useSelectedIsGroupV2();
const [shareHistory, setShareHistory] = useState(false);

const { uniqueValues: selectedContacts, addTo, removeFrom } = useSet<string>();
const { uniqueValues: selectedContacts, addTo, removeFrom, empty } = useSet<string>();

if (isPrivate) {
throw new Error('InviteContactsDialogInner must be a group');
Expand All @@ -144,27 +144,28 @@ const InviteContactsDialogInner = (props: Props) => {
};

const onClickOK = () => {
if (selectedContacts.length > 0) {
if (isPublic) {
void submitForOpenGroup(conversationId, selectedContacts);
} else {
if (PubKey.is03Pubkey(conversationId)) {
const forcedAsPubkeys = selectedContacts as Array<PubkeyType>;
const action = groupInfoActions.currentDeviceGroupMembersChange({
addMembersWithoutHistory: shareHistory ? [] : forcedAsPubkeys,
addMembersWithHistory: shareHistory ? forcedAsPubkeys : [],
removeMembers: [],
groupPk: conversationId,
alsoRemoveMessages: false,
});
dispatch(action as any);
return;
}
void submitForClosedGroup(conversationId, selectedContacts);
}
if (selectedContacts.length <= 0) {
closeDialog();
return;
}

closeDialog();
if (isPublic) {
void submitForOpenGroup(conversationId, selectedContacts);
return;
}
if (PubKey.is03Pubkey(conversationId)) {
const forcedAsPubkeys = selectedContacts as Array<PubkeyType>;
const action = groupInfoActions.currentDeviceGroupMembersChange({
addMembersWithoutHistory: shareHistory ? [] : forcedAsPubkeys,
addMembersWithHistory: shareHistory ? forcedAsPubkeys : [],
removeMembers: [],
groupPk: conversationId,
alsoRemoveMessages: false,
});
dispatch(action as any);
empty();
return;
}
void submitForClosedGroup(conversationId, selectedContacts);
};

useKey((event: KeyboardEvent) => {
Expand All @@ -182,7 +183,7 @@ const InviteContactsDialogInner = (props: Props) => {
const hasContacts = validContactsForInvite.length > 0;

return (
<SessionWrapperModal title={titleText} onClose={closeDialog}>
<SessionWrapperModal title={titleText} onClose={closeDialog} showExitIcon={true}>
{hasContacts && isGroupV2 && <GroupInviteRequiredVersionBanner />}

<SpacerLG />
Expand Down
6 changes: 6 additions & 0 deletions ts/components/dialog/UpdateGroupNameDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ export function UpdateGroupNameDialog(props: { conversationId: string }) {
type="text"
value={newGroupName}
placeholder={window.i18n('groupNameEnter')}
onKeyDown={e => {
if (e.key === 'Enter') {
onClickOK();
e.preventDefault();
}
}}
onChange={e => setNewGroupName(e.target.value)}
tabIndex={0}
required={true}
Expand Down
1 change: 0 additions & 1 deletion ts/components/leftpane/overlay/OverlayClosedGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export const OverlayClosedGroupV2 = () => {

async function onEnterPressed() {
setGroupNameError(undefined);
setGroupName('');
if (isCreatingGroup) {
window?.log?.warn('Closed group creation already in progress');
return;
Expand Down
Loading

0 comments on commit b731ffc

Please sign in to comment.