client/posts: fix adding loop flag to non videos
This commit is contained in:
		
							parent
							
								
									9ae2b6aa44
								
							
						
					
					
						commit
						6bf5764c6c
					
				@ -60,7 +60,7 @@
 | 
			
		||||
                <%= ctx.makeCheckbox({
 | 
			
		||||
                    text: 'Loop video',
 | 
			
		||||
                    name: 'loop-video',
 | 
			
		||||
                    checked: true,
 | 
			
		||||
                    checked: ctx.uploadable.flags.includes('loop'),
 | 
			
		||||
                }) %>
 | 
			
		||||
            </div>
 | 
			
		||||
        <% } %>
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@ class Uploadable extends events.EventTarget {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        super();
 | 
			
		||||
        this.safety = 'safe';
 | 
			
		||||
        this.flags = ['loop'];
 | 
			
		||||
        this.flags = [];
 | 
			
		||||
        this.anonymous = false;
 | 
			
		||||
        this.order = globalOrder;
 | 
			
		||||
        globalOrder++;
 | 
			
		||||
@ -54,6 +54,12 @@ class Uploadable extends events.EventTarget {
 | 
			
		||||
    get name() {
 | 
			
		||||
        throw new Error('Not implemented');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _initComplete() {
 | 
			
		||||
        if (['video'].includes(this.type)) {
 | 
			
		||||
            this.flags.push('loop');
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class File extends Uploadable {
 | 
			
		||||
@ -73,6 +79,7 @@ class File extends Uploadable {
 | 
			
		||||
                    new CustomEvent('finish', {detail: {uploadable: this}}));
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        this._initComplete();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    destroy() {
 | 
			
		||||
@ -103,6 +110,7 @@ class Url extends Uploadable {
 | 
			
		||||
        super();
 | 
			
		||||
        this.url = url;
 | 
			
		||||
        this.dispatchEvent(new CustomEvent('finish'));
 | 
			
		||||
        this._initComplete();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    get mimeType() {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user