mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-16 01:09:55 +00:00
[Glitch] Force modern emoji experimental to be dev mode only
Port dfaca794bf to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -3,8 +3,8 @@ import { useCallback } from 'react';
|
||||
import { useLinks } from 'flavours/glitch/hooks/useLinks';
|
||||
|
||||
import { EmojiHTML } from '../features/emoji/emoji_html';
|
||||
import { isFeatureEnabled } from '../initial_state';
|
||||
import { useAppSelector } from '../store';
|
||||
import { isModernEmojiEnabled } from '../utils/environment';
|
||||
|
||||
interface AccountBioProps {
|
||||
className: string;
|
||||
@@ -32,9 +32,7 @@ export const AccountBio: React.FC<AccountBioProps> = ({
|
||||
if (!account) {
|
||||
return '';
|
||||
}
|
||||
return isFeatureEnabled('modern_emojis')
|
||||
? account.note
|
||||
: account.note_emojified;
|
||||
return isModernEmojiEnabled() ? account.note : account.note_emojified;
|
||||
});
|
||||
const extraEmojis = useAppSelector((state) => {
|
||||
const account = state.accounts.get(accountId);
|
||||
|
||||
@@ -13,9 +13,10 @@ import ChevronRightIcon from '@/material-icons/400-24px/chevron_right.svg?react'
|
||||
import { Icon } from 'flavours/glitch/components/icon';
|
||||
import { Poll } from 'flavours/glitch/components/poll';
|
||||
import { identityContextPropShape, withIdentity } from 'flavours/glitch/identity_context';
|
||||
import { autoPlayGif, isFeatureEnabled, languages as preloadedLanguages } from 'flavours/glitch/initial_state';
|
||||
import { autoPlayGif, languages as preloadedLanguages } from 'flavours/glitch/initial_state';
|
||||
import { decode as decodeIDNA } from 'flavours/glitch/utils/idna';
|
||||
import { EmojiHTML } from '../features/emoji/emoji_html';
|
||||
import { isModernEmojiEnabled } from '../utils/environment';
|
||||
|
||||
const MAX_HEIGHT = 706; // 22px * 32 (+ 2px padding at the top)
|
||||
|
||||
@@ -80,7 +81,7 @@ const isLinkMisleading = (link) => {
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getStatusContent(status) {
|
||||
if (isFeatureEnabled('modern_emojis')) {
|
||||
if (isModernEmojiEnabled()) {
|
||||
return status.getIn(['translation', 'content']) || status.get('content');
|
||||
}
|
||||
return status.getIn(['translation', 'contentHtml']) || status.get('contentHtml');
|
||||
|
||||
@@ -5,8 +5,8 @@ import type { List as ImmutableList } from 'immutable';
|
||||
import { isList } from 'immutable';
|
||||
|
||||
import type { ApiCustomEmojiJSON } from '@/flavours/glitch/api_types/custom_emoji';
|
||||
import { isFeatureEnabled } from '@/flavours/glitch/initial_state';
|
||||
import type { CustomEmoji } from '@/flavours/glitch/models/custom_emoji';
|
||||
import { isModernEmojiEnabled } from '@/flavours/glitch/utils/environment';
|
||||
|
||||
import { useEmojiAppState } from './hooks';
|
||||
import { emojifyElement } from './render';
|
||||
@@ -25,7 +25,7 @@ export const EmojiHTML: React.FC<EmojiHTMLProps> = ({
|
||||
extraEmojis,
|
||||
...props
|
||||
}) => {
|
||||
if (isFeatureEnabled('modern_emojis')) {
|
||||
if (isModernEmojiEnabled()) {
|
||||
return (
|
||||
<ModernEmojiHTML
|
||||
htmlString={htmlString}
|
||||
|
||||
@@ -168,12 +168,4 @@ export function getAccessToken() {
|
||||
return getMeta('access_token');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} feature
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isFeatureEnabled(feature) {
|
||||
return initialState?.features?.includes(feature) || false;
|
||||
}
|
||||
|
||||
export default initialState;
|
||||
|
||||
@@ -4,16 +4,16 @@ import { Globals } from '@react-spring/web';
|
||||
|
||||
import { setupBrowserNotifications } from 'flavours/glitch/actions/notifications';
|
||||
import Mastodon from 'flavours/glitch/containers/mastodon';
|
||||
import {
|
||||
isFeatureEnabled,
|
||||
me,
|
||||
reduceMotion,
|
||||
} from 'flavours/glitch/initial_state';
|
||||
import { me, reduceMotion } from 'flavours/glitch/initial_state';
|
||||
import * as perf from 'flavours/glitch/performance';
|
||||
import ready from 'flavours/glitch/ready';
|
||||
import { store } from 'flavours/glitch/store';
|
||||
|
||||
import { isProduction, isDevelopment } from './utils/environment';
|
||||
import {
|
||||
isProduction,
|
||||
isDevelopment,
|
||||
isModernEmojiEnabled,
|
||||
} from './utils/environment';
|
||||
|
||||
function main() {
|
||||
perf.start('main()');
|
||||
@@ -33,7 +33,7 @@ function main() {
|
||||
});
|
||||
}
|
||||
|
||||
if (isFeatureEnabled('modern_emojis')) {
|
||||
if (isModernEmojiEnabled()) {
|
||||
const { initializeEmoji } = await import(
|
||||
'@/flavours/glitch/features/emoji'
|
||||
);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import initialState from '../initial_state';
|
||||
|
||||
export function isDevelopment() {
|
||||
if (typeof process !== 'undefined')
|
||||
return process.env.NODE_ENV === 'development';
|
||||
@@ -9,3 +11,13 @@ export function isProduction() {
|
||||
return process.env.NODE_ENV === 'production';
|
||||
else return import.meta.env.PROD;
|
||||
}
|
||||
|
||||
export type Features = 'modern_emojis';
|
||||
|
||||
export function isFeatureEnabled(feature: Features) {
|
||||
return initialState?.features.includes(feature) ?? false;
|
||||
}
|
||||
|
||||
export function isModernEmojiEnabled() {
|
||||
return isFeatureEnabled('modern_emojis') && isDevelopment();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user