COR-192 Don't set status if it's the same
This commit is contained in:
parent
80bb3b0581
commit
46aade557d
@ -16,8 +16,10 @@ const ConnectionInfoContextMenu: FC<ConnectionInfoContextMenuProps> = (props: Co
|
||||
const { guild, selfMember, relativeToRef, close, setOverlay } = props;
|
||||
|
||||
const setSelfStatus = useCallback(async (status: string) => {
|
||||
await guild.requestSetStatus(status);
|
||||
}, [ guild ]);
|
||||
if (selfMember.status !== status) {
|
||||
await guild.requestSetStatus(status);
|
||||
}
|
||||
}, [ guild, selfMember ]);
|
||||
|
||||
const statusElements = useMemo(() => {
|
||||
return [ 'online', 'away', 'busy', 'invisible' ].map(status => {
|
||||
|
@ -634,12 +634,16 @@ function bindActionEvents(io: socketio.Server, client: socketio.Socket, identity
|
||||
|
||||
LOG.info(`u#${identity.memberId}: setting status to ${status}`);
|
||||
|
||||
const before = await DB.getMember(identity.guildId, identity.memberId);
|
||||
await DB.setMemberStatus(identity.guildId, identity.memberId, status);
|
||||
const updated = await DB.getMember(identity.guildId, identity.memberId);
|
||||
|
||||
respond(null, updated);
|
||||
|
||||
io.to(identity.guildId).emit('update-member', updated);
|
||||
|
||||
if (before.status !== updated.status) {
|
||||
// Only send the update event if it actually changed
|
||||
io.to(identity.guildId).emit('update-member', updated);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user