mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 19:00:32 -06:00
UX: Better error message when logging out in read only mode.
This commit is contained in:
parent
d70e4ac5b6
commit
bfea842d32
@ -4,10 +4,10 @@ import showModal from 'discourse/lib/show-modal';
|
||||
import OpenComposer from "discourse/mixins/open-composer";
|
||||
import Category from 'discourse/models/category';
|
||||
|
||||
function unlessReadOnly(method) {
|
||||
function unlessReadOnly(method, message) {
|
||||
return function() {
|
||||
if (this.site.get("isReadOnly")) {
|
||||
bootbox.alert(I18n.t("read_only_mode.login_disabled"));
|
||||
bootbox.alert(message);
|
||||
} else {
|
||||
this[method]();
|
||||
}
|
||||
@ -19,7 +19,9 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
|
||||
|
||||
actions: {
|
||||
|
||||
logout() {
|
||||
logout: unlessReadOnly('_handleLogout', I18n.t("read_only_mode.logout_disabled")),
|
||||
|
||||
_handleLogout() {
|
||||
if (this.currentUser) {
|
||||
this.currentUser.destroySession().then(() => logout(this.siteSettings, this.keyValueStore));
|
||||
}
|
||||
@ -83,9 +85,9 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
|
||||
return true;
|
||||
},
|
||||
|
||||
showLogin: unlessReadOnly('handleShowLogin'),
|
||||
showLogin: unlessReadOnly('handleShowLogin', I18n.t("read_only_mode.login_disabled")),
|
||||
|
||||
showCreateAccount: unlessReadOnly('handleShowCreateAccount'),
|
||||
showCreateAccount: unlessReadOnly('handleShowCreateAccount', I18n.t("read_only_mode.login_disabled")),
|
||||
|
||||
showForgotPassword() {
|
||||
showModal('forgotPassword', { title: 'forgot_password.title' });
|
||||
|
@ -777,6 +777,7 @@ en:
|
||||
read_only_mode:
|
||||
enabled: "This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now."
|
||||
login_disabled: "Login is disabled while the site is in read only mode."
|
||||
logout_disabled: "Logout is disabled while the site is in read only mode."
|
||||
too_few_topics_and_posts_notice: "Let's <a href='http://blog.discourse.org/2014/08/building-a-discourse-community/'>get this discussion started!</a> There are currently <strong>%{currentTopics} / %{requiredTopics}</strong> topics and <strong>%{currentPosts} / %{requiredPosts}</strong> posts. New visitors need some conversations to read and respond to."
|
||||
too_few_topics_notice: "Let's <a href='http://blog.discourse.org/2014/08/building-a-discourse-community/'>get this discussion started!</a> There are currently <strong>%{currentTopics} / %{requiredTopics}</strong> topics. New visitors need some conversations to read and respond to."
|
||||
too_few_posts_notice: "Let's <a href='http://blog.discourse.org/2014/08/building-a-discourse-community/'>get this discussion started!</a> There are currently <strong>%{currentPosts} / %{requiredPosts}</strong> posts. New visitors need some conversations to read and respond to."
|
||||
|
Loading…
Reference in New Issue
Block a user