Skip to content

Commit

Permalink
Ingawei/man 2090 hide users who dislike comments (#3170)
Browse files Browse the repository at this point in the history
  • Loading branch information
ingawei authored Nov 30, 2024
1 parent 0963eac commit 4a3e9ce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
8 changes: 5 additions & 3 deletions backend/scripts/shift-tiers/backfill-tier-column.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- Create a function to update contracts in batches
drop function if exists update_contract_tiers_efficient(batch_size INTEGER, start_time TIMESTAMP );
drop function if exists update_contract_tiers_efficient (batch_size integer, start_time timestamp);

create
or replace function update_contract_tiers_efficient (batch_size integer, start_time timestamp) returns table (
updated_count integer,
Expand All @@ -19,7 +20,9 @@ BEGIN
COALESCE((data->>'totalLiquidity')::NUMERIC, 0)
) AS new_tier
FROM contracts
WHERE created_time > start_time
-- WHERE created_time > start_time
WHERE token = 'CASH' -- Added condition
AND tier IS NULL -- Added condition
AND (data->>'totalLiquidity' IS NOT NULL)
ORDER BY created_time
LIMIT batch_size
Expand Down Expand Up @@ -48,4 +51,3 @@ $$ language plpgsql;

-- Commit the transaction to save the functions
commit;

1 change: 1 addition & 0 deletions web/components/comments/comment-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ export function LikeAndDislikeComment(props: {
onReact={() => setUserReactedWith('dislike')}
onUnreact={() => setUserReactedWith('none')}
className={'min-w-[60px]'}
hideReactList
/>
</>
)
Expand Down
8 changes: 6 additions & 2 deletions web/components/contract/react-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const ReactButton = memo(function ReactButton(props: {
userReactedWith?: 'like' | 'dislike' | 'none'
onReact?: () => void
onUnreact?: () => void
hideReactList?: boolean
}) {
const {
user,
Expand All @@ -66,6 +67,7 @@ export const ReactButton = memo(function ReactButton(props: {
heartClassName,
reactionType = 'like',
userReactedWith,
hideReactList,
} = props
const allReactions = useReactionsOnContent(contentType, contentId)
const reactions = allReactions?.filter(
Expand Down Expand Up @@ -130,7 +132,9 @@ export const ReactButton = memo(function ReactButton(props: {

const likeLongPress = useLongTouch(
() => {
setModalOpen(true)
if (!hideReactList) {
setModalOpen(true)
}
},
() => {
if (!disabled) {
Expand All @@ -144,7 +148,7 @@ export const ReactButton = memo(function ReactButton(props: {
)

const otherLikes = reacted ? totalReactions - 1 : totalReactions
const showList = otherLikes > 0
const showList = otherLikes > 0 && !hideReactList
const thumbIcon = iconType == 'thumb' || reactionType == 'dislike'

return (
Expand Down

0 comments on commit 4a3e9ce

Please sign in to comment.