diff --git a/keyserver/src/fetchers/entry-fetchers.js b/keyserver/src/fetchers/entry-fetchers.js --- a/keyserver/src/fetchers/entry-fetchers.js +++ b/keyserver/src/fetchers/entry-fetchers.js @@ -191,10 +191,9 @@ } const query = SQL` - SELECT r.id, u.username AS author, r.text, r.last_update AS lastUpdate, + SELECT r.id, r.author AS authorID, r.text, r.last_update AS lastUpdate, r.deleted, d.thread AS threadID, r.entry AS entryID FROM revisions r - LEFT JOIN users u ON u.id = r.author LEFT JOIN entries e ON e.id = r.entry LEFT JOIN days d ON d.id = e.day WHERE r.entry = ${entryID} @@ -206,7 +205,7 @@ for (const row of result) { revisions.push({ id: row.id.toString(), - author: row.author, + authorID: row.authorID.toString(), text: row.text, lastUpdate: row.lastUpdate, deleted: !!row.deleted, diff --git a/lib/types/history-types.js b/lib/types/history-types.js --- a/lib/types/history-types.js +++ b/lib/types/history-types.js @@ -5,7 +5,7 @@ export type HistoryRevisionInfo = { +id: string, +entryID: string, - +author: ?string, + +authorID: string, +text: string, +lastUpdate: number, +deleted: boolean, diff --git a/web/modals/history/history-revision.react.js b/web/modals/history/history-revision.react.js --- a/web/modals/history/history-revision.react.js +++ b/web/modals/history/history-revision.react.js @@ -5,6 +5,7 @@ import * as React from 'react'; import TimeAgo from 'react-timeago'; +import { useENSNames } from 'lib/hooks/ens-cache'; import { threadInfoSelector } from 'lib/selectors/thread-selectors'; import { colorIsDark } from 'lib/shared/thread-utils'; import type { HistoryRevisionInfo } from 'lib/types/history-types'; @@ -39,12 +40,17 @@ ); } - const author = - props.revisionInfo.author === null ? ( - 'Anonymous' - ) : ( - {props.revisionInfo.author} - ); + const { authorID } = props.revisionInfo; + const authorUserInfo = useSelector( + state => state.userStore.userInfos[authorID], + ); + const [authorWithENSName] = useENSNames([authorUserInfo]); + + const author = authorWithENSName?.username ? ( + {authorWithENSName.username} + ) : ( + 'anonymous' + ); const date = new Date(props.revisionInfo.lastUpdate); const hovertext = dateFormat(date, "dddd, mmmm dS, yyyy 'at' h:MM TT");