Skip to content

Commit

Permalink
Allow disabling reactions from content or comments or from both
Browse files Browse the repository at this point in the history
  • Loading branch information
miko authored and tzarebczan committed Apr 11, 2024
1 parent cde4cbe commit ad84571
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
2 changes: 0 additions & 2 deletions static/app-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2958,8 +2958,6 @@
"Publications: %claims%": "Publications: %claims%",
"Channels:": "Channels",
"Larger comment histories may take time to load": "Larger comment histories may take time to load",
"Disable Slimes Video + Comments": "Disable Slimes Video + Comments",
"Disable Reactions Video + Comments": "Disable Reactions Video + Comments",
"Disable Tipping and Boosting": "Disable Tipping and Boosting",

"--end--": "--end--"
Expand Down
15 changes: 12 additions & 3 deletions ui/component/commentReactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import { doToast } from 'redux/actions/notifications';
import { selectMyReactsForComment, selectOthersReactsForComment } from 'redux/selectors/comments';
import { doCommentReact } from 'redux/actions/comments';
import { selectActiveChannelClaim } from 'redux/selectors/app';
import { DISABLE_REACTIONS_ALL_TAG, DISABLE_SLIMES_ALL_TAG } from 'constants/tags';
import {
DISABLE_REACTIONS_ALL_TAG,
DISABLE_SLIMES_ALL_TAG,
DISABLE_SLIMES_COMMENTS_TAG,
DISABLE_REACTIONS_COMMENTS_TAG,
} from 'constants/tags';

const select = (state, props) => {
const activeChannelClaim = selectActiveChannelClaim(state);
Expand All @@ -16,8 +21,12 @@ const select = (state, props) => {

return {
claim,
disableReactions: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_REACTIONS_ALL_TAG)(state),
disableSlimes: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SLIMES_ALL_TAG)(state),
disableReactions:
makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_REACTIONS_ALL_TAG)(state) ||
makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_REACTIONS_COMMENTS_TAG)(state),
disableSlimes:
makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SLIMES_ALL_TAG)(state) ||
makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SLIMES_COMMENTS_TAG)(state),
claimIsMine: selectClaimIsMine(state, claim),
myReacts: selectMyReactsForComment(state, reactionKey),
othersReacts: selectOthersReactsForComment(state, reactionKey),
Expand Down
4 changes: 0 additions & 4 deletions ui/component/tagsSearch/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ export default function TagsSearch(props: Props) {
let label;
if (t === 'disable-support') {
label = __('Disable Tipping and Boosting');
} else if (t === 'c:disable-reactions-all') {
label = __('Disable Reactions Video + Comments');
} else if (t === 'c:disable-slimes-all') {
label = __('Disable Slimes Video + Comments');
} else {
label = __(
t
Expand Down
15 changes: 12 additions & 3 deletions ui/constants/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export const LBRY_FIRST_TAG = 'c:lbry-first';
export const DISABLE_DOWNLOAD_BUTTON_TAG = 'c:disable-download';
export const DISABLE_REACTIONS_ALL_TAG = 'c:disable-reactions-all';
export const DISABLE_REACTIONS_VIDEO_TAG = 'c:disable-reactions-video';
export const DISABLE_REACTIONS_COMMENTS_TAG = 'c:disable-reactions-comments';
export const DISABLE_SLIMES_ALL_TAG = 'c:disable-slimes-all';
export const DISABLE_SLIMES_VIDEO_TAG = 'c:disable-slimes-video';
export const DISABLE_SLIMES_COMMENTS_TAG = 'c:disable-slimes-comments';

export const PURCHASE_TAG = 'c:purchase';
export const RENTAL_TAG = 'c:rental';
Expand All @@ -50,16 +52,23 @@ export const SCHEDULED_TAGS = Object.freeze({
export const CONTROL_TAGS = [
DISABLE_SUPPORT_TAG,
DISABLE_DOWNLOAD_BUTTON_TAG,
DISABLE_REACTIONS_ALL_TAG,
DISABLE_REACTIONS_VIDEO_TAG,
DISABLE_SLIMES_ALL_TAG,
DISABLE_REACTIONS_COMMENTS_TAG,
DISABLE_SLIMES_VIDEO_TAG,
DISABLE_SLIMES_COMMENTS_TAG,
];

// System tags are special tags that are not available to the user.
export const SYSTEM_TAGS = [LBRY_FIRST_TAG, ...Object.values(VISIBILITY_TAGS), ...Object.values(SCHEDULED_TAGS)];

export const INTERNAL_TAGS = [...CONTROL_TAGS, ...SYSTEM_TAGS, ...MEMBERS_ONLY_TAGS, PREFERENCE_EMBED];
export const INTERNAL_TAGS = [
...CONTROL_TAGS,
...SYSTEM_TAGS,
...MEMBERS_ONLY_TAGS,
PREFERENCE_EMBED,
DISABLE_REACTIONS_ALL_TAG,
DISABLE_SLIMES_ALL_TAG,
];

export const MATURE_TAGS = Object.freeze([
'porn',
Expand Down

0 comments on commit ad84571

Please sign in to comment.