mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
Don't show an error in console on promise rejection when not logged in and trying to reply / start a discussion
This commit is contained in:
committed by
Franz Liedke
parent
cbd9c8dd4f
commit
2673dd2ee3
@@ -164,7 +164,11 @@ export default class IndexPage extends Page {
|
|||||||
icon: 'fas fa-edit',
|
icon: 'fas fa-edit',
|
||||||
className: 'Button Button--primary IndexPage-newDiscussion',
|
className: 'Button Button--primary IndexPage-newDiscussion',
|
||||||
itemClassName: 'App-primaryControl',
|
itemClassName: 'App-primaryControl',
|
||||||
onclick: this.newDiscussionAction.bind(this),
|
onclick: () => {
|
||||||
|
// If the user is not logged in, the promise rejects, and a login modal shows up.
|
||||||
|
// Since that's already handled, we dont need to show an error message in the console.
|
||||||
|
return this.newDiscussionAction().catch(() => { });
|
||||||
|
},
|
||||||
disabled: !canStartDiscussion,
|
disabled: !canStartDiscussion,
|
||||||
},
|
},
|
||||||
app.translator.trans(canStartDiscussion ? 'core.forum.index.start_discussion_button' : 'core.forum.index.cannot_start_discussion_button')
|
app.translator.trans(canStartDiscussion ? 'core.forum.index.start_discussion_button' : 'core.forum.index.cannot_start_discussion_button')
|
||||||
|
@@ -56,22 +56,26 @@ export default {
|
|||||||
'reply',
|
'reply',
|
||||||
!app.session.user || discussion.canReply()
|
!app.session.user || discussion.canReply()
|
||||||
? Button.component(
|
? Button.component(
|
||||||
{
|
{
|
||||||
icon: 'fas fa-reply',
|
icon: 'fas fa-reply',
|
||||||
onclick: this.replyAction.bind(discussion, true, false),
|
onclick: () => {
|
||||||
|
// If the user is not logged in, the promise rejects, and a login modal shows up.
|
||||||
|
// Since that's already handled, we dont need to show an error message in the console.
|
||||||
|
return this.replyAction(discussion, true, false).catch(() => { });
|
||||||
},
|
},
|
||||||
app.translator.trans(
|
},
|
||||||
app.session.user ? 'core.forum.discussion_controls.reply_button' : 'core.forum.discussion_controls.log_in_to_reply_button'
|
app.translator.trans(
|
||||||
)
|
app.session.user ? 'core.forum.discussion_controls.reply_button' : 'core.forum.discussion_controls.log_in_to_reply_button'
|
||||||
)
|
)
|
||||||
|
)
|
||||||
: Button.component(
|
: Button.component(
|
||||||
{
|
{
|
||||||
icon: 'fas fa-reply',
|
icon: 'fas fa-reply',
|
||||||
className: 'disabled',
|
className: 'disabled',
|
||||||
title: app.translator.trans('core.forum.discussion_controls.cannot_reply_text'),
|
title: app.translator.trans('core.forum.discussion_controls.cannot_reply_text'),
|
||||||
},
|
},
|
||||||
app.translator.trans('core.forum.discussion_controls.cannot_reply_button')
|
app.translator.trans('core.forum.discussion_controls.cannot_reply_button')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user