Add account link in videos list

This commit is contained in:
Chocobozzz 2018-04-25 14:32:19 +02:00
parent 6b738c7a31
commit 03e12d7c49
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
8 changed files with 24 additions and 8 deletions

View File

@ -12,6 +12,6 @@
</span> </span>
<span class="video-miniature-created-at-views">{{ video.publishedAt | myFromNow }} - {{ video.views | myNumberFormatter }} views</span> <span class="video-miniature-created-at-views">{{ video.publishedAt | myFromNow }} - {{ video.views | myNumberFormatter }} views</span>
<span class="video-miniature-account">{{ video.by }}</span> <a class="video-miniature-account" [routerLink]="[ '/account', video.account.id ]">{{ video.by }}</a>
</div> </div>
</div> </div>

View File

@ -39,12 +39,18 @@
} }
.video-miniature-account { .video-miniature-account {
@include disable-default-a-behaviour;
display: block; display: block;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
font-size: 13px; font-size: 13px;
color: #585858; color: #585858;
&:hover {
color: #303030;
}
} }
} }
} }

View File

@ -35,6 +35,8 @@ export class Video implements VideoServerModel {
nsfw: boolean nsfw: boolean
account: { account: {
id: number
uuid: string
name: string name: string
displayName: string displayName: string
url: string url: string

View File

@ -23,7 +23,7 @@
<div class="video-info-by"> <div class="video-info-by">
<a [routerLink]="[ '/account', video.account.id ]" title="Go the account page"> <a [routerLink]="[ '/account', video.account.id ]" title="Go the account page">
By {{ video.by }} <span>By {{ video.by }}</span>
<img [src]="getAvatarPath()" alt="Account avatar" /> <img [src]="getAvatarPath()" alt="Account avatar" />
</a> </a>
</div> </div>

View File

@ -68,14 +68,16 @@
font-size: 15px; font-size: 15px;
} }
.video-info-by { .video-info-by a {
@include disable-default-a-behaviour;
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 13px; font-size: 13px;
color: #000;
a { span:hover {
color: black; opacity: 0.8;
display: inline-block;
} }
img { img {

View File

@ -104,13 +104,13 @@ enum ScopeNames {
videoChannelId?: number videoChannelId?: number
}) => { }) => {
const accountInclude = { const accountInclude = {
attributes: [ 'name' ], attributes: [ 'id', 'name' ],
model: AccountModel.unscoped(), model: AccountModel.unscoped(),
required: true, required: true,
where: {}, where: {},
include: [ include: [
{ {
attributes: [ 'preferredUsername', 'url', 'serverId', 'avatarId' ], attributes: [ 'id', 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ],
model: ActorModel.unscoped(), model: ActorModel.unscoped(),
required: true, required: true,
where: VideoModel.buildActorWhereWithFilter(options.filter), where: VideoModel.buildActorWhereWithFilter(options.filter),
@ -1078,6 +1078,8 @@ export class VideoModel extends Model<VideoModel> {
updatedAt: this.updatedAt, updatedAt: this.updatedAt,
publishedAt: this.publishedAt, publishedAt: this.publishedAt,
account: { account: {
id: formattedAccount.id,
uuid: formattedAccount.uuid,
name: formattedAccount.name, name: formattedAccount.name,
displayName: formattedAccount.displayName, displayName: formattedAccount.displayName,
url: formattedAccount.url, url: formattedAccount.url,

View File

@ -486,6 +486,8 @@ async function completeVideoCheck (
expect(video.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy]) expect(video.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy])
expect(video.nsfw).to.equal(attributes.nsfw) expect(video.nsfw).to.equal(attributes.nsfw)
expect(video.description).to.equal(attributes.description) expect(video.description).to.equal(attributes.description)
expect(video.account.id).to.be.a('number')
expect(video.account.uuid).to.be.a('string')
expect(video.account.host).to.equal(attributes.account.host) expect(video.account.host).to.equal(attributes.account.host)
expect(video.account.name).to.equal(attributes.account.name) expect(video.account.name).to.equal(attributes.account.name)
expect(video.likes).to.equal(attributes.likes) expect(video.likes).to.equal(attributes.likes)

View File

@ -40,6 +40,8 @@ export interface Video {
nsfw: boolean nsfw: boolean
account: { account: {
id: number
uuid: string
name: string name: string
displayName: string displayName: string
url: string url: string