diff --git a/lib/shared/entry-utils.js b/lib/shared/entry-utils.js --- a/lib/shared/entry-utils.js +++ b/lib/shared/entry-utils.js @@ -48,7 +48,7 @@ month: rawEntryInfo.month, day: rawEntryInfo.day, creationTime: rawEntryInfo.creationTime, - creator: creatorInfo && creatorInfo.username, + creator: creatorInfo, deleted: rawEntryInfo.deleted, }; } diff --git a/lib/types/entry-types.js b/lib/types/entry-types.js --- a/lib/types/entry-types.js +++ b/lib/types/entry-types.js @@ -12,7 +12,7 @@ ServerCreateUpdatesResponse, ClientCreateUpdatesResponse, } from './update-types'; -import type { AccountUserInfo } from './user-types'; +import type { UserInfo, AccountUserInfo } from './user-types'; export type RawEntryInfo = { id?: string, // null if local copy without ID yet @@ -36,7 +36,7 @@ month: number, // 1-indexed day: number, // 1-indexed creationTime: number, // millisecond timestamp - creator: ?string, + creator: ?UserInfo, deleted: boolean, }; diff --git a/web/modals/history/history-entry.react.js b/web/modals/history/history-entry.react.js --- a/web/modals/history/history-entry.react.js +++ b/web/modals/history/history-entry.react.js @@ -8,6 +8,7 @@ restoreEntryActionTypes, restoreEntry, } from 'lib/actions/entry-actions'; +import { useENSNames } from 'lib/hooks/ens-cache'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors'; import { threadInfoSelector } from 'lib/selectors/thread-selectors'; import { colorIsDark } from 'lib/shared/thread-utils'; @@ -19,6 +20,7 @@ } from 'lib/types/entry-types'; import type { LoadingStatus } from 'lib/types/loading-types'; import type { ThreadInfo } from 'lib/types/thread-types'; +import type { UserInfo } from 'lib/types/user-types'; import { type DispatchActionPromise, useDispatchActionPromise, @@ -43,6 +45,7 @@ +calendarQuery: () => CalendarQuery, +dispatchActionPromise: DispatchActionPromise, +restoreEntry: (info: RestoreEntryInfo) => Promise, + +creator: ?UserInfo, }; class HistoryEntry extends React.PureComponent { @@ -82,14 +85,11 @@ [css.darkEntry]: colorIsDark(this.props.threadInfo.color), }); const textStyle = { backgroundColor: '#' + this.props.threadInfo.color }; - const creator = - this.props.entryInfo.creator === null ? ( - 'Anonymous' - ) : ( - - {this.props.entryInfo.creator} - - ); + const creator = this.props.creator?.username ? ( + {this.props.creator.username} + ) : ( + 'anonymous' + ); return (
  • @@ -162,19 +162,23 @@ `${restoreEntryActionTypes.started}:${entryID}`, ), ); - const calanderQuery = useSelector(nonThreadCalendarQuery); + const calenderQuery = useSelector(nonThreadCalendarQuery); const callRestoreEntry = useServerCall(restoreEntry); const dispatchActionPromise = useDispatchActionPromise(); + const { creator } = props.entryInfo; + const [creatorWithENSName] = useENSNames([creator]); + return ( ); },