GoToSocial support
This commit is contained in:
parent
eb3fc815d9
commit
fb7c642dc7
|
@ -61,6 +61,7 @@ export function fetchInstance() {
|
|||
dispatch(fetchNodeinfo()); // Pleroma < 2.1 backwards compatibility
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
dispatch({ type: INSTANCE_FETCH_FAIL, error, skipAlert: true });
|
||||
});
|
||||
};
|
||||
|
|
|
@ -28,14 +28,22 @@ export default class Avatar extends React.PureComponent {
|
|||
height: `${size}px`,
|
||||
};
|
||||
|
||||
return (
|
||||
<StillImage
|
||||
className={classNames('account__avatar', { 'account__avatar-inline': inline })}
|
||||
style={style}
|
||||
src={account.get('avatar')}
|
||||
alt=''
|
||||
/>
|
||||
);
|
||||
// Only render the image if src is provided
|
||||
if (account.get('avatar')) {
|
||||
return (
|
||||
<StillImage
|
||||
className={classNames('account__avatar', { 'account__avatar-inline': inline })}
|
||||
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} />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,9 +89,20 @@ export const getFeatures = createSelector([
|
|||
export const parseVersion = version => {
|
||||
const regex = /^([\w\.]*)(?: \(compatible; ([\w]*) (.*)\))?$/;
|
||||
const match = regex.exec(version);
|
||||
return {
|
||||
software: match[2] || MASTODON,
|
||||
version: match[3] || match[1],
|
||||
compatVersion: match[1],
|
||||
};
|
||||
|
||||
if (match) {
|
||||
return {
|
||||
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',
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue