Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update functions.js #87

Merged
merged 4 commits into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const OWASP_CONFIG = {

const WORDPRESS_CREDENTIALS = {
url: 'https://www.iee.ihu.gr',
is_multilingual: false,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code style convection we follow is camel cased, so please try follow this for consistency.
In this case "is_multilingual" shloud be "isMultilingual"

username: 'fakeusername',
password: 'fakepassword',
rejectUnauthorized: false
Expand Down
15 changes: 8 additions & 7 deletions routes/bulletinBoard/announcements/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ function postToTeithe (announcement, action) {
announcement.publisher.name).then(function (wordpressContent) {
if (action === 'create') {
clientWordpress.newPost({
title: '<!--:el-->' + announcement.title + '<!--:--><!--:en-->' +
announcement.titleEn + '<!--:-->',
title: (WORDPRESS_CREDENTIALS.is_multilingual)?('<!--:el-->' + announcement.title + '<!--:--><!--:en-->' +
announcement.titleEn + '<!--:-->'):announcement.title,
content: wordpressContent,
status: 'publish',
terms: {
Expand All @@ -258,8 +258,8 @@ function postToTeithe (announcement, action) {
})
} else if (action === 'edit') {
clientWordpress.editPost(announcement.wordpressId, {
title: '<!--:el-->' + announcement.title + '<!--:--><!--:en-->' +
announcement.titleEn + '<!--:-->',
title: (WORDPRESS_CREDENTIALS.is_multilingual)?('<!--:el-->' + announcement.title + '<!--:--><!--:en-->' +
announcement.titleEn + '<!--:-->'):announcement.title,
content: wordpressContent,
terms: {
'category': [category.wid]
Expand Down Expand Up @@ -434,11 +434,12 @@ function generateWordpressContent (
let isoDate = new Date(date)
let dateModified = formatDate(isoDate, true)

let htmlContentEl = '<!--:el-->' + text + '<br/>' + attachmentsHtml +
let htmlContentEl = '<!--:el-->' + text + '<br/><br/>' + attachmentsHtml +
dateModified + ' - από ' + publisher + '<!--:-->'
let htmlContentEn = '<!--:en-->' + textEn + '<br/>' + attachmentsHtml +
let htmlContentEn = '<!--:en-->' + textEn + '<br/><br/>' + attachmentsHtml +
dateModified + ' - από ' + publisher + '<!--:-->'
resolve(htmlContentEl + htmlContentEn)

resolve(WORDPRESS_CREDENTIALS.is_multilingual?(htmlContentEl + htmlContentEn):htmlContentEl)
})
})
}
Expand Down