mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +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,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`identifier` varchar(48) DEFAULT NULL,
|
`identifier` varchar(48) DEFAULT NULL,
|
||||||
`avatar` varchar(512) DEFAULT NULL,
|
`avatar` varchar(512) DEFAULT NULL,
|
||||||
`number` varchar(10) DEFAULT NULL,
|
`number` varchar(12) DEFAULT NULL,
|
||||||
`display` varchar(255) NOT NULL DEFAULT '',
|
`display` varchar(255) NOT NULL DEFAULT '',
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -72,10 +72,10 @@ export const DialerHistory = ({ calls }) => {
|
|||||||
/>
|
/>
|
||||||
<IconButton onClick={() => handleCall(call.receiver)}>{<PhoneIcon />}</IconButton>
|
<IconButton onClick={() => handleCall(call.receiver)}>{<PhoneIcon />}</IconButton>
|
||||||
|
|
||||||
{getDisplayByNumber(call.transmitter) === call.transmitter && (
|
{getDisplayByNumber(call.receiver) === call.receiver && (
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)
|
history.push(`/contacts/-1?addNumber=${call.receiver}&referal=/phone/contacts`)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<PersonAddIcon />
|
<PersonAddIcon />
|
||||||
|
|||||||
@@ -118,6 +118,9 @@ onNet(PhoneEvents.PLAYER_IS_READY, (ready: boolean) => {
|
|||||||
isPlayerReady = ready;
|
isPlayerReady = ready;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onNet(PhoneEvents.SEND_CREDENTIALS, (number: string) => {
|
||||||
|
sendMessage('SIMCARD', PhoneEvents.SET_NUMBER, number)
|
||||||
|
})
|
||||||
AddEventHandler('onResourceStop', function (resource: string) {
|
AddEventHandler('onResourceStop', function (resource: string) {
|
||||||
if (resource === GetCurrentResourceName()) {
|
if (resource === GetCurrentResourceName()) {
|
||||||
sendMessage('PHONE', PhoneEvents.SET_VISIBILITY, false);
|
sendMessage('PHONE', PhoneEvents.SET_VISIBILITY, false);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class CallsService {
|
|||||||
|
|
||||||
const channelId = src;
|
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`);
|
callLogger.debug(`Call with key ${transmitterNumber} was updated to be accepted`);
|
||||||
|
|
||||||
// player who is being called
|
// player who is being called
|
||||||
@@ -172,6 +172,8 @@ class CallsService {
|
|||||||
emitNet(CallEvents.SEND_HANGUP_ANIM, currentCall.transmitterSource);
|
emitNet(CallEvents.SEND_HANGUP_ANIM, currentCall.transmitterSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.callsDB.updateCall(currentCall, true, endCallTimeUnix);
|
||||||
|
|
||||||
// Clear from memory
|
// Clear from memory
|
||||||
this.callMap.delete(transmitterNumber);
|
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.
|
// This has to be an event as FXServer does not yet support exports which return a promise.
|
||||||
on('npwd:newPlayer', async (playerDTO: PlayerAddData) => {
|
on('npwd:newPlayer', async (playerDTO: PlayerAddData) => {
|
||||||
if (typeof playerDTO.source !== 'number') {
|
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('Receive newPlayer event, data:');
|
||||||
playerLogger.debug(playerDTO);
|
playerLogger.debug(playerDTO);
|
||||||
|
|||||||
@@ -3,13 +3,14 @@ import { mainLogger } from './sv_logger';
|
|||||||
import { PhoneEvents } from '../../typings/phone';
|
import { PhoneEvents } from '../../typings/phone';
|
||||||
import PlayerService from './players/player.service';
|
import PlayerService from './players/player.service';
|
||||||
import { getSource } from './utils/miscUtils';
|
import { getSource } from './utils/miscUtils';
|
||||||
|
import { config } from './server';
|
||||||
|
|
||||||
interface Credentials {
|
interface Credentials {
|
||||||
phone_number: string;
|
phone_number: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCredentials(identifier: string): Promise<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 [result] = await pool.query(query, [identifier]);
|
||||||
const number = <Credentials[]>result;
|
const number = <Credentials[]>result;
|
||||||
if (number.length === 0) return '###-####';
|
if (number.length === 0) return '###-####';
|
||||||
|
|||||||
Reference in new issue
Block a user