mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
FIX: UX improvements for system messages when PMs are disabled
This commit is contained in:
parent
28d432263e
commit
782d75069e
|
@ -6,6 +6,16 @@ export default Ember.Component.extend({
|
|||
// Allow us to extend it
|
||||
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')
|
||||
canInviteTo(result) {
|
||||
return !this.site.mobileView && result;
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
disabled=inviteDisabled}}
|
||||
{{/if}}
|
||||
|
||||
{{#if topic.isPrivateMessage}}
|
||||
{{d-button class="standard"
|
||||
{{#if canArchive}}
|
||||
{{d-button class="standard archive-topic"
|
||||
title=archiveTitle
|
||||
label=archiveLabel
|
||||
icon=archiveIcon
|
||||
|
@ -79,7 +79,9 @@
|
|||
{{pinned-button pinned=topic.pinned topic=topic}}
|
||||
</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"
|
||||
args=(hash topic=topic)
|
||||
|
|
|
@ -1034,6 +1034,7 @@ en:
|
|||
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_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_long_polling: "Message bus used for notification can use long polling"
|
||||
|
|
|
@ -507,6 +507,8 @@ posting:
|
|||
enable_private_messages:
|
||||
default: true
|
||||
client: true
|
||||
enable_system_message_replies:
|
||||
default: true
|
||||
enable_private_email_messages:
|
||||
default: false
|
||||
client: true
|
||||
|
|
|
@ -80,6 +80,9 @@ module PostGuardian
|
|||
|
||||
# Creating Method
|
||||
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))) && (
|
||||
!parent ||
|
||||
!parent.category ||
|
||||
|
|
|
@ -857,6 +857,25 @@ describe Guardian do
|
|||
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
|
||||
let(:private_message) { Fabricate(:topic, archetype: Archetype.private_message, category_id: nil) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user