mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
Fix double call history & adding contact from history (#231)
This commit is contained in:
1 parent
488c8df5cb
commit
2411c39b95
6 files changed
+12
-6
No files matched your search
+1
-1
@@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS `npwd_phone_contacts` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(48) DEFAULT NULL,
|
||||
`avatar` varchar(512) DEFAULT NULL,
|
||||
`number` varchar(10) DEFAULT NULL,
|
||||
`number` varchar(12) DEFAULT NULL,
|
||||
`display` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
@@ -72,10 +72,10 @@ export const DialerHistory = ({ calls }) => {
|
||||
/>
|
||||
<IconButton onClick={() => handleCall(call.receiver)}>{<PhoneIcon />}</IconButton>
|
||||
|
||||
{getDisplayByNumber(call.transmitter) === call.transmitter && (
|
||||
{getDisplayByNumber(call.receiver) === call.receiver && (
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)
|
||||
history.push(`/contacts/-1?addNumber=${call.receiver}&referal=/phone/contacts`)
|
||||
}
|
||||
>
|
||||
<PersonAddIcon />
|
||||
|
||||
@@ -118,6 +118,9 @@ onNet(PhoneEvents.PLAYER_IS_READY, (ready: boolean) => {
|
||||
isPlayerReady = ready;
|
||||
});
|
||||
|
||||
onNet(PhoneEvents.SEND_CREDENTIALS, (number: string) => {
|
||||
sendMessage('SIMCARD', PhoneEvents.SET_NUMBER, number)
|
||||
})
|
||||
AddEventHandler('onResourceStop', function (resource: string) {
|
||||
if (resource === GetCurrentResourceName()) {
|
||||
sendMessage('PHONE', PhoneEvents.SET_VISIBILITY, false);
|
||||
|
||||
@@ -96,7 +96,7 @@ class CallsService {
|
||||
|
||||
const channelId = src;
|
||||
|
||||
await this.callsDB.saveCall(curCallAccepted);
|
||||
await this.callsDB.updateCall(curCallAccepted, true, null);
|
||||
callLogger.debug(`Call with key ${transmitterNumber} was updated to be accepted`);
|
||||
|
||||
// player who is being called
|
||||
@@ -172,6 +172,8 @@ class CallsService {
|
||||
emitNet(CallEvents.SEND_HANGUP_ANIM, currentCall.transmitterSource);
|
||||
}
|
||||
|
||||
await this.callsDB.updateCall(currentCall, true, endCallTimeUnix);
|
||||
|
||||
// Clear from memory
|
||||
this.callMap.delete(transmitterNumber);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ if (config.general.enableMultiChar) {
|
||||
// This has to be an event as FXServer does not yet support exports which return a promise.
|
||||
on('npwd:newPlayer', async (playerDTO: PlayerAddData) => {
|
||||
if (typeof playerDTO.source !== 'number') {
|
||||
return playerLogger.error('Source must be passed as a number when unloading a player');
|
||||
return playerLogger.error('Source must be passed as a number when loading a player');
|
||||
}
|
||||
playerLogger.debug('Receive newPlayer event, data:');
|
||||
playerLogger.debug(playerDTO);
|
||||
|
||||
@@ -3,13 +3,14 @@ import { mainLogger } from './sv_logger';
|
||||
import { PhoneEvents } from '../../typings/phone';
|
||||
import PlayerService from './players/player.service';
|
||||
import { getSource } from './utils/miscUtils';
|
||||
import { config } from './server';
|
||||
|
||||
interface Credentials {
|
||||
phone_number: string;
|
||||
}
|
||||
|
||||
async function getCredentials(identifier: string): Promise<string> {
|
||||
const query = 'SELECT phone_number FROM users WHERE identifier = ?';
|
||||
const query = `SELECT phone_number FROM ${config.database.playerTable} WHERE ${config.database.identifierColumn} = ?`;
|
||||
const [result] = await pool.query(query, [identifier]);
|
||||
const number = <Credentials[]>result;
|
||||
if (number.length === 0) return '###-####';
|
||||
|
||||
Reference in new issue
Block a user