Skip to content

Commit

Permalink
feature-2228: Generator Creates Images for Rejected Speakers (#2668)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hieu Lam - TMA authored Aug 24, 2023
1 parent e8438b6 commit 2e1f9e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/backend/fold_v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ function returnAttendees(attendeesData) {

function createSocialLinks(event) {
const sociallinks = Array.from(event.social_links);

sociallinks.forEach((link) => {
link.show = true;
switch (link.name.toLowerCase()) {
Expand Down Expand Up @@ -482,7 +482,7 @@ function extractEventUrls(event, speakers, sponsors, reqOpts, next) {

const arrayTwitterLink = sociallink.split('/');
const twitterLink = arrayTwitterLink[arrayTwitterLink.length - 1];

const urls = {
main_page_url: event.event_url,
logo_url: event.logo,
Expand Down Expand Up @@ -882,7 +882,10 @@ function foldBySpeakers(speakers, sessions, tracksData, reqOpts, next) {
const appFolder = reqOpts.email + '/' + slugify(reqOpts.name);

async.eachOfSeries(speakers, (speaker, key, callback) => {
if (speaker.photo !== null && speaker.photo !== '') {
const isDownloadImage = speaker.sessions.filter((session) => {
return session.state !== 'rejected';
}).length !== 0;
if (isDownloadImage && speaker.photo !== null && speaker.photo !== '') {
if (speaker.photo.substring(0, 4) === 'http') {
distHelper.downloadSpeakerPhoto(appFolder, speaker.photo, function(result) {
speakers[key].photo = encodeURI(result);
Expand Down
9 changes: 6 additions & 3 deletions src/backend/fold_v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ function returnAttendees(attendeesData) {

function createSocialLinks(event) {
const sociallinks = Array.from(event['social-links']).filter(Boolean);

sociallinks.forEach((link) => {
link.show = true;
switch (link.name.toLowerCase()) {
Expand Down Expand Up @@ -479,7 +479,7 @@ function createSocialLinks(event) {
link.show = false;
break;
}

if (link.link === '') {
link.show = false;
}
Expand Down Expand Up @@ -935,7 +935,10 @@ function foldBySpeakers(speakers, sessions, tracksData, reqOpts, next) {
let thumb = '';

async.eachOfLimit(speakers, PHOTO_DOWNLOAD_CONCURRENCY, (speaker, key, callback) => {
if (speaker['photo-url'] !== null && speaker['photo-url'] !== '') {
const isDownloadImage = speaker.sessions.filter((session) => {
return session.state !== 'rejected';
}).length !== 0;
if (isDownloadImage && speaker['photo-url'] !== null && speaker['photo-url'] !== '') {
if (speaker['photo-url'].substring(0, 4) === 'http') {
distHelper.downloadSpeakerPhoto(appFolder, speaker['photo-url'], function(result) {
speakers[key]['photo-url'] = encodeURI(result);
Expand Down

0 comments on commit 2e1f9e6

Please sign in to comment.