Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
一杯枸杞茶ya
csdn-workflow
提交
8e42065f
C
csdn-workflow
项目概览
一杯枸杞茶ya
/
csdn-workflow
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
csdn-workflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8e42065f
编写于
2月 10, 2021
作者:
T
Tomas Vik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: support displaying users without avatars
上级
0bc6135b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
17 deletion
+26
-17
src/data_providers/items/mr_item_model.ts
src/data_providers/items/mr_item_model.ts
+4
-2
src/gitlab/gitlab_new_service.ts
src/gitlab/gitlab_new_service.ts
+6
-5
src/gitlab_service.ts
src/gitlab_service.ts
+14
-8
src/types.d.ts
src/types.d.ts
+1
-1
src/utils/ensure_absolute_avatar_url.ts
src/utils/ensure_absolute_avatar_url.ts
+1
-1
未找到文件。
src/data_providers/items/mr_item_model.ts
浏览文件 @
8e42065f
...
...
@@ -32,7 +32,9 @@ export class MrItemModel extends ItemModel {
`!
${
iid
}
·
${
title
}
`
,
vscode
.
TreeItemCollapsibleState
.
Collapsed
,
);
item
.
iconPath
=
vscode
.
Uri
.
parse
(
author
.
avatar_url
);
if
(
author
.
avatar_url
)
{
item
.
iconPath
=
vscode
.
Uri
.
parse
(
author
.
avatar_url
);
}
return
item
;
}
...
...
@@ -91,7 +93,7 @@ export class MrItemModel extends ItemModel {
mode
:
vscode
.
CommentMode
.
Preview
,
author
:
{
name
:
author
.
name
,
iconPath
:
vscode
.
Uri
.
parse
(
author
.
avatarUrl
)
,
iconPath
:
author
.
avatarUrl
!==
null
?
vscode
.
Uri
.
parse
(
author
.
avatarUrl
)
:
undefined
,
},
}));
const
position
=
notes
.
nodes
[
0
]?.
position
as
GqlPosition
;
// we filtered out all discussions without position
...
...
src/gitlab/gitlab_new_service.ts
浏览文件 @
8e42065f
...
...
@@ -8,7 +8,7 @@ import * as assert from 'assert';
import
{
tokenService
}
from
'
../services/token_service
'
;
import
{
FetchError
}
from
'
../errors/fetch_error
'
;
import
{
getUserAgentHeader
}
from
'
../utils/get_user_agent_header
'
;
import
{
getAvatarUrl
}
from
'
../utils/get
_avatar_url
'
;
import
{
ensureAbsoluteAvatarUrl
}
from
'
../utils/ensure_absolute
_avatar_url
'
;
import
{
getHttpAgentOptions
}
from
'
../utils/get_http_agent_options
'
;
import
{
GitLabProject
,
GqlProject
}
from
'
./gitlab_project
'
;
import
{
getRestIdFromGraphQLId
}
from
'
../utils/get_rest_id_from_graphql_id
'
;
...
...
@@ -43,15 +43,15 @@ export interface GqlBlob {
path
:
string
;
}
interface
Gql
NoteAutho
r
{
avatarUrl
:
string
;
interface
Gql
Use
r
{
avatarUrl
:
string
|
null
;
name
:
string
;
username
:
string
;
webUrl
:
string
;
}
interface
GqlNote
{
id
:
string
;
author
:
Gql
NoteAutho
r
;
author
:
Gql
Use
r
;
createdAt
:
string
;
system
:
boolean
;
body
:
string
;
// TODO: remove this once the SystemNote.vue doesn't require plain text body
...
...
@@ -335,7 +335,8 @@ export class GitLabNewService {
bodyHtml
:
note
.
bodyHtml
.
replace
(
/href="
\/
/
,
`href="
${
this
.
instanceUrl
}
/`
),
author
:
{
...
note
.
author
,
avatarUrl
:
getAvatarUrl
(
this
.
instanceUrl
,
note
.
author
.
avatarUrl
),
avatarUrl
:
note
.
author
.
avatarUrl
&&
ensureAbsoluteAvatarUrl
(
this
.
instanceUrl
,
note
.
author
.
avatarUrl
),
},
});
return
{
...
...
src/gitlab_service.ts
浏览文件 @
8e42065f
...
...
@@ -12,7 +12,7 @@ import { handleError, logError } from './log';
import
{
getUserAgentHeader
}
from
'
./utils/get_user_agent_header
'
;
import
{
CustomQueryType
}
from
'
./gitlab/custom_query_type
'
;
import
{
CustomQuery
}
from
'
./gitlab/custom_query
'
;
import
{
getAvatarUrl
}
from
'
./utils/get
_avatar_url
'
;
import
{
ensureAbsoluteAvatarUrl
}
from
'
./utils/ensure_absolute
_avatar_url
'
;
import
{
getHttpAgentOptions
}
from
'
./utils/get_http_agent_options
'
;
import
{
getInstanceUrl
as
getInstanceUrlUtil
}
from
'
./utils/get_instance_url
'
;
import
{
GitLabProject
}
from
'
./gitlab/gitlab_project
'
;
...
...
@@ -27,13 +27,19 @@ interface GitLabJob {
created_at
:
string
;
}
const
normalizeAvatarUrl
=
(
instanceUrl
:
string
)
=>
(
issuable
:
RestIssuable
):
RestIssuable
=>
({
...
issuable
,
author
:
{
...
issuable
.
author
,
avatar_url
:
getAvatarUrl
(
instanceUrl
,
issuable
.
author
.
avatar_url
),
},
});
const
normalizeAvatarUrl
=
(
instanceUrl
:
string
)
=>
(
issuable
:
RestIssuable
):
RestIssuable
=>
{
const
{
author
}
=
issuable
;
if
(
!
author
.
avatar_url
)
{
return
issuable
;
}
return
{
...
issuable
,
author
:
{
...
author
,
avatar_url
:
ensureAbsoluteAvatarUrl
(
instanceUrl
,
author
.
avatar_url
),
},
};
};
const
projectCache
:
Record
<
string
,
GitLabProject
>
=
{};
let
versionCache
:
string
|
null
=
null
;
...
...
src/types.d.ts
浏览文件 @
8e42065f
...
...
@@ -13,7 +13,7 @@ interface RestIssuable {
title
:
string
;
project_id
:
number
;
web_url
:
string
;
author
:
{
name
:
string
;
avatar_url
:
string
};
author
:
{
name
:
string
;
avatar_url
:
string
|
null
};
sha
?:
string
;
// only present in MR, legacy logic uses the presence to decide issuable type
references
:
{
full
:
string
;
// e.g. "gitlab-org/gitlab#219925"
...
...
src/utils/
get
_avatar_url.ts
→
src/utils/
ensure_absolute
_avatar_url.ts
浏览文件 @
8e42065f
import
*
as
vscode
from
'
vscode
'
;
export
const
get
AvatarUrl
=
(
instanceUrl
:
string
,
avatarUrl
:
string
):
string
=>
{
export
const
ensureAbsolute
AvatarUrl
=
(
instanceUrl
:
string
,
avatarUrl
:
string
):
string
=>
{
if
(
!
avatarUrl
.
startsWith
(
'
/
'
))
{
return
avatarUrl
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录