mirror of
https://github.com/discourse/discourse.git
synced 2025-04-02 01:46:08 +08:00
UX: Don't display all groups
option if group directory is disabled.a
https://meta.discourse.org/t/all-groups-option-leads-to-access-denied-page/88464
This commit is contained in:
parent
857a4e0006
commit
0b55416742
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<div class="groups-header-filters">
|
<div class="groups-header-filters">
|
||||||
{{text-field value=filterInput
|
{{text-field value=filterInput
|
||||||
placeholderKey="groups.index.all_groups"
|
placeholderKey="groups.index.all"
|
||||||
class="groups-header-filters-name no-blur"}}
|
class="groups-header-filters-name no-blur"}}
|
||||||
|
|
||||||
{{combo-box value=type
|
{{combo-box value=type
|
||||||
|
@ -29,11 +29,15 @@ export default ComboBoxComponent.extend({
|
|||||||
|
|
||||||
@computed
|
@computed
|
||||||
collectionHeader() {
|
collectionHeader() {
|
||||||
|
if (this.siteSettings.enable_group_directory ||
|
||||||
|
(this.currentUser && this.currentUser.get('staff'))) {
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<a href="${Discourse.getURL("/groups")}" class="group-dropdown-filter">
|
<a href="${Discourse.getURL("/groups")}" class="group-dropdown-filter">
|
||||||
${I18n.t("groups.index.all").toLowerCase()}
|
${I18n.t("groups.index.all").toLowerCase()}
|
||||||
</a>
|
</a>
|
||||||
`.htmlSafe();
|
`.htmlSafe();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -464,7 +464,6 @@ en:
|
|||||||
all: "All Groups"
|
all: "All Groups"
|
||||||
empty: "There are no visible groups."
|
empty: "There are no visible groups."
|
||||||
filter: "Filter by group type"
|
filter: "Filter by group type"
|
||||||
all_groups: "All Groups"
|
|
||||||
owner_groups: "Groups I am an owner of"
|
owner_groups: "Groups I am an owner of"
|
||||||
close_groups: "Closed Groups"
|
close_groups: "Closed Groups"
|
||||||
automatic_groups: "Automatic Groups"
|
automatic_groups: "Automatic Groups"
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
import { acceptance, logIn } from "helpers/qunit-helpers";
|
import { acceptance, logIn } from "helpers/qunit-helpers";
|
||||||
|
|
||||||
acceptance("Group");
|
acceptance("Group", {
|
||||||
|
settings: {
|
||||||
|
enable_group_directory: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const response = object => {
|
const response = object => {
|
||||||
return [
|
return [
|
||||||
@ -10,50 +14,53 @@ const response = object => {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
QUnit.test("Anonymous Viewing Group", assert => {
|
QUnit.test("Anonymous Viewing Group", async assert => {
|
||||||
visit("/groups/discourse");
|
await visit("/groups/discourse");
|
||||||
|
|
||||||
andThen(() => {
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
count(".nav-pills li a[title='Messages']"),
|
count(".nav-pills li a[title='Messages']"),
|
||||||
0,
|
0,
|
||||||
'it deos not show group messages navigation link'
|
'it deos not show group messages navigation link'
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
click(".nav-pills li a[title='Activity']");
|
await click(".nav-pills li a[title='Activity']");
|
||||||
|
|
||||||
andThen(() => {
|
|
||||||
assert.ok(count('.user-stream-item') > 0, "it lists stream items");
|
assert.ok(count('.user-stream-item') > 0, "it lists stream items");
|
||||||
});
|
|
||||||
|
|
||||||
click(".activity-nav li a[href='/groups/discourse/activity/topics']");
|
await click(".activity-nav li a[href='/groups/discourse/activity/topics']");
|
||||||
|
|
||||||
andThen(() => {
|
|
||||||
assert.ok(find('.topic-list'), "it shows the topic list");
|
assert.ok(find('.topic-list'), "it shows the topic list");
|
||||||
assert.equal(count('.topic-list-item'), 2, "it lists stream items");
|
assert.equal(count('.topic-list-item'), 2, "it lists stream items");
|
||||||
});
|
|
||||||
|
|
||||||
click(".activity-nav li a[href='/groups/discourse/activity/mentions']");
|
await click(".activity-nav li a[href='/groups/discourse/activity/mentions']");
|
||||||
|
|
||||||
andThen(() => {
|
|
||||||
assert.ok(count('.user-stream-item') > 0, "it lists stream items");
|
assert.ok(count('.user-stream-item') > 0, "it lists stream items");
|
||||||
});
|
|
||||||
|
|
||||||
andThen(() => {
|
|
||||||
assert.ok(find(".nav-pills li a[title='Edit Group']").length === 0, 'it should not show messages tab if user is not admin');
|
assert.ok(find(".nav-pills li a[title='Edit Group']").length === 0, 'it should not show messages tab if user is not admin');
|
||||||
assert.ok(find(".nav-pills li a[title='Logs']").length === 0, 'it should not show Logs tab if user is not admin');
|
assert.ok(find(".nav-pills li a[title='Logs']").length === 0, 'it should not show Logs tab if user is not admin');
|
||||||
assert.ok(count('.user-stream-item') > 0, "it lists stream items");
|
assert.ok(count('.user-stream-item') > 0, "it lists stream items");
|
||||||
});
|
|
||||||
|
|
||||||
selectKit('.group-dropdown').expand();
|
await expandSelectKit('.group-dropdown');
|
||||||
|
|
||||||
andThen(() => {
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find('.select-kit-row').text().trim(), 'discourse',
|
find('.select-kit-row').text().trim(), 'discourse',
|
||||||
'it displays the right row'
|
'it displays the right row'
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
assert.equal(
|
||||||
|
find('.group-dropdown-filter').text().trim(), I18n.t("groups.index.all").toLowerCase(),
|
||||||
|
'it displays the right header'
|
||||||
|
);
|
||||||
|
|
||||||
|
Discourse.SiteSettings.enable_group_directory = false;
|
||||||
|
|
||||||
|
await visit("/groups");
|
||||||
|
await visit("/groups/discourse");
|
||||||
|
await expandSelectKit('.group-dropdown');
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
find('.group-dropdown-filter').length, 0,
|
||||||
|
'it should not display the default header'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("Anonymous Viewing Automatic Group", assert => {
|
QUnit.test("Anonymous Viewing Automatic Group", assert => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user