Merge commit '55f59b4343' into kb_migration

This commit is contained in:
KMY 2023-04-09 09:28:58 +09:00
commit c459fcb78b
10 changed files with 34 additions and 15 deletions

View file

@ -18,7 +18,6 @@ export function fetchEmojiReactedStatuses() {
dispatch(fetchEmojiReactedStatusesRequest());
api(getState).get('/api/v1/emoji_reactions').then(response => {
console.dir(response.data)
const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(importFetchedStatuses(response.data));
dispatch(fetchEmojiReactedStatusesSuccess(response.data, next ? next.uri : null));

View file

@ -66,8 +66,16 @@ export function normalizeStatus(status, normalOldStatus) {
normalStatus.filtered = status.filtered.map(normalizeFilterResult);
}
if (status.emoji_reactions && normalOldStatus && normalOldStatus.get('emoji_reactions')) {
normalStatus.emoji_reactions = normalizeEmojiReactions(normalOldStatus.get('emoji_reactions').toArray());
if (status.emoji_reactions) {
normalStatus.emoji_reactions = normalizeEmojiReactions(status.emoji_reactions);
}
if (status.media_attachments_ex) {
normalStatus.media_attachments = status.media_attachments.concat(status.media_attachments_ex);
}
if (!status.visibility_ex) {
normalStatus.visibility_ex = status.visibility;
}
// Only calculate these values when status first encountered and
@ -104,8 +112,8 @@ export function normalizeEmojiReactions(emoji_reactions) {
const myAccountId = me;
let converted = [];
for (let emoji_reaction of emoji_reactions) {
let obj = emoji_reaction.toObject();
obj.me = obj.account_ids.toArray().some((id) => id === myAccountId);
let obj = emoji_reaction;
obj.me = obj.account_ids.some((id) => id === myAccountId);
converted.push(obj);
}
return converted;

View file

@ -357,7 +357,6 @@ class MediaGallery extends React.PureComponent {
}
const maxSize = displayMediaExpand ? 8 : 4;
console.log(displayMediaExpand);
const size = media.take(maxSize).size;
const uncached = media.every(attachment => attachment.get('type') === 'unknown');

View file

@ -518,7 +518,7 @@ class Status extends ImmutablePureComponent {
'direct': { icon: 'at', text: intl.formatMessage(messages.direct_short) },
};
const visibilityIcon = visibilityIconInfo[status.get('visibility_ex')];
const visibilityIcon = visibilityIconInfo[status.get('visibility_ex')] || visibilityIconInfo[status.get('visibility')];
let emojiReactionsBar = null;
if (!this.props.withoutEmojiReactions && status.get('emoji_reactions')) {

View file

@ -8,11 +8,12 @@ import { HASHTAG_PATTERN_REGEX } from 'mastodon/utils/hashtags';
const mapStateToProps = state => ({
needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),
hashtagWarning: state.getIn(['compose', 'privacy']) !== 'public' && HASHTAG_PATTERN_REGEX.test(state.getIn(['compose', 'text'])),
hashtagWarning: ['public', 'public_unlisted'].indexOf(state.getIn(['compose', 'privacy'])) < 0 && HASHTAG_PATTERN_REGEX.test(state.getIn(['compose', 'text'])),
directMessageWarning: state.getIn(['compose', 'privacy']) === 'direct',
searchabilityWarning: state.getIn(['compose', 'searchability']) === 'direct',
});
const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning }) => {
const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning, searchabilityWarning }) => {
if (needsLockWarning) {
return <Warning message={<FormattedMessage id='compose_form.lock_disclaimer' defaultMessage='Your account is not {locked}. Anyone can follow you to view your follower-only posts.' values={{ locked: <a href='/settings/profile'><FormattedMessage id='compose_form.lock_disclaimer.lock' defaultMessage='locked' /></a> }} />} />;
}
@ -31,6 +32,10 @@ const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning
return <Warning message={message} />;
}
if (searchabilityWarning) {
return <Warning message={<FormattedMessage id='compose_form.searchability_warning' defaultMessage='Self only searchability is not available other mastodon servers. Others can search your post.' />} />;
}
return null;
};
@ -38,6 +43,7 @@ WarningWrapper.propTypes = {
needsLockWarning: PropTypes.bool,
hashtagWarning: PropTypes.bool,
directMessageWarning: PropTypes.bool,
searchabilityWarning: PropTypes.bool,
};
export default connect(mapStateToProps)(WarningWrapper);

View file

@ -132,6 +132,7 @@
"compose_form.lock_disclaimer": "Your account is not {locked}. Anyone can follow you to view your follower-only posts.",
"compose_form.lock_disclaimer.lock": "locked",
"compose_form.placeholder": "What's on your mind?",
"compose_form.searchability_warning": "Self only searchability is not available other mastodon servers. Others can search your post.",
"compose_form.poll.add_option": "Add a choice",
"compose_form.poll.duration": "Poll duration",
"compose_form.poll.option_placeholder": "Choice {number}",

View file

@ -132,6 +132,7 @@
"compose_form.lock_disclaimer": "あなたのアカウントは{locked}になっていません。誰でもあなたをフォローすることができ、フォロワー限定の投稿を見ることができます。",
"compose_form.lock_disclaimer.lock": "承認制",
"compose_form.placeholder": "今なにしてる?",
"compose_form.searchability_warning": "検索許可「自分のみ」はkmyblue内の検索でのみ有効です。他のサーバーでは「リアクションした人のみ」と同等に扱われます",
"compose_form.poll.add_option": "追加",
"compose_form.poll.duration": "アンケート期間",
"compose_form.poll.option_placeholder": "項目 {number}",