GoToSocial support

This commit is contained in:
Alex Gleason 2022-02-06 20:46:06 -06:00
parent eb3fc815d9
commit fb7c642dc7
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 33 additions and 13 deletions

View File

@ -61,6 +61,7 @@ export function fetchInstance() {
dispatch(fetchNodeinfo()); // Pleroma < 2.1 backwards compatibility dispatch(fetchNodeinfo()); // Pleroma < 2.1 backwards compatibility
} }
}).catch(error => { }).catch(error => {
console.error(error);
dispatch({ type: INSTANCE_FETCH_FAIL, error, skipAlert: true }); dispatch({ type: INSTANCE_FETCH_FAIL, error, skipAlert: true });
}); });
}; };

View File

@ -28,14 +28,22 @@ export default class Avatar extends React.PureComponent {
height: `${size}px`, height: `${size}px`,
}; };
return ( // Only render the image if src is provided
<StillImage if (account.get('avatar')) {
className={classNames('account__avatar', { 'account__avatar-inline': inline })} return (
style={style} <StillImage
src={account.get('avatar')} className={classNames('account__avatar', { 'account__avatar-inline': inline })}
alt='' style={style}
/> src={account.get('avatar')}
); alt=''
/>
);
} else {
// Fall back on rendering an empty div
return (
<div className={classNames('account__avatar', { 'account__avatar-inline': inline })} style={style} />
);
}
} }
} }

View File

@ -89,9 +89,20 @@ export const getFeatures = createSelector([
export const parseVersion = version => { export const parseVersion = version => {
const regex = /^([\w\.]*)(?: \(compatible; ([\w]*) (.*)\))?$/; const regex = /^([\w\.]*)(?: \(compatible; ([\w]*) (.*)\))?$/;
const match = regex.exec(version); const match = regex.exec(version);
return {
software: match[2] || MASTODON, if (match) {
version: match[3] || match[1], return {
compatVersion: match[1], software: match[2] || MASTODON,
}; version: match[3] || match[1],
compatVersion: match[1],
};
} else {
// If we can't parse the version, this is a new and exotic backend.
// Fall back to minimal featureset.
return {
software: null,
version: '0.0.0',
compatVersion: '0.0.0',
};
}
}; };