Merge commit '55f59b4343
' into kb_migration
This commit is contained in:
commit
c459fcb78b
10 changed files with 34 additions and 15 deletions
|
@ -41,11 +41,7 @@ class Api::V1::Statuses::EmojiReactionsController < Api::BaseController
|
|||
|
||||
def create_private(emoji)
|
||||
count = EmojiReaction.where(account: current_account, status: @status).count
|
||||
|
||||
if count >= EmojiReaction::EMOJI_REACTION_PER_ACCOUNT_LIMIT
|
||||
bad_request
|
||||
return
|
||||
end
|
||||
raise Mastodon::ValidationError, I18n.t('reactions.errors.limit_reached') if count >= EmojiReaction::EMOJI_REACTION_PER_ACCOUNT_LIMIT
|
||||
|
||||
EmojiReactService.new.call(current_account, @status, emoji)
|
||||
render json: @status, serializer: REST::StatusSerializer
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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')) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -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}",
|
||||
|
|
|
@ -290,6 +290,14 @@ class Status < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def ordered_media_attachments_original_mastodon
|
||||
ordered_media_attachments.take(4)
|
||||
end
|
||||
|
||||
def ordered_media_attachments_extra
|
||||
ordered_media_attachments.drop(4).take(4)
|
||||
end
|
||||
|
||||
def replies_count
|
||||
status_stat&.replies_count || 0
|
||||
end
|
||||
|
|
|
@ -22,7 +22,8 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||
belongs_to :application, if: :show_application?
|
||||
belongs_to :account, serializer: REST::AccountSerializer
|
||||
|
||||
has_many :ordered_media_attachments, key: :media_attachments, serializer: REST::MediaAttachmentSerializer
|
||||
has_many :ordered_media_attachments_original_mastodon, key: :media_attachments, serializer: REST::MediaAttachmentSerializer
|
||||
has_many :ordered_media_attachments_extra, key: :media_attachments_ex, serializer: REST::MediaAttachmentSerializer
|
||||
has_many :ordered_mentions, key: :mentions
|
||||
has_many :tags
|
||||
has_many :emojis, serializer: REST::CustomEmojiSerializer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue