Merge branch 'repost-events' into 'develop'

Add 'Repost event' to menu

Closes #1272

See merge request soapbox-pub/soapbox!2225
This commit is contained in:
marcin mikołajczak 2023-01-25 23:33:32 +00:00
commit da1510a089
3 changed files with 32 additions and 9 deletions

View File

@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Compatibility: added compatibility with Friendica.
- Posts: bot badge on statuses from bot accounts.
- Compatibility: improved browser support for older browsers.
- Events: allow to repost events in event menu.
### Changed
- Chats: improved display of media attachments.

View File

@ -7,7 +7,7 @@ import { blockAccount } from 'soapbox/actions/accounts';
import { launchChat } from 'soapbox/actions/chats';
import { directCompose, mentionCompose, quoteCompose } from 'soapbox/actions/compose';
import { editEvent, fetchEventIcs } from 'soapbox/actions/events';
import { toggleBookmark, togglePin } from 'soapbox/actions/interactions';
import { toggleBookmark, togglePin, toggleReblog } from 'soapbox/actions/interactions';
import { openModal } from 'soapbox/actions/modals';
import { deleteStatusModal, toggleStatusSensitivityModal } from 'soapbox/actions/moderation';
import { initMuteModal } from 'soapbox/actions/mutes';
@ -18,7 +18,7 @@ import StillImage from 'soapbox/components/still-image';
import { Button, HStack, IconButton, Menu, MenuButton, MenuDivider, MenuItem, MenuLink, MenuList, Stack, Text } from 'soapbox/components/ui';
import SvgIcon from 'soapbox/components/ui/icon/svg-icon';
import VerificationBadge from 'soapbox/components/verification-badge';
import { useAppDispatch, useFeatures, useOwnAccount } from 'soapbox/hooks';
import { useAppDispatch, useFeatures, useOwnAccount, useSettings } from 'soapbox/hooks';
import { isRemote } from 'soapbox/utils/accounts';
import copy from 'soapbox/utils/copy';
import { download } from 'soapbox/utils/download';
@ -38,11 +38,11 @@ const messages = defineMessages({
external: { id: 'event.external', defaultMessage: 'View event on {domain}' },
bookmark: { id: 'status.bookmark', defaultMessage: 'Bookmark' },
unbookmark: { id: 'status.unbookmark', defaultMessage: 'Remove bookmark' },
quotePost: { id: 'status.quote', defaultMessage: 'Quote post' },
quotePost: { id: 'event.quote', defaultMessage: 'Quote event' },
reblog: { id: 'event.reblog', defaultMessage: 'Repost event' },
unreblog: { id: 'event.unreblog', defaultMessage: 'Un-repost event' },
pin: { id: 'status.pin', defaultMessage: 'Pin on profile' },
unpin: { id: 'status.unpin', defaultMessage: 'Unpin from profile' },
reblog_private: { id: 'status.reblog_private', defaultMessage: 'Repost to original audience' },
cancel_reblog_private: { id: 'status.cancel_reblog_private', defaultMessage: 'Un-repost' },
delete: { id: 'status.delete', defaultMessage: 'Delete' },
mention: { id: 'status.mention', defaultMessage: 'Mention @{name}' },
chat: { id: 'status.chat', defaultMessage: 'Chat with @{name}' },
@ -72,6 +72,7 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
const history = useHistory();
const features = useFeatures();
const settings = useSettings();
const ownAccount = useOwnAccount();
const isStaff = ownAccount ? ownAccount.staff : false;
const isAdmin = ownAccount ? ownAccount.admin : false;
@ -121,6 +122,16 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
dispatch(toggleBookmark(status));
};
const handleReblogClick = () => {
const modalReblog = () => dispatch(toggleReblog(status));
const boostModal = settings.get('boostModal');
if (!boostModal) {
modalReblog();
} else {
dispatch(openModal('BOOST', { status, onReblog: modalReblog }));
}
};
const handleQuoteClick = () => {
dispatch(quoteCompose(status));
};
@ -224,6 +235,13 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
});
}
if (['public', 'unlisted'].includes(status.visibility)) {
menu.push({
text: intl.formatMessage(status.reblogged ? messages.unreblog : messages.reblog),
action: handleReblogClick,
icon: require('@tabler/icons/repeat.svg'),
});
if (features.quotePosts) {
menu.push({
text: intl.formatMessage(messages.quotePost),
@ -231,6 +249,7 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
icon: require('@tabler/icons/quote.svg'),
});
}
}
menu.push(null);

View File

@ -639,7 +639,10 @@
"event.manage": "Manage",
"event.organized_by": "Organized by {name}",
"event.participants": "{count} {rawCount, plural, one {person} other {people}} going",
"event.quote": "Quote event",
"event.reblog": "Repost event",
"event.show_on_map": "Show on map",
"event.unreblog": "Un-repost event",
"event.website": "External links",
"event_map.navigate": "Navigate",
"events.create_event": "Create event",