diff --git a/app/utils/avatar.js b/app/utils/avatar.js index b3ef7e41..54ad2238 100644 --- a/app/utils/avatar.js +++ b/app/utils/avatar.js @@ -1,12 +1,19 @@ +import semver from 'semver'; + +import reduxStore from '../lib/createStore'; + const formatUrl = (url, size, query) => `${ url }?format=png&size=${ size }${ query }`; export const avatarURL = ({ type, text, size, user = {}, avatar, server, avatarETag, rid, blockUnauthenticatedAccess }) => { + const { version: serverVersion } = reduxStore.getState().server; + const isLegacy = serverVersion && semver.lt(semver.coerce(serverVersion), '3.6.0'); + let room; if (type === 'd') { room = text; - } else if (rid) { + } else if (rid && !isLegacy) { room = `room/${ rid }`; } else { room = `@${ text }`; diff --git a/storybook/index.js b/storybook/index.js index 8e12a5a9..99b30178 100644 --- a/storybook/index.js +++ b/storybook/index.js @@ -6,6 +6,8 @@ import 'react-native-gesture-handler'; // eslint-disable-next-line no-undef jest.mock('../app/lib/database', () => jest.fn(() => null)); // comment this line to make storybook work +// eslint-disable-next-line no-undef +jest.mock('../app/lib/createStore', () => ({ getState: () => ({ server: {} }) })); // comment this line to make storybook work RNBootSplash.hide();