mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
add configuration if we should generate profile_name from users
This commit is contained in:
1 parent
7eedec2229
commit
44622b8d8a
5 files changed
+64
-21
No files matched your search
@@ -17,6 +17,7 @@ import TwitterSearch from "./TwitterSearch";
|
||||
|
||||
import "./twitter.css";
|
||||
import "emoji-mart/css/emoji-mart.css";
|
||||
import { useProfile } from "../hooks/useProfile";
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
backgroundModal: {
|
||||
@@ -37,6 +38,9 @@ export const TwitterApp = () => {
|
||||
const classes = useStyles();
|
||||
const { modalVisible, setModalVisible } = useModal();
|
||||
const [activePage, setActivePage] = useState(0);
|
||||
const { profile } = useProfile();
|
||||
|
||||
console.log(profile);
|
||||
|
||||
useEffect(() => {
|
||||
Nui.send("phone:getOrCreateTwitterProfile", {});
|
||||
|
||||
@@ -23,8 +23,7 @@ Config.DestroyPhoneReCheck = 3 --MINUTES /// WIll wait the check for x MINUTES a
|
||||
--Twitter
|
||||
------
|
||||
Config.twitter = {}
|
||||
-- Config.twitter.registerByName = true -- if users can register by first_name and last_name from the users table
|
||||
-- Config.twitter.registerByPhoneNumber = true -- if users can register by phone_number from the users table
|
||||
Config.twitter.generateProfileNameFromUsers = true -- if the player's profile name should be generated from the users.first_name and users.last_name table
|
||||
Config.twitter.characterLimit = 240 -- character limit on tweet messages
|
||||
Config.twitter.allowEdtiableProfileName = true -- whether or not players can edit their profile names
|
||||
-- Config.twitter.enableLikes = true -- whether or not players can like other player's tweets and that they are visible
|
||||
|
||||
@@ -1 +1,44 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="%PUBLIC_URL%/favicon.ico"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/><link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><title>React App</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="main.js"></script></body></html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
|
||||
<!--
|
||||
Notice the use of in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
<script src="dev.js"></script></body>
|
||||
</html>
|
||||
@@ -23,7 +23,6 @@ CREATE TABLE `npwd_twitter_tweets` (
|
||||
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`likes` int NOT NULL DEFAULT '0',
|
||||
`identifier` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`realUser` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`visible` tinyint NOT NULL DEFAULT '1',
|
||||
`images` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
|
||||
@@ -60,12 +60,11 @@ ESX.RegisterServerCallback('phone:createTweet', function(source, cb, data)
|
||||
local _identifier = xPlayer.getIdentifier()
|
||||
|
||||
MySQL.Async.transaction({[[
|
||||
INSERT INTO npwd_twitter_tweets (`identifier`, `realUser`, `message`, `images`)
|
||||
VALUES (@identifier, @realUser, @message, @images)
|
||||
INSERT INTO npwd_twitter_tweets (`identifier`, `message`, `images`)
|
||||
VALUES (@identifier, @message, @images)
|
||||
]]},
|
||||
{
|
||||
identifier = _identifier,
|
||||
realUser = data.realUser,
|
||||
message = data.message,
|
||||
images = data.images
|
||||
},
|
||||
@@ -86,28 +85,27 @@ function getProfile(identifier, cb)
|
||||
end
|
||||
|
||||
function getProfileName(identifier, cb)
|
||||
local defaultProfileName = '' -- handle any edge cases where the user does not exist or their name isn't populated
|
||||
local defaultProfileName = ''
|
||||
if Config.twitter.generateProfileNameFromUsers == false then
|
||||
print('use default')
|
||||
cb(defaultProfileName)
|
||||
return
|
||||
end
|
||||
|
||||
-- TODO: make this query configurable
|
||||
MySQL.Async.fetchAll([[
|
||||
SELECT first_name, last_name
|
||||
SELECT CONCAT(first_name, '_', last_name) AS profile_name
|
||||
FROM users
|
||||
WHERE identifier = @identifier LIMIT 1
|
||||
]],
|
||||
{ identifier = identifier },
|
||||
function(users)
|
||||
-- no user found with this identifier
|
||||
if next(users) == nil then
|
||||
cb(defaultProfileName)
|
||||
return
|
||||
end
|
||||
|
||||
local first_name = users[1].first_name
|
||||
local last_name = users[1].last_name
|
||||
if (first_name == "" and last_name == "") then
|
||||
if next(users) == nil then -- no user found with this identifier
|
||||
cb(defaultProfileName)
|
||||
else
|
||||
local profileName = first_name .. '_' .. last_name
|
||||
cb(profileName)
|
||||
return
|
||||
end
|
||||
|
||||
cb(users[1].profile_name)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user