More small fixes

This commit is contained in:
SachaG 2019-01-18 18:35:28 +09:00
parent e544b0ce0b
commit 9d27f386c9
3 changed files with 12 additions and 8 deletions

View file

@ -6,6 +6,7 @@
},
"scripts": {
"start": "meteor --settings settings.json",
"visualizer": "meteor --extra-packages bundle-visualizer --production --settings settings.json",
"lint": "eslint --cache --ext .jsx,js packages",
"test-unit": "TEST_WATCH=1 meteor test-packages ./packages/* --port 3002 --driver-package meteortesting:mocha --raw-logs",
"test": "npm run test-unit",

View file

@ -117,14 +117,17 @@ class Upload extends PureComponent {
const self = this;
// add callback to clean any preview or error values
// (when handling multiple images)
function uploadKeepRealImages(data) {
// keep only "real" images
const images = self.getImages({
includePreviews: false,
includeDeleted: false,
});
// replace images in `data` object with real images
set(data, self.props.path, images);
if (Array.isArray(self.props.value)) {
// keep only "real" images
const images = self.getImages({
includePreviews: false,
includeDeleted: false,
});
// replace images in `data` object with real images
set(data, self.props.path, images);
}
return data;
}
context.addToSubmitForm(uploadKeepRealImages);

View file

@ -48,7 +48,7 @@ Users.getUserNameById = function (userId) {return Users.getUserName(Users.findOn
* @param {Object} user
*/
Users.getDisplayName = function (user) {
if (typeof user === 'undefined') {
if (!user) {
return '';
} else {
return (user.displayName) ? user.displayName : Users.getUserName(user);