1
0
Fork 0

Make /a and /c default URLs for accounts and channels

This commit is contained in:
Kimsible 2021-04-28 23:45:23 +02:00
parent 69e076ddb0
commit 7188739644
21 changed files with 38 additions and 38 deletions

View file

@ -133,6 +133,6 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
}
getVideoChannelLink (videoChannel: VideoChannel) {
return [ '/video-channels', videoChannel.nameWithHost ]
return [ '/c', videoChannel.nameWithHost ]
}
}

View file

@ -10,7 +10,7 @@
<ng-container *ngIf="!isCreation()">
<li class="breadcrumb-item active" i18n>Edit</li>
<li class="breadcrumb-item active" aria-current="page">
<a *ngIf="user" [routerLink]="[ '/accounts', user?.username ]">{{ user?.username }}</a>
<a *ngIf="user" [routerLink]="[ '/a', user?.username ]">{{ user?.username }}</a>
</li>
</ng-container>
</ol>

View file

@ -87,7 +87,7 @@
</td>
<td *ngIf="isSelected('username')">
<a i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer" [routerLink]="[ '/accounts/' + user.username ]">
<a i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer" [routerLink]="[ '/a/' + user.username ]">
<div class="chip two-lines">
<my-actor-avatar [account]="user?.account" size="32"></my-actor-avatar>
<div>

View file

@ -17,10 +17,10 @@
<div class="video-channels">
<div *ngFor="let videoChannel of videoChannels; let i = index" class="video-channel">
<my-actor-avatar [channel]="videoChannel" [internalHref]="[ '/video-channels', videoChannel.nameWithHost ]"></my-actor-avatar>
<my-actor-avatar [channel]="videoChannel" [internalHref]="[ '/c', videoChannel.nameWithHost ]"></my-actor-avatar>
<div class="video-channel-info">
<a [routerLink]="[ '/video-channels', videoChannel.nameWithHost ]" class="video-channel-names" i18n-title title="Channel page">
<a [routerLink]="[ '/c', videoChannel.nameWithHost ]" class="video-channel-names" i18n-title title="Channel page">
<div class="video-channel-display-name">{{ videoChannel.displayName }}</div>
<div class="video-channel-name">{{ videoChannel.nameWithHost }}</div>
</a>

View file

@ -14,17 +14,17 @@
<div class="video-channels" myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()">
<div *ngFor="let videoChannel of videoChannels" class="video-channel">
<my-actor-avatar [channel]="videoChannel" [internalHref]="[ '/video-channels', videoChannel.nameWithHost ]"></my-actor-avatar>
<my-actor-avatar [channel]="videoChannel" [internalHref]="[ '/c', videoChannel.nameWithHost ]"></my-actor-avatar>
<div class="video-channel-info">
<a [routerLink]="[ '/video-channels', videoChannel.nameWithHost ]" class="video-channel-names" i18n-title title="Channel page">
<a [routerLink]="[ '/c', videoChannel.nameWithHost ]" class="video-channel-names" i18n-title title="Channel page">
<div class="video-channel-display-name">{{ videoChannel.displayName }}</div>
<div class="video-channel-name">{{ videoChannel.nameWithHost }}</div>
</a>
<div i18n class="video-channel-followers">{{ videoChannel.followersCount }} subscribers</div>
<a [routerLink]="[ '/accounts', videoChannel.ownerBy ]" i18n-title title="Owner account page" class="actor-owner">
<a [routerLink]="[ '/a', videoChannel.ownerBy ]" i18n-title title="Owner account page" class="actor-owner">
<span i18n>Created by {{ videoChannel.ownerBy }}</span>
<my-actor-avatar [account]="videoChannel.ownerAccount" size="18"></my-actor-avatar>

View file

