mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 09:10:25 +08:00
FIX: UX improvements for system messages when PMs are disabled
This commit is contained in:
parent
28d432263e
commit
782d75069e
6 changed files with 40 additions and 3 deletions
|
@ -6,6 +6,16 @@ export default Ember.Component.extend({
|
||||||
// Allow us to extend it
|
// Allow us to extend it
|
||||||
layoutName: 'components/topic-footer-buttons',
|
layoutName: 'components/topic-footer-buttons',
|
||||||
|
|
||||||
|
@computed('topic.isPrivateMessage')
|
||||||
|
canArchive(isPM) {
|
||||||
|
return this.siteSettings.enable_private_messages && isPM;
|
||||||
|
},
|
||||||
|
|
||||||
|
@computed('topic.isPrivateMessage')
|
||||||
|
showNotificationsButton(isPM) {
|
||||||
|
return (!isPM) || this.siteSettings.enable_private_messages;
|
||||||
|
},
|
||||||
|
|
||||||
@computed('topic.details.can_invite_to')
|
@computed('topic.details.can_invite_to')
|
||||||
canInviteTo(result) {
|
canInviteTo(result) {
|
||||||
return !this.site.mobileView && result;
|
return !this.site.mobileView && result;
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
disabled=inviteDisabled}}
|
disabled=inviteDisabled}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if topic.isPrivateMessage}}
|
{{#if canArchive}}
|
||||||
{{d-button class="standard"
|
{{d-button class="standard archive-topic"
|
||||||
title=archiveTitle
|
title=archiveTitle
|
||||||
label=archiveLabel
|
label=archiveLabel
|
||||||
icon=archiveIcon
|
icon=archiveIcon
|
||||||
|
@ -79,7 +79,9 @@
|
||||||
{{pinned-button pinned=topic.pinned topic=topic}}
|
{{pinned-button pinned=topic.pinned topic=topic}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{topic-notifications-button notificationLevel=topic.details.notification_level topic=topic}}
|
{{#if showNotificationsButton}}
|
||||||
|
{{topic-notifications-button notificationLevel=topic.details.notification_level topic=topic}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{plugin-outlet name="after-topic-footer-buttons"
|
{{plugin-outlet name="after-topic-footer-buttons"
|
||||||
args=(hash topic=topic)
|
args=(hash topic=topic)
|
||||||
|
|
|
@ -1034,6 +1034,7 @@ en:
|
||||||
summary_max_results: "Maximum posts returned by 'Summary This Topic'"
|
summary_max_results: "Maximum posts returned by 'Summary This Topic'"
|
||||||
|
|
||||||
enable_private_messages: "Allow trust level 1 (configurable via min trust level to send messages) users to create messages and reply to messages. Note that staff can always send messages no matter what."
|
enable_private_messages: "Allow trust level 1 (configurable via min trust level to send messages) users to create messages and reply to messages. Note that staff can always send messages no matter what."
|
||||||
|
enable_system_message_replies: "Allows users to reply to system messages, even if private messages are disabled"
|
||||||
enable_private_email_messages: "Allow trust level 4 (configurable via min trust level to send messages) users to send private email messages. Note that staff can always send messages no matter what."
|
enable_private_email_messages: "Allow trust level 4 (configurable via min trust level to send messages) users to send private email messages. Note that staff can always send messages no matter what."
|
||||||
|
|
||||||
enable_long_polling: "Message bus used for notification can use long polling"
|
enable_long_polling: "Message bus used for notification can use long polling"
|
||||||
|
|
|
@ -507,6 +507,8 @@ posting:
|
||||||
enable_private_messages:
|
enable_private_messages:
|
||||||
default: true
|
default: true
|
||||||
client: true
|
client: true
|
||||||
|
enable_system_message_replies:
|
||||||
|
default: true
|
||||||
enable_private_email_messages:
|
enable_private_email_messages:
|
||||||
default: false
|
default: false
|
||||||
client: true
|
client: true
|
||||||
|
|
|
@ -80,6 +80,9 @@ module PostGuardian
|
||||||
|
|
||||||
# Creating Method
|
# Creating Method
|
||||||
def can_create_post?(parent)
|
def can_create_post?(parent)
|
||||||
|
|
||||||
|
return false if !SiteSetting.enable_system_message_replies? && parent.try(:subtype) == "system_message"
|
||||||
|
|
||||||
(!SpamRule::AutoSilence.silence?(@user) || (!!parent.try(:private_message?) && parent.allowed_users.include?(@user))) && (
|
(!SpamRule::AutoSilence.silence?(@user) || (!!parent.try(:private_message?) && parent.allowed_users.include?(@user))) && (
|
||||||
!parent ||
|
!parent ||
|
||||||
!parent.category ||
|
!parent.category ||
|
||||||
|
|
|
@ -857,6 +857,25 @@ describe Guardian do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "system message" do
|
||||||
|
let(:private_message) {
|
||||||
|
Fabricate(
|
||||||
|
:topic,
|
||||||
|
archetype: Archetype.private_message,
|
||||||
|
subtype: 'system_message',
|
||||||
|
category_id: nil
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
before { user.save! }
|
||||||
|
it "allows the user to reply to system messages" do
|
||||||
|
expect(Guardian.new(user).can_create_post?(private_message)).to eq(true)
|
||||||
|
SiteSetting.enable_system_message_replies = false
|
||||||
|
expect(Guardian.new(user).can_create_post?(private_message)).to eq(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
context "private message" do
|
context "private message" do
|
||||||
let(:private_message) { Fabricate(:topic, archetype: Archetype.private_message, category_id: nil) }
|
let(:private_message) { Fabricate(:topic, archetype: Archetype.private_message, category_id: nil) }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue