Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sync show gitlab issue detail #2115 #3247

Merged
merged 2 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class GitlabApiService {

return this._sendIssuePaginatedRequest$(
{
url: `${this._apiLink(cfg, project)}/issues?${queryParams}${this.getScopeParam(
url: `${this._apiLink(cfg, project, true)}/issues?${queryParams}${this.getScopeParam(
cfg,
)}${this.getCustomFilterParam(cfg)}`,
},
Expand All @@ -104,7 +104,7 @@ export class GitlabApiService {
}

getIssueWithComments$(issue: GitlabIssue, cfg: GitlabCfg): Observable<GitlabIssue> {
return this._getIssueComments$(issue.id, cfg).pipe(
return this._getIssueComments$(issue, cfg).pipe(
map((comments) => {
return {
...issue,
Expand Down Expand Up @@ -266,15 +266,15 @@ export class GitlabApiService {
}

private _getIssueComments$(
issueid: number | string,
issue: GitlabIssue,
cfg: GitlabCfg,
): Observable<GitlabOriginalComment[]> {
if (!this._isValidSettings(cfg)) {
return EMPTY;
}
return this._sendPaginatedRequest$(
{
url: `${this._issueApiLink(cfg, issueid)}/notes`,
url: `${issue.links.self}/notes`,
},
cfg,
).pipe(
Expand Down Expand Up @@ -429,13 +429,14 @@ export class GitlabApiService {
}

private _issueApiLink(cfg: GitlabCfg, issue: string | number): string {
return `${this._apiLink(
cfg,
this.getProject(cfg, issue),
)}/issues/${this._getIidFromIssue(issue)}`;
return `${this._apiLink(cfg, this.getProject(cfg, issue), true)}/issues/${issue}`;
}

private _apiLink(projectConfig: GitlabCfg, project?: string | number): string {
private _apiLink(
projectConfig: GitlabCfg,
project?: string | number,
onlyApiUrl = false,
): string {
let apiURL: string = '';

if (projectConfig.gitlabBaseUrl) {
Expand All @@ -446,6 +447,7 @@ export class GitlabApiService {
} else {
apiURL = GITLAB_API_BASE_URL + '/';
}
if (onlyApiUrl) return apiURL;

let projectURL = project;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</div>
<div
*ngIf="comment.body"
[innerHTML]="comment?.body|markdown"
[innerHTML]="comment?.body"
class="markdown"
></div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ export const mapGitlabIssue = (
url: issue.web_url,
// NOTE: we use the issue number as id as well, as it there is not much to be done with the id with the api
// when we can get issues from multiple projects we use full refence as id
id: /* issue.references.full, */ issue.iid,
id: /* issue.references.full, */ issue.id,
project: GitlabApiService.getPartsFromIssue(issue.references.full)[0],
links: issue._links,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ export type GitlabIssue = Readonly<{

// according to the docs: "Users on GitLab Starter, Bronze, or higher will also see the weight parameter"
weight?: number;
links: {
self: string;
notes: string;
award_emoji: string;
project: string;
};
}>;
Loading