0
0
Fork 0

Add option to open original page in dropdowns of remote content in web UI (#20299)

Change profile picture click to open profile picture in modal in web UI
This commit is contained in:
Eugen Rochko 2022-11-10 08:49:35 +01:00 committed by GitHub
parent e37e8deb0f
commit ef582dc4f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 111 additions and 40 deletions

View file

@ -45,6 +45,7 @@ const messages = defineMessages({
unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
filter: { id: 'status.filter', defaultMessage: 'Filter this post' },
openOriginalPage: { id: 'account.open_original_page', defaultMessage: 'Open original page' },
});
const mapStateToProps = (state, { status }) => ({
@ -221,25 +222,10 @@ class StatusActionBar extends ImmutablePureComponent {
}
handleCopy = () => {
const url = this.props.status.get('url');
const textarea = document.createElement('textarea');
textarea.textContent = url;
textarea.style.position = 'fixed';
document.body.appendChild(textarea);
try {
textarea.select();
document.execCommand('copy');
} catch (e) {
} finally {
document.body.removeChild(textarea);
}
const url = this.props.status.get('url');
navigator.clipboard.writeText(url);
}
handleHideClick = () => {
this.props.onFilter();
}
@ -254,12 +240,17 @@ class StatusActionBar extends ImmutablePureComponent {
const mutingConversation = status.get('muted');
const account = status.get('account');
const writtenByMe = status.getIn(['account', 'id']) === me;
const isRemote = status.getIn(['account', 'username']) !== status.getIn(['account', 'acct']);
let menu = [];
menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen });
if (publicStatus) {
if (isRemote) {
menu.push({ text: intl.formatMessage(messages.openOriginalPage), href: status.get('url') });
}
menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
}