kopia lustrzana https://github.com/cheeaun/phanpy
Porównaj commity
7 Commity
b6cf53c221
...
51457302f8
Autor | SHA1 | Data |
---|---|---|
Chee Aun | 51457302f8 | |
Lim Chee Aun | 7376cb1e99 | |
Lim Chee Aun | ffbae70178 | |
Lim Chee Aun | 9235d2c800 | |
Lim Chee Aun | 6ccefaebe1 | |
Lim Chee Aun | 5a448c8049 | |
Lim Chee Aun | 9bf77fa97a |
|
@ -131,7 +131,7 @@ const HASHTAG_RE = new RegExp(
|
||||||
// https://github.com/mastodon/mastodon/blob/23e32a4b3031d1da8b911e0145d61b4dd47c4f96/app/models/custom_emoji.rb#L31
|
// https://github.com/mastodon/mastodon/blob/23e32a4b3031d1da8b911e0145d61b4dd47c4f96/app/models/custom_emoji.rb#L31
|
||||||
const SHORTCODE_RE_FRAGMENT = '[a-zA-Z0-9_]{2,}';
|
const SHORTCODE_RE_FRAGMENT = '[a-zA-Z0-9_]{2,}';
|
||||||
const SCAN_RE = new RegExp(
|
const SCAN_RE = new RegExp(
|
||||||
`([^A-Za-z0-9_:\\n]|^)(:${SHORTCODE_RE_FRAGMENT}:)(?=[^A-Za-z0-9_:]|$)`,
|
`(^|[^=\\/\\w])(:${SHORTCODE_RE_FRAGMENT}:)(?=[^A-Za-z0-9_:]|$)`,
|
||||||
'g',
|
'g',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1219,22 +1219,30 @@ function Compose({
|
||||||
/>
|
/>
|
||||||
<Icon icon="attachment" />
|
<Icon icon="attachment" />
|
||||||
</label>{' '}
|
</label>{' '}
|
||||||
<button
|
{/* If maxOptions is not defined or defined and is greater than 1, show poll button */}
|
||||||
type="button"
|
{maxOptions == null ||
|
||||||
class="toolbar-button"
|
(maxOptions > 1 && (
|
||||||
disabled={
|
<>
|
||||||
uiState === 'loading' || !!poll || !!mediaAttachments.length
|
<button
|
||||||
}
|
type="button"
|
||||||
onClick={() => {
|
class="toolbar-button"
|
||||||
setPoll({
|
disabled={
|
||||||
options: ['', ''],
|
uiState === 'loading' ||
|
||||||
expiresIn: 24 * 60 * 60, // 1 day
|
!!poll ||
|
||||||
multiple: false,
|
!!mediaAttachments.length
|
||||||
});
|
}
|
||||||
}}
|
onClick={() => {
|
||||||
>
|
setPoll({
|
||||||
<Icon icon="poll" alt="Add poll" />
|
options: ['', ''],
|
||||||
</button>{' '}
|
expiresIn: 24 * 60 * 60, // 1 day
|
||||||
|
multiple: false,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon icon="poll" alt="Add poll" />
|
||||||
|
</button>{' '}
|
||||||
|
</>
|
||||||
|
))}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="toolbar-button"
|
class="toolbar-button"
|
||||||
|
|
|
@ -388,7 +388,7 @@ function Media({
|
||||||
data-orientation="${orientation}"
|
data-orientation="${orientation}"
|
||||||
preload="auto"
|
preload="auto"
|
||||||
autoplay
|
autoplay
|
||||||
muted="${isGIF}"
|
${isGIF ? 'muted' : ''}
|
||||||
${isGIF ? '' : 'controls'}
|
${isGIF ? '' : 'controls'}
|
||||||
playsinline
|
playsinline
|
||||||
loop="${loopable}"
|
loop="${loopable}"
|
||||||
|
|
|
@ -21,6 +21,7 @@ export default function RelativeTime({ datetime, format }) {
|
||||||
const [renderCount, rerender] = useReducer((x) => x + 1, 0);
|
const [renderCount, rerender] = useReducer((x) => x + 1, 0);
|
||||||
const date = useMemo(() => dayjs(datetime), [datetime]);
|
const date = useMemo(() => dayjs(datetime), [datetime]);
|
||||||
const [dateStr, dt, title] = useMemo(() => {
|
const [dateStr, dt, title] = useMemo(() => {
|
||||||
|
if (!date.isValid()) return ['' + datetime, '', ''];
|
||||||
let str;
|
let str;
|
||||||
if (format === 'micro') {
|
if (format === 'micro') {
|
||||||
// If date <= 1 day ago or day is within this year
|
// If date <= 1 day ago or day is within this year
|
||||||
|
@ -37,6 +38,7 @@ export default function RelativeTime({ datetime, format }) {
|
||||||
}, [date, format, renderCount]);
|
}, [date, format, renderCount]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!date.isValid()) return;
|
||||||
let timeout;
|
let timeout;
|
||||||
let raf;
|
let raf;
|
||||||
function rafRerender() {
|
function rafRerender() {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useSearchParams } from 'react-router-dom';
|
||||||
import Link from '../components/link';
|
import Link from '../components/link';
|
||||||
import Timeline from '../components/timeline';
|
import Timeline from '../components/timeline';
|
||||||
import { api } from '../utils/api';
|
import { api } from '../utils/api';
|
||||||
|
import { fixNotifications } from '../utils/group-notifications';
|
||||||
import { saveStatus } from '../utils/states';
|
import { saveStatus } from '../utils/states';
|
||||||
import useTitle from '../utils/useTitle';
|
import useTitle from '../utils/useTitle';
|
||||||
|
|
||||||
|
@ -30,6 +31,8 @@ function Mentions({ columnMode, ...props }) {
|
||||||
const results = await mentionsIterator.current.next();
|
const results = await mentionsIterator.current.next();
|
||||||
let { value } = results;
|
let { value } = results;
|
||||||
if (value?.length) {
|
if (value?.length) {
|
||||||
|
value = fixNotifications(value);
|
||||||
|
|
||||||
if (firstLoad) {
|
if (firstLoad) {
|
||||||
latestItem.current = value[0].id;
|
latestItem.current = value[0].id;
|
||||||
console.log('First load', latestItem.current);
|
console.log('First load', latestItem.current);
|
||||||
|
|
|
@ -9,7 +9,7 @@ const notificationTypeKeys = {
|
||||||
poll: ['status'],
|
poll: ['status'],
|
||||||
update: ['status'],
|
update: ['status'],
|
||||||
};
|
};
|
||||||
function fixNotifications(notifications) {
|
export function fixNotifications(notifications) {
|
||||||
return notifications.filter((notification) => {
|
return notifications.filter((notification) => {
|
||||||
const { type, id, createdAt } = notification;
|
const { type, id, createdAt } = notification;
|
||||||
if (!type) {
|
if (!type) {
|
||||||
|
|
|
@ -107,10 +107,10 @@ export function getCurrentInstance() {
|
||||||
return (currentInstance = instances[instance]);
|
return (currentInstance = instances[instance]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
alert(`Failed to load instance configuration. Please try again.\n\n${e}`);
|
// alert(`Failed to load instance configuration. Please try again.\n\n${e}`);
|
||||||
// Temporary fix for corrupted data
|
// Temporary fix for corrupted data
|
||||||
store.local.del('instances');
|
// store.local.del('instances');
|
||||||
location.reload();
|
// location.reload();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue