Merge branch 'cleanup' into 'develop'
Use Array.includes instead of indexOf See merge request soapbox-pub/soapbox-fe!1727
This commit is contained in:
commit
67f5f5fb8b
11 changed files with 8 additions and 8 deletions
|
@ -37,7 +37,7 @@ if (!HTMLCanvasElement.prototype.toBlob) {
|
|||
const dataURL = this.toDataURL(type, quality);
|
||||
let data;
|
||||
|
||||
if (dataURL.indexOf(BASE64_MARKER) >= 0) {
|
||||
if (dataURL.includes(BASE64_MARKER)) {
|
||||
const [, base64] = dataURL.split(BASE64_MARKER);
|
||||
data = decodeBase64(base64);
|
||||
} else {
|
||||
|
|
|
@ -30,7 +30,7 @@ const textAtCursorMatchesToken = (str: string, caretPosition: number, searchToke
|
|||
word = str.slice(left, right + caretPosition);
|
||||
}
|
||||
|
||||
if (!word || word.trim().length < 3 || searchTokens.indexOf(word[0]) === -1) {
|
||||
if (!word || word.trim().length < 3 || !searchTokens.includes(word[0])) {
|
||||
return [null, null];
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ const textAtCursorMatchesToken = (str: string, caretPosition: number) => {
|
|||
word = str.slice(left, right + caretPosition);
|
||||
}
|
||||
|
||||
if (!word || word.trim().length < 3 || ['@', ':', '#'].indexOf(word[0]) === -1) {
|
||||
if (!word || word.trim().length < 3 || !['@', ':', '#'].includes(word[0])) {
|
||||
return [null, null];
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ const MediaItem: React.FC<IMediaItem> = ({ attachment, displayWidth, onOpenMedia
|
|||
};
|
||||
|
||||
const hoverToPlay = () => {
|
||||
return !autoPlayGif && ['gifv', 'video'].indexOf(attachment.type) !== -1;
|
||||
return !autoPlayGif && ['gifv', 'video'].includes(attachment.type);
|
||||
};
|
||||
|
||||
const handleClick: React.MouseEventHandler = e => {
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -26,7 +26,7 @@ const addAutoPlay = (html: string): string => {
|
|||
const iframe = document.querySelector('iframe');
|
||||
|
||||
if (iframe) {
|
||||
if (iframe.src.indexOf('?') !== -1) {
|
||||
if (iframe.src.includes('?')) {
|
||||
iframe.src += '&';
|
||||
} else {
|
||||
iframe.src += '?';
|
||||
|
|
Binary file not shown.
|
@ -28,7 +28,7 @@ const UserPanel: React.FC<IUserPanel> = ({ accountId, action, badges, domain })
|
|||
|
||||
if (!account) return null;
|
||||
const displayNameHtml = { __html: account.get('display_name_html') };
|
||||
const acct = account.get('acct').indexOf('@') === -1 && domain ? `${account.get('acct')}@${domain}` : account.get('acct');
|
||||
const acct = !account.get('acct').includes('@') && domain ? `${account.get('acct')}@${domain}` : account.get('acct');
|
||||
const header = account.get('header');
|
||||
const verified = account.get('verified');
|
||||
|
||||
|
|
|
@ -352,7 +352,7 @@ const UI: React.FC = ({ children }) => {
|
|||
const handleDragEnter = (e: DragEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (e.target && dragTargets.current.indexOf(e.target) === -1) {
|
||||
if (e.target && !dragTargets.current.includes(e.target)) {
|
||||
dragTargets.current.push(e.target);
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ const toServerSideType = (columnType: string): string => {
|
|||
case 'thread':
|
||||
return columnType;
|
||||
default:
|
||||
if (columnType.indexOf('list:') > -1) {
|
||||
if (columnType.includes('list:')) {
|
||||
return 'home';
|
||||
} else {
|
||||
return 'public'; // community, account, hashtag
|
||||
|
|
Loading…
Reference in a new issue