PLT-6689: fix user image requests (#6946)

* fix user image requests

* fix eslint errors and a few more cache busters
Этот коммит содержится в:
Chris
2017-07-19 13:54:16 -07:00
коммит произвёл Christopher Speller
родитель 23a59b03dd
Коммит 673f3a1144
14 изменённых файлов: 39 добавлений и 42 удалений

Просмотреть файл

@@ -1023,6 +1023,17 @@ export function displayUsernameForUser(user) {
return '';
}
export function imageURLForUser(userIdOrObject) {
if (typeof userIdOrObject == 'string') {
const profile = UserStore.getProfile(userIdOrObject);
if (profile) {
return imageURLForUser(profile);
}
return Client4.getUsersRoute() + '/' + userIdOrObject + '/image?_=' + Date.now();
}
return Client4.getUsersRoute() + '/' + userIdOrObject.id + '/image?_=' + (userIdOrObject.last_picture_update || 0);
}
// Converts a file size in bytes into a human-readable string of the form '123MB'.
export function fileSizeToString(bytes) {
// it's unlikely that we'll have files bigger than this