Replaced getAvatarURL from js-utils

This commit is contained in:
akshitkrnagpal 2018-06-23 05:06:48 +05:30 committed by Hristo Terezov
parent c0f5d0e208
commit 541cfd3401
6 changed files with 16 additions and 37 deletions

View File

@ -1,6 +1,6 @@
// @flow
import { getAvatarURL } from '../utils';
import { getAvatarURL } from 'js-utils';
import { SET_EMAIL, SET_NAME } from './actionTypes';
import { setAvatarURL } from './actions';

View File

@ -2,7 +2,7 @@
import os from 'os';
import { getAvatarURL } from '../utils';
import { getAvatarURL } from 'js-utils';
import {
SET_AVATAR_URL,

View File

@ -3,7 +3,6 @@
// @flow
import { shell } from 'electron';
import md5 from 'js-md5';
import config from '../config';
/**
@ -56,35 +55,3 @@ export function normalizeServerURL(url: string) {
export function openExternalLink(link: string) {
shell.openExternal(link);
}
/**
* Returns the Avatar URL to be used.
*
* @param {string} key - Unique key to generate Avatar URL.
* @returns {string}
*/
export function getAvatarURL({ email, id }: {
email: string,
id: string
}) {
let key = email || id;
let urlPrefix;
let urlSuffix;
// If the ID looks like an e-mail address, we'll use Gravatar because it
// supports e-mail addresses.
if (key && key.indexOf('@') > 0) {
// URL prefix and suffix of gravatar service.
urlPrefix = 'https://www.gravatar.com/avatar/';
urlSuffix = '?d=wavatar&size=200';
} else {
key = id;
// Otherwise, use a default (meeples, of course).
urlPrefix = 'https://abotars.jitsi.net/meeple/';
urlSuffix = '';
}
return urlPrefix + md5.hex(key.trim().toLowerCase()) + urlSuffix;
}

12
package-lock.json generated
View File

@ -2363,6 +2363,11 @@
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
"dev": true
},
"bowser": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/bowser/-/bowser-1.9.1.tgz",
"integrity": "sha512-UXti1JB6oK8hO983AImunnV6j/fqAEeDlPXh99zhsP5g32oLbxJJ6qcOaUesR+tqqhnUVQHlRJyD0dfiV0Hxaw=="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@ -7321,6 +7326,13 @@
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
},
"js-utils": {
"version": "github:jitsi/js-utils#0c53500a5120be2aa3fc590f0f932a0d4771920f",
"requires": {
"bowser": "1.9.1",
"js-md5": "0.7.3"
}
},
"js-yaml": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.7.0.tgz",

View File

@ -45,8 +45,8 @@
"electron-window-state": "4.1.1",
"history": "4.7.2",
"jitsi-meet-electron-utils": "github:jitsi/jitsi-meet-electron-utils#1972c3bf0884ace68eb496894dabae593d6dbf49",
"js-md5": "0.7.3",
"mousetrap": "1.6.2",
"js-utils": "github:jitsi/js-utils#0c53500a5120be2aa3fc590f0f932a0d4771920f",
"react": "16.3.2",
"react-dom": "16.3.2",
"react-redux": "5.0.7",

View File

@ -12,7 +12,7 @@ const commonConfig = {
module: {
rules: [
{
exclude: /(node_modules)/,
exclude: /node_modules(?!\/js-utils)/,
loader: 'babel-loader',
options: {
presets: [