Merge pull request #446 from cheeaun/main

Update from main
This commit is contained in:
Chee Aun 2024-03-07 22:28:08 +08:00 committed by GitHub
commit aed84226a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 41 additions and 21 deletions

View file

@ -62,6 +62,7 @@ function AccountBlock({
group, group,
followersCount, followersCount,
createdAt, createdAt,
locked,
} = account; } = account;
let [_, acct1, acct2] = acct.match(/([^@]+)(@.+)/i) || [, acct]; let [_, acct1, acct2] = acct.match(/([^@]+)(@.+)/i) || [, acct];
if (accountInstance) { if (accountInstance) {
@ -123,6 +124,12 @@ function AccountBlock({
@{acct1} @{acct1}
<wbr /> <wbr />
{acct2} {acct2}
{locked && (
<>
{' '}
<Icon icon="lock" size="s" alt="Locked" />
</>
)}
</span> </span>
{showActivity && ( {showActivity && (
<> <>

View file

@ -232,8 +232,8 @@ function ReportModal({ account, post, onClose }) {
disabled={uiState === 'loading'} disabled={uiState === 'loading'}
/> />
</section> </section>
<section> {!!domain && domain !== currentDomain && (
{domain !== currentDomain && ( <section>
<p> <p>
<label> <label>
<input <input
@ -247,8 +247,8 @@ function ReportModal({ account, post, onClose }) {
</span> </span>
</label> </label>
</p> </p>
)} </section>
</section> )}
<footer> <footer>
<button type="submit" disabled={uiState === 'loading'}> <button type="submit" disabled={uiState === 'loading'}>
Send Report Send Report

View file

@ -73,7 +73,7 @@ const SearchForm = forwardRef((props, ref) => {
autocomplete="off" autocomplete="off"
autocorrect="off" autocorrect="off"
autocapitalize="off" autocapitalize="off"
spellcheck="false" spellCheck="false"
onSearch={(e) => { onSearch={(e) => {
if (!e.target.value) { if (!e.target.value) {
setSearchParams({}); setSearchParams({});

View file

@ -671,7 +671,7 @@ function ShortcutForm({
} }
autocorrect="off" autocorrect="off"
autocapitalize="off" autocapitalize="off"
spellcheck={false} spellCheck={false}
pattern={pattern} pattern={pattern}
/> />
{currentType === 'hashtag' && {currentType === 'hashtag' &&

View file

@ -947,7 +947,7 @@ function Status({
}} }}
> >
<Icon icon="code" /> <Icon icon="code" />
<span>Embed</span> <span>Embed post</span>
</MenuItem> </MenuItem>
)} )}
{(isSelf || mentionSelf) && <MenuDivider />} {(isSelf || mentionSelf) && <MenuDivider />}

View file

@ -32,12 +32,12 @@ import { oklab2rgb, rgb2oklab } from '../utils/color-utils';
import db from '../utils/db'; import db from '../utils/db';
import emojifyText from '../utils/emojify-text'; import emojifyText from '../utils/emojify-text';
import { isFiltered } from '../utils/filters'; import { isFiltered } from '../utils/filters';
import getHTMLText from '../utils/getHTMLText';
import htmlContentLength from '../utils/html-content-length'; import htmlContentLength from '../utils/html-content-length';
import niceDateTime from '../utils/nice-date-time'; import niceDateTime from '../utils/nice-date-time';
import shortenNumber from '../utils/shorten-number'; import shortenNumber from '../utils/shorten-number';
import showToast from '../utils/show-toast'; import showToast from '../utils/show-toast';
import states, { statusKey } from '../utils/states'; import states, { statusKey } from '../utils/states';
import statusPeek from '../utils/status-peek';
import store from '../utils/store'; import store from '../utils/store';
import { getCurrentAccountNS } from '../utils/store-utils'; import { getCurrentAccountNS } from '../utils/store-utils';
import { assignFollowedTags } from '../utils/timeline-utils'; import { assignFollowedTags } from '../utils/timeline-utils';
@ -1484,7 +1484,7 @@ function PostPeek({ post, filterInfo }) {
const isThread = const isThread =
(inReplyToId && inReplyToAccountId === account.id) || !!_thread; (inReplyToId && inReplyToAccountId === account.id) || !!_thread;
const showMedia = !spoilerText && !sensitive; const showMedia = !spoilerText && !sensitive;
const postText = content ? getHTMLText(content) : ''; const postText = content ? statusPeek(post) : '';
return ( return (
<div class="post-peek" title={!spoilerText ? postText : ''}> <div class="post-peek" title={!spoilerText ? postText : ''}>
@ -1518,19 +1518,27 @@ function PostPeek({ post, filterInfo }) {
<span class="post-peek-tag post-peek-thread">Thread</span>{' '} <span class="post-peek-tag post-peek-thread">Thread</span>{' '}
</> </>
)} )}
{content ? ( {!!content && (
<div <div
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: emojifyText(content, emojis), __html: emojifyText(content, emojis),
}} }}
/> />
) : mediaAttachments?.length === 1 && )}
mediaAttachments[0].description ? ( {!!poll?.options?.length &&
<> poll.options.map((o) => (
<span class="post-peek-tag post-peek-alt">ALT</span>{' '} <div>
<div>{mediaAttachments[0].description}</div> {poll.multiple ? '▪️' : '•'} {o.title}
</> </div>
) : null} ))}
{!content &&
mediaAttachments?.length === 1 &&
mediaAttachments[0].description && (
<>
<span class="post-peek-tag post-peek-alt">ALT</span>{' '}
<div>{mediaAttachments[0].description}</div>
</>
)}
</div> </div>
)} )}
</span> </span>

View file

@ -285,7 +285,7 @@ function Hashtags({ media: mediaView, columnMode, ...props }) {
required required
autocorrect="off" autocorrect="off"
autocapitalize="off" autocapitalize="off"
spellcheck={false} spellCheck={false}
// no spaces, no hashtags // no spaces, no hashtags
pattern="[^#][^\s#]+[^#]" pattern="[^#][^\s#]+[^#]"
disabled={reachLimit} disabled={reachLimit}

View file

@ -160,7 +160,7 @@ function Login() {
autocorrect="off" autocorrect="off"
autocapitalize="off" autocapitalize="off"
autocomplete="off" autocomplete="off"
spellcheck={false} spellCheck={false}
placeholder="instance domain" placeholder="instance domain"
onInput={(e) => { onInput={(e) => {
setInstanceText(e.target.value); setInstanceText(e.target.value);

View file

@ -221,6 +221,9 @@ function Notifications({ columnMode }) {
lastHiddenTime.current = Date.now(); lastHiddenTime.current = Date.now();
} }
unsub = subscribeKey(states, 'notificationsShowNew', (v) => { unsub = subscribeKey(states, 'notificationsShowNew', (v) => {
if (uiState === 'loading') {
return;
}
if (v) { if (v) {
loadUpdates(); loadUpdates();
} }

View file

@ -9,8 +9,10 @@ function statusPeek(status) {
text += getHTMLText(content); text += getHTMLText(content);
} }
text = text.trim(); text = text.trim();
if (poll) { if (poll?.options?.length) {
text += ' 📊'; text += `\n\n📊:\n${poll.options
.map((o) => `${poll.multiple ? '▪️' : '•'} ${o.title}`)
.join('\n')}`;
} }
if (mediaAttachments?.length) { if (mediaAttachments?.length) {
text += text +=