mirror of
https://github.com/zkitter/ui.git
synced 2026-01-09 21:28:05 -05:00
fix: notification display for likes and getLikers query (#76)
* fix display for notification view for likes * fix query when getting likers
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import classNames from 'classnames';
|
||||
import moment from 'moment/moment';
|
||||
import React, { ReactElement, useCallback, useEffect, useState } from 'react';
|
||||
import React, { ReactElement, useCallback } from 'react';
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
import { convertMarkdownToDraft, DraftEditor } from '../DraftEditor';
|
||||
import { fetchLikersByPost, useMeta, usePost, useZKGroupFromPost } from '../../ducks/posts';
|
||||
import { useMeta, usePost, useZKGroupFromPost } from '../../ducks/posts';
|
||||
import { useUser } from '../../ducks/users';
|
||||
import { MessageType, PostMessageSubType } from '../../util/message';
|
||||
import { getHandle, getUsername } from '../../util/user';
|
||||
|
||||
@@ -80,7 +80,7 @@ export default function UsersCountModal(props: {
|
||||
// hacky?
|
||||
const { fetch, count } = useItem(item, id);
|
||||
|
||||
const many = count && count > 1 && item !== Item.Following;
|
||||
const many = !!count && count > 1 && item !== Item.Following;
|
||||
const text = `${item}${many ? 's' : ''}`;
|
||||
const title = item === Item.Like ? 'Liked By' : text;
|
||||
|
||||
@@ -109,7 +109,7 @@ export default function UsersCountModal(props: {
|
||||
<div className="hover:underline cursor-pointer" onClick={onClick}>
|
||||
<div className="flex flex-row flex-nowrap item-center">
|
||||
<div className="font-semibold">{count}</div>
|
||||
<div className="ml-2 text-gray-500">{`${text}${many ? 's' : ''}`}</div>
|
||||
<div className="ml-2 text-gray-500">{`${text}`}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -246,7 +246,9 @@ export const fetchLikersByPost = async (
|
||||
const { creator, hash } = parseMessageId(messageId);
|
||||
|
||||
const resp = await fetch(
|
||||
`${config.indexerAPI}/v1/post/${creator}%2F${hash}/likes?limit=${limit}&offset=${offset}`,
|
||||
`${config.indexerAPI}/v1/post/${encodeURIComponent(
|
||||
messageId
|
||||
)}/likes?limit=${limit}&offset=${offset}`,
|
||||
{ method: 'GET' }
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user