mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: dont show chat upload btn if maxFileSize is 0, #12926
This commit is contained in:
@@ -98,7 +98,7 @@
|
||||
"multiparty": "4.2.3",
|
||||
"nconf": "0.12.1",
|
||||
"nodebb-plugin-2factor": "7.5.6",
|
||||
"nodebb-plugin-composer-default": "10.2.42",
|
||||
"nodebb-plugin-composer-default": "10.2.43",
|
||||
"nodebb-plugin-dbsearch": "6.2.5",
|
||||
"nodebb-plugin-emoji": "5.1.15",
|
||||
"nodebb-plugin-emoji-android": "4.0.0",
|
||||
|
||||
@@ -171,6 +171,8 @@ get:
|
||||
type: number
|
||||
canReply:
|
||||
type: boolean
|
||||
canUpload:
|
||||
type: boolean
|
||||
groupChat:
|
||||
type: boolean
|
||||
usernames:
|
||||
|
||||
@@ -67,8 +67,11 @@ chatsController.get = async function (req, res, next) {
|
||||
|
||||
room.title = room.roomName || room.usernames || '[[pages:chats]]';
|
||||
room.bodyClasses = ['chat-loaded'];
|
||||
room.canViewInfo = await privileges.global.can('view:users:info', uid);
|
||||
|
||||
const [canViewInfo, canUploadImage, canUploadFile] = await privileges.global.can([
|
||||
'view:users:info', 'upload:post:image', 'upload:post:file',
|
||||
], uid);
|
||||
room.canViewInfo = canViewInfo;
|
||||
room.canUpload = (canUploadImage || canUploadFile) && (meta.config.maximumFileSize > 0 || room.isAdmin);
|
||||
res.render('chats', {
|
||||
...payload,
|
||||
...room,
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
<div component="chat/composer/replying-to-text"></div> <button component="chat/composer/replying-to-cancel" class="btn btn-ghost btn-sm px-2 py-1"><i class="fa fa-times"></i></button>
|
||||
</div>
|
||||
<div class="w-100 flex-grow-1 flex-nowrap position-relative d-flex rounded-2 border border-secondary p-1 align-items-end">
|
||||
{{{ if canUpload }}}
|
||||
<button component="chat/upload/button" class="btn btn-ghost btn-sm d-flex p-2" type="button" title="[[global:upload]]" data-bs-toggle="tooltip"><i class="fa fa-fw fa-upload"></i></button>
|
||||
{{{ end }}}
|
||||
<div class="flex-grow-1 align-self-center">
|
||||
<textarea component="chat/input" placeholder="{{{ if roomName }}}[[modules:chat.placeholder.message-room, {roomName}]]{{{ else }}}[[modules:chat.placeholder.mobile]]{{{ end }}}" class="bg-transparent text-body form-control chat-input mousetrap rounded-0 border-0 shadow-none px-1 py-0" style="min-height: 1.5rem;height:0;max-height:30vh;resize:none;"></textarea>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user