Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions assets/javascripts/discourse/components/chat-composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { findRawTemplate } from "discourse-common/lib/raw-templates";
import { emojiSearch, isSkinTonableEmoji } from "pretty-text/emoji";
import { emojiUrlFor } from "discourse/lib/text";
import { inject as service } from "@ember/service";
import { or, readOnly, reads } from "@ember/object/computed";
import { readOnly, reads } from "@ember/object/computed";
import { search as searchCategoryTag } from "discourse/lib/category-tag-search";
import { SKIP } from "discourse/lib/autocomplete";
import { Promise } from "rsvp";
Expand Down Expand Up @@ -44,10 +44,7 @@ export default Component.extend(TextareaTextManipulation, {
inProgressUploads: null,
composerEventPrefix: "chat",
composerFocusSelector: ".chat-composer-input",
canAttachUploads: or(
"siteSettings.chat_allow_uploads",
"chatChannel.isDirectMessageChannel"
),
canAttachUploads: reads("siteSettings.chat_allow_uploads"),
isNetworkUnreliable: reads("chat.isNetworkUnreliable"),

@discourseComputed(...chatComposerButtonsDependentKeys())
Expand Down
2 changes: 1 addition & 1 deletion config/locales/server.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ en:
chat_default_channel_id: "The chat channel that will be opened by default when a user has no unread messages or mentions in other channels."
chat_duplicate_message_sensitivity: "The likelihood that a duplicate message by the same sender will be blocked in a short period. Decimal number between 0 and 1.0, with 1.0 being the highest setting (blocks messages more frequently in a shorter amount of time). Set to `0` to allow duplicate messages."
chat_minimum_message_length: "Minimum number of characters for a chat message."
chat_allow_uploads: "Allow uploads in public chat channels."
chat_allow_uploads: "Allow uploads in public chat channels and direct message channels."
chat_archive_destination_topic_status: "The status that the destination topic should be once a channel archive is completed. This only applies when the destination topic is a new topic, not an existing one."
default_emoji_reactions: "Default emoji reactions for chat messages. Add up to 5 emojis for quick reaction."
errors:
Expand Down
39 changes: 39 additions & 0 deletions test/javascripts/acceptance/chat-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,45 @@ acceptance("Discourse Chat - image uploads", function (needs) {
});
});

acceptance(
"Discourse Chat - image uploads - uploads not allowed",
function (needs) {
needs.user({
admin: false,
moderator: false,
username: "eviltrout",
id: 1,
can_chat: true,
has_chat_enabled: true,
});
needs.settings({
chat_enabled: true,
chat_allow_uploads: false,
});
needs.pretender((server, helper) => {
baseChatPretenders(server, helper);
directMessageChannelPretender(server, helper);
chatChannelPretender(server, helper);
});

test("uploads are not allowed in public channels", async function (assert) {
await visit("/chat/channel/4/public-category");
assert.notOk(
visible(".chat-composer-dropdown__trigger-btn"),
"composer dropdown should not be visible because uploads are not enabled and no other buttons are rendered"
);
});

test("uploads are not allowed in direct message channels", async function (assert) {
await visit("/chat/channel/75/@hawk");
assert.notOk(
visible(".chat-composer-dropdown__trigger-btn"),
"composer dropdown should not be visible because uploads are not enabled and no other buttons are rendered"
);
});
}
);

acceptance("Discourse Chat - Insert Date", function (needs) {
needs.user({
username: "eviltrout",
Expand Down
66 changes: 0 additions & 66 deletions test/javascripts/components/chat-composer-attachments-test.js

This file was deleted.