Reactions from another device should show as yours

This commit is contained in:
ayumi-signal 2023-12-20 08:15:27 -08:00 committed by GitHub
parent b1edf2def1
commit fab72205c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,6 +37,7 @@ import {
GroupCallConnectionState, GroupCallConnectionState,
GroupCallJoinState, GroupCallJoinState,
} from '../types/Calling'; } from '../types/Calling';
import type { ServiceIdString } from '../types/ServiceId';
import { AvatarColors } from '../types/Colors'; import { AvatarColors } from '../types/Colors';
import type { ConversationType } from '../state/ducks/conversations'; import type { ConversationType } from '../state/ducks/conversations';
import { import {
@ -997,6 +998,10 @@ type CallingReactionsToastsType = {
function useReactionsToast(props: CallingReactionsToastsType): void { function useReactionsToast(props: CallingReactionsToastsType): void {
const { reactions, conversationsByDemuxId, localDemuxId, i18n } = props; const { reactions, conversationsByDemuxId, localDemuxId, i18n } = props;
const ourServiceId: ServiceIdString | undefined = localDemuxId
? conversationsByDemuxId.get(localDemuxId)?.serviceId
: undefined;
const [previousReactions, setPreviousReactions] = React.useState< const [previousReactions, setPreviousReactions] = React.useState<
ActiveCallReactionsType | undefined ActiveCallReactionsType | undefined
>(undefined); >(undefined);
@ -1012,6 +1017,7 @@ function useReactionsToast(props: CallingReactionsToastsType): void {
} }
reactions.forEach(({ timestamp, demuxId, value }) => { reactions.forEach(({ timestamp, demuxId, value }) => {
const conversation = conversationsByDemuxId.get(demuxId);
showToast({ showToast({
key: `reactions-${timestamp}-${demuxId}`, key: `reactions-${timestamp}-${demuxId}`,
onlyShowOnce: true, onlyShowOnce: true,
@ -1019,9 +1025,10 @@ function useReactionsToast(props: CallingReactionsToastsType): void {
content: ( content: (
<span className="CallingReactionsToasts__reaction"> <span className="CallingReactionsToasts__reaction">
<Emoji size={28} emoji={value} /> <Emoji size={28} emoji={value} />
{demuxId === localDemuxId {demuxId === localDemuxId ||
(ourServiceId && conversation?.serviceId === ourServiceId)
? i18n('icu:CallingReactions--me') ? i18n('icu:CallingReactions--me')
: conversationsByDemuxId.get(demuxId)?.title} : conversation?.title}
</span> </span>
), ),
}); });
@ -1033,6 +1040,7 @@ function useReactionsToast(props: CallingReactionsToastsType): void {
conversationsByDemuxId, conversationsByDemuxId,
localDemuxId, localDemuxId,
i18n, i18n,
ourServiceId,
]); ]);
} }