Skip to content
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
11 changes: 5 additions & 6 deletions webapp/src/components/sidebar_right/gitlab_items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ export const notificationReasons: Record<string | symbol, string> = {
approval_required: 'Your approval is required on this issue/merge request.',
unmergeable: 'This merge request can\'t be merged.',
merge_train_removed: 'A merge train was removed.',
member_access_requested: 'requested access to a project/group.'
};

const SUCCESS = 'success';
const PENDING = 'pending';
const ACTION_NAME_MEMBER_ACCESS_REQUESTED = 'member_access_requested';

function GitlabItems({item, theme}: GitlabItemsProps) {
const style = getStyle(theme);
Expand All @@ -48,7 +50,7 @@ function GitlabItems({item, theme}: GitlabItemsProps) {
);
}

const titleText = item.title || item.target?.title || '';
const titleText = item.title || item.target?.title || item.body || '';

let title: React.ReactNode = titleText;
if (item.web_url || item.target_url) {
Expand Down Expand Up @@ -174,17 +176,14 @@ function GitlabItems({item, theme}: GitlabItemsProps) {
</div>
<div>
{number}
<span className='light'>{repoName}</span>
{repoName && <span className='light'>({repoName})</span>}
</div>
{labels}
<div
className='light'
style={style.subtitle}
>
{'Opened'}
Comment thread
raghavaggarwal2308 marked this conversation as resolved.
{item.created_at && ` ${formatTimeSince(item.created_at)} ago`}
{userName && ` by ${userName}`}
{'.'}
{milestone}
</div>
<div
Expand All @@ -194,7 +193,7 @@ function GitlabItems({item, theme}: GitlabItemsProps) {
{item.action_name && (
<>
<div>{item.updated_at && `Updated ${formatTimeSince(item.updated_at)} ago.`}</div>
{notificationReasons[item.action_name]}
{item.action_name == ACTION_NAME_MEMBER_ACCESS_REQUESTED && <a href={item.author.web_url}>{item.author.name}</a>} {notificationReasons[item.action_name]}
Comment thread
raghavaggarwal2308 marked this conversation as resolved.
Outdated
</>
)}
</div>
Expand Down
3 changes: 3 additions & 0 deletions webapp/src/types/gitlab_items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export interface Label {

export interface User {
username: string;
web_url: string;
name: string;
}

export interface References {
Expand Down Expand Up @@ -57,6 +59,7 @@ export interface Item {
num_approvers: number;
total_reviewers: number;
reviewers: User[];
body: string;
}

export interface GitlabItemsProps {
Expand Down