@ -43,7 +43,7 @@ export class RemoteInteractionComponent implements OnInit {
} else if (channelResult.data.length !== 0) {
const channel = new VideoChannel(channelResult.data[0])
redirectUrl = '/video-channels/' + channel.nameWithHost
redirectUrl = '/c/' + channel.nameWithHost
} else {
this.error = $localize`Cannot access to the remote resource`
return

View file

@ -214,7 +214,7 @@ export class SearchComponent implements OnInit, OnDestroy {
const linkType = this.getVideoLinkType()
if (linkType === 'internal') {
return [ '/video-channels', channel.nameWithHost ]
return [ '/c', channel.nameWithHost ]
}
if (linkType === 'lazy-load') {

View file

@ -112,7 +112,7 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
}
getAccountUrl () {
return [ '/accounts', this.videoChannel.ownerBy ]
return [ '/a', this.videoChannel.ownerBy ]
}
private loadChannelVideosCount () {

View file

@ -11,7 +11,7 @@
<div class="comment-account-date">
<div class="comment-account">
<a [routerLink]="[ '/accounts', comment.by ]">
<a [routerLink]="[ '/a', comment.by ]">
<span class="comment-account-name" [ngClass]="{ 'video-author': video.account.id === comment.account.id }">
{{ comment.account.displayName }}
</span>

View file

@ -1,11 +1,11 @@
<div class="wrapper" [ngClass]="{ 'generic-channel': genericChannel }">
<my-actor-avatar
class="channel" [channel]="video.channel"
[internalHref]="[ '/video-channels', video.byVideoChannel ]" [title]="channelLinkTitle"
[internalHref]="[ '/c', video.byVideoChannel ]" [title]="channelLinkTitle"
></my-actor-avatar>
<my-actor-avatar
class="account" [account]="video.account"
[internalHref]="[ '/accounts', video.byAccount ]" [title]="accountLinkTitle">
[internalHref]="[ '/a', video.byAccount ]" [title]="accountLinkTitle">
</my-actor-avatar>
</div>

View file

@ -183,16 +183,16 @@
<div class="video-info-channel-left-links ml-1">
<ng-container *ngIf="!isChannelDisplayNameGeneric()">
<a [routerLink]="[ '/video-channels', video.byVideoChannel ]" i18n-title title="Channel page">
<a [routerLink]="[ '/c', video.byVideoChannel ]" i18n-title title="Channel page">
{{ video.channel.displayName }}
</a>
<a [routerLink]="[ '/accounts', video.byAccount ]" i18n-title title="Account page">
<a [routerLink]="[ '/a', video.byAccount ]" i18n-title title="Account page">
<span i18n>By {{ video.byAccount }}</span>
</a>
</ng-container>
<ng-container *ngIf="isChannelDisplayNameGeneric()">
<a [routerLink]="[ '/accounts', video.byAccount ]" class="single-link" i18n-title title="Account page">
<a [routerLink]="[ '/a', video.byAccount ]" class="single-link" i18n-title title="Account page">
<span i18n>{{ video.byAccount }}</span>
</a>
</ng-container>

View file

@ -32,7 +32,7 @@
<div class="section channel videos" *ngFor="let object of overview.channels">
<div class="section-title">
<a [routerLink]="[ '/video-channels', buildVideoChannelBy(object) ]">
<a [routerLink]="[ '/c', buildVideoChannelBy(object) ]">
<my-actor-avatar [channel]="buildVideoChannel(object)"></my-actor-avatar>
<h2 class="section-title">{{ object.channel.displayName }}</h2>

View file

@ -27,11 +27,11 @@ const routes: Routes = [
loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule)
},
{
path: 'accounts',
path: 'a',
loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule)
},
{
path: 'video-channels',
path: 'c',
loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule)
},
{
@ -67,12 +67,12 @@ const routes: Routes = [
redirectTo: 'videos/watch/playlist'
},
{
path: 'a',
redirectTo: 'accounts'
path: 'accounts',
redirectTo: 'a'
},
{
path: 'c',
redirectTo: 'video-channels'
path: 'video-channels',
redirectTo: 'c'
},
{
matcher: (url): UrlMatchResult => {

View file

@ -18,7 +18,7 @@
</div>
<div ngbDropdownMenu>
<a *ngIf="user.account" ngbDropdownItem ngbDropdownToggle class="dropdown-item" [routerLink]="[ '/accounts', user.account.nameWithHost ]"
<a *ngIf="user.account" ngbDropdownItem ngbDropdownToggle class="dropdown-item" [routerLink]="[ '/a', user.account.nameWithHost ]"
#profile (click)="onActiveLinkScrollToAnchor(profile)">
<my-global-icon iconName="go" aria-hidden="true"></my-global-icon> <ng-container i18n>Public profile</ng-container>
</a>

View file

@ -30,12 +30,12 @@ export class RootComponent implements OnInit {
]))
)
.subscribe(actor => {
if (actor.constructor.name === 'Account') {
this.router.navigateByUrl(`/accounts/${actor.name}`)
if (/\/accounts\//.test(actor.url)) {
this.router.navigate([ `/a/${actor.name}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true })
}
if (actor.constructor.name === 'VideoChannel') {
this.router.navigateByUrl(`/video-channels/${actor.name}`)
if (/\/video-channels\//.test(actor.url)) {
this.router.navigate([ `/c/${actor.name}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true })
}
})
}

