Skip to content
Permalink
Browse files

Merge pull request #1265 from liveblog/release/3.6.6

Release v3.6.6
  • Loading branch information...
eos87 committed Aug 6, 2019
2 parents 2c7ae7f + 413ec28 commit 199077d0fe0fa45e3acdfc14cdac055126c483f2
Showing with 351 additions and 160 deletions.
  1. +2 −2 README.md
  2. +2 −2 client/app/index.html
  3. +0 −8 client/app/scripts/liveblog-bloglist/controllers/blog-list.js
  4. +2 −3 client/app/scripts/liveblog-edit/controllers/blog-edit.js
  5. +2 −2 client/package.json
  6. +6 −3 client/tasks/options/webpack.js
  7. +2 −2 client/tsconfig.json
  8. +2 −0 client/webpack.config.js
  9. +1 −1 package.json
  10. +10 −2 server/app.py
  11. +3 −1 server/liveblog/blogs/embeds.py
  12. +1 −1 server/liveblog/blogs/request_membership.py
  13. +7 −1 server/liveblog/blogs/templates/embed.html
  14. +11 −5 server/liveblog/blogs/templates/embed_amp.html
  15. +41 −19 server/liveblog/client_modules/client_modules.py
  16. +2 −0 server/liveblog/client_modules/client_modules_test.py
  17. +60 −25 server/liveblog/posts/posts.py
  18. +4 −0 server/liveblog/syndication/consumer.py
  19. +6 −0 server/liveblog/themes/themes_assets/amp/dist/amp-8ca9b745b9.css
  20. +0 −6 server/liveblog/themes/themes_assets/amp/dist/amp-dde572bbac.css
  21. +1 −1 server/liveblog/themes/themes_assets/amp/dist/rev-manifest.json
  22. +6 −0 server/liveblog/themes/themes_assets/amp/images/logo-liveblog-watermark.svg
  23. +18 −0 server/liveblog/themes/themes_assets/amp/less/embed.less
  24. +2 −2 server/liveblog/themes/themes_assets/amp/package.json
  25. +3 −0 server/liveblog/themes/themes_assets/amp/template.html
  26. +3 −0 server/liveblog/themes/themes_assets/amp/templates/template-timeline.html
  27. +3 −3 server/liveblog/themes/themes_assets/amp/theme.json
  28. +1 −1 server/liveblog/themes/themes_assets/classic/dist/scripts.min.js
  29. +2 −2 server/liveblog/themes/themes_assets/classic/dist/templates.js
  30. +1 −1 server/liveblog/themes/themes_assets/classic/theme.json
  31. +2 −2 server/liveblog/themes/themes_assets/classic/views/author.html
  32. +2 −2 server/liveblog/themes/themes_assets/classic/views/posts.html
  33. +13 −0 server/liveblog/themes/themes_assets/default/dist/default-4808c42d78.js
  34. +1 −0 server/liveblog/themes/themes_assets/default/dist/default-930b50c8f9.css
  35. +0 −1 server/liveblog/themes/themes_assets/default/dist/default-adddf70ec7.css
  36. +0 −13 server/liveblog/themes/themes_assets/default/dist/default-cf6c86cf0a.js
  37. +2 −2 server/liveblog/themes/themes_assets/default/dist/rev-manifest.json
  38. +6 −0 server/liveblog/themes/themes_assets/default/images/logo-liveblog-watermark.svg
  39. +17 −0 server/liveblog/themes/themes_assets/default/less/embed.less
  40. +1 −1 server/liveblog/themes/themes_assets/default/package.json
  41. +2 −0 server/liveblog/themes/themes_assets/default/template.html
  42. +2 −2 server/liveblog/themes/themes_assets/default/templates/template-ad-entry.html
  43. +2 −2 server/liveblog/themes/themes_assets/default/templates/template-post-actions.html
  44. +2 −0 server/liveblog/themes/themes_assets/default/templates/template-timeline.html
  45. +3 −0 server/liveblog/themes/themes_assets/default/templates/template-watermark.html
  46. +5 −5 server/liveblog/themes/themes_assets/default/theme.json
  47. +2 −2 server/liveblog/themes/themes_assets/simple/dist/rev-manifest.json
  48. +0 −16 server/liveblog/themes/themes_assets/simple/dist/simple-6a706fbb9d.js
  49. +16 −0 server/liveblog/themes/themes_assets/simple/dist/simple-7e8b2587f8.js
  50. +2 −0 server/liveblog/themes/themes_assets/simple/dist/simple-913c28403e.css
  51. +0 −2 server/liveblog/themes/themes_assets/simple/dist/simple-91730d9196.css
  52. +6 −0 server/liveblog/themes/themes_assets/simple/images/logo-liveblog-watermark.svg
  53. +17 −0 server/liveblog/themes/themes_assets/simple/less/simple.less
  54. +2 −2 server/liveblog/themes/themes_assets/simple/package.json
  55. +2 −0 server/liveblog/themes/themes_assets/simple/template.html
  56. +5 −5 server/liveblog/themes/themes_assets/simple/theme.json
  57. +24 −10 server/liveblog/video_upload/video_upload.py
  58. +1 −0 server/requirements.txt
  59. +10 −0 server/settings.py
