about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-01-20 13:56:37 +0100
committerGitHub <noreply@github.com>2019-01-20 13:56:37 +0100
commitaa362ab73dc7121104b3c01800152b9fc56ea396 (patch)
treef0f5879a51325856887a2e32a4c3f9654af61aab /app/javascript/flavours/glitch/components
parent530d29148ca0c5bf29f6fa516b1ef4f91d95894b (diff)
parent5145c81620efbd5cf8dc911858d17d1fa888c996 (diff)
Merge pull request #888 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/components')
-rw-r--r--app/javascript/flavours/glitch/components/display_name.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/components/display_name.js b/app/javascript/flavours/glitch/components/display_name.js
index d6ac4907d..a26cff049 100644
--- a/app/javascript/flavours/glitch/components/display_name.js
+++ b/app/javascript/flavours/glitch/components/display_name.js
@@ -9,15 +9,23 @@ export default function DisplayName ({
   account,
   className,
   inline,
+  localDomain,
 }) {
   const computedClass = classNames('display-name', { inline }, className);
 
+  if (!account) return null;
+
+  let acct = account.get('acct');
+  if (acct.indexOf('@') === -1 && localDomain) {
+    acct = `${acct}@${localDomain}`;
+  }
+
   //  The result.
   return account ? (
     <span className={computedClass}>
       <bdi><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} /></bdi>
       {inline ? ' ' : null}
-      <span className='display-name__account'>@{account.get('acct')}</span>
+      <span className='display-name__account'>@{acct}</span>
     </span>
   ) : null;
 }
@@ -27,4 +35,5 @@ DisplayName.propTypes = {
   account: ImmutablePropTypes.map,
   className: PropTypes.string,
   inline: PropTypes.bool,
+  localDomain: PropTypes.string,
 };