View file

@ -124,7 +124,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
}
getAccountUrl (abuse: ProcessedAbuse) {
return '/accounts/' + abuse.flaggedAccount.nameWithHost
return '/a/' + abuse.flaggedAccount.nameWithHost
}
getVideoEmbed (abuse: AdminAbuse) {

View file

@ -242,7 +242,7 @@ export class UserNotification implements UserNotificationServer {
}
private buildAccountUrl (account: { name: string, host: string }) {
return '/accounts/' + Actor.CREATE_BY_STRING(account.name, account.host)
return '/a/' + Actor.CREATE_BY_STRING(account.name, account.host)
}
private buildVideoImportUrl () {

View file

@ -95,7 +95,7 @@ export class VideoCommentAdmin implements VideoCommentAdminServerModel {
if (this.account) {
this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host)
this.account.localUrl = '/accounts/' + this.by
this.account.localUrl = '/a/' + this.by
}
}
}

View file

@ -12,12 +12,12 @@
<div class="d-flex video-miniature-meta">
<my-actor-avatar
*ngIf="displayOptions.avatar && displayOwnerVideoChannel()" [title]="channelLinkTitle"
[channel]="video.channel" [size]="actorImageSize" [internalHref]="[ '/video-channels', video.byVideoChannel ]"
[channel]="video.channel" [size]="actorImageSize" [internalHref]="[ '/c', video.byVideoChannel ]"
></my-actor-avatar>
<my-actor-avatar
*ngIf="displayOptions.avatar && displayOwnerAccount()" [title]="channelLinkTitle"
[account]="video.account" [size]="actorImageSize" [internalHref]="[ '/video-channels', video.byVideoChannel ]"
[account]="video.account" [size]="actorImageSize" [internalHref]="[ '/c', video.byVideoChannel ]"
></my-actor-avatar>
<div class="w-100 d-flex flex-column">
@ -39,10 +39,10 @@
</span>
</span>
<a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/video-channels', video.byVideoChannel ]">
<a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/c', video.byVideoChannel ]">
{{ video.byAccount }}
</a>
<a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/video-channels', video.byVideoChannel ]">
<a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/c', video.byVideoChannel ]">
{{ video.byVideoChannel }}
</a>

View file

@ -20,7 +20,7 @@
[attr.title]="playlistElement.video.name"
>{{ playlistElement.video.name }}</a>
<a *ngIf="accountLink" tabindex="-1" class="video-info-account" [routerLink]="[ '/accounts', playlistElement.video.byAccount ]">
<a *ngIf="accountLink" tabindex="-1" class="video-info-account" [routerLink]="[ '/a', playlistElement.video.byAccount ]">
{{ playlistElement.video.byAccount }}
</a>
<span *ngIf="!accountLink" tabindex="-1" class="video-info-account">{{ playlistElement.video.byAccount }}</span>

View file

@ -19,7 +19,7 @@
{{ playlist.displayName }}
</a>
<a i18n [routerLink]="[ '/video-channels', playlist.videoChannelBy ]" class="by" *ngIf="displayChannel && playlist.videoChannelBy">
<a i18n [routerLink]="[ '/c', playlist.videoChannelBy ]" class="by" *ngIf="displayChannel && playlist.videoChannelBy">
{{ playlist.videoChannelBy }}
</a>