@@ -3,7 +3,7 @@
[Fork](https://github.com/liveblog/liveblog) •
[License](https://github.com/liveblog/liveblog/blob/master/LICENSE) •
[Documentation](http://sourcefabric.booktype.pro/live-blog-30-for-journalists/what-is-live-blog/) •
*Version 3.6.5*
*Version 3.6.6*

[![Build Status](https://travis-ci.org/liveblog/liveblog.svg?branch=master)](https://travis-ci.org/liveblog/liveblog)

@@ -43,7 +43,7 @@ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs
```

Install The various Python requirements
Install the various Python requirements

```bash
sudo apt-get install \
@@ -52,10 +52,10 @@ <h3 class="modal__heading" translate>About</h3>
<div class="about-page-text">
<p>
<div style="font-weight: 700" translate>
Live Blog 3.6.5
Live Blog 3.6.6
</div>
<div translate>
Released on 04/06/2019
Released on 06/08/2019
</div>
</p>
<p translate>
@@ -452,14 +452,6 @@ export default function BlogListController(
api.blogs.query(getCriteria(), false).then((blogs) => {
$scope.blogs = blogs;
$scope.blogsLoading = false;

// check if redirect after youtube authentication
let blogToRedirect = localStorage.getItem('blogToRedirect');

if (blogToRedirect) {
$scope.edit(blogToRedirect);
localStorage.removeItem('blogToRedirect');
}
});
}
// initialize bloglist embed code.
@@ -698,10 +698,9 @@ export default function BlogEditController(
currentUrl: window.location.href,
},
}).then((response) => {
// save to later be able to redirect to the place we were
localStorage.setItem('blogToRedirect', $scope.blog._id);
notify.pop();
notify.info(gettext('Saved credentials'));
notify.info(gettext('Saved credentials. Redirecting...'));
// redirect to google verification screen
window.location.replace(response.data);
});
}, () => cleanEditor(true));
@@ -1,6 +1,6 @@
{
"name": "liveblog-client",
"version": "3.6.5",
"version": "3.6.6",
"repository": {
"type": "git",
"url": "git@github.com:liveblog/liveblog.git"
@@ -10,7 +10,7 @@
"eslint": "grunt eslint",
"tslint": "tsc --noEmit && tslint -c tslint.json 'app/**/*.{ts,tsx}'",
"lint": "npm run eslint && npm run tslint",
"webdriver-update": "./node_modules/protractor/bin/webdriver-manager update --gecko false --versions.chrome 74.0.3729.6 --versions.standalone 3.9.1",
"webdriver-update": "./node_modules/protractor/bin/webdriver-manager update --gecko false --versions.chrome 75.0.3770.140 --versions.standalone 3.9.1",
"e2e": "./node_modules/.bin/protractor protractor-conf.js"
},
"licenses": [
@@ -9,9 +9,12 @@ module.exports = function(grunt) {
build: {
plugins: config.plugins.concat(
new webpack.DefinePlugin({
'process.env': {NODE_ENV: JSON.stringify('production')}
'process.env': {NODE_ENV: JSON.stringify('production')},
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
})
)
}
),
},
};
};
@@ -10,8 +10,8 @@
"noUnusedLocals": true,
"allowJs": true,
"esModuleInterop": true,
"module": "commonjs",
"target": "es2015",
"moduleResolution": "node",
"target": "es5",
"skipLibCheck": true,
"lib": [
"dom",
@@ -1,3 +1,5 @@
/* eslint-disable */

const path = require('path');
const webpack = require('webpack');
const lodash = require('lodash');
@@ -1,6 +1,6 @@
{
"name": "liveblog",
"version": "3.6.5",
"version": "3.6.6",
"repository": {
"type": "git",
"url": "git@github.com:liveblog/liveblog.git"
@@ -30,6 +30,7 @@
from liveblog.video_upload.video_upload import video_upload_blueprint

from superdesk.factory import get_app as superdesk_app
from superdesk.default_settings import celery_queue as instance_prefix


def get_app(config=None):
@@ -64,8 +65,15 @@ def get_app(config=None):
])
app.jinja_loader = custom_loader

# Caching.
app.cache = Cache(app, config={'CACHE_TYPE': 'simple'})
# Caching. By default 'simple' cache will be used
cache_config = {'CACHE_TYPE': settings.LIVEBLOG_CACHE_TYPE}
if cache_config['CACHE_TYPE'] == 'redis':
cache_config.update({
'CACHE_REDIS_URL': settings.LIVEBLOG_CACHE_REDIS_URL,
'CACHE_KEY_PREFIX': instance_prefix('_lb-cache')
})

app.cache = Cache(app, config=cache_config)
app.blog_cache = BlogCache(cache=app.cache)

# Amazon S3 support.
@@ -28,7 +28,7 @@

from .app_settings import BLOGLIST_ASSETS, BLOGSLIST_ASSETS_DIR
from .utils import is_relative_to_current_folder
from settings import TRIGGER_HOOK_URLS, SUBSCRIPTION_LEVEL
from settings import TRIGGER_HOOK_URLS, SUBSCRIPTION_LEVEL, ACTIVATE_WATERMARK

logger = logging.getLogger('superdesk')
embed_blueprint = superdesk.Blueprint('embed_liveblog', __name__, template_folder='templates')
@@ -189,6 +189,8 @@ def embed(blog_id, theme=None, output=None, api_host=None):
if blog.get('blog_status') == 'closed':
theme_settings['canComment'] = False

theme_settings['watermark'] = ACTIVATE_WATERMARK

# Check if theme is SEO and/or AMP compatible.
is_amp = theme.get('ampTheme', False)
is_seo = theme.get('seoTheme', False)
@@ -100,7 +100,7 @@ def on_create(self, docs):
def on_created(self, docs):
for doc in docs:
push_notification(self.notification_key, created=1, request_id=str(doc.get('_id')))
# and members with emails
# and members with emails
notify_the_owner(doc, app.config['CLIENT_URL'])


@@ -22,8 +22,14 @@
<link rel="stylesheet" href="{{ style }}">
{% endfor %}
{% endif %}

{% if settings.watermark %}
<style>
:root { --watermark: url('{{ assets_root }}images/logo-liveblog-watermark.svg') }
</style>
{% endif %}
</head>
<body class="lb-wrapBody" style="{{ (output and output.get('style')) | tostyle | safe }}">
<body class="lb-wrapBody {% if settings.watermark %}watermark{% endif %}" style="{{ (output and output.get('style')) | tostyle | safe }}">
{% elif not settings.removeStylesESI %}
{% if debug %}
{% for style in assets.devStyles %}<link rel="stylesheet" href="{{ style }}">{% endfor %}
@@ -42,16 +42,22 @@

{% block extrahead %}
<!-- amp style -->
{% if amp_style %}
<style amp-custom>
{{ amp_style | safe }}
{{ (output and output.get('style')) | tostyle | safe }}
{% if amp_style %}
{{ amp_style | safe }}
{{ (output and output.get('style')) | tostyle | safe }}
{% endif %}
{% if settings.watermark %}
:root {
--watermark: url('{{ assets_root }}images/logo-liveblog-watermark.svg')
}
{% endif %}
</style>
{% endif %}
<!-- end amp style -->
{% endblock %}
</head>
<body class="lb-wrapBody">
<body class="lb-wrapBody {% if settings.watermark %}watermark{% endif %}" style="{{ (output and output.get('style')) | tostyle | safe }};">
<!-- else esi -->
{% elif not settings.removeStylesESI %}
{% if amp_style %}
@@ -1,3 +1,4 @@
import json
from itertools import groupby
from liveblog.blogs.blogs import BlogsResource
from liveblog.advertisements.collections import CollectionsService, CollectionsResource
@@ -21,6 +22,7 @@
from superdesk import get_resource_service
from werkzeug.datastructures import MultiDict


blog_posts_blueprint = Blueprint('blog_posts', __name__)
CORS(blog_posts_blueprint)

@@ -227,25 +229,43 @@ class ClientBlogPostsResource(BlogPostsResource):


class ClientBlogPostsService(BlogPostsService):

def find_author(self, author_id):
"""Find a user by id. Caches whole list of authors to avoid hitting
database multiple times in a short period of time"""

users_cache_key = 'lb_ClientBlogPostsService_find_author'
all_users = app.cache.get(users_cache_key)

if all_users is None:
all_users = list(get_resource_service('users').find({}))
app.cache.set(users_cache_key, all_users, timeout=5 * 60)

found = list(filter(lambda x: str(x['_id']) == author_id, all_users))
if len(found) > 0:
return found[0]

return {}

def add_post_info(self, doc, items=None):
# users collection will be used many times here
# so we need to cache it and reuse it the object to avoid hitting db
items = items or []
if not items:
# Get from groups
for group in doc.get('groups'):
for ref in group.get('refs'):
item = ref.get('item')
if item:
item['original_creator'] = get_resource_service('users')\
.find_one(req=None, _id=item['original_creator'])
item['original_creator'] = self.find_author(item['original_creator'])
items.append(item)

if not items:
# Not available in groups. Fetch from packageService.
for assoc in self.packageService._get_associations(doc):
if 'residRef' in assoc:
item = get_resource_service('archive').find_one(req=None, _id=assoc['residRef'])
item['original_creator'] = get_resource_service('users')\
.find_one(req=None, _id=item['original_creator'])
item['original_creator'] = self.find_author(item['original_creator'])
items.append(item)

items_length = len(items)
@@ -282,18 +302,11 @@ def add_post_info(self, doc, items=None):

doc['post_items_type'] = post_items_type

# Bring the client user in the posts so we can post.original_creator.
# LBSD-2010
doc['original_creator'] = get_resource_service('users') \
.find_one(req=None, _id=doc['original_creator'])
# Bring the client user in the posts so we can post.original_creator.X - LBSD-2010
doc['original_creator'] = self.find_author(doc['original_creator'])

return doc

def on_fetched(self, docs):
super().on_fetched(docs)
for doc in docs['_items']:
self.add_post_info(doc)

def get(self, req, lookup):
allowed_params = {
'start_date', 'end_date',
@@ -307,13 +320,22 @@ def get(self, req, lookup):
# check for unknown query parameters
_check_for_unknown_params(request, allowed_params)

cache_key = 'lb_ClientBlogPostsService_get_%s' % (hash(frozenset(req.__dict__.items())))
sufix = hash(json.dumps(req.__dict__, sort_keys=True))
cache_key = 'lb_ClientBlogPostsService_get_%s' % sufix
blog_id = lookup.get('blog_id')
docs = app.blog_cache.get(blog_id, cache_key)
if not docs:
docs = super().get(req, lookup)
app.blog_cache.set(blog_id, cache_key, docs)
return docs

# ElasticCursor is returned so we can loop and modify docs inside
blog_posts = app.blog_cache.get(blog_id, cache_key)

if blog_posts is None:
blog_posts = super().get(req, lookup)

# let's complete the post info before cache
for post in blog_posts.docs:
self.add_post_info(post)
app.blog_cache.set(blog_id, cache_key, blog_posts)

return blog_posts


def _check_for_unknown_params(request, whitelist, allow_filtering=True):
@@ -4,6 +4,7 @@
import liveblog.blogs as blogs
import superdesk.users as users_app
import liveblog.items as items_app
from flask_cache import Cache
from liveblog.blogs.blog import Blog
from superdesk.tests import TestCase
from bson import ObjectId
@@ -40,6 +41,7 @@ def setUp(self):
client_modules.init_app(self.app)
self.app.register_blueprint(blog_posts_blueprint)
self.client = self.app.test_client()
self.app.cache = Cache(self.app, config={'CACHE_TYPE': 'simple'})

self.client_item_service = get_resource_service('client_items')
self.client_comment_service = get_resource_service('client_comments')

0 comments on commit 199077d

Please sign in to comment.
You can’t perform that action at this time.