From 2d43de553a4fdefb980ca1744ccf68ba32d2f00a Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Tue, 14 Dec 2021 15:32:48 +0000
Subject: [PATCH] Tweak FacePile tooltip to include whether or not you are
included
---
src/components/views/elements/FacePile.tsx | 28 +++++++++++++++++-----
src/i18n/strings/en_EN.json | 6 ++++-
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/src/components/views/elements/FacePile.tsx b/src/components/views/elements/FacePile.tsx
index 0c19a7a63af..0ac43b06f37 100644
--- a/src/components/views/elements/FacePile.tsx
+++ b/src/components/views/elements/FacePile.tsx
@@ -38,7 +38,9 @@ const isKnownMember = (member: RoomMember) => !!DMRoomMap.shared().getDMRoomsFor
const FacePile = ({ room, onlyKnownUsers = true, numShown = DEFAULT_NUM_FACES, ...props }: IProps) => {
const cli = useContext(MatrixClientContext);
+ const isJoined = room.getMyMembership() === "join";
let members = useRoomMembers(room);
+ const count = members.length;
// sort users with an explicit avatar first
const iteratees = [member => !!member.getMxcAvatarUrl()];
@@ -59,19 +61,33 @@ const FacePile = ({ room, onlyKnownUsers = true, numShown = DEFAULT_NUM_FACES, .
let tooltip: ReactNode;
if (props.onClick) {
+ let subText: string;
+ if (isJoined) {
+ subText = _t("Including you, %(commaSeparatedMembers)s", { commaSeparatedMembers });
+ } else {
+ subText = _t("Including %(commaSeparatedMembers)s", { commaSeparatedMembers });
+ }
+
tooltip =
- { _t("View all %(count)s members", { count: members.length }) }
+ { _t("View all %(count)s members", { count }) }
- { _t("Including %(commaSeparatedMembers)s", { commaSeparatedMembers }) }
+ { subText }
;
} else {
- tooltip = _t("%(count)s members including %(commaSeparatedMembers)s", {
- count: members.length,
- commaSeparatedMembers,
- });
+ if (isJoined) {
+ tooltip = _t("%(count)s members including you, %(commaSeparatedMembers)s", {
+ count: count - 1,
+ commaSeparatedMembers,
+ });
+ } else {
+ tooltip = _t("%(count)s members including %(commaSeparatedMembers)s", {
+ count,
+ commaSeparatedMembers,
+ });
+ }
}
return
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 36a061706ed..6406ce728e3 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -2166,9 +2166,13 @@
"Please create a new issue on GitHub so that we can investigate this bug.": "Please create a new issue on GitHub so that we can investigate this bug.",
"collapse": "collapse",
"expand": "expand",
+ "Including you, %(commaSeparatedMembers)s": "Including you, %(commaSeparatedMembers)s",
+ "Including %(commaSeparatedMembers)s": "Including %(commaSeparatedMembers)s",
"View all %(count)s members|other": "View all %(count)s members",
"View all %(count)s members|one": "View 1 member",
- "Including %(commaSeparatedMembers)s": "Including %(commaSeparatedMembers)s",
+ "%(count)s members including you, %(commaSeparatedMembers)s|other": "%(count)s members including you, %(commaSeparatedMembers)s",
+ "%(count)s members including you, %(commaSeparatedMembers)s|zero": "You",
+ "%(count)s members including you, %(commaSeparatedMembers)s|one": "%(count)s members including you and %(commaSeparatedMembers)s",
"%(count)s members including %(commaSeparatedMembers)s|other": "%(count)s members including %(commaSeparatedMembers)s",
"%(count)s members including %(commaSeparatedMembers)s|one": "%(commaSeparatedMembers)s",
"%(count)s people you know have already joined|other": "%(count)s people you know have already joined",