mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
fix(phone/messages): change how we get source | remove useEffect for parts
This commit is contained in:
1 parent
be479d75cc
commit
15d7d3dcea
2 files changed
+5
-6
No files matched your search
@@ -19,8 +19,6 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
|
|||||||
const [participants, setParticipants] = useState('');
|
const [participants, setParticipants] = useState('');
|
||||||
const [label, setLabel] = useState('');
|
const [label, setLabel] = useState('');
|
||||||
|
|
||||||
useEffect(() => phoneNumber && setParticipants(phoneNumber), [phoneNumber]);
|
|
||||||
|
|
||||||
// handles phone numbers in a csv format and strips all spaces and
|
// handles phone numbers in a csv format and strips all spaces and
|
||||||
// external characters out of them:
|
// external characters out of them:
|
||||||
// 123-4567, 987-6543, 333-4444
|
// 123-4567, 987-6543, 333-4444
|
||||||
@@ -37,7 +35,7 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (phoneNumber) {
|
if (phoneNumber) {
|
||||||
sendNuiCreateMessageGroup({ parts: getGroupParts(phoneNumber), isGroupChat: false, labelValue });
|
sendNuiCreateMessageGroup({ parts: getGroupParts(phoneNumber), isGroupChat: false, labelValue: null });
|
||||||
history.push('/messages');
|
history.push('/messages');
|
||||||
}
|
}
|
||||||
}, [phoneNumber, labelValue, history, getGroupParts]);
|
}, [phoneNumber, labelValue, history, getGroupParts]);
|
||||||
|
|||||||
@@ -402,6 +402,7 @@ onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, async () => {
|
|||||||
onNet(
|
onNet(
|
||||||
events.MESSAGES_CREATE_MESSAGE_GROUP,
|
events.MESSAGES_CREATE_MESSAGE_GROUP,
|
||||||
async (phoneNumbers: string[], label: string = null) => {
|
async (phoneNumbers: string[], label: string = null) => {
|
||||||
|
const pSource = (global as any).source;
|
||||||
try {
|
try {
|
||||||
const _identifier = await useIdentifier();
|
const _identifier = await useIdentifier();
|
||||||
const result = await createMessageGroupsFromPhoneNumbers(
|
const result = await createMessageGroupsFromPhoneNumbers(
|
||||||
@@ -413,18 +414,18 @@ onNet(
|
|||||||
if (result.error) {
|
if (result.error) {
|
||||||
emitNet(
|
emitNet(
|
||||||
events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED,
|
events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED,
|
||||||
getSource(),
|
pSource,
|
||||||
result
|
result
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
emitNet(
|
emitNet(
|
||||||
events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS,
|
events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS,
|
||||||
getSource(),
|
pSource,
|
||||||
result
|
result
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, getSource());
|
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, pSource);
|
||||||
messageLogger.error(`Failed to create message group, ${e.message}`);
|
messageLogger.error(`Failed to create message group, ${e.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user