Verified Commit a24bd1ed authored by Chocobozzz's avatar Chocobozzz
Browse files

Merge branch 'next' into develop

parents 5f26f13b c63830f1
......@@ -2,11 +2,6 @@ name: Test Suite
on:
push:
branches:
- develop
- master
- ci
- next
pull_request:
types: [synchronize, opened]
schedule:
......
......@@ -11,8 +11,7 @@ import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { InstanceService } from '@app/shared/shared-instance'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
import { HTMLServerConfig } from '@shared/models'
import { HTMLServerConfig, HttpStatusCode } from '@shared/models'
type Prefill = {
subject?: string
......
......@@ -13,8 +13,7 @@ import {
VideoService
} from '@app/shared/shared-main'
import { AccountReportComponent } from '@app/shared/shared-moderation'
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
import { User, UserRight } from '@shared/models'
import { HttpStatusCode, User, UserRight } from '@shared/models'
import { AccountSearchComponent } from './account-search/account-search.component'
@Component({
......
......@@ -26,12 +26,12 @@ export class AdminComponent implements OnInit {
label: $localize`Federation`,
children: [
{
label: $localize`Instances you follow`,
label: $localize`Following`,
routerLink: '/admin/follows/following-list',
iconName: 'following'
},
{
label: $localize`Instances following you`,
label: $localize`Followers`,
routerLink: '/admin/follows/followers-list',
iconName: 'follower'
},
......
......@@ -25,7 +25,7 @@ import {
EditVODTranscodingComponent
} from './config'
import { ConfigService } from './config/shared/config.service'
import { FollowersListComponent, FollowsComponent, VideoRedundanciesListComponent } from './follows'
import { FollowersListComponent, FollowModalComponent, FollowsComponent, VideoRedundanciesListComponent } from './follows'
import { FollowingListComponent } from './follows/following-list/following-list.component'
import { RedundancyCheckboxComponent } from './follows/shared/redundancy-checkbox.component'
import { VideoRedundancyInformationComponent } from './follows/video-redundancies-list/video-redundancy-information.component'
......@@ -68,6 +68,7 @@ import { UserCreateComponent, UserListComponent, UserPasswordComponent, UsersCom
FollowsComponent,
FollowersListComponent,
FollowingListComponent,
FollowModalComponent,
RedundancyCheckboxComponent,
VideoRedundanciesListComponent,
VideoRedundancyInformationComponent,
......
<h1>
<my-global-icon iconName="follower" aria-hidden="true"></my-global-icon>
<ng-container i18n>Instances following you</ng-container>
<ng-container i18n>Followers of your instance</ng-container>
</h1>
<p-table
......@@ -21,7 +21,7 @@
<ng-template pTemplate="header">
<tr>
<th style="width: 150px;" i18n>Actions</th>
<th i18n>Follower handle</th>
<th i18n>Follower</th>
<th style="width: 100px;" i18n pSortableColumn="state">State <p-sortIcon field="state"></p-sortIcon></th>
<th style="width: 100px;" i18n pSortableColumn="score">Score <p-sortIcon field="score"></p-sortIcon></th>
<th style="width: 150px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
......
<ng-template #modal>
<div class="modal-header">
<h4 i18n class="modal-title">Follow</h4>
<my-global-icon iconName="cross" aria-label="Close" role="button" (click)="hide()"></my-global-icon>
</div>
<div class="modal-body">
<form novalidate [formGroup]="form" (ngSubmit)="submit()">
<div class="form-group">
<label i18n for="hostsOrHandles">1 host (without "http://"), account handle or channel handle per line</label>
<textarea
[placeholder]="placeholder" formControlName="hostsOrHandles" type="text" id="hostsOrHandles" name="hostsOrHandles"
class="form-control" [ngClass]="{ 'input-error': formErrors['hostsOrHandles'] }" ngbAutofocus
></textarea>
<div *ngIf="formErrors.hostsOrHandles" class="form-error">
{{ formErrors.hostsOrHandles }}
<div *ngIf="form.controls['hostsOrHandles'].errors.validHostsOrHandles">
{{ form.controls['hostsOrHandles'].errors.validHostsOrHandles.value }}
</div>
</div>
</div>
<div i18n *ngIf="httpEnabled() === false" class="alert alert-warning">
It seems that you are not on a HTTPS server. Your webserver needs to have TLS activated in order to follow servers.
</div>
<div class="form-group inputs">
<input
type="button" role="button" i18n-value value="Cancel" class="peertube-button grey-button"
(click)="hide()" (key.enter)="hide()"
>
<input type="submit" i18n-value value="Follow" class="peertube-button orange-button" [disabled]="!form.valid" />
</div>
</form>
</div>
</ng-template>
import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'
import { Notifier } from '@app/core'
import { splitAndGetNotEmpty, UNIQUE_HOSTS_OR_HANDLE_VALIDATOR } from '@app/shared/form-validators/host-validators'
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { InstanceFollowService } from '@app/shared/shared-instance'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
@Component({
selector: 'my-follow-modal',
templateUrl: './follow-modal.component.html',
styleUrls: [ './follow-modal.component.scss' ]
})
export class FollowModalComponent extends FormReactive implements OnInit {
@ViewChild('modal', { static: true }) modal: NgbModal
@Output() newFollow = new EventEmitter<void>()
placeholder = 'example.com\nchocobozzz@example.com\nchocobozzz_channel@example.com'
private openedModal: NgbModalRef
constructor (
protected formValidatorService: FormValidatorService,
private modalService: NgbModal,
private followService: InstanceFollowService,
private notifier: Notifier
) {
super()
}
ngOnInit () {
this.buildForm({
hostsOrHandles: UNIQUE_HOSTS_OR_HANDLE_VALIDATOR
})
}
openModal () {
this.openedModal = this.modalService.open(this.modal, { centered: true })
}
hide () {
this.openedModal.close()
}
submit () {
this.addFollowing()
this.form.reset()
this.hide()
}
httpEnabled () {
return window.location.protocol === 'https:'
}
private async addFollowing () {
const hostsOrHandles = splitAndGetNotEmpty(this.form.value['hostsOrHandles'])
this.followService.follow(hostsOrHandles).subscribe(
() => {
this.notifier.success($localize`Follow request(s) sent!`)
this.newFollow.emit()
},
err => this.notifier.error(err.message)
)
}
}
<h1>
<my-global-icon iconName="following" aria-hidden="true"></my-global-icon>
<ng-container i18n>Instances you follow</ng-container>
<ng-container i18n>Your instance subscriptions</ng-container>
</h1>
<p-table
......@@ -13,9 +13,9 @@
<ng-template pTemplate="caption">
<div class="caption">
<div class="left-buttons">
<a class="follow-button" (click)="addDomainsToFollow()" (key.enter)="addDomainsToFollow()">
<a class="follow-button" (click)="openFollowModal()" (key.enter)="openFollowModal()">
<my-global-icon iconName="following" aria-hidden="true"></my-global-icon>
<ng-container i18n>Follow instances</ng-container>
<ng-container i18n>Follow</ng-container>
</a>
</div>
......@@ -28,7 +28,7 @@
<ng-template pTemplate="header">
<tr>
<th style="width: 150px;" i18n>Action</th>
<th i18n>Host</th>
<th i18n>Following</th>
<th style="width: 100px;" i18n pSortableColumn="state">State <p-sortIcon field="state"></p-sortIcon></th>
<th style="width: 150px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
<th style="width: 160px;" i18n pSortableColumn="redundancyAllowed">Redundancy allowed <p-sortIcon field="redundancyAllowed"></p-sortIcon></th>
......@@ -41,8 +41,8 @@
<my-delete-button label="Unfollow" i18n-label (click)="removeFollowing(follow)"></my-delete-button>
</td>
<td>
<a [href]="'https://' + follow.following.host" i18n-title title="Open instance in a new tab" target="_blank" rel="noopener noreferrer">
{{ follow.following.host }}
<a [href]="follow.following.url" i18n-title title="Open instance in a new tab" target="_blank" rel="noopener noreferrer">
{{ follow.following.name + '@' + follow.following.host }}
<span class="glyphicon glyphicon-new-window"></span>
</a>
</td>
......@@ -57,6 +57,7 @@
<td>{{ follow.createdAt | date: 'short' }}</td>
<td>
<my-redundancy-checkbox
*ngIf="isInstanceFollowing(follow)"
[host]="follow.following.host" [redundancyAllowed]="follow.following.hostRedundancyAllowed"
></my-redundancy-checkbox>
</td>
......@@ -75,10 +76,4 @@
</ng-template>
</p-table>
<my-batch-domains-modal #batchDomainsModal i18n-action action="Follow domains" (domains)="addFollowing($event)">
<ng-container ngProjectAs="warning">
<div i18n *ngIf="httpEnabled() === false" class="alert alert-warning">
It seems that you are not on a HTTPS server. Your webserver needs to have TLS activated in order to follow servers.
</div>
</ng-container>
</my-batch-domains-modal>
<my-follow-modal #followModal></my-follow-modal>
......@@ -4,13 +4,14 @@ import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
import { InstanceFollowService } from '@app/shared/shared-instance'
import { BatchDomainsModalComponent } from '@app/shared/shared-moderation'
import { ActorFollow } from '@shared/models'
import { FollowModalComponent } from './follow-modal.component'
@Component({
templateUrl: './following-list.component.html',
styleUrls: [ '../follows.component.scss', './following-list.component.scss' ]
})
export class FollowingListComponent extends RestTable implements OnInit {
@ViewChild('batchDomainsModal') batchDomainsModal: BatchDomainsModalComponent
@ViewChild('followModal') followModal: FollowModalComponent
following: ActorFollow[] = []
totalRecords = 0
......@@ -33,23 +34,12 @@ export class FollowingListComponent extends RestTable implements OnInit {
return 'FollowingListComponent'
}
addDomainsToFollow () {
this.batchDomainsModal.openModal()
openFollowModal () {
this.followModal.openModal()
}
httpEnabled () {
return window.location.protocol === 'https:'
}
async addFollowing (hosts: string[]) {
this.followService.follow(hosts).subscribe(
() => {
this.notifier.success($localize`Follow request(s) sent!`)
this.reloadData()
},
err => this.notifier.error(err.message)
)
isInstanceFollowing (follow: ActorFollow) {
return follow.following.name === 'peertube'
}
async removeFollowing (follow: ActorFollow) {
......
export * from './follow-modal.component'
export * from './following-list.component'
......@@ -25,7 +25,7 @@ export const FollowsRoutes: Routes = [
component: FollowingListComponent,
data: {
meta: {
title: $localize`Following list`
title: $localize`Following`
}
}
},
......@@ -34,7 +34,7 @@ export const FollowsRoutes: Routes = [
component: FollowersListComponent,
data: {
meta: {
title: $localize`Followers list`
title: $localize`Followers`
}
}
},
......
......@@ -28,6 +28,10 @@
<div *ngIf="formErrors.username" class="form-error">
{{ formErrors.username }}
</div>
<div *ngIf="hasUsernameUppercase()" i18n class="form-warning">
⚠️ Most email addresses do not include capital letters.
</div>
</div>
<div class="form-group">
......
......@@ -141,6 +141,10 @@ The link will expire within 1 hour.`
this.accordion = instanceAboutAccordion.accordion
}
hasUsernameUppercase () {
return this.form.value['username'].match(/[A-Z]/)
}
private loadExternalAuthToken (username: string, token: string) {
this.isAuthenticatedWithExternalAuth = true
......
import { of } from 'rxjs'
import { switchMap } from 'rxjs/operators'
import { Component, OnInit } from '@angular/core'
import { Router } from '@angular/router'
import { AuthService, Notifier } from '@app/core'
......@@ -9,11 +11,8 @@ import {
} from '@app/shared/form-validators/video-channel-validators'
import { FormValidatorService } from '@app/shared/shared-forms'
import { VideoChannel, VideoChannelService } from '@app/shared/shared-main'
import { VideoChannelCreate } from '@shared/models'
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
import { HttpStatusCode, VideoChannelCreate } from '@shared/models'
import { MyVideoChannelEdit } from './my-video-channel-edit'
import { switchMap } from 'rxjs/operators'
import { of } from 'rxjs'
@Component({
templateUrl: './my-video-channel-edit.component.html',
......
......@@ -45,9 +45,9 @@ export class MyVideoChannelsComponent {
It will delete ${videoChannel.videosCount} videos uploaded in this channel, and you will not be able to create another
channel with the same name (${videoChannel.name})!`,
$localize`Please type the display name of the video channel (${videoChannel.displayName}) to confirm`,
$localize`Please type the name of the video channel (${videoChannel.name}) to confirm`,
videoChannel.displayName,
videoChannel.name,
$localize`Delete`
)
......
import { Component, OnInit } from '@angular/core'
import { Title } from '@angular/platform-browser'
import { Router } from '@angular/router'
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
import { HttpStatusCode } from '@shared/models'
@Component({
selector: 'my-page-not-found',
templateUrl: './page-not-found.component.html',
......
......@@ -7,7 +7,7 @@ import { AuthService, MarkdownService, Notifier, RestExtractor, ScreenService }
import { ListOverflowItem, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main'
import { SupportModalComponent } from '@app/shared/shared-support-modal'
import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
import { HttpStatusCode } from '@shared/models'
@Component({
templateUrl: './video-channels.component.html',
......
......@@ -7,8 +7,7 @@ import { genericUploadErrorHandler, scrollToTop } from '@app/helpers'
import { FormValidatorService } from '@app/shared/shared-forms'
import { BytesPipe, Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
import { LoadingBarService } from '@ngx-loading-bar/core'
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
import { VideoPrivacy } from '@shared/models'
import { HttpStatusCode, VideoPrivacy } from '@shared/models'
import { UploaderXFormData } from './uploaderx-form-data'
import { VideoSend } from './video-send'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment