client/posts: don't show notes on videos

This commit is contained in:
rr- 2016-08-27 22:14:17 +02:00
parent 02d631a65d
commit 63ec28ddb3
3 changed files with 15 additions and 6 deletions

View file

@ -5,10 +5,10 @@ const views = require('../util/views.js');
const optimizedResize = require('../util/optimized_resize.js');
class PostContentControl {
constructor(containerNode, post, viewportSizeCalculator) {
constructor(hostNode, post, viewportSizeCalculator) {
this._post = post;
this._viewportSizeCalculator = viewportSizeCalculator;
this._containerNode = containerNode;
this._hostNode = hostNode;
this._template = views.getTemplate('post-content');
this._currentFitFunction = {
@ -24,6 +24,10 @@ class PostContentControl {
'changeContent', e => this._evtPostContentChange(e));
}
disableOverlay() {
this._hostNode.querySelector('.post-overlay').style.display = 'none';
}
fitWidth() {
this._currentFitFunction = this.fitWidth;
const mul = this._post.canvasHeight / this._post.canvasWidth;
@ -94,7 +98,7 @@ class PostContentControl {
this._reinstall();
optimizedResize.add(() => this._refreshSize());
views.monitorNodeRemoval(
this._containerNode, () => { this._uninstall(); });
this._hostNode, () => { this._uninstall(); });
}
_reinstall() {
@ -103,9 +107,9 @@ class PostContentControl {
newNode.classList.add('transparency-grid');
}
if (this._postContentNode) {
this._containerNode.replaceChild(newNode, this._postContentNode);
this._hostNode.replaceChild(newNode, this._postContentNode);
} else {
this._containerNode.appendChild(newNode);
this._hostNode.appendChild(newNode);
}
this._postContentNode = newNode;
this._refreshSize();

View file

@ -27,7 +27,8 @@ class PostEditSidebarControl extends events.EventTarget {
canEditPostSource: api.hasPrivilege('posts:edit:source'),
canEditPostTags: api.hasPrivilege('posts:edit:tags'),
canEditPostRelations: api.hasPrivilege('posts:edit:relations'),
canEditPostNotes: api.hasPrivilege('posts:edit:notes'),
canEditPostNotes: api.hasPrivilege('posts:edit:notes') &&
post.type !== 'video',
canEditPostFlags: api.hasPrivilege('posts:edit:flags'),
canEditPostContent: api.hasPrivilege('posts:edit:content'),
canEditPostThumbnail: api.hasPrivilege('posts:edit:thumbnail'),

View file

@ -51,6 +51,10 @@ class PostView {
postContainerNode.querySelector('.post-overlay'),
ctx.post);
if (ctx.post.type === 'video') {
this._postContentControl.disableOverlay();
}
this._installSidebar(ctx);
this._installCommentForm();
this._installComments(ctx.post.comments);