FIX: various fixes to channel archive status (#19649)

- improves UI by displaying channel status on it's own line
- ensures channel status is correctly updated right after the request on frontend
- adds status on info page
This commit is contained in:
Joffrey JAFFEUX 2022-12-29 11:45:40 +01:00 committed by GitHub
parent 5e844793d8
commit 4ba4959a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 14 deletions

View File

@ -38,9 +38,9 @@ export default Component.extend(ModalFunctionality, {
return this.chatApi
.createChannelArchive(this.chatChannel.id, this._data())
.then((result) => {
.then(() => {
this.flash(I18n.t("chat.channel_archive.process_started"), "success");
result.target.status = CHANNEL_STATUSES.archived;
this.chatChannel.set("status", CHANNEL_STATUSES.archived);
discourseLater(() => {
this.closeModal();

View File

@ -2,5 +2,7 @@
<div class="chat-channel-status">
{{d-icon this.channelStatusIcon}}
<span>{{this.channelStatusMessage}}</span>
<ChatChannelArchiveStatus @channel={{this.channel}} />
</div>
{{/if}}
{{/if}}

View File

@ -33,10 +33,9 @@
</div>
{{/if}}
</div>
<ChatChannelArchiveStatus @channel={{this.chatChannel}} />
<ChatChannelStatus @channel={{this.chatChannel}} />
</div>
<ChatChannelStatus @channel={{this.chatChannel}} />
{{/if}}
<ChatRetentionReminder @chatChannel={{this.chatChannel}} />
@ -153,4 +152,4 @@
{{else}}
<ChatChannelPreviewCard @channel={{this.chatChannel}} />
{{/if}}
{{/if}}
{{/if}}

View File

@ -26,6 +26,8 @@
</div>
</div>
<ChatChannelStatus @channel={{this.model}} />
<div class="chat-tabs chat-info-tabs">
<ul class="chat-tabs-list nav-pills" role="tablist">
{{#each this.tabs as |tab|}}
@ -60,4 +62,4 @@
{{outlet}}
</div>
</div>
</div>
</div>

View File

@ -664,8 +664,9 @@ body.has-full-page-chat {
}
.chat-channel-status {
padding-top: 1rem;
font-weight: 500;
background: var(--secondary);
padding: 0.5rem 1rem;
border-bottom: 1px solid var(--primary-low);
}
html.has-full-page-chat {

View File

@ -62,10 +62,7 @@ RSpec.describe "Archive channel", type: :system, js: true do
click_button(I18n.t("js.chat.channel_archive.title"))
expect(page).to have_content(I18n.t("js.chat.channel_archive.process_started"))
chat.visit_channel(channel_1)
expect(page).to have_content(I18n.t("js.chat.channel_status.archived_header"))
expect(page).to have_css(".chat-channel-archive-status")
end
context "when archived channels had unreads" do