Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
Don't render cards in notifications unless they are mentions/replies
Browse files Browse the repository at this point in the history
Fixes #577
  • Loading branch information
eramdam committed Apr 9, 2021
1 parent e8d41a7 commit f7e4151
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/features/renderCardsInColumns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
TweetDeckChirp,
TweetDeckColumn,
TweetDeckColumnMediaPreviewSizesEnum,
TwitterActionEnum,
} from '../types/tweetdeckTypes';

export const maybeRenderCardsInColumns = makeBTDModule((options) => {
Expand Down Expand Up @@ -108,7 +109,11 @@ export const maybeRenderCardsInColumns = makeBTDModule((options) => {
const baseChirp = getChirpFromKey(TD, payload.chirp.id, payload.columnKey);

// In the case of a reply, we want the `targetTweet`, as the chirp itself is just a notification
const actualChirp = baseChirp?.targetTweet ? baseChirp.targetTweet : baseChirp;
const isEligibleNotification =
payload.chirpExtra.action === TwitterActionEnum.MENTION ||
payload.chirpExtra.action === TwitterActionEnum.REPLY;
const actualChirp =
baseChirp?.targetTweet && isEligibleNotification ? baseChirp.targetTweet : baseChirp;

if (!actualChirp || !actualChirp.card || !renderCardForChirpModule || !getColumnTypeModule) {
return;
Expand Down

0 comments on commit f7e4151

Please sign in to comment.