mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
UX: don't show 'auto delete' option for TL4
This commit is contained in:
@ -15,12 +15,15 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
|
|
||||||
@computed("model.closed")
|
@computed("model.closed")
|
||||||
publicTimerTypes(closed) {
|
publicTimerTypes(closed) {
|
||||||
return [
|
let types = [
|
||||||
{ id: CLOSE_STATUS_TYPE, name: I18n.t(closed ? 'topic.temp_open.title' : 'topic.auto_close.title'), },
|
{ id: CLOSE_STATUS_TYPE, name: I18n.t(closed ? 'topic.temp_open.title' : 'topic.auto_close.title'), },
|
||||||
{ id: OPEN_STATUS_TYPE, name: I18n.t(closed ? 'topic.auto_reopen.title' : 'topic.temp_close.title') },
|
{ id: OPEN_STATUS_TYPE, name: I18n.t(closed ? 'topic.auto_reopen.title' : 'topic.temp_close.title') },
|
||||||
{ id: PUBLISH_TO_CATEGORY_STATUS_TYPE, name: I18n.t('topic.publish_to_category.title') },
|
{ id: PUBLISH_TO_CATEGORY_STATUS_TYPE, name: I18n.t('topic.publish_to_category.title') },
|
||||||
{ id: DELETE_STATUS_TYPE, name: I18n.t('topic.auto_delete.title') }
|
|
||||||
];
|
];
|
||||||
|
if (this.currentUser.get("staff")) {
|
||||||
|
types.push({ id: DELETE_STATUS_TYPE, name: I18n.t('topic.auto_delete.title') });
|
||||||
|
}
|
||||||
|
return types;
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed()
|
@computed()
|
||||||
@ -32,20 +35,12 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
|
|
||||||
@computed("isPublic", 'publicTimerTypes', 'privateTimerTypes')
|
@computed("isPublic", 'publicTimerTypes', 'privateTimerTypes')
|
||||||
selections(isPublic, publicTimerTypes, privateTimerTypes) {
|
selections(isPublic, publicTimerTypes, privateTimerTypes) {
|
||||||
if (isPublic === 'true') {
|
return "true" === isPublic ? publicTimerTypes : privateTimerTypes;
|
||||||
return publicTimerTypes;
|
|
||||||
} else {
|
|
||||||
return privateTimerTypes;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed('isPublic', 'model.topic_timer', 'model.private_topic_timer')
|
@computed('isPublic', 'model.topic_timer', 'model.private_topic_timer')
|
||||||
topicTimer(isPublic, publicTopicTimer, privateTopicTimer) {
|
topicTimer(isPublic, publicTopicTimer, privateTopicTimer) {
|
||||||
if (isPublic === 'true') {
|
return "true" === isPublic ? publicTopicTimer : privateTopicTimer;
|
||||||
return publicTopicTimer;
|
|
||||||
} else {
|
|
||||||
return privateTopicTimer;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_setTimer(time, statusType) {
|
_setTimer(time, statusType) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { acceptance } from 'helpers/qunit-helpers';
|
import { acceptance, replaceCurrentUser } from 'helpers/qunit-helpers';
|
||||||
acceptance('Topic - Edit timer', { loggedIn: true });
|
acceptance('Topic - Edit timer', { loggedIn: true });
|
||||||
|
|
||||||
QUnit.test('default', assert => {
|
QUnit.test('default', assert => {
|
||||||
@ -162,6 +162,22 @@ QUnit.test('schedule', assert => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test("TL4 can't auto-delete", assert => {
|
||||||
|
replaceCurrentUser({ staff: false, trust_level: 4 });
|
||||||
|
|
||||||
|
visit('/t/internationalization-localization');
|
||||||
|
click('.toggle-admin-menu');
|
||||||
|
click('.topic-admin-status-update button');
|
||||||
|
|
||||||
|
const timerType = selectKit('.select-kit.timer-type');
|
||||||
|
|
||||||
|
timerType.expand();
|
||||||
|
|
||||||
|
andThen(() => {
|
||||||
|
assert.ok(!timerType.rowByValue("delete").exists());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('auto delete', assert => {
|
QUnit.test('auto delete', assert => {
|
||||||
const timerType = selectKit('.select-kit.timer-type');
|
const timerType = selectKit('.select-kit.timer-type');
|
||||||
const futureDateInputSelector = selectKit('.future-date-input-selector');
|
const futureDateInputSelector = selectKit('.future-date-input-selector');
|
||||||
|
Reference in New Issue
Block a user