client/posts: don't show notes on videos
This commit is contained in:
parent
02d631a65d
commit
63ec28ddb3
3 changed files with 15 additions and 6 deletions
|
@ -5,10 +5,10 @@ const views = require('../util/views.js');
|
||||||
const optimizedResize = require('../util/optimized_resize.js');
|
const optimizedResize = require('../util/optimized_resize.js');
|
||||||
|
|
||||||
class PostContentControl {
|
class PostContentControl {
|
||||||
constructor(containerNode, post, viewportSizeCalculator) {
|
constructor(hostNode, post, viewportSizeCalculator) {
|
||||||
this._post = post;
|
this._post = post;
|
||||||
this._viewportSizeCalculator = viewportSizeCalculator;
|
this._viewportSizeCalculator = viewportSizeCalculator;
|
||||||
this._containerNode = containerNode;
|
this._hostNode = hostNode;
|
||||||
this._template = views.getTemplate('post-content');
|
this._template = views.getTemplate('post-content');
|
||||||
|
|
||||||
this._currentFitFunction = {
|
this._currentFitFunction = {
|
||||||
|
@ -24,6 +24,10 @@ class PostContentControl {
|
||||||
'changeContent', e => this._evtPostContentChange(e));
|
'changeContent', e => this._evtPostContentChange(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disableOverlay() {
|
||||||
|
this._hostNode.querySelector('.post-overlay').style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
fitWidth() {
|
fitWidth() {
|
||||||
this._currentFitFunction = this.fitWidth;
|
this._currentFitFunction = this.fitWidth;
|
||||||
const mul = this._post.canvasHeight / this._post.canvasWidth;
|
const mul = this._post.canvasHeight / this._post.canvasWidth;
|
||||||
|
@ -94,7 +98,7 @@ class PostContentControl {
|
||||||
this._reinstall();
|
this._reinstall();
|
||||||
optimizedResize.add(() => this._refreshSize());
|
optimizedResize.add(() => this._refreshSize());
|
||||||
views.monitorNodeRemoval(
|
views.monitorNodeRemoval(
|
||||||
this._containerNode, () => { this._uninstall(); });
|
this._hostNode, () => { this._uninstall(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
_reinstall() {
|
_reinstall() {
|
||||||
|
@ -103,9 +107,9 @@ class PostContentControl {
|
||||||
newNode.classList.add('transparency-grid');
|
newNode.classList.add('transparency-grid');
|
||||||
}
|
}
|
||||||
if (this._postContentNode) {
|
if (this._postContentNode) {
|
||||||
this._containerNode.replaceChild(newNode, this._postContentNode);
|
this._hostNode.replaceChild(newNode, this._postContentNode);
|
||||||
} else {
|
} else {
|
||||||
this._containerNode.appendChild(newNode);
|
this._hostNode.appendChild(newNode);
|
||||||
}
|
}
|
||||||
this._postContentNode = newNode;
|
this._postContentNode = newNode;
|
||||||
this._refreshSize();
|
this._refreshSize();
|
||||||
|
|
|
@ -27,7 +27,8 @@ class PostEditSidebarControl extends events.EventTarget {
|
||||||
canEditPostSource: api.hasPrivilege('posts:edit:source'),
|
canEditPostSource: api.hasPrivilege('posts:edit:source'),
|
||||||
canEditPostTags: api.hasPrivilege('posts:edit:tags'),
|
canEditPostTags: api.hasPrivilege('posts:edit:tags'),
|
||||||
canEditPostRelations: api.hasPrivilege('posts:edit:relations'),
|
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'),
|
canEditPostFlags: api.hasPrivilege('posts:edit:flags'),
|
||||||
canEditPostContent: api.hasPrivilege('posts:edit:content'),
|
canEditPostContent: api.hasPrivilege('posts:edit:content'),
|
||||||
canEditPostThumbnail: api.hasPrivilege('posts:edit:thumbnail'),
|
canEditPostThumbnail: api.hasPrivilege('posts:edit:thumbnail'),
|
||||||
|
|
|
@ -51,6 +51,10 @@ class PostView {
|
||||||
postContainerNode.querySelector('.post-overlay'),
|
postContainerNode.querySelector('.post-overlay'),
|
||||||
ctx.post);
|
ctx.post);
|
||||||
|
|
||||||
|
if (ctx.post.type === 'video') {
|
||||||
|
this._postContentControl.disableOverlay();
|
||||||
|
}
|
||||||
|
|
||||||
this._installSidebar(ctx);
|
this._installSidebar(ctx);
|
||||||
this._installCommentForm();
|
this._installCommentForm();
|
||||||
this._installComments(ctx.post.comments);
|
this._installComments(ctx.post.comments);
|
||||||
|
|
Loading…
Reference in a new issue