Skip to content

Commit

Permalink
[Glitch] Add setting to disable hover cards
Browse files Browse the repository at this point in the history
Port ad52b04 to glitch-soc

Co-authored-by: Eugen Rochko <[email protected]>
  • Loading branch information
ClearlyClaire and Gargron committed Jul 12, 2024
1 parent 55cf5e0 commit 8d2a93b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class StatusContent extends PureComponent {

if (mention) {
link.addEventListener('click', this.onMentionClick.bind(this, mention), false);
link.removeAttribute('title');
link.setAttribute('title', `@${mention.get('acct')}`);
link.setAttribute('data-hover-card-account', mention.get('id'));
if (rewriteMentions !== 'no') {
while (link.firstChild) link.removeChild(link.firstChild);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default class StatusHeader extends PureComponent {
target='_blank'
onClick={this.handleAccountClick}
rel='noopener noreferrer'
title={status.getIn(['account', 'acct'])}
data-hover-card-account={status.getIn(['account', 'id'])}
>
<div className='status__avatar'>
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/flavours/glitch/features/ui/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { clearHeight } from '../../actions/height_cache';
import { expandNotifications, notificationsSetVisibility } from '../../actions/notifications';
import { fetchServer, fetchServerTranslationLanguages } from '../../actions/server';
import { expandHomeTimeline } from '../../actions/timelines';
import initialState, { me, owner, singleUserMode, trendsEnabled, trendsAsLanding } from '../../initial_state';
import initialState, { me, owner, singleUserMode, trendsEnabled, trendsAsLanding, disableHoverCards } from '../../initial_state';

import BundleColumnError from './components/bundle_column_error';
import Header from './components/header';
Expand Down Expand Up @@ -651,7 +651,7 @@ class UI extends PureComponent {

{layout !== 'mobile' && <PictureInPicture />}
<NotificationsContainer />
<HoverCardController />
{!disableHoverCards && <HoverCardController />}
<LoadingBarContainer className='loading-bar' />
<ModalContainer />
<UploadArea active={draggingOver} onClose={this.closeUploadModal} />
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/flavours/glitch/initial_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @property {boolean} crop_images
* @property {boolean=} delete_modal
* @property {boolean=} disable_swiping
* @property {boolean=} disable_hover_cards
* @property {string=} disabled_account_id
* @property {string} display_media
* @property {string} domain
Expand Down Expand Up @@ -106,6 +107,7 @@ export const boostModal = getMeta('boost_modal');
export const cropImages = getMeta('crop_images');
export const deleteModal = getMeta('delete_modal');
export const disableSwiping = getMeta('disable_swiping');
export const disableHoverCards = getMeta('disable_hover_cards');
export const disabledAccountId = getMeta('disabled_account_id');
export const displayMedia = getMeta('display_media');
export const domain = getMeta('domain');
Expand Down

0 comments on commit 8d2a93b

Please sign in to comment.