Update more strings to not wrongly mention room when it is/could be a space (#7722)

This commit is contained in:
Michael Telatynski 2022-03-29 15:02:12 +01:00 committed by GitHub
parent c3e02b21cb
commit e161f0b17b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 186 additions and 109 deletions

View file

@ -125,7 +125,7 @@ export function showAnyInviteErrors(
// user. This usually means that no other users were attempted, making it // user. This usually means that no other users were attempted, making it
// pointless for us to list who failed exactly. // pointless for us to list who failed exactly.
Modal.createTrackedDialog('Failed to invite users to the room', '', ErrorDialog, { Modal.createTrackedDialog('Failed to invite users to the room', '', ErrorDialog, {
title: _t("Failed to invite users to the room:", { roomName: room.name }), title: _t("Failed to invite users to %(roomName)s", { roomName: room.name }),
description: inviter.getErrorText(failedUsers[0]), description: inviter.getErrorText(failedUsers[0]),
}); });
return false; return false;

View file

@ -428,8 +428,7 @@ const UserOptionsSection: React.FC<{
const roomId = member && member.roomId ? member.roomId : RoomViewStore.getRoomId(); const roomId = member && member.roomId ? member.roomId : RoomViewStore.getRoomId();
const onInviteUserButton = async (ev: ButtonEvent) => { const onInviteUserButton = async (ev: ButtonEvent) => {
try { try {
// We use a MultiInviter to re-use the invite logic, even though // We use a MultiInviter to re-use the invite logic, even though we're only inviting one user.
// we're only inviting one user.
const inviter = new MultiInviter(roomId); const inviter = new MultiInviter(roomId);
await inviter.invite([member.userId]).then(() => { await inviter.invite([member.userId]).then(() => {
if (inviter.getCompletionState(member.userId) !== "invited") { if (inviter.getCompletionState(member.userId) !== "invited") {

View file

@ -227,17 +227,6 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
.getStateEvents(EventType.RoomJoinRules, "")?.getContent<IJoinRuleEventContent>().join_rule; .getStateEvents(EventType.RoomJoinRules, "")?.getContent<IJoinRuleEventContent>().join_rule;
} }
private roomName(atStart = false): string {
const name = this.props.room ? this.props.room.name : this.props.roomAlias;
if (name) {
return name;
} else if (atStart) {
return _t("This room");
} else {
return _t("this room");
}
}
private getMyMember(): RoomMember { private getMyMember(): RoomMember {
return this.props.room?.getMember(MatrixClientPeg.get().getUserId()); return this.props.room?.getMember(MatrixClientPeg.get().getUserId());
} }
@ -289,6 +278,8 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
render() { render() {
const brand = SdkConfig.get().brand; const brand = SdkConfig.get().brand;
const roomName = this.props.room?.name ?? this.props.roomAlias ?? "";
const isSpace = this.props.room?.isSpaceRoom() ?? this.props.oobData?.roomType === RoomType.Space;
let showSpinner = false; let showSpinner = false;
let title; let title;
@ -304,7 +295,12 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
const messageCase = this.getMessageCase(); const messageCase = this.getMessageCase();
switch (messageCase) { switch (messageCase) {
case MessageCase.Joining: { case MessageCase.Joining: {
title = this.props.oobData?.roomType === RoomType.Space ? _t("Joining space …") : _t("Joining room …"); if (this.props.oobData?.roomType || isSpace) {
title = isSpace ? _t("Joining space …") : _t("Joining room …");
} else {
title = _t("Joining …");
}
showSpinner = true; showSpinner = true;
break; break;
} }
@ -330,7 +326,7 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
footer = ( footer = (
<div> <div>
<Spinner w={20} h={20} /> <Spinner w={20} h={20} />
{ _t("Loading room preview") } { _t("Loading preview") }
</div> </div>
); );
} }
@ -338,37 +334,56 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
} }
case MessageCase.Kicked: { case MessageCase.Kicked: {
const { memberName, reason } = this.getKickOrBanInfo(); const { memberName, reason } = this.getKickOrBanInfo();
if (roomName) {
title = _t("You were removed from %(roomName)s by %(memberName)s", title = _t("You were removed from %(roomName)s by %(memberName)s",
{ memberName, roomName: this.roomName() }); { memberName, roomName });
} else {
title = _t("You were removed by %(memberName)s", { memberName });
}
subTitle = reason ? _t("Reason: %(reason)s", { reason }) : null; subTitle = reason ? _t("Reason: %(reason)s", { reason }) : null;
if (this.joinRule() === "invite") { if (isSpace) {
primaryActionLabel = _t("Forget this room"); primaryActionLabel = _t("Forget this space");
primaryActionHandler = this.props.onForgetClick;
} else { } else {
primaryActionLabel = _t("Forget this room");
}
primaryActionHandler = this.props.onForgetClick;
if (this.joinRule() !== JoinRule.Invite) {
secondaryActionLabel = primaryActionLabel;
secondaryActionHandler = primaryActionHandler;
primaryActionLabel = _t("Re-join"); primaryActionLabel = _t("Re-join");
primaryActionHandler = this.props.onJoinClick; primaryActionHandler = this.props.onJoinClick;
secondaryActionLabel = _t("Forget this room");
secondaryActionHandler = this.props.onForgetClick;
} }
break; break;
} }
case MessageCase.Banned: { case MessageCase.Banned: {
const { memberName, reason } = this.getKickOrBanInfo(); const { memberName, reason } = this.getKickOrBanInfo();
title = _t("You were banned from %(roomName)s by %(memberName)s", if (roomName) {
{ memberName, roomName: this.roomName() }); title = _t("You were banned from %(roomName)s by %(memberName)s", { memberName, roomName });
} else {
title = _t("You were banned by %(memberName)s", { memberName });
}
subTitle = reason ? _t("Reason: %(reason)s", { reason }) : null; subTitle = reason ? _t("Reason: %(reason)s", { reason }) : null;
if (isSpace) {
primaryActionLabel = _t("Forget this space");
} else {
primaryActionLabel = _t("Forget this room"); primaryActionLabel = _t("Forget this room");
}
primaryActionHandler = this.props.onForgetClick; primaryActionHandler = this.props.onForgetClick;
break; break;
} }
case MessageCase.OtherThreePIDError: { case MessageCase.OtherThreePIDError: {
title = _t("Something went wrong with your invite to %(roomName)s", if (roomName) {
{ roomName: this.roomName() }); title = _t("Something went wrong with your invite to %(roomName)s", { roomName });
} else {
title = _t("Something went wrong with your invite.");
}
const joinRule = this.joinRule(); const joinRule = this.joinRule();
const errCodeMessage = _t( const errCodeMessage = _t(
"An error (%(errcode)s) was returned while trying to validate your " + "An error (%(errcode)s) was returned while trying to validate your " +
"invite. You could try to pass this information on to a room admin.", "invite. You could try to pass this information on to the person who invited you.",
{ errcode: this.state.threePidFetchError.errcode || _t("unknown error code") }, { errcode: this.state.threePidFetchError.errcode || _t("unknown error code") },
); );
switch (joinRule) { switch (joinRule) {
@ -381,7 +396,7 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
primaryActionHandler = this.props.onJoinClick; primaryActionHandler = this.props.onJoinClick;
break; break;
case "public": case "public":
subTitle = _t("You can still join it because this is a public room."); subTitle = _t("You can still join here.");
primaryActionLabel = _t("Join the discussion"); primaryActionLabel = _t("Join the discussion");
primaryActionHandler = this.props.onJoinClick; primaryActionHandler = this.props.onJoinClick;
break; break;
@ -394,14 +409,22 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
break; break;
} }
case MessageCase.InvitedEmailNotFoundInAccount: { case MessageCase.InvitedEmailNotFoundInAccount: {
if (roomName) {
title = _t( title = _t(
"This invite to %(roomName)s was sent to %(email)s which is not " + "This invite to %(roomName)s was sent to %(email)s which is not " +
"associated with your account", "associated with your account",
{ {
roomName: this.roomName(), roomName,
email: this.props.invitedEmail, email: this.props.invitedEmail,
}, },
); );
} else {
title = _t(
"This invite was sent to %(email)s which is not associated with your account",
{ email: this.props.invitedEmail },
);
}
subTitle = _t( subTitle = _t(
"Link this email with your account in Settings to receive invites " + "Link this email with your account in Settings to receive invites " +
"directly in %(brand)s.", "directly in %(brand)s.",
@ -412,13 +435,18 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
break; break;
} }
case MessageCase.InvitedEmailNoIdentityServer: { case MessageCase.InvitedEmailNoIdentityServer: {
if (roomName) {
title = _t( title = _t(
"This invite to %(roomName)s was sent to %(email)s", "This invite to %(roomName)s was sent to %(email)s",
{ {
roomName: this.roomName(), roomName,
email: this.props.invitedEmail, email: this.props.invitedEmail,
}, },
); );
} else {
title = _t("This invite was sent to %(email)s", { email: this.props.invitedEmail });
}
subTitle = _t( subTitle = _t(
"Use an identity server in Settings to receive invites directly in %(brand)s.", "Use an identity server in Settings to receive invites directly in %(brand)s.",
{ brand }, { brand },
@ -428,13 +456,18 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
break; break;
} }
case MessageCase.InvitedEmailMismatch: { case MessageCase.InvitedEmailMismatch: {
if (roomName) {
title = _t( title = _t(
"This invite to %(roomName)s was sent to %(email)s", "This invite to %(roomName)s was sent to %(email)s",
{ {
roomName: this.roomName(), roomName,
email: this.props.invitedEmail, email: this.props.invitedEmail,
}, },
); );
} else {
title = _t("This invite was sent to %(email)s", { email: this.props.invitedEmail });
}
subTitle = _t( subTitle = _t(
"Share this email in Settings to receive invites directly in %(brand)s.", "Share this email in Settings to receive invites directly in %(brand)s.",
{ brand }, { brand },
@ -460,16 +493,14 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
const isDM = this.isDMInvite(); const isDM = this.isDMInvite();
if (isDM) { if (isDM) {
title = _t("Do you want to chat with %(user)s?", title = _t("Do you want to chat with %(user)s?", { user: inviteMember.name });
{ user: inviteMember.name });
subTitle = [ subTitle = [
avatar, avatar,
_t("<userName/> wants to chat", {}, { userName: () => inviterElement }), _t("<userName/> wants to chat", {}, { userName: () => inviterElement }),
]; ];
primaryActionLabel = _t("Start chatting"); primaryActionLabel = _t("Start chatting");
} else { } else {
title = _t("Do you want to join %(roomName)s?", title = _t("Do you want to join %(roomName)s?", { roomName });
{ roomName: this.roomName() });
subTitle = [ subTitle = [
avatar, avatar,
_t("<userName/> invited you", {}, { userName: () => inviterElement }), _t("<userName/> invited you", {}, { userName: () => inviterElement }),
@ -502,27 +533,35 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
} }
case MessageCase.ViewingRoom: { case MessageCase.ViewingRoom: {
if (this.props.canPreview) { if (this.props.canPreview) {
title = _t("You're previewing %(roomName)s. Want to join it?", title = _t("You're previewing %(roomName)s. Want to join it?", { roomName });
{ roomName: this.roomName() }); } else if (roomName) {
title = _t("%(roomName)s can't be previewed. Do you want to join it?", { roomName });
} else { } else {
title = _t("%(roomName)s can't be previewed. Do you want to join it?", title = _t("There's no preview, would you like to join?");
{ roomName: this.roomName(true) });
} }
primaryActionLabel = _t("Join the discussion"); primaryActionLabel = _t("Join the discussion");
primaryActionHandler = this.props.onJoinClick; primaryActionHandler = this.props.onJoinClick;
break; break;
} }
case MessageCase.RoomNotFound: { case MessageCase.RoomNotFound: {
title = _t("%(roomName)s does not exist.", { roomName: this.roomName(true) }); if (roomName) {
subTitle = _t("This room doesn't exist. Are you sure you're at the right place?"); title = _t("%(roomName)s does not exist.", { roomName });
} else {
title = _t("This room or space does not exist.");
}
subTitle = _t("Are you sure you're at the right place?");
break; break;
} }
case MessageCase.OtherError: { case MessageCase.OtherError: {
title = _t("%(roomName)s is not accessible at this time.", { roomName: this.roomName(true) }); if (roomName) {
title = _t("%(roomName)s is not accessible at this time.", { roomName });
} else {
title = _t("This room or space is not accessible at this time.");
}
subTitle = [ subTitle = [
_t("Try again later, or ask a room admin to check if you have access."), _t("Try again later, or ask a room or space admin to check if you have access."),
_t( _t(
"%(errcode)s was returned while trying to access the room. " + "%(errcode)s was returned while trying to access the room or space. " +
"If you think you're seeing this message in error, please " + "If you think you're seeing this message in error, please " +
"<issueLink>submit a bug report</issueLink>.", "<issueLink>submit a bug report</issueLink>.",
{ errcode: this.props.error.errcode }, { errcode: this.props.error.errcode },

View file

@ -99,6 +99,7 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
render() { render() {
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
const room = client.getRoom(this.props.roomId); const room = client.getRoom(this.props.roomId);
const isSpace = room.isSpaceRoom();
let unfederatableSection; let unfederatableSection;
const createEvent = room.currentState.getStateEvents(EventType.RoomCreate, ''); const createEvent = room.currentState.getStateEvents(EventType.RoomCreate, '');
@ -122,7 +123,9 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
) } ) }
</p> </p>
<AccessibleButton onClick={this.upgradeRoom} kind='primary'> <AccessibleButton onClick={this.upgradeRoom} kind='primary'>
{ _t("Upgrade this room to the recommended room version") } { isSpace
? _t("Upgrade this space to the recommended room version")
: _t("Upgrade this room to the recommended room version") }
</AccessibleButton> </AccessibleButton>
</div> </div>
); );
@ -130,12 +133,16 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
let oldRoomLink; let oldRoomLink;
if (this.state.oldRoomId) { if (this.state.oldRoomId) {
let name = _t("this room"); let copy: string;
const room = MatrixClientPeg.get().getRoom(this.props.roomId); if (isSpace) {
if (room && room.name) name = room.name; copy = _t("View older version of %(spaceName)s.", { spaceName: room.name });
} else {
copy = _t("View older messages in %(roomName)s.", { roomName: room.name });
}
oldRoomLink = ( oldRoomLink = (
<AccessibleButton element='a' onClick={this.onOldRoomClicked}> <AccessibleButton element='a' onClick={this.onOldRoomClicked}>
{ _t("View older messages in %(roomName)s.", { roomName: name }) } { copy }
</AccessibleButton> </AccessibleButton>
); );
} }

View file

@ -384,7 +384,7 @@
"Custom (%(level)s)": "Custom (%(level)s)", "Custom (%(level)s)": "Custom (%(level)s)",
"Failed to invite": "Failed to invite", "Failed to invite": "Failed to invite",
"Operation failed": "Operation failed", "Operation failed": "Operation failed",
"Failed to invite users to the room:": "Failed to invite users to the room:", "Failed to invite users to %(roomName)s": "Failed to invite users to %(roomName)s",
"We sent the others, but the below people couldn't be invited to <RoomName/>": "We sent the others, but the below people couldn't be invited to <RoomName/>", "We sent the others, but the below people couldn't be invited to <RoomName/>": "We sent the others, but the below people couldn't be invited to <RoomName/>",
"Some invites couldn't be sent": "Some invites couldn't be sent", "Some invites couldn't be sent": "Some invites couldn't be sent",
"%(space1Name)s and %(space2Name)s": "%(space1Name)s and %(space2Name)s", "%(space1Name)s and %(space2Name)s": "%(space1Name)s and %(space2Name)s",
@ -694,12 +694,16 @@
"This room is used for important messages from the Homeserver, so you cannot leave it.": "This room is used for important messages from the Homeserver, so you cannot leave it.", "This room is used for important messages from the Homeserver, so you cannot leave it.": "This room is used for important messages from the Homeserver, so you cannot leave it.",
"Error leaving room": "Error leaving room", "Error leaving room": "Error leaving room",
"Unrecognised address": "Unrecognised address", "Unrecognised address": "Unrecognised address",
"You do not have permission to invite people to this space.": "You do not have permission to invite people to this space.",
"You do not have permission to invite people to this room.": "You do not have permission to invite people to this room.", "You do not have permission to invite people to this room.": "You do not have permission to invite people to this room.",
"User %(userId)s is already invited to the room": "User %(userId)s is already invited to the room", "User is already invited to the space": "User is already invited to the space",
"User %(userId)s is already in the room": "User %(userId)s is already in the room", "User is already invited to the room": "User is already invited to the room",
"User %(user_id)s does not exist": "User %(user_id)s does not exist", "User is already in the space": "User is already in the space",
"User %(user_id)s may or may not exist": "User %(user_id)s may or may not exist", "User is already in the room": "User is already in the room",
"User does not exist": "User does not exist",
"User may or may not exist": "User may or may not exist",
"The user must be unbanned before they can be invited.": "The user must be unbanned before they can be invited.", "The user must be unbanned before they can be invited.": "The user must be unbanned before they can be invited.",
"The user's homeserver does not support the version of the space.": "The user's homeserver does not support the version of the space.",
"The user's homeserver does not support the version of the room.": "The user's homeserver does not support the version of the room.", "The user's homeserver does not support the version of the room.": "The user's homeserver does not support the version of the room.",
"Unknown server error": "Unknown server error", "Unknown server error": "Unknown server error",
"Use a few words, avoid common phrases": "Use a few words, avoid common phrases", "Use a few words, avoid common phrases": "Use a few words, avoid common phrases",
@ -815,12 +819,12 @@
"Update %(brand)s": "Update %(brand)s", "Update %(brand)s": "Update %(brand)s",
"New version of %(brand)s is available": "New version of %(brand)s is available", "New version of %(brand)s is available": "New version of %(brand)s is available",
"Guest": "Guest", "Guest": "Guest",
"There was an error joining the room": "There was an error joining the room", "There was an error joining.": "There was an error joining.",
"Sorry, your homeserver is too old to participate in this room.": "Sorry, your homeserver is too old to participate in this room.", "Sorry, your homeserver is too old to participate here.": "Sorry, your homeserver is too old to participate here.",
"Please contact your homeserver administrator.": "Please contact your homeserver administrator.", "Please contact your homeserver administrator.": "Please contact your homeserver administrator.",
"The person who invited you already left the room.": "The person who invited you already left the room.", "The person who invited you has already left.": "The person who invited you has already left.",
"The person who invited you already left the room, or their server is offline.": "The person who invited you already left the room, or their server is offline.", "The person who invited you has already left, or their server is offline.": "The person who invited you has already left, or their server is offline.",
"Failed to join room": "Failed to join room", "Failed to join": "Failed to join",
"All rooms": "All rooms", "All rooms": "All rooms",
"Home": "Home", "Home": "Home",
"Favourites": "Favourites", "Favourites": "Favourites",
@ -1518,8 +1522,9 @@
"Voice & Video": "Voice & Video", "Voice & Video": "Voice & Video",
"This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers", "This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers",
"<b>Warning</b>: Upgrading a room will <i>not automatically migrate room members to the new version of the room.</i> We'll post a link to the new room in the old version of the room - room members will have to click this link to join the new room.": "<b>Warning</b>: Upgrading a room will <i>not automatically migrate room members to the new version of the room.</i> We'll post a link to the new room in the old version of the room - room members will have to click this link to join the new room.", "<b>Warning</b>: Upgrading a room will <i>not automatically migrate room members to the new version of the room.</i> We'll post a link to the new room in the old version of the room - room members will have to click this link to join the new room.": "<b>Warning</b>: Upgrading a room will <i>not automatically migrate room members to the new version of the room.</i> We'll post a link to the new room in the old version of the room - room members will have to click this link to join the new room.",
"Upgrade this space to the recommended room version": "Upgrade this space to the recommended room version",
"Upgrade this room to the recommended room version": "Upgrade this room to the recommended room version", "Upgrade this room to the recommended room version": "Upgrade this room to the recommended room version",
"this room": "this room", "View older version of %(spaceName)s.": "View older version of %(spaceName)s.",
"View older messages in %(roomName)s.": "View older messages in %(roomName)s.", "View older messages in %(roomName)s.": "View older messages in %(roomName)s.",
"Space information": "Space information", "Space information": "Space information",
"Internal room ID": "Internal room ID", "Internal room ID": "Internal room ID",
@ -1779,29 +1784,35 @@
"Currently removing messages in %(count)s rooms|one": "Currently removing messages in %(count)s room", "Currently removing messages in %(count)s rooms|one": "Currently removing messages in %(count)s room",
"%(spaceName)s menu": "%(spaceName)s menu", "%(spaceName)s menu": "%(spaceName)s menu",
"Home options": "Home options", "Home options": "Home options",
"This room": "This room",
"Joining space …": "Joining space …", "Joining space …": "Joining space …",
"Joining room …": "Joining room …", "Joining room …": "Joining room …",
"Joining …": "Joining …",
"Loading …": "Loading …", "Loading …": "Loading …",
"Rejecting invite …": "Rejecting invite …", "Rejecting invite …": "Rejecting invite …",
"Join the conversation with an account": "Join the conversation with an account", "Join the conversation with an account": "Join the conversation with an account",
"Sign Up": "Sign Up", "Sign Up": "Sign Up",
"Loading room preview": "Loading room preview", "Loading preview": "Loading preview",
"You were removed from %(roomName)s by %(memberName)s": "You were removed from %(roomName)s by %(memberName)s", "You were removed from %(roomName)s by %(memberName)s": "You were removed from %(roomName)s by %(memberName)s",
"You were removed by %(memberName)s": "You were removed by %(memberName)s",
"Reason: %(reason)s": "Reason: %(reason)s", "Reason: %(reason)s": "Reason: %(reason)s",
"Forget this space": "Forget this space",
"Forget this room": "Forget this room", "Forget this room": "Forget this room",
"Re-join": "Re-join", "Re-join": "Re-join",
"You were banned from %(roomName)s by %(memberName)s": "You were banned from %(roomName)s by %(memberName)s", "You were banned from %(roomName)s by %(memberName)s": "You were banned from %(roomName)s by %(memberName)s",
"You were banned by %(memberName)s": "You were banned by %(memberName)s",
"Something went wrong with your invite to %(roomName)s": "Something went wrong with your invite to %(roomName)s", "Something went wrong with your invite to %(roomName)s": "Something went wrong with your invite to %(roomName)s",
"An error (%(errcode)s) was returned while trying to validate your invite. You could try to pass this information on to a room admin.": "An error (%(errcode)s) was returned while trying to validate your invite. You could try to pass this information on to a room admin.", "Something went wrong with your invite.": "Something went wrong with your invite.",
"An error (%(errcode)s) was returned while trying to validate your invite. You could try to pass this information on to the person who invited you.": "An error (%(errcode)s) was returned while trying to validate your invite. You could try to pass this information on to the person who invited you.",
"unknown error code": "unknown error code", "unknown error code": "unknown error code",
"You can only join it with a working invite.": "You can only join it with a working invite.", "You can only join it with a working invite.": "You can only join it with a working invite.",
"Try to join anyway": "Try to join anyway", "Try to join anyway": "Try to join anyway",
"You can still join it because this is a public room.": "You can still join it because this is a public room.", "You can still join here.": "You can still join here.",
"Join the discussion": "Join the discussion", "Join the discussion": "Join the discussion",
"This invite to %(roomName)s was sent to %(email)s which is not associated with your account": "This invite to %(roomName)s was sent to %(email)s which is not associated with your account", "This invite to %(roomName)s was sent to %(email)s which is not associated with your account": "This invite to %(roomName)s was sent to %(email)s which is not associated with your account",
"This invite was sent to %(email)s which is not associated with your account": "This invite was sent to %(email)s which is not associated with your account",
"Link this email with your account in Settings to receive invites directly in %(brand)s.": "Link this email with your account in Settings to receive invites directly in %(brand)s.", "Link this email with your account in Settings to receive invites directly in %(brand)s.": "Link this email with your account in Settings to receive invites directly in %(brand)s.",
"This invite to %(roomName)s was sent to %(email)s": "This invite to %(roomName)s was sent to %(email)s", "This invite to %(roomName)s was sent to %(email)s": "This invite to %(roomName)s was sent to %(email)s",
"This invite was sent to %(email)s": "This invite was sent to %(email)s",
"Use an identity server in Settings to receive invites directly in %(brand)s.": "Use an identity server in Settings to receive invites directly in %(brand)s.", "Use an identity server in Settings to receive invites directly in %(brand)s.": "Use an identity server in Settings to receive invites directly in %(brand)s.",
"Share this email in Settings to receive invites directly in %(brand)s.": "Share this email in Settings to receive invites directly in %(brand)s.", "Share this email in Settings to receive invites directly in %(brand)s.": "Share this email in Settings to receive invites directly in %(brand)s.",
"Do you want to chat with %(user)s?": "Do you want to chat with %(user)s?", "Do you want to chat with %(user)s?": "Do you want to chat with %(user)s?",
@ -1813,11 +1824,14 @@
"Reject & Ignore user": "Reject & Ignore user", "Reject & Ignore user": "Reject & Ignore user",
"You're previewing %(roomName)s. Want to join it?": "You're previewing %(roomName)s. Want to join it?", "You're previewing %(roomName)s. Want to join it?": "You're previewing %(roomName)s. Want to join it?",
"%(roomName)s can't be previewed. Do you want to join it?": "%(roomName)s can't be previewed. Do you want to join it?", "%(roomName)s can't be previewed. Do you want to join it?": "%(roomName)s can't be previewed. Do you want to join it?",
"There's no preview, would you like to join?": "There's no preview, would you like to join?",
"%(roomName)s does not exist.": "%(roomName)s does not exist.", "%(roomName)s does not exist.": "%(roomName)s does not exist.",
"This room doesn't exist. Are you sure you're at the right place?": "This room doesn't exist. Are you sure you're at the right place?", "This room or space does not exist.": "This room or space does not exist.",
"Are you sure you're at the right place?": "Are you sure you're at the right place?",
"%(roomName)s is not accessible at this time.": "%(roomName)s is not accessible at this time.", "%(roomName)s is not accessible at this time.": "%(roomName)s is not accessible at this time.",
"Try again later, or ask a room admin to check if you have access.": "Try again later, or ask a room admin to check if you have access.", "This room or space is not accessible at this time.": "This room or space is not accessible at this time.",
"%(errcode)s was returned while trying to access the room. If you think you're seeing this message in error, please <issueLink>submit a bug report</issueLink>.": "%(errcode)s was returned while trying to access the room. If you think you're seeing this message in error, please <issueLink>submit a bug report</issueLink>.", "Try again later, or ask a room or space admin to check if you have access.": "Try again later, or ask a room or space admin to check if you have access.",
"%(errcode)s was returned while trying to access the room or space. If you think you're seeing this message in error, please <issueLink>submit a bug report</issueLink>.": "%(errcode)s was returned while trying to access the room or space. If you think you're seeing this message in error, please <issueLink>submit a bug report</issueLink>.",
"Appearance": "Appearance", "Appearance": "Appearance",
"Show rooms with unread messages first": "Show rooms with unread messages first", "Show rooms with unread messages first": "Show rooms with unread messages first",
"Show previews of messages": "Show previews of messages", "Show previews of messages": "Show previews of messages",

View file

@ -379,14 +379,14 @@ class RoomViewStore extends Store<ActionPayload> {
} }
public showJoinRoomError(err: MatrixError, roomId: string) { public showJoinRoomError(err: MatrixError, roomId: string) {
let msg: ReactNode = err.message ? err.message : JSON.stringify(err); let description: ReactNode = err.message ? err.message : JSON.stringify(err);
logger.log("Failed to join room:", msg); logger.log("Failed to join room:", description);
if (err.name === "ConnectionError") { if (err.name === "ConnectionError") {
msg = _t("There was an error joining the room"); description = _t("There was an error joining.");
} else if (err.errcode === 'M_INCOMPATIBLE_ROOM_VERSION') { } else if (err.errcode === 'M_INCOMPATIBLE_ROOM_VERSION') {
msg = <div> description = <div>
{ _t("Sorry, your homeserver is too old to participate in this room.") }<br /> { _t("Sorry, your homeserver is too old to participate here.") }<br />
{ _t("Please contact your homeserver administrator.") } { _t("Please contact your homeserver administrator.") }
</div>; </div>;
} else if (err.httpStatus === 404) { } else if (err.httpStatus === 404) {
@ -395,9 +395,9 @@ class RoomViewStore extends Store<ActionPayload> {
if (invitingUserId) { if (invitingUserId) {
// if the inviting user is on the same HS, there can only be one cause: they left. // if the inviting user is on the same HS, there can only be one cause: they left.
if (invitingUserId.endsWith(`:${MatrixClientPeg.get().getDomain()}`)) { if (invitingUserId.endsWith(`:${MatrixClientPeg.get().getDomain()}`)) {
msg = _t("The person who invited you already left the room."); description = _t("The person who invited you has already left.");
} else { } else {
msg = _t("The person who invited you already left the room, or their server is offline."); description = _t("The person who invited you has already left, or their server is offline.");
} }
} }
} }
@ -405,8 +405,8 @@ class RoomViewStore extends Store<ActionPayload> {
// FIXME: Using an import will result in test failures // FIXME: Using an import will result in test failures
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Failed to join room', '', ErrorDialog, { Modal.createTrackedDialog('Failed to join room', '', ErrorDialog, {
title: _t("Failed to join room"), title: _t("Failed to join"),
description: msg, description,
}); });
} }

View file

@ -203,18 +203,32 @@ export default class MultiInviter {
logger.error(err); logger.error(err);
let errorText; const isSpace = this.roomId && this.matrixClient.getRoom(this.roomId)?.isSpaceRoom();
let errorText: string;
let fatal = false; let fatal = false;
switch (err.errcode) { switch (err.errcode) {
case "M_FORBIDDEN": case "M_FORBIDDEN":
if (isSpace) {
errorText = _t('You do not have permission to invite people to this space.');
} else {
errorText = _t('You do not have permission to invite people to this room.'); errorText = _t('You do not have permission to invite people to this room.');
}
fatal = true; fatal = true;
break; break;
case USER_ALREADY_INVITED: case USER_ALREADY_INVITED:
errorText = _t("User %(userId)s is already invited to the room", { userId: address }); if (isSpace) {
errorText = _t("User is already invited to the space");
} else {
errorText = _t("User is already invited to the room");
}
break; break;
case USER_ALREADY_JOINED: case USER_ALREADY_JOINED:
errorText = _t("User %(userId)s is already in the room", { userId: address }); if (isSpace) {
errorText = _t("User is already in the space");
} else {
errorText = _t("User is already in the room");
}
break; break;
case "M_LIMIT_EXCEEDED": case "M_LIMIT_EXCEEDED":
// we're being throttled so wait a bit & try again // we're being throttled so wait a bit & try again
@ -224,10 +238,10 @@ export default class MultiInviter {
return; return;
case "M_NOT_FOUND": case "M_NOT_FOUND":
case "M_USER_NOT_FOUND": case "M_USER_NOT_FOUND":
errorText = _t("User %(user_id)s does not exist", { user_id: address }); errorText = _t("User does not exist");
break; break;
case "M_PROFILE_UNDISCLOSED": case "M_PROFILE_UNDISCLOSED":
errorText = _t("User %(user_id)s may or may not exist", { user_id: address }); errorText = _t("User may or may not exist");
break; break;
case "M_PROFILE_NOT_FOUND": case "M_PROFILE_NOT_FOUND":
if (!ignoreProfile) { if (!ignoreProfile) {
@ -241,7 +255,11 @@ export default class MultiInviter {
errorText = _t("The user must be unbanned before they can be invited."); errorText = _t("The user must be unbanned before they can be invited.");
break; break;
case "M_UNSUPPORTED_ROOM_VERSION": case "M_UNSUPPORTED_ROOM_VERSION":
if (isSpace) {
errorText = _t("The user's homeserver does not support the version of the space.");
} else {
errorText = _t("The user's homeserver does not support the version of the room."); errorText = _t("The user's homeserver does not support the version of the room.");
}
break; break;
} }

View file

@ -108,7 +108,7 @@ describe('<RoomPreviewBar />', () => {
const component = getComponent({ joining: true }); const component = getComponent({ joining: true });
expect(isSpinnerRendered(component)).toBeTruthy(); expect(isSpinnerRendered(component)).toBeTruthy();
expect(getMessage(component).textContent).toEqual('Joining room …'); expect(getMessage(component).textContent).toEqual('Joining …');
}); });
it('renders rejecting message', () => { it('renders rejecting message', () => {
const component = getComponent({ rejecting: true }); const component = getComponent({ rejecting: true });

View file

@ -54,11 +54,11 @@ exports[`<RoomPreviewBar /> with an error renders other errors 1`] = `
RoomPreviewBar-test-room is not accessible at this time. RoomPreviewBar-test-room is not accessible at this time.
</h3> </h3>
<p> <p>
Try again later, or ask a room admin to check if you have access. Try again later, or ask a room or space admin to check if you have access.
</p> </p>
<p> <p>
<span> <span>
Something_else was returned while trying to access the room. If you think you're seeing this message in error, please Something_else was returned while trying to access the room or space. If you think you're seeing this message in error, please
<a <a
href="https://github.com/vector-im/element-web/issues/new/choose" href="https://github.com/vector-im/element-web/issues/new/choose"
rel="noreferrer noopener" rel="noreferrer noopener"
@ -80,7 +80,7 @@ exports[`<RoomPreviewBar /> with an error renders room not found error 1`] = `
RoomPreviewBar-test-room does not exist. RoomPreviewBar-test-room does not exist.
</h3> </h3>
<p> <p>
This room doesn't exist. Are you sure you're at the right place? Are you sure you're at the right place?
</p> </p>
</div> </div>
`; `;
@ -93,7 +93,7 @@ exports[`<RoomPreviewBar /> with an invite with an invited email when client fai
Something went wrong with your invite to RoomPreviewBar-test-room Something went wrong with your invite to RoomPreviewBar-test-room
</h3> </h3>
<p> <p>
An error (unknown error code) was returned while trying to validate your invite. You could try to pass this information on to a room admin. An error (unknown error code) was returned while trying to validate your invite. You could try to pass this information on to the person who invited you.
</p> </p>
</div> </div>
`; `;