Skip to content

Commit

Permalink
Add account link in videos list
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Apr 25, 2018
1 parent 6b738c7 commit 03e12d7
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/src/app/shared/video/video-miniature.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
</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>
6 changes: 6 additions & 0 deletions client/src/app/shared/video/video-miniature.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
2 changes: 2 additions & 0 deletions client/src/app/shared/video/video.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export class Video implements VideoServerModel {
nsfw: boolean

account: {
id: number
uuid: string
name: string
displayName: string
url: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<div class="video-info-by">
<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" />
</a>
</div>
Expand Down
10 changes: 6 additions & 4 deletions client/src/app/videos/+video-watch/video-watch.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions server/models/video/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -1078,6 +1078,8 @@ export class VideoModel extends Model<VideoModel> {
updatedAt: this.updatedAt,
publishedAt: this.publishedAt,
account: {
id: formattedAccount.id,
uuid: formattedAccount.uuid,
name: formattedAccount.name,
displayName: formattedAccount.displayName,
url: formattedAccount.url,
Expand Down
2 changes: 2 additions & 0 deletions server/tests/utils/videos/videos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions shared/models/videos/video.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export interface Video {
nsfw: boolean

account: {
id: number
uuid: string
name: string
displayName: string
url: string
Expand Down

0 comments on commit 03e12d7

Please sign in to comment.