From 03e12d7c4954e1071fdeb7ef362ea5c3965d4075 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Apr 2018 14:32:19 +0200 Subject: [PATCH] Add account link in videos list --- .../app/shared/video/video-miniature.component.html | 2 +- .../app/shared/video/video-miniature.component.scss | 6 ++++++ client/src/app/shared/video/video.model.ts | 2 ++ .../app/videos/+video-watch/video-watch.component.html | 2 +- .../app/videos/+video-watch/video-watch.component.scss | 10 ++++++---- server/models/video/video.ts | 6 ++++-- server/tests/utils/videos/videos.ts | 2 ++ shared/models/videos/video.model.ts | 2 ++ 8 files changed, 24 insertions(+), 8 deletions(-) diff --git a/client/src/app/shared/video/video-miniature.component.html b/client/src/app/shared/video/video-miniature.component.html index 233432142..d0b305509 100644 --- a/client/src/app/shared/video/video-miniature.component.html +++ b/client/src/app/shared/video/video-miniature.component.html @@ -12,6 +12,6 @@ {{ video.publishedAt | myFromNow }} - {{ video.views | myNumberFormatter }} views - {{ video.by }} + {{ video.by }} diff --git a/client/src/app/shared/video/video-miniature.component.scss b/client/src/app/shared/video/video-miniature.component.scss index ece090828..588eea3a7 100644 --- a/client/src/app/shared/video/video-miniature.component.scss +++ b/client/src/app/shared/video/video-miniature.component.scss @@ -39,12 +39,18 @@ } .video-miniature-account { + @include disable-default-a-behaviour; + display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: #585858; + + &:hover { + color: #303030; + } } } } diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts index a284c1688..2e85f40ef 100644 --- a/client/src/app/shared/video/video.model.ts +++ b/client/src/app/shared/video/video.model.ts @@ -35,6 +35,8 @@ export class Video implements VideoServerModel { nsfw: boolean account: { + id: number + uuid: string name: string displayName: string url: string diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html index abda5043e..036d75d3c 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html @@ -23,7 +23,7 @@
- By {{ video.by }} + By {{ video.by }} Account avatar
diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scss index 1b44f0d6a..b4d9841fe 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.scss +++ b/client/src/app/videos/+video-watch/video-watch.component.scss @@ -68,14 +68,16 @@ font-size: 15px; } - .video-info-by { + .video-info-by a { + @include disable-default-a-behaviour; + display: flex; align-items: center; font-size: 13px; + color: #000; - a { - color: black; - display: inline-block; + span:hover { + opacity: 0.8; } img { diff --git a/server/models/video/video.ts b/server/models/video/video.ts index f23fac2ab..ea466fccd 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -104,13 +104,13 @@ enum ScopeNames { videoChannelId?: number }) => { const accountInclude = { - attributes: [ 'name' ], + attributes: [ 'id', 'name' ], model: AccountModel.unscoped(), required: true, where: {}, include: [ { - attributes: [ 'preferredUsername', 'url', 'serverId', 'avatarId' ], + attributes: [ 'id', 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ], model: ActorModel.unscoped(), required: true, where: VideoModel.buildActorWhereWithFilter(options.filter), @@ -1078,6 +1078,8 @@ export class VideoModel extends Model { updatedAt: this.updatedAt, publishedAt: this.publishedAt, account: { + id: formattedAccount.id, + uuid: formattedAccount.uuid, name: formattedAccount.name, displayName: formattedAccount.displayName, url: formattedAccount.url, diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 2ba3a860b..d1d8c07df 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -486,6 +486,8 @@ async function completeVideoCheck ( expect(video.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy]) expect(video.nsfw).to.equal(attributes.nsfw) 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.name).to.equal(attributes.account.name) expect(video.likes).to.equal(attributes.likes) diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts index 259826689..ba1881da3 100644 --- a/shared/models/videos/video.model.ts +++ b/shared/models/videos/video.model.ts @@ -40,6 +40,8 @@ export interface Video { nsfw: boolean account: { + id: number + uuid: string name: string displayName: string url: string -- 2.41.0