mirror of https://github.com/zulip/zulip.git
user_pill: Show deactivated icon in user_display_only_pill.
This commit adds code to show the deactivated icon for deactivated users.
This commit is contained in:
parent
dd0d482d76
commit
f937669ba1
|
@ -181,12 +181,15 @@ export function get_sub_by_id(stream_id: number): StreamSubscription | undefined
|
||||||
return stream_info.get(stream_id);
|
return stream_info.get(stream_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function maybe_get_creator_details(creator_id: number | null): User | undefined {
|
export function maybe_get_creator_details(
|
||||||
|
creator_id: number | null,
|
||||||
|
): (User & {is_active: boolean}) | undefined {
|
||||||
if (creator_id === null) {
|
if (creator_id === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return people.get_user_by_id_assert_valid(creator_id);
|
const creator = people.get_user_by_id_assert_valid(creator_id);
|
||||||
|
return {...creator, is_active: people.is_person_active(creator_id)};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function get_stream_id(name: string): number | undefined {
|
export function get_stream_id(name: string): number | undefined {
|
||||||
|
|
|
@ -205,6 +205,13 @@
|
||||||
.panel_user_list > .pill-container,
|
.panel_user_list > .pill-container,
|
||||||
.stream_creator_details > .display_only_pill {
|
.stream_creator_details > .display_only_pill {
|
||||||
background-color: hsl(0deg 0% 0% / 7%);
|
background-color: hsl(0deg 0% 0% / 7%);
|
||||||
|
gap: 2px;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
|
||||||
|
&.inline_with_text_pill > .pill-deactivated {
|
||||||
|
font-size: 0.9em;
|
||||||
|
padding-right: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
{{#if is_admin}}
|
{{#if is_admin}}
|
||||||
<td>
|
<td>
|
||||||
<span class="referred_by panel_user_list">
|
<span class="referred_by panel_user_list">
|
||||||
{{> ../user_display_only_pill display_value=referrer_name user_id=invited_by_user_id}}
|
{{> ../user_display_only_pill display_value=referrer_name user_id=invited_by_user_id is_active=true}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td class="panel_user_list">
|
<td class="panel_user_list">
|
||||||
{{> ../user_display_only_pill display_value=full_name strikethrough=soft_removed}}
|
{{> ../user_display_only_pill display_value=full_name strikethrough=soft_removed is_active=true}}
|
||||||
</td>
|
</td>
|
||||||
{{#if email}}
|
{{#if email}}
|
||||||
<td class="subscriber-email {{#if soft_removed}} strikethrough {{/if}}">{{email}}</td>
|
<td class="subscriber-email {{#if soft_removed}} strikethrough {{/if}}">{{email}}</td>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<tr data-subscriber-id="{{user_id}}">
|
<tr data-subscriber-id="{{user_id}}">
|
||||||
<td class="subscriber-name panel_user_list">
|
<td class="subscriber-name panel_user_list">
|
||||||
{{> ../user_display_only_pill display_value=name}}
|
{{> ../user_display_only_pill display_value=name is_active=true}}
|
||||||
</td>
|
</td>
|
||||||
{{#if email}}
|
{{#if email}}
|
||||||
<td class="subscriber-email">{{email}}</td>
|
<td class="subscriber-email">{{email}}</td>
|
||||||
|
|
|
@ -84,7 +84,8 @@
|
||||||
user_id=creator.user_id
|
user_id=creator.user_id
|
||||||
img_src=creator.avatar_url
|
img_src=creator.avatar_url
|
||||||
display_value=creator.full_name
|
display_value=creator.full_name
|
||||||
is_current_user=is_creator }}
|
is_current_user=is_creator
|
||||||
|
is_active=creator.is_active }}
|
||||||
{{/inline}}
|
{{/inline}}
|
||||||
{{#*inline "z-stream-date-created"}}{{date_created_string}}{{/inline}}
|
{{#*inline "z-stream-date-created"}}{{date_created_string}}{{/inline}}
|
||||||
{{/tr}}
|
{{/tr}}
|
||||||
|
|
|
@ -13,4 +13,7 @@
|
||||||
{{~/if~}}
|
{{~/if~}}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
{{#unless is_active}}
|
||||||
|
<i class="fa fa-ban pill-deactivated deactivated-user-icon tippy-zulip-delayed-tooltip" data-tippy-content="{{#if is_bot}}{{t 'Bot is deactivated' }}{{else}}{{t 'User is deactivated' }}{{/if}}"></i>
|
||||||
|
{{/unless}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -841,7 +841,15 @@ test("creator_id", () => {
|
||||||
// When there is no creator
|
// When there is no creator
|
||||||
assert.equal(stream_data.maybe_get_creator_details(null), undefined);
|
assert.equal(stream_data.maybe_get_creator_details(null), undefined);
|
||||||
|
|
||||||
const creator_details = people.get_by_user_id(test_user.user_id);
|
let creator_details = {...people.get_by_user_id(test_user.user_id), is_active: true};
|
||||||
|
assert.deepStrictEqual(
|
||||||
|
stream_data.maybe_get_creator_details(test_user.user_id),
|
||||||
|
creator_details,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check when creator is deactivated.
|
||||||
|
people.deactivate(test_user);
|
||||||
|
creator_details = {...people.get_by_user_id(test_user.user_id), is_active: false};
|
||||||
assert.deepStrictEqual(
|
assert.deepStrictEqual(
|
||||||
stream_data.maybe_get_creator_details(test_user.user_id),
|
stream_data.maybe_get_creator_details(test_user.user_id),
|
||||||
creator_details,
|
creator_details,
|
||||||
|
|
Loading…
Reference in New Issue