summaryrefslogtreecommitdiffstats
path: root/webapp/utils/utils.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils/utils.jsx')
-rw-r--r--webapp/utils/utils.jsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index b14bdaf11..0bd8c7bff 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -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