Fix new Angular 7 issues
This commit is contained in:
parent
79c2480f46
commit
2fbe7f1933
|
@ -129,7 +129,6 @@
|
||||||
"ngx-clipboard": "11.1.7",
|
"ngx-clipboard": "11.1.7",
|
||||||
"ngx-pipes": "^2.1.7",
|
"ngx-pipes": "^2.1.7",
|
||||||
"ngx-qrcode2": "^0.0.9",
|
"ngx-qrcode2": "^0.0.9",
|
||||||
"ngx-textarea-autosize": "^2.0.0",
|
|
||||||
"node-sass": "^4.9.3",
|
"node-sass": "^4.9.3",
|
||||||
"npm-font-source-sans-pro": "^1.0.2",
|
"npm-font-source-sans-pro": "^1.0.2",
|
||||||
"path-browserify": "^1.0.0",
|
"path-browserify": "^1.0.0",
|
||||||
|
|
|
@ -4,10 +4,10 @@ import { USER_ROLE_LABELS, VideoResolution } from '../../../../../../shared'
|
||||||
import { ConfigService } from '@app/+admin/config/shared/config.service'
|
import { ConfigService } from '@app/+admin/config/shared/config.service'
|
||||||
|
|
||||||
export abstract class UserEdit extends FormReactive {
|
export abstract class UserEdit extends FormReactive {
|
||||||
|
|
||||||
videoQuotaOptions: { value: string, label: string }[] = []
|
videoQuotaOptions: { value: string, label: string }[] = []
|
||||||
videoQuotaDailyOptions: { value: string, label: string }[] = []
|
videoQuotaDailyOptions: { value: string, label: string }[] = []
|
||||||
roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
|
roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
|
||||||
|
username: string
|
||||||
|
|
||||||
protected abstract serverService: ServerService
|
protected abstract serverService: ServerService
|
||||||
protected abstract configService: ConfigService
|
protected abstract configService: ConfigService
|
||||||
|
|
|
@ -86,4 +86,4 @@
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-table>
|
</p-table>
|
||||||
|
|
||||||
<my-user-ban-modal #userBanModal (userBanned)="onUsersBanned()"></my-user-ban-modal>
|
<my-user-ban-modal #userBanModal (userBanned)="onUserChanged()"></my-user-ban-modal>
|
||||||
|
|
|
@ -66,7 +66,7 @@ export class UserListComponent extends RestTable implements OnInit {
|
||||||
this.userBanModal.openModal(users)
|
this.userBanModal.openModal(users)
|
||||||
}
|
}
|
||||||
|
|
||||||
onUsersBanned () {
|
onUserChanged () {
|
||||||
this.loadData()
|
this.loadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,11 @@ import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
|
||||||
export abstract class MyAccountVideoChannelEdit extends FormReactive {
|
export abstract class MyAccountVideoChannelEdit extends FormReactive {
|
||||||
// We need it even in the create component because it's used in the edit template
|
// We need it even in the create component because it's used in the edit template
|
||||||
videoChannelToUpdate: VideoChannel
|
videoChannelToUpdate: VideoChannel
|
||||||
|
instanceHost: string
|
||||||
|
|
||||||
abstract isCreation (): boolean
|
abstract isCreation (): boolean
|
||||||
abstract getFormButtonTitle (): string
|
abstract getFormButtonTitle (): string
|
||||||
|
|
||||||
|
// FIXME: We need this method so angular does not complain in the child template
|
||||||
|
onAvatarChange (formData: FormData) { /* empty */ }
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
.icon.icon-upload {
|
.icon.icon-upload {
|
||||||
@include icon(22px);
|
@include icon(22px);
|
||||||
|
|
||||||
background-image: url('../../assets/images/header/upload.svg');
|
background-image: url('../../assets/images/header/upload-white.svg');
|
||||||
height: 24px;
|
height: 24px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
export * from './form-validators'
|
export * from './form-validators'
|
||||||
export * from './form-reactive'
|
export * from './form-reactive'
|
||||||
export * from './reactive-file.component'
|
export * from './reactive-file.component'
|
||||||
|
export * from './textarea-autoresize.directive'
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Thanks: https://github.com/evseevdev/ngx-textarea-autosize
|
||||||
|
import { AfterViewInit, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: 'textarea[myAutoResize]'
|
||||||
|
})
|
||||||
|
export class TextareaAutoResizeDirective implements AfterViewInit {
|
||||||
|
@HostBinding('attr.rows') rows = '1'
|
||||||
|
@HostBinding('style.overflow') overflow = 'hidden'
|
||||||
|
|
||||||
|
constructor (private elem: ElementRef) { }
|
||||||
|
|
||||||
|
public ngAfterViewInit () {
|
||||||
|
this.resize()
|
||||||
|
}
|
||||||
|
|
||||||
|
@HostListener('input')
|
||||||
|
resize () {
|
||||||
|
const textarea = this.elem.nativeElement as HTMLTextAreaElement
|
||||||
|
// Reset textarea height to auto that correctly calculate the new height
|
||||||
|
textarea.style.height = 'auto'
|
||||||
|
// Set new height
|
||||||
|
textarea.style.height = `${textarea.scrollHeight}px`
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,8 +7,9 @@ export class FromNowPipe implements PipeTransform {
|
||||||
|
|
||||||
constructor (private i18n: I18n) { }
|
constructor (private i18n: I18n) { }
|
||||||
|
|
||||||
transform (value: number) {
|
transform (arg: number | Date | string) {
|
||||||
const seconds = Math.floor((Date.now() - value) / 1000)
|
const argDate = new Date(arg)
|
||||||
|
const seconds = Math.floor((Date.now() - argDate.getTime()) / 1000)
|
||||||
|
|
||||||
let interval = Math.floor(seconds / 31536000)
|
let interval = Math.floor(seconds / 31536000)
|
||||||
if (interval > 1) {
|
if (interval > 1) {
|
||||||
|
|
|
@ -37,13 +37,15 @@ import {
|
||||||
LoginValidatorsService,
|
LoginValidatorsService,
|
||||||
ReactiveFileComponent,
|
ReactiveFileComponent,
|
||||||
ResetPasswordValidatorsService,
|
ResetPasswordValidatorsService,
|
||||||
|
TextareaAutoResizeDirective,
|
||||||
UserValidatorsService,
|
UserValidatorsService,
|
||||||
VideoAbuseValidatorsService,
|
VideoAbuseValidatorsService,
|
||||||
|
VideoAcceptOwnershipValidatorsService,
|
||||||
VideoBlacklistValidatorsService,
|
VideoBlacklistValidatorsService,
|
||||||
|
VideoChangeOwnershipValidatorsService,
|
||||||
VideoChannelValidatorsService,
|
VideoChannelValidatorsService,
|
||||||
VideoCommentValidatorsService,
|
VideoCommentValidatorsService,
|
||||||
VideoValidatorsService,
|
VideoValidatorsService
|
||||||
VideoChangeOwnershipValidatorsService, VideoAcceptOwnershipValidatorsService
|
|
||||||
} from '@app/shared/forms'
|
} from '@app/shared/forms'
|
||||||
import { I18nPrimengCalendarService } from '@app/shared/i18n/i18n-primeng-calendar'
|
import { I18nPrimengCalendarService } from '@app/shared/i18n/i18n-primeng-calendar'
|
||||||
import { ScreenService } from '@app/shared/misc/screen.service'
|
import { ScreenService } from '@app/shared/misc/screen.service'
|
||||||
|
@ -53,7 +55,7 @@ import { PeertubeCheckboxComponent } from '@app/shared/forms/peertube-checkbox.c
|
||||||
import { VideoImportService } from '@app/shared/video-import/video-import.service'
|
import { VideoImportService } from '@app/shared/video-import/video-import.service'
|
||||||
import { ActionDropdownComponent } from '@app/shared/buttons/action-dropdown.component'
|
import { ActionDropdownComponent } from '@app/shared/buttons/action-dropdown.component'
|
||||||
import { NgbDropdownModule, NgbModalModule, NgbPopoverModule, NgbTabsetModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbDropdownModule, NgbModalModule, NgbPopoverModule, NgbTabsetModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { SubscribeButtonComponent, RemoteSubscribeComponent, UserSubscriptionService } from '@app/shared/user-subscription'
|
import { RemoteSubscribeComponent, SubscribeButtonComponent, UserSubscriptionService } from '@app/shared/user-subscription'
|
||||||
import { InstanceFeaturesTableComponent } from '@app/shared/instance/instance-features-table.component'
|
import { InstanceFeaturesTableComponent } from '@app/shared/instance/instance-features-table.component'
|
||||||
import { OverviewService } from '@app/shared/overview'
|
import { OverviewService } from '@app/shared/overview'
|
||||||
import { UserBanModalComponent } from '@app/shared/moderation'
|
import { UserBanModalComponent } from '@app/shared/moderation'
|
||||||
|
@ -92,6 +94,7 @@ import { BlocklistService } from '@app/shared/blocklist'
|
||||||
FromNowPipe,
|
FromNowPipe,
|
||||||
MarkdownTextareaComponent,
|
MarkdownTextareaComponent,
|
||||||
InfiniteScrollerDirective,
|
InfiniteScrollerDirective,
|
||||||
|
TextareaAutoResizeDirective,
|
||||||
HelpComponent,
|
HelpComponent,
|
||||||
ReactiveFileComponent,
|
ReactiveFileComponent,
|
||||||
PeertubeCheckboxComponent,
|
PeertubeCheckboxComponent,
|
||||||
|
@ -129,6 +132,7 @@ import { BlocklistService } from '@app/shared/blocklist'
|
||||||
ActionDropdownComponent,
|
ActionDropdownComponent,
|
||||||
MarkdownTextareaComponent,
|
MarkdownTextareaComponent,
|
||||||
InfiniteScrollerDirective,
|
InfiniteScrollerDirective,
|
||||||
|
TextareaAutoResizeDirective,
|
||||||
HelpComponent,
|
HelpComponent,
|
||||||
ReactiveFileComponent,
|
ReactiveFileComponent,
|
||||||
PeertubeCheckboxComponent,
|
PeertubeCheckboxComponent,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<img [src]="getAvatarUrl()" alt="Avatar" />
|
<img [src]="getAvatarUrl()" alt="Avatar" />
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<textarea i18n-placeholder placeholder="Add comment..." autosize
|
<textarea i18n-placeholder placeholder="Add comment..." myAutoResize
|
||||||
[readonly]="(user === null) ? true : false"
|
[readonly]="(user === null) ? true : false"
|
||||||
(click)="openVisitorModal($event)"
|
(click)="openVisitorModal($event)"
|
||||||
formControlName="text" [ngClass]="{ 'input-error': formErrors['text'] }"
|
formControlName="text" [ngClass]="{ 'input-error': formErrors['text'] }"
|
||||||
|
|
|
@ -31,7 +31,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
|
||||||
@ViewChild('visitorModal') visitorModal: NgbModal
|
@ViewChild('visitorModal') visitorModal: NgbModal
|
||||||
@ViewChild('textarea') private textareaElement: ElementRef
|
@ViewChild('textarea') private textareaElement: ElementRef
|
||||||
|
|
||||||
private addingComment = false
|
addingComment = false
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
protected formValidatorService: FormValidatorService,
|
protected formValidatorService: FormValidatorService,
|
||||||
|
|
|
@ -17,7 +17,6 @@ import { NgxQRCodeModule } from 'ngx-qrcode2'
|
||||||
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { VideoBlacklistComponent } from '@app/videos/+video-watch/modal/video-blacklist.component'
|
import { VideoBlacklistComponent } from '@app/videos/+video-watch/modal/video-blacklist.component'
|
||||||
import { RecommendationsModule } from '@app/videos/recommendations/recommendations.module'
|
import { RecommendationsModule } from '@app/videos/recommendations/recommendations.module'
|
||||||
import { TextareaAutosizeModule } from 'ngx-textarea-autosize'
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -26,7 +25,6 @@ import { TextareaAutosizeModule } from 'ngx-textarea-autosize'
|
||||||
ClipboardModule,
|
ClipboardModule,
|
||||||
NgbTooltipModule,
|
NgbTooltipModule,
|
||||||
NgxQRCodeModule,
|
NgxQRCodeModule,
|
||||||
TextareaAutosizeModule,
|
|
||||||
RecommendationsModule
|
RecommendationsModule
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
874
client/yarn.lock
874
client/yarn.lock
File diff suppressed because it is too large
Load Diff
|
@ -30,7 +30,7 @@ elif [ "$1" = "api-2" ]; then
|
||||||
elif [ "$1" = "api-3" ]; then
|
elif [ "$1" = "api-3" ]; then
|
||||||
npm run build:server
|
npm run build:server
|
||||||
mocha --timeout 5000 --exit --require ts-node/register/type-check --bail server/tests/api/index-3.ts
|
mocha --timeout 5000 --exit --require ts-node/register/type-check --bail server/tests/api/index-3.ts
|
||||||
elif [ "$1" = "api-3" ]; then
|
elif [ "$1" = "api-4" ]; then
|
||||||
npm run build:server
|
npm run build:server
|
||||||
mocha --timeout 5000 --exit --require ts-node/register/type-check --bail server/tests/api/index-4.ts
|
mocha --timeout 5000 --exit --require ts-node/register/type-check --bail server/tests/api/index-4.ts
|
||||||
elif [ "$1" = "lint" ]; then
|
elif [ "$1" = "lint" ]; then
|
||||||
|
|
Loading…
Reference in New Issue