handle all configuration cases

This commit is contained in:
Kire committed 2021-03-22 10:37:10 -04:00
1 parent 8000cc3d3f
commit 97f5c99cc0
12 files changed
+289 -157

No files matched your search

+106 -109
View File
@@ -21,6 +21,9 @@ import ProfilePrompt from './profile/ProfilePrompt';
import InjectDebugData from '../../../os/debug/InjectDebugData'; import InjectDebugData from '../../../os/debug/InjectDebugData';
import { TwitterThemeProvider } from '../providers/TwitterThemeProvider'; import { TwitterThemeProvider } from '../providers/TwitterThemeProvider';
import DefaultProfilePrompt from './profile/DefaultProfilePrompt'; import DefaultProfilePrompt from './profile/DefaultProfilePrompt';
import { useRecoilValue } from 'recoil';
import { twitterState } from '../hooks/state';
import { Profile } from '../../../../../typings/twitter';
const useStyles = makeStyles(() => ({ const useStyles = makeStyles(() => ({
backgroundModal: { backgroundModal: {
@@ -42,16 +45,13 @@ export const TwitterApp = () => {
const { profile } = useProfile(); const { profile } = useProfile();
// before any other action can be taken by the user we force // before any other action can be taken by the user we force
// them have a profile name // them have a profile name.
let promptProfileName = profile && (!profile.profile_name || !profile.profile_name.trim()); const promptProfileName = !profile || !profile.profile_name || !profile.profile_name.trim();
promptProfileName = true;
const openModal = () => setModalVisible(true); const openModal = () => setModalVisible(true);
const handlePageChange = (e, page) => setActivePage(page); const handlePageChange = (e, page) => setActivePage(page);
const showTweetButton = !promptProfileName && activePage === 0; const showTweetButton = !promptProfileName && activePage === 0;
const defaultProfileNames = ['test_user', '123-456-7890'];
return ( return (
<TwitterThemeProvider> <TwitterThemeProvider>
<AppWrapper id="twitter-app"> <AppWrapper id="twitter-app">
@@ -60,10 +60,7 @@ export const TwitterApp = () => {
<TwitterTitle /> <TwitterTitle />
<AppContent> <AppContent>
{promptProfileName ? ( {promptProfileName ? (
<DefaultProfilePrompt <ProfilePrompt />
updateEvent="phone:updateTwitterProfile"
defaultProfileNames={defaultProfileNames}
/>
) : ( ) : (
<Switch> <Switch>
<Route path="/twitter" exact component={TweetListContainer} /> <Route path="/twitter" exact component={TweetListContainer} />
@@ -81,104 +78,104 @@ export const TwitterApp = () => {
); );
}; };
InjectDebugData([ // InjectDebugData([
{ // {
app: 'TWITTER', // app: 'TWITTER',
method: 'getOrCreateTwitterProfile', // method: 'getOrCreateTwitterProfile',
data: { // data: {
profile_name: 'Angular_Dev', // profile_name: 'Angular_Dev',
bio: 'Angular FTW', // bio: 'Angular FTW',
job: 'Googler @ Google', // job: 'Googler @ Google',
location: '1600 Amphitheatre Parkway, CA, USA', // location: '1600 Amphitheatre Parkway, CA, USA',
avatar_url: 'https://i.tasoagc.dev/i9Ig', // avatar_url: 'https://i.tasoagc.dev/i9Ig',
}, // },
}, // },
{ // {
app: 'TWITTER', // app: 'TWITTER',
method: 'fetchTweets', // method: 'fetchTweets',
data: [ // data: [
{ // {
id: 59, // id: 59,
message: 'XSS\n<script src="test.js">Test</script>\nBro', // message: 'XSS\n<script src="test.js">Test</script>\nBro',
avatar_url: 'http://i.tasoagc.dev/jtKL', // avatar_url: 'http://i.tasoagc.dev/jtKL',
seconds_since_tweet: 500, // seconds_since_tweet: 500,
isMine: false, // isMine: false,
isRetweetedByPlayer: true, // isRetweetedByPlayer: true,
updateAt: '2021-02-08 14:37:46', // updateAt: '2021-02-08 14:37:46',
visible: 1, // visible: 1,
likes: 50000, // likes: 50000,
profile_name: 'jQuery Main', // profile_name: 'jQuery Main',
images: 'http://i.tasoagc.dev/0xdp', // images: 'http://i.tasoagc.dev/0xdp',
}, // },
{ // {
id: 2, // id: 2,
message: 'GCPhone will never die', // message: 'GCPhone will never die',
avatar_url: 'http://i.tasoagc.dev/jtKL', // avatar_url: 'http://i.tasoagc.dev/jtKL',
seconds_since_tweet: 500, // seconds_since_tweet: 500,
isMine: false, // isMine: false,
updateAt: '2021-02-08 14:37:46', // updateAt: '2021-02-08 14:37:46',
visible: 1, // visible: 1,
likes: 50000, // likes: 50000,
profile_name: 'GCPhone_v9999', // profile_name: 'GCPhone_v9999',
images: 'http://i.tasoagc.dev/0xdp', // images: 'http://i.tasoagc.dev/0xdp',
}, // },
{ // {
id: 1, // id: 1,
message: 'I love angular', // message: 'I love angular',
avatar_url: 'https://i.tasoagc.dev/i9Ig', // avatar_url: 'https://i.tasoagc.dev/i9Ig',
seconds_since_tweet: 800, // seconds_since_tweet: 800,
isMine: true, // isMine: true,
updateAt: '2021-02-08 14:37:46', // updateAt: '2021-02-08 14:37:46',
visible: 1, // visible: 1,
likes: 50000, // likes: 50000,
profile_name: 'Angular_Dev', // profile_name: 'Angular_Dev',
images: 'http://i.tasoagc.dev/i9Ig', // images: 'http://i.tasoagc.dev/i9Ig',
}, // },
{ // {
id: 3, // id: 3,
message: // message:
'Anyways uhm... I bought a whole bunch of shungite, rocks, ' + // 'Anyways uhm... I bought a whole bunch of shungite, rocks, ' +
'do you know what shungite is? Anybody know what shungite is. No, no ' + // 'do you know what shungite is? Anybody know what shungite is. No, no ' +
'Suge Knight, I think hes locked up in prison.', // 'Suge Knight, I think hes locked up in prison.',
avatar_url: 'http://i.tasoagc.dev/0v64', // avatar_url: 'http://i.tasoagc.dev/0v64',
seconds_since_tweet: 800, // seconds_since_tweet: 800,
isMine: true, // isMine: true,
updateAt: '2021-02-08 14:37:46', // updateAt: '2021-02-08 14:37:46',
visible: 1, // visible: 1,
likes: 50000, // likes: 50000,
profile_name: 'The_Doc', // profile_name: 'The_Doc',
}, // },
], // ],
}, // },
]); // ]);
InjectDebugData( // InjectDebugData(
[ // [
{ // {
app: 'TWITTER', // app: 'TWITTER',
method: 'createTweetBroadcast', // method: 'createTweetBroadcast',
data: { // data: {
id: 111, // id: 111,
profile_id: 111, // profile_id: 111,
profile_name: 'Kidz', // profile_name: 'Kidz',
isMine: false, // isMine: false,
isReported: false, // isReported: false,
message: 'I have tweeted this because Im badass', // message: 'I have tweeted this because Im badass',
}, // },
}, // },
{ // {
app: 'TWITTER', // app: 'TWITTER',
method: 'createTweetBroadcast', // method: 'createTweetBroadcast',
data: { // data: {
id: 111, // id: 111,
profile_id: 111, // profile_id: 111,
profile_name: 'ItsChip', // profile_name: 'ItsChip',
isMine: false, // isMine: false,
isReported: false, // isReported: false,
message: // message:
'I have tweeted this because Im even more badass... And I need this to be longer so I will continue to write', // 'I have tweeted this because Im even more badass... And I need this to be longer so I will continue to write',
}, // },
}, // },
], // ],
3000, // 3000,
); // );
@@ -11,8 +11,10 @@ import { useProfile } from '../../hooks/useProfile';
import ProfileUpdateButton from '../buttons/ProfileUpdateButton'; import ProfileUpdateButton from '../buttons/ProfileUpdateButton';
interface IProps { interface IProps {
handleUpdate: () => void;
profileName: string;
setProfileName: (name: string) => void;
defaultProfileNames: string[]; defaultProfileNames: string[];
updateEvent: string;
} }
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
@@ -28,25 +30,17 @@ const useStyles = makeStyles((theme) => ({
}, },
})); }));
export function DefaultProfilePrompt({ defaultProfileNames, updateEvent }: IProps): JSX.Element { export function DefaultProfilePrompt({
profileName,
setProfileName,
handleUpdate,
defaultProfileNames,
}: IProps): JSX.Element {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
const { profile } = useProfile();
const hasDefaults = defaultProfileNames.length > 0;
const defaultProfileName = hasDefaults ? defaultProfileNames[0] : '';
const [profileName, setProfileName] = useState(defaultProfileName);
const handleUpdate = () => {
const data = {
...profile,
profile_name: profileName,
};
Nui.send(updateEvent, data);
};
const handleChange = (event: React.ChangeEvent<any>): void => { const handleChange = (event: React.ChangeEvent<any>): void => {
event.preventDefault();
setProfileName(event.target.value); setProfileName(event.target.value);
}; };
@@ -65,8 +59,10 @@ export function DefaultProfilePrompt({ defaultProfileNames, updateEvent }: IProp
}} }}
> >
<option value="" /> <option value="" />
{defaultProfileNames.map((profileName) => ( {defaultProfileNames.map((name) => (
<option value={profileName}>{profileName}</option> <option key={name} value={name}>
{name}
</option>
))} ))}
</Select> </Select>
</FormControl> </FormControl>
@@ -5,7 +5,12 @@ import { useTranslation } from 'react-i18next';
import Nui from '../../../../os/nui-events/utils/Nui'; import Nui from '../../../../os/nui-events/utils/Nui';
import { useProfile } from '../../hooks/useProfile'; import { useProfile } from '../../hooks/useProfile';
import ProfileField from './ProfileField'; import ProfileField from './ProfileField';
import DefaultProfilePrompt from './DefaultProfilePrompt';
import ProfileUpdateButton from '../buttons/ProfileUpdateButton'; import ProfileUpdateButton from '../buttons/ProfileUpdateButton';
import { useRecoilValue } from 'recoil';
import { twitterState } from '../../hooks/state';
import { useSettings } from '../../../settings/hooks/useSettings';
import { usePhone } from '../../../../os/phone/hooks/usePhone';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
@@ -23,23 +28,43 @@ export function ProfilePrompt() {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
const { profile } = useProfile(); const { profile } = useProfile();
const defaultProfileNames = useRecoilValue(twitterState.defaultProfileNames);
const [profileName, setProfileName] = useState(profile?.profile_name || '');
const { config } = usePhone();
const [name, handleNameChange] = useState(profile.profile_name || ''); const showDefaultProfileNames = !config.twitter.allowEdtiableProfileName && !profile;
const eventName = showDefaultProfileNames
? 'phone:createTwitterProfile'
: 'phone:updateTwitterProfile';
const handleUpdate = () => { const handleUpdate = () => {
const data = { Nui.send(eventName, {
...profile, ...profile,
profile_name: name, profile_name: profileName,
}; });
Nui.send('phone:updateTwitterProfile', data);
}; };
// case where profile doesn't exist, couldn't be created automatically
// and the player is not allowed to edit their own profile name
if (showDefaultProfileNames) {
return (
<DefaultProfilePrompt
profileName={profileName}
defaultProfileNames={defaultProfileNames}
setProfileName={setProfileName}
handleUpdate={handleUpdate}
/>
);
}
// case where profile doesn't exist, couldn't be created automatically
// but the player IS allowed to edit their own profile name
return ( return (
<div className={classes.root}> <div className={classes.root}>
<ProfileField <ProfileField
label={t('APPS_TWITTER_EDIT_PROFILE_NAME')} label={t('APPS_TWITTER_EDIT_PROFILE_NAME')}
value={name} value={profileName}
handleChange={handleNameChange} handleChange={setProfileName}
allowChange allowChange
/> />
<ProfileUpdateButton handleClick={handleUpdate} /> <ProfileUpdateButton handleClick={handleUpdate} />
+4
View File
@@ -5,6 +5,10 @@ export const twitterState = {
key: 'profile', key: 'profile',
default: null, default: null,
}), }),
defaultProfileNames: atom({
key: 'defaultProfileNames',
default: null,
}),
tweets: atom({ tweets: atom({
key: 'tweets', key: 'tweets',
default: null, default: null,
@@ -59,6 +59,7 @@ export const useTwitterService = () => {
const [currentTweets, setTweets] = useRecoilState(twitterState.tweets); const [currentTweets, setTweets] = useRecoilState(twitterState.tweets);
const setFilteredTweets = useSetRecoilState(twitterState.filteredTweets); const setFilteredTweets = useSetRecoilState(twitterState.filteredTweets);
const setCreateLoading = useSetRecoilState(twitterState.createTweetLoading); const setCreateLoading = useSetRecoilState(twitterState.createTweetLoading);
const setDefaultProfileNames = useSetRecoilState(twitterState.defaultProfileNames);
const _setTweets = (tweets) => { const _setTweets = (tweets) => {
setTweets(tweets.map(processTweet)); setTweets(tweets.map(processTweet));
@@ -83,6 +84,8 @@ export const useTwitterService = () => {
}; };
useNuiEvent(APP_TWITTER, 'getOrCreateTwitterProfile', setProfile); useNuiEvent(APP_TWITTER, 'getOrCreateTwitterProfile', setProfile);
useNuiEvent(APP_TWITTER, 'getOrCreateTwitterProfileNull', setDefaultProfileNames);
useNuiEvent(APP_TWITTER, 'phone:createProfileResult', handleAddAlert);
useNuiEvent(APP_TWITTER, 'updateProfileLoading', setUpdateProfileLoading); useNuiEvent(APP_TWITTER, 'updateProfileLoading', setUpdateProfileLoading);
useNuiEvent(APP_TWITTER, 'updateProfileResult', handleAddAlert); useNuiEvent(APP_TWITTER, 'updateProfileResult', handleAddAlert);
useNuiEvent(APP_TWITTER, 'fetchTweets', _setTweets); useNuiEvent(APP_TWITTER, 'fetchTweets', _setTweets);
+2
View File
@@ -81,6 +81,8 @@
"APPS_TWITTER_EDIT_PROFILE_BIO": "Bio", "APPS_TWITTER_EDIT_PROFILE_BIO": "Bio",
"APPS_TWITTER_EDIT_PROFILE_LOCATION": "Location", "APPS_TWITTER_EDIT_PROFILE_LOCATION": "Location",
"APPS_TWITTER_EDIT_PROFILE_JOB": "Job", "APPS_TWITTER_EDIT_PROFILE_JOB": "Job",
"APPS_TWITTER_CREATE_PROFILE_SUCCESS": "Successfully created your profile",
"APPS_TWITTER_CREATE_PROFILE_FAILURE": "Failed to create your profile",
"APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Successfully updated your profile", "APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Successfully updated your profile",
"APPS_TWITTER_EDIT_PROFILE_FAILURE": "Failed to update your profile", "APPS_TWITTER_EDIT_PROFILE_FAILURE": "Failed to update your profile",
"APPS_TWITTER_RETWEET_EXISTS": "You have already retweeted this tweet!", "APPS_TWITTER_RETWEET_EXISTS": "You have already retweeted this tweet!",
+1
View File
@@ -17,6 +17,7 @@ function fetchOnInitialize() {
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS); emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS);
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE); emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
sendMessage('PHONE', 'setPhoneReady', isPhoneReady); sendMessage('PHONE', 'setPhoneReady', isPhoneReady);
sendMessage('PHONE', 'phoneConfig', config);
} }
RegisterKeyMapping('phone', 'Open Phone', 'keyboard', 'f1'); RegisterKeyMapping('phone', 'Open Phone', 'keyboard', 'f1');
+18
View File
@@ -18,6 +18,24 @@ onNet(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE, () => {
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE); sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE);
}); });
onNet(events.TWITTER_GET_OR_CREATE_PROFILE_NULL, (defaultProfileNames: string[]): void => {
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_NULL, defaultProfileNames);
});
/**
* Twitter create profile
*/
RegisterNuiCallbackType(events.TWITTER_CREATE_PROFILE);
on(`__cfx_nui:${events.TWITTER_CREATE_PROFILE}`, (data: any) => {
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_LOADING, true);
emitNet(events.TWITTER_CREATE_PROFILE, data);
});
onNet(events.TWITTER_CREATE_PROFILE_RESULT, (alert: IAlertProps) => {
sendTwitterMessage(events.TWITTER_CREATE_PROFILE_RESULT, alert);
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
});
/** /**
* Twitter update profile * Twitter update profile
*/ */
+48
View File
@@ -89,6 +89,54 @@ export async function getPlayerInfo(identifier: string): Promise<PlayerQueryResp
return { firstname, lastname, phone_number }; return { firstname, lastname, phone_number };
} }
const clean = (input: string) => (input ? input.replace(/[^0-9a-z]/gi, '') : input);
async function getCleanedPlayerInfo(identifier: string): Promise<PlayerQueryResp> {
const { firstname, lastname, phone_number } = await getPlayerInfo(identifier);
return {
firstname: clean(firstname),
lastname: clean(lastname),
phone_number: clean(phone_number),
};
}
/**
* Generate a profile name by the player's name and/or phone number
* @param identifier - player's identifier
*/
export async function generateProfileName(identifier: string): Promise<string | null> {
const { firstname, lastname, phone_number } = await getCleanedPlayerInfo(identifier);
if (firstname && lastname) {
return `${firstname}_${lastname}`;
} else if (firstname) {
return firstname;
} else if (lastname) {
return lastname;
} else if (phone_number) {
return phone_number;
}
return null;
}
export async function getDefaultProfileNames(identifier: string): Promise<string[]> {
const { firstname, lastname, phone_number } = await getCleanedPlayerInfo(identifier);
let defaultProfileNames = [];
if (firstname && lastname) {
defaultProfileNames.push(`${firstname}_${lastname}`);
} else if (firstname) {
defaultProfileNames.push(firstname);
} else if (lastname) {
defaultProfileNames.push(lastname);
}
if (phone_number) {
defaultProfileNames.push(phone_number);
}
return defaultProfileNames;
}
// Attach to playerJoining event as this is when // Attach to playerJoining event as this is when
// the permanent source is assigned for the user // the permanent source is assigned for the user
-1
View File
@@ -1,5 +1,4 @@
import { pool } from './db'; import { pool } from './db';
import config from '../utils/config';
import { getIdentifier, getSource } from './functions'; import { getIdentifier, getSource } from './functions';
import { mainLogger } from './sv_logger'; import { mainLogger } from './sv_logger';
+58 -22
View File
@@ -6,6 +6,8 @@ import config from '../utils/config';
import { reportTweetToDiscord } from './discord'; import { reportTweetToDiscord } from './discord';
import { mainLogger } from './sv_logger'; import { mainLogger } from './sv_logger';
import { ResultSetHeader } from 'mysql2'; import { ResultSetHeader } from 'mysql2';
import { generateProfileName } from './players/sv_players';
import { getDefaultProfileNames } from './players/sv_players';
const twitterLogger = mainLogger.child({ module: 'twitter' }); const twitterLogger = mainLogger.child({ module: 'twitter' });
@@ -165,23 +167,19 @@ async function getProfile(identifier: string): Promise<Profile | null> {
} }
/** /**
* Generate a twitter profile name by the player's name * Create a twitter profile
* @param identifier - player's identifier * @param identifier - player's identifier
* @param profileName - profile name to be created
* @returns
*/ */
async function generateProfileName(identifier: string): Promise<string> { async function createProfile(identifier: string, profileName: string): Promise<Profile> {
const defaultProfileName = '';
if (!config.twitter.generateProfileNameFromUsers) return defaultProfileName;
const query = ` const query = `
SELECT CONCAT(firstname, '_', lastname) AS profile_name INSERT INTO npwd_twitter_profiles (identifier, profile_name)
FROM users VALUES (?, ?)
WHERE identifier = ? LIMIT 1
`; `;
const [results] = await pool.query(query, [identifier]);
const profileNames = <ProfileName[]>results;
if (profileNames.length === 0) return defaultProfileName; await pool.execute(query, [identifier, profileName]);
return profileNames[0].profile_name || defaultProfileName; return await getProfile(identifier);
} }
/** /**
@@ -189,15 +187,17 @@ async function generateProfileName(identifier: string): Promise<string> {
* that all player's will receive and can then customize. * that all player's will receive and can then customize.
* @param identifier - player's identifier * @param identifier - player's identifier
*/ */
async function createDefaultProfile(identifier: string): Promise<Profile> { async function createDefaultProfile(identifier: string): Promise<Profile | null> {
const profileName = await generateProfileName(identifier); // case where the server owner wants players to select their own names
const query = ` if (!config.twitter.generateProfileNameFromUsers) return null;
INSERT INTO npwd_twitter_profiles (identifier, profile_name)
VALUES (?, ?)
`;
await pool.execute(query, [identifier, profileName]); const defaultProfileName = await generateProfileName(identifier);
return getProfile(identifier); // case where we tried to generate a profile name but failed due to
// some database misconfiguration or error
if (!defaultProfileName) return null;
twitterLogger.info(`Creating default Twitter profile ${defaultProfileName} for ${identifier}`);
return await createProfile(identifier, defaultProfileName);
} }
/** /**
@@ -316,12 +316,41 @@ onNet(events.TWITTER_GET_OR_CREATE_PROFILE, async () => {
try { try {
const profile = await getOrCreateProfile(identifier); const profile = await getOrCreateProfile(identifier);
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE_SUCCESS, _source, profile);
// if we got null from getOrCreateProfile it means it doesn't exist and
// we failed to create it. In this case we pass the UI some default
// profile names it can choose from
if (!profile) {
const defaultProfileNames = await getDefaultProfileNames(identifier);
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE_NULL, _source, defaultProfileNames);
} else {
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE_SUCCESS, _source, profile);
}
} catch (e) { } catch (e) {
twitterLogger.error(`Failed to get or create profile, ${e.message}`, { twitterLogger.error(`Failed to get or create profile, ${e.message}`, {
source: _source, source: _source,
}); });
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE, _source); emitNet(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE, _source, null);
}
});
onNet(events.TWITTER_CREATE_PROFILE, async (profile: Profile) => {
const _source = getSource();
try {
const identifier = getIdentifier(_source);
await createProfile(identifier, profile.profile_name);
emitNet(events.TWITTER_CREATE_PROFILE_RESULT, _source, {
message: 'TWITTER_CREATE_PROFILE_SUCCESS',
type: 'success',
});
} catch (e) {
twitterLogger.error(`Failed to create twitter profile: ${e.message}`, {
source: _source,
});
emitNet(events.TWITTER_CREATE_PROFILE_RESULT, _source, {
message: 'TWITTER_CREATE_PROFILE_FAILURE',
type: 'error',
});
} }
}); });
@@ -350,6 +379,13 @@ onNet(events.TWITTER_FETCH_TWEETS, async () => {
try { try {
const identifier = getIdentifier(_source); const identifier = getIdentifier(_source);
const profile = await getProfile(identifier); const profile = await getProfile(identifier);
if (!profile) {
twitterLogger.warn(
`Aborted fetching tweets for user ${identifier} because they do not have a profile.`,
);
return;
}
const tweets = await fetchAllTweets(profile.id); const tweets = await fetchAllTweets(profile.id);
emitNet(events.TWITTER_FETCH_TWEETS_SUCCESS, _source, tweets); emitNet(events.TWITTER_FETCH_TWEETS_SUCCESS, _source, tweets);
} catch (e) { } catch (e) {
+3
View File
@@ -8,7 +8,10 @@ export default {
TWITTER_FETCH_TWEETS_FILTERED_FAILURE: 'fetchTweetsFilteredFailed', TWITTER_FETCH_TWEETS_FILTERED_FAILURE: 'fetchTweetsFilteredFailed',
TWITTER_GET_OR_CREATE_PROFILE: 'phone:getOrCreateTwitterProfile', TWITTER_GET_OR_CREATE_PROFILE: 'phone:getOrCreateTwitterProfile',
TWITTER_GET_OR_CREATE_PROFILE_SUCCESS: 'getOrCreateTwitterProfile', TWITTER_GET_OR_CREATE_PROFILE_SUCCESS: 'getOrCreateTwitterProfile',
TWITTER_GET_OR_CREATE_PROFILE_NULL: 'getOrCreateTwitterProfileNull',
TWITTER_GET_OR_CREATE_PROFILE_FAILURE: 'getOrCreateTwitterProfileFailed', TWITTER_GET_OR_CREATE_PROFILE_FAILURE: 'getOrCreateTwitterProfileFailed',
TWITTER_CREATE_PROFILE: 'phone:createTwitterProfile',
TWITTER_CREATE_PROFILE_RESULT: 'phone:createProfileResult',
TWITTER_UPDATE_PROFILE: 'phone:updateTwitterProfile', TWITTER_UPDATE_PROFILE: 'phone:updateTwitterProfile',
TWITTER_UPDATE_PROFILE_LOADING: 'updateProfileLoading', TWITTER_UPDATE_PROFILE_LOADING: 'updateProfileLoading',
TWITTER_UPDATE_PROFILE_RESULT: 'updateProfileResult', TWITTER_UPDATE_PROFILE_RESULT: 'updateProfileResult',