commit
3a13cead22
@ -1,4 +1,3 @@ |
||||
app/theme/client/vendor/fontello/css/fontello.css |
||||
app/meteor-autocomplete/client/autocomplete.css |
||||
app/katex/katex.min.css |
||||
app/emoji-emojione/client/*.css |
||||
|
||||
@ -0,0 +1,6 @@ |
||||
import { APIClass } from '.'; |
||||
|
||||
export declare const API: { |
||||
v1: APIClass; |
||||
default: APIClass; |
||||
}; |
||||
@ -0,0 +1,28 @@ |
||||
import { getInstanceConnection } from '../../../../server/stream/streamBroadcast'; |
||||
import { hasPermission } from '../../../authorization/server'; |
||||
import { API } from '../api'; |
||||
import InstanceStatus from '../../../models/server/models/InstanceStatus'; |
||||
import { IInstanceStatus } from '../../../../definition/IInstanceStatus'; |
||||
|
||||
API.v1.addRoute('instances.get', { authRequired: true }, { |
||||
get() { |
||||
if (!hasPermission(this.userId, 'view-statistics')) { |
||||
return API.v1.unauthorized(); |
||||
} |
||||
|
||||
const instances = InstanceStatus.find().fetch(); |
||||
|
||||
return API.v1.success({ |
||||
instances: instances.map((instance: IInstanceStatus) => { |
||||
const connection = getInstanceConnection(instance); |
||||
if (connection) { |
||||
delete connection.instanceRecord; |
||||
} |
||||
return { |
||||
...instance, |
||||
connection, |
||||
}; |
||||
}), |
||||
}); |
||||
}, |
||||
}); |
||||
@ -1,432 +0,0 @@ |
||||
.rc-apps-section, |
||||
.rc-apps-marketplace { |
||||
display: flex; |
||||
|
||||
overflow: auto; |
||||
flex-direction: column; |
||||
|
||||
height: 100vh; |
||||
|
||||
padding: 1.25rem 2rem; |
||||
|
||||
font-size: 14px; |
||||
|
||||
&.page-settings .rc-apps-container { |
||||
a { |
||||
color: var(--rc-color-button-primary); |
||||
|
||||
font-weight: 500; |
||||
} |
||||
} |
||||
|
||||
h1 { |
||||
margin-bottom: 0; |
||||
|
||||
letter-spacing: 0; |
||||
text-transform: initial; |
||||
|
||||
color: var(--color-dark-medium); |
||||
|
||||
font-size: 22px; |
||||
font-weight: normal; |
||||
line-height: 28px; |
||||
} |
||||
|
||||
h2 { |
||||
margin-top: 10px; |
||||
margin-bottom: 0; |
||||
|
||||
letter-spacing: 0; |
||||
text-transform: initial; |
||||
|
||||
color: var(--color-dark); |
||||
|
||||
font-size: 16px; |
||||
font-weight: 500; |
||||
line-height: 24px; |
||||
} |
||||
|
||||
h3 { |
||||
margin-bottom: 0; |
||||
|
||||
text-align: left; |
||||
letter-spacing: 0; |
||||
text-transform: initial; |
||||
|
||||
color: var(--color-gray); |
||||
|
||||
font-size: 14px; |
||||
font-weight: 500; |
||||
line-height: 20px; |
||||
} |
||||
|
||||
.rc-apps-container { |
||||
margin-top: 0; |
||||
padding-bottom: 15px; |
||||
} |
||||
|
||||
.rc-apps-container__header { |
||||
padding-top: 10px; |
||||
|
||||
border-bottom: 1.5px solid var(--color-gray-lightest); |
||||
} |
||||
|
||||
/* |
||||
.js-install { |
||||
margin-top: 6px; |
||||
} */ |
||||
|
||||
.content { |
||||
/* display: block !important; */ |
||||
padding: 0 !important; |
||||
|
||||
> .rc-apps-container { |
||||
display: block; |
||||
overflow-y: scroll; |
||||
|
||||
padding: 0 !important; |
||||
} |
||||
|
||||
> .rc-apps-details { |
||||
display: block; |
||||
} |
||||
} |
||||
|
||||
.rc-apps-category { |
||||
margin-right: 8px; |
||||
padding: 8px; |
||||
|
||||
text-align: left; |
||||
letter-spacing: -0.17px; |
||||
text-transform: uppercase; |
||||
|
||||
color: #9da2a9; |
||||
border-radius: 2px; |
||||
background: var(--color-gray-lightest); |
||||
|
||||
font-size: 12px; |
||||
font-weight: 500; |
||||
} |
||||
|
||||
.app-enable-loading .loading-animation { |
||||
margin-left: 50px; |
||||
justify-content: left; |
||||
} |
||||
|
||||
.apps-error { |
||||
display: flex; |
||||
flex-direction: column; |
||||
|
||||
width: 100%; |
||||
height: calc(100% - 60px); |
||||
padding: 25px 40px; |
||||
|
||||
font-size: 45px; |
||||
align-items: center; |
||||
justify-content: center; |
||||
} |
||||
|
||||
.rc-table-avatar { |
||||
width: 40px; |
||||
height: 40px; |
||||
margin: 0 7px; |
||||
} |
||||
|
||||
.rc-table-info { |
||||
height: 40px; |
||||
margin: 0 7px; |
||||
} |
||||
|
||||
.rc-app-price { |
||||
position: relative; |
||||
top: -3px; |
||||
} |
||||
|
||||
.rc-table-td--medium { |
||||
width: 300px; |
||||
} |
||||
|
||||
.rc-table td { |
||||
padding: 0.5rem 0; |
||||
|
||||
padding-right: 10px; |
||||
} |
||||
|
||||
&__wrap-actions { |
||||
& > .loading { |
||||
display: none; |
||||
} |
||||
|
||||
&.loading { |
||||
& > .loading { |
||||
display: block; |
||||
|
||||
font-size: 11px; |
||||
font-weight: 600; |
||||
|
||||
& > .rc-icon--loading { |
||||
animation: spin 1s linear infinite; |
||||
} |
||||
} |
||||
|
||||
& > .apps-installer { |
||||
display: none; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.arrow-up { |
||||
transform: rotate(180deg); |
||||
} |
||||
|
||||
&.page-settings .content .rocket-form .section { |
||||
padding: 0 2.5em; |
||||
|
||||
border-bottom: none; |
||||
|
||||
&:hover { |
||||
background-color: var(--rc-color-primary-lightest); |
||||
} |
||||
} |
||||
|
||||
.rc-table-content { |
||||
display: flex; |
||||
overflow-x: auto; |
||||
flex-direction: column; |
||||
flex: 1 1 100%; |
||||
|
||||
height: 100vh; |
||||
|
||||
margin-top: 20px; |
||||
|
||||
& .rc-form-filters { |
||||
margin: 8px 0; |
||||
} |
||||
|
||||
& .js-sort { |
||||
cursor: pointer; |
||||
|
||||
&.is-sorting .table-fake-th .rc-icon { |
||||
opacity: 1; |
||||
} |
||||
} |
||||
|
||||
& .table-fake-th { |
||||
&:hover .rc-icon { |
||||
opacity: 1; |
||||
} |
||||
|
||||
& .rc-icon { |
||||
transition: opacity 0.3s; |
||||
|
||||
opacity: 0; |
||||
|
||||
font-size: 1rem; |
||||
} |
||||
} |
||||
|
||||
& tbody .rc-table-tr .rc-apps-section__app-menu-trigger { |
||||
visibility: hidden; |
||||
} |
||||
|
||||
& tbody .rc-table-tr:hover .rc-apps-section__app-menu-trigger { |
||||
visibility: visible; |
||||
} |
||||
|
||||
& tbody .rc-table-tr:not(.table-no-click):not(.table-no-pointer):hover { |
||||
background-color: #f7f8fa; |
||||
} |
||||
|
||||
& .rc-table-info { |
||||
margin: 0; |
||||
justify-content: center; |
||||
|
||||
& .rc-table-title, |
||||
& .rc-table-subtitle { |
||||
font-size: 0.875rem; |
||||
line-height: 1.25rem; |
||||
} |
||||
|
||||
& .rc-apps-categories { |
||||
display: flex; |
||||
|
||||
height: 1.25rem; |
||||
margin: 0 -0.25rem; |
||||
align-items: center; |
||||
flex-wrap: wrap; |
||||
|
||||
& .rc-apps-category { |
||||
overflow: hidden; |
||||
flex: 0 0 auto; |
||||
|
||||
box-sizing: border-box; |
||||
margin: 0.125rem 0.25rem; |
||||
padding: 0.0625rem 0.25rem; |
||||
|
||||
text-transform: none; |
||||
text-overflow: ellipsis; |
||||
|
||||
color: var(--color-gray); |
||||
background-color: var(--color-gray-lightest); |
||||
|
||||
font-size: 0.625rem; |
||||
font-weight: 500; |
||||
line-height: 0.875rem; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@media (width <= 700px) { |
||||
.rc-table-content { |
||||
& th:not(:first-child), |
||||
& td:not(:first-child) { |
||||
display: none; |
||||
} |
||||
} |
||||
} |
||||
|
||||
&__app-menu-trigger { |
||||
|
||||
position: relative; |
||||
|
||||
display: flex; |
||||
flex: 0 0 auto; |
||||
|
||||
margin-left: auto; |
||||
padding: 0; |
||||
|
||||
font-size: 0.875rem; |
||||
line-height: 1.25rem; |
||||
align-items: center; |
||||
appearance: none; |
||||
margin-inline-start: auto; |
||||
|
||||
&:active { |
||||
transform: translateY(2px); |
||||
|
||||
opacity: 0.9; |
||||
} |
||||
|
||||
&:active::before { |
||||
top: -2px; |
||||
} |
||||
|
||||
&::before { |
||||
position: absolute; |
||||
top: 0; |
||||
right: 0; |
||||
bottom: 0; |
||||
left: 0; |
||||
|
||||
content: ""; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
& .rc-icon { |
||||
margin: 0; |
||||
} |
||||
} |
||||
|
||||
&__spinning-icon { |
||||
animation: spin 1s linear infinite; |
||||
} |
||||
|
||||
&__button--working { |
||||
opacity: 0.6; |
||||
} |
||||
|
||||
&__status { |
||||
width: 100%; |
||||
|
||||
color: var(--rc-color-primary-light); |
||||
|
||||
line-height: 40px; |
||||
|
||||
&--warning { |
||||
color: var(--rc-color-alert); |
||||
} |
||||
|
||||
&--failed { |
||||
color: var(--rc-color-error); |
||||
} |
||||
} |
||||
|
||||
&__status-column { |
||||
width: 150px; |
||||
} |
||||
|
||||
tr .rc-apps-section__table-button--hideable { |
||||
visibility: hidden; |
||||
} |
||||
|
||||
tr .rc-apps-section__table-button--working, |
||||
tr:hover .rc-apps-section__table-button--hideable { |
||||
visibility: visible; |
||||
} |
||||
|
||||
.rc-apps-section__table-button--working { |
||||
opacity: 0.6; |
||||
} |
||||
} |
||||
|
||||
.rc-game { |
||||
&__list { |
||||
.rc-table-title { |
||||
width: 135px; |
||||
} |
||||
} |
||||
|
||||
&__container { |
||||
height: calc(100% - 79px); |
||||
} |
||||
|
||||
&__close { |
||||
position: absolute; |
||||
top: -30px; |
||||
right: -25px; |
||||
|
||||
cursor: pointer; |
||||
|
||||
color: #e9ebee; |
||||
|
||||
font-size: 20px; |
||||
|
||||
&:hover { |
||||
color: white; |
||||
} |
||||
} |
||||
|
||||
&__main { |
||||
min-width: 400px; |
||||
height: 100%; |
||||
} |
||||
} |
||||
|
||||
.rc-game-modal { |
||||
&__container { |
||||
margin: -14px -14px -18px; |
||||
} |
||||
|
||||
&__main { |
||||
min-height: 730px; |
||||
} |
||||
} |
||||
|
||||
.rc-icon.game-center__invite-players-icon.game-center__invite-players-icon--plus { |
||||
font-size: 18px; |
||||
|
||||
&:hover { |
||||
color: #1d74f5; |
||||
} |
||||
} |
||||
|
||||
@keyframes play90 { |
||||
0% { |
||||
right: -798px; |
||||
} |
||||
|
||||
100% { |
||||
right: 2px; |
||||
} |
||||
} |
||||
@ -1,31 +0,0 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { Tracker } from 'meteor/tracker'; |
||||
|
||||
import { APIClient } from '../../../utils/client'; |
||||
import { TabBar } from '../../../ui-utils/client'; |
||||
import { settings } from '../../../settings/client'; |
||||
|
||||
import './gameCenter.html'; |
||||
|
||||
Meteor.startup(function() { |
||||
Tracker.autorun(async function() { |
||||
if (!settings.get('Apps_Game_Center_enabled')) { |
||||
return TabBar.removeButton('gameCenter'); |
||||
} |
||||
|
||||
const { externalComponents } = await APIClient.get('apps/externalComponents'); |
||||
|
||||
if (!externalComponents.length) { |
||||
return TabBar.removeButton('gameCenter'); |
||||
} |
||||
|
||||
TabBar.addButton({ |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'gameCenter', |
||||
i18nTitle: 'Apps_Game_Center', |
||||
icon: 'game', |
||||
template: 'GameCenter', |
||||
order: -1, |
||||
}); |
||||
}); |
||||
}); |
||||
@ -0,0 +1,28 @@ |
||||
import { useMemo } from 'react'; |
||||
|
||||
import { useSetting } from '../../../../client/contexts/SettingsContext'; |
||||
import { addAction } from '../../../../client/views/room/lib/Toolbox'; |
||||
import { useEndpointData } from '../../../../client/hooks/useEndpointData'; |
||||
import { AsyncStatePhase } from '../../../../client/hooks/useAsyncState'; |
||||
|
||||
addAction('game-center', () => { |
||||
const enabled = useSetting('Apps_Game_Center_enabled'); |
||||
|
||||
const { value = { externalComponents: [] }, phase: state, error } = useEndpointData('/apps/externalComponents'); |
||||
|
||||
const hasExternalComponents = value && value.externalComponents.length > 0; |
||||
const hasError = !!error; |
||||
return useMemo(() => |
||||
(enabled |
||||
&& state === AsyncStatePhase.LOADING |
||||
&& !hasError |
||||
&& hasExternalComponents |
||||
? { |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'game-center', |
||||
title: 'Apps_Game_Center', |
||||
icon: 'game', |
||||
template: 'GameCenter', |
||||
order: -1, |
||||
} : null), [enabled, hasError, hasExternalComponents, state]); |
||||
}); |
||||
@ -1,76 +1,49 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { Random } from 'meteor/random'; |
||||
import { Tracker } from 'meteor/tracker'; |
||||
import s from 'underscore.string'; |
||||
import Autolinker from 'autolinker'; |
||||
|
||||
import { escapeRegExp } from '../../../lib/escapeRegExp'; |
||||
|
||||
export const createAutolinkerMessageRenderer = (config) => |
||||
(message) => { |
||||
if (!message.html?.trim()) { |
||||
return message; |
||||
} |
||||
|
||||
let msgParts; |
||||
let regexTokens; |
||||
if (message.tokens && message.tokens.length) { |
||||
regexTokens = new RegExp(`(${ (message.tokens || []).map(({ token }) => escapeRegExp(token)) })`, 'g'); |
||||
msgParts = message.html.split(regexTokens); |
||||
} else { |
||||
msgParts = [message.html]; |
||||
} |
||||
|
||||
message.html = msgParts |
||||
.map((msgPart) => { |
||||
if (regexTokens && regexTokens.test(msgPart)) { |
||||
return msgPart; |
||||
} |
||||
return Autolinker.link(msgPart, { |
||||
...config, |
||||
stripTrailingSlash: false, |
||||
replaceFn: (match) => { |
||||
const token = `=!=${ Random.id() }=!=`; |
||||
const tag = match.buildTag(); |
||||
|
||||
if (~match.matchedText.indexOf(Meteor.absoluteUrl())) { |
||||
tag.setAttr('target', ''); |
||||
} |
||||
|
||||
message.tokens = message.tokens ?? []; |
||||
message.tokens.push({ |
||||
token, |
||||
text: tag.toAnchorString(), |
||||
}); |
||||
return token; |
||||
} }); |
||||
}) |
||||
.join(''); |
||||
|
||||
import { settings } from '../../settings'; |
||||
import { callbacks } from '../../callbacks'; |
||||
import { escapeRegExp } from '../../../client/lib/escapeRegExp'; |
||||
|
||||
let config; |
||||
|
||||
Tracker.autorun(function() { |
||||
config = { |
||||
stripPrefix: settings.get('AutoLinker_StripPrefix'), |
||||
urls: { |
||||
schemeMatches: settings.get('AutoLinker_Urls_Scheme'), |
||||
wwwMatches: settings.get('AutoLinker_Urls_www'), |
||||
tldMatches: settings.get('AutoLinker_Urls_TLD'), |
||||
}, |
||||
email: settings.get('AutoLinker_Email'), |
||||
phone: settings.get('AutoLinker_Phone'), |
||||
twitter: false, |
||||
stripTrailingSlash: false, |
||||
}; |
||||
}); |
||||
|
||||
const renderMessage = (message) => { |
||||
if (!s.trim(message.html)) { |
||||
return message; |
||||
} |
||||
|
||||
let msgParts; |
||||
let regexTokens; |
||||
if (message.tokens && message.tokens.length) { |
||||
regexTokens = new RegExp(`(${ (message.tokens || []).map(({ token }) => escapeRegExp(token)) })`, 'g'); |
||||
msgParts = message.html.split(regexTokens); |
||||
} else { |
||||
msgParts = [message.html]; |
||||
} |
||||
|
||||
message.html = msgParts |
||||
.map((msgPart) => { |
||||
if (regexTokens && regexTokens.test(msgPart)) { |
||||
return msgPart; |
||||
} |
||||
return Autolinker.link(msgPart, { |
||||
...config, |
||||
replaceFn: (match) => { |
||||
const token = `=!=${ Random.id() }=!=`; |
||||
const tag = match.buildTag(); |
||||
|
||||
if (~match.matchedText.indexOf(Meteor.absoluteUrl())) { |
||||
tag.setAttr('target', ''); |
||||
} |
||||
|
||||
message.tokens.push({ |
||||
token, |
||||
text: tag.toAnchorString(), |
||||
}); |
||||
return token; |
||||
} }); |
||||
}) |
||||
.join(''); |
||||
|
||||
return message; |
||||
}; |
||||
|
||||
Tracker.autorun(function() { |
||||
if (settings.get('AutoLinker') !== true) { |
||||
return callbacks.remove('renderMessage', 'autolinker'); |
||||
} |
||||
|
||||
callbacks.add('renderMessage', renderMessage, callbacks.priority.MEDIUM, 'autolinker'); |
||||
}); |
||||
}; |
||||
|
||||
@ -1 +1 @@ |
||||
import './client'; |
||||
export { createAutolinkerMessageRenderer } from './client'; |
||||
|
||||
@ -1,4 +1,8 @@ |
||||
import './lib/actionButton'; |
||||
import './lib/tabBar'; |
||||
|
||||
export { AutoTranslate } from './lib/autotranslate'; |
||||
export { |
||||
AutoTranslate, |
||||
createAutoTranslateMessageRenderer, |
||||
createAutoTranslateMessageStreamHandler, |
||||
} from './lib/autotranslate'; |
||||
|
||||
@ -1,23 +0,0 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { Tracker } from 'meteor/tracker'; |
||||
|
||||
import { settings } from '../../../settings'; |
||||
import { hasAtLeastOnePermission } from '../../../authorization'; |
||||
import { TabBar } from '../../../ui-utils'; |
||||
|
||||
Meteor.startup(function() { |
||||
Tracker.autorun(function() { |
||||
if (settings.get('AutoTranslate_Enabled') && hasAtLeastOnePermission(['auto-translate'])) { |
||||
return TabBar.addButton({ |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'autotranslate', |
||||
i18nTitle: 'Auto_Translate', |
||||
icon: 'language', |
||||
template: 'AutoTranslate', |
||||
full: true, |
||||
order: 20, |
||||
}); |
||||
} |
||||
TabBar.removeButton('autotranslate'); |
||||
}); |
||||
}); |
||||
@ -0,0 +1,19 @@ |
||||
import { lazy, useMemo } from 'react'; |
||||
|
||||
import { addAction } from '../../../../client/views/room/lib/Toolbox'; |
||||
import { usePermission } from '../../../../client/contexts/AuthorizationContext'; |
||||
import { useSetting } from '../../../../client/contexts/SettingsContext'; |
||||
|
||||
addAction('autotranslate', () => { |
||||
const hasPermission = usePermission('auto-translate'); |
||||
const autoTranslateEnabled = useSetting('AutoTranslate_Enabled'); |
||||
return useMemo(() => (hasPermission && autoTranslateEnabled ? { |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'autotranslate', |
||||
title: 'Auto_Translate', |
||||
icon: 'language', |
||||
template: lazy(() => import('../../../../client/views/room/contextualBar/AutoTranslate')), |
||||
order: 20, |
||||
full: true, |
||||
} : null), [autoTranslateEnabled, hasPermission]); |
||||
}); |
||||
@ -1,9 +1,5 @@ |
||||
import './startup/messageTypes'; |
||||
import './startup/tabBar'; |
||||
import './startup/trackSettingsChange'; |
||||
import './views/channelSettings.html'; |
||||
import './views/channelSettings'; |
||||
import './views/Multiselect'; |
||||
import './stylesheets/channel-settings.css'; |
||||
|
||||
export { ChannelSettings } from './lib/ChannelSettings'; |
||||
|
||||
@ -1,16 +0,0 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
|
||||
import { TabBar } from '../../../ui-utils'; |
||||
|
||||
Meteor.startup(() => { |
||||
TabBar.addButton({ |
||||
groups: ['channel', 'group'], |
||||
id: 'channel-settings', |
||||
anonymous: true, |
||||
i18nTitle: 'Room_Info', |
||||
icon: 'info-circled', |
||||
template: 'channelSettings', |
||||
order: 7, |
||||
full: true, |
||||
}); |
||||
}); |
||||
@ -0,0 +1,14 @@ |
||||
import { FC, lazy, LazyExoticComponent } from 'react'; |
||||
|
||||
import { addAction } from '../../../../client/views/room/lib/Toolbox'; |
||||
|
||||
addAction('channel-settings', { |
||||
groups: ['channel', 'group'], |
||||
id: 'channel-settings', |
||||
anonymous: true, |
||||
full: true, |
||||
title: 'Room_Info', |
||||
icon: 'info-circled', |
||||
template: lazy(() => import('../../../../client/views/room/contextualBar/Info')) as LazyExoticComponent<FC>, |
||||
order: 7, |
||||
}); |
||||
@ -1,48 +0,0 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { Tracker } from 'meteor/tracker'; |
||||
import { FlowRouter } from 'meteor/kadira:flow-router'; |
||||
import { Session } from 'meteor/session'; |
||||
|
||||
import { callbacks } from '../../../callbacks'; |
||||
import { RoomManager } from '../../../ui-utils'; |
||||
import { roomTypes } from '../../../utils'; |
||||
import { ChatRoom, ChatSubscription } from '../../../models'; |
||||
|
||||
Meteor.startup(function() { |
||||
const roomSettingsChangedCallback = (msg) => { |
||||
Tracker.nonreactive(() => { |
||||
if (msg.t === 'room_changed_privacy') { |
||||
if (Session.get('openedRoom') === msg.rid) { |
||||
const type = FlowRouter.current().route.name === 'channel' ? 'c' : 'p'; |
||||
RoomManager.close(type + FlowRouter.getParam('name')); |
||||
|
||||
const subscription = ChatSubscription.findOne({ rid: msg.rid }); |
||||
const route = subscription.t === 'c' ? 'channel' : 'group'; |
||||
FlowRouter.go(route, { name: subscription.name }, FlowRouter.current().queryParams); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
return msg; |
||||
}; |
||||
|
||||
callbacks.add('streamMessage', roomSettingsChangedCallback, callbacks.priority.HIGH, 'room-settings-changed'); |
||||
|
||||
const roomNameChangedCallback = (msg) => { |
||||
Tracker.nonreactive(() => { |
||||
if (msg.t === 'r') { |
||||
if (Session.get('openedRoom') === msg.rid) { |
||||
const room = ChatRoom.findOne(msg.rid); |
||||
if (room.name !== FlowRouter.getParam('name')) { |
||||
RoomManager.close(room.t + FlowRouter.getParam('name')); |
||||
roomTypes.openRouteLink(room.t, room, FlowRouter.current().queryParams); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
|
||||
return msg; |
||||
}; |
||||
|
||||
callbacks.add('streamMessage', roomNameChangedCallback, callbacks.priority.HIGH, 'room-name-changed'); |
||||
}); |
||||
@ -1,133 +0,0 @@ |
||||
.rtl .flex-tab { |
||||
direction: rtl; |
||||
|
||||
& .channel-settings { |
||||
& .editing { |
||||
padding-right: 8px; |
||||
padding-left: 80px; |
||||
} |
||||
|
||||
& .buttons { |
||||
right: auto; |
||||
left: 1px; |
||||
|
||||
border-radius: 4px 0 0 4px; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.flex-tab { |
||||
& .channel-settings { |
||||
& ul { |
||||
& li { |
||||
margin-bottom: 20px; |
||||
} |
||||
} |
||||
|
||||
& label { |
||||
display: block; |
||||
|
||||
margin-bottom: 5px; |
||||
|
||||
font-size: 14px; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
& .current-setting { |
||||
display: inline-block; |
||||
|
||||
width: calc(100% - 38px); |
||||
min-height: 20px; |
||||
margin-top: 3px; |
||||
|
||||
cursor: pointer; |
||||
vertical-align: middle; |
||||
word-wrap: break-word; |
||||
|
||||
font-size: 14px; |
||||
|
||||
&[data-edit="false"] { |
||||
cursor: inherit; |
||||
user-select: initial; |
||||
} |
||||
} |
||||
|
||||
& .editing { |
||||
padding-right: 80px; |
||||
|
||||
font-size: 14px; |
||||
} |
||||
|
||||
& .buttons { |
||||
position: absolute; |
||||
top: -1px; |
||||
right: 10px; |
||||
|
||||
border-radius: 0 4px 4px 0; |
||||
|
||||
& .button { |
||||
padding: 8px; |
||||
} |
||||
} |
||||
|
||||
& .button { |
||||
display: inline-block; |
||||
visibility: hidden; |
||||
|
||||
padding: 8px; |
||||
|
||||
vertical-align: middle; |
||||
|
||||
font-size: 12px; |
||||
} |
||||
|
||||
& .submit { |
||||
margin-top: 30px; |
||||
|
||||
text-align: center; |
||||
} |
||||
|
||||
& .boolean { |
||||
font-size: 0; |
||||
|
||||
& > label { |
||||
display: inline-block; |
||||
|
||||
width: calc(100% - 45px); |
||||
|
||||
vertical-align: middle; |
||||
} |
||||
|
||||
& .setting-block { |
||||
display: inline-block; |
||||
|
||||
width: 40px; |
||||
margin-left: -5px; |
||||
|
||||
vertical-align: middle; |
||||
} |
||||
} |
||||
|
||||
& .setting-block { |
||||
position: relative; |
||||
|
||||
display: flex; |
||||
|
||||
font-size: 0; |
||||
|
||||
& .loading-animation { |
||||
top: 30px; |
||||
} |
||||
|
||||
&:hover { |
||||
& .button { |
||||
visibility: visible; |
||||
} |
||||
} |
||||
} |
||||
|
||||
& nav { |
||||
text-align: right; |
||||
} |
||||
} |
||||
} |
||||
@ -1,7 +0,0 @@ |
||||
<template name="channelSettings"> |
||||
{{#if editing}} |
||||
{{> channelSettingsEditing channelData }} |
||||
{{else}} |
||||
{{> channelSettingsInfo channelData }} |
||||
{{/if}} |
||||
</template> |
||||
@ -1,32 +0,0 @@ |
||||
import { HTML } from 'meteor/htmljs'; |
||||
import { ReactiveVar } from 'meteor/reactive-var'; |
||||
import { Template } from 'meteor/templating'; |
||||
|
||||
import { ChatRoom } from '../../../models'; |
||||
import { createTemplateForComponent } from '../../../../client/reactAdapters'; |
||||
|
||||
createTemplateForComponent('channelSettingsEditing', () => import('../../../../client/channel/ChannelInfo/EditChannel'), { |
||||
renderContainerView: () => HTML.DIV({ class: 'contextual-bar' }), // eslint-disable-line new-cap
|
||||
}); |
||||
|
||||
createTemplateForComponent('channelSettingsInfo', () => import('../../../../client/channel/ChannelInfo/RoomInfo'), { |
||||
renderContainerView: () => HTML.DIV({ class: 'contextual-bar' }), // eslint-disable-line new-cap
|
||||
}); |
||||
|
||||
Template.channelSettings.helpers({ |
||||
channelData() { |
||||
const { editing } = Template.instance(); |
||||
return { |
||||
...Template.currentData(), |
||||
openEditing: () => editing.set(true), |
||||
}; |
||||
}, |
||||
editing() { |
||||
return Template.instance().editing.get(); |
||||
}, |
||||
}); |
||||
|
||||
Template.channelSettings.onCreated(function() { |
||||
this.room = ChatRoom.findOne(this.data && this.data.rid); |
||||
this.editing = new ReactiveVar(false); |
||||
}); |
||||
@ -1,24 +1,13 @@ |
||||
import s from 'underscore.string'; |
||||
|
||||
import { settings } from '../../settings'; |
||||
import { callbacks } from '../../callbacks'; |
||||
import './style.css'; |
||||
|
||||
//
|
||||
// HexColorPreview is a named function that will process Colors
|
||||
// @param {Object} message - The message object
|
||||
//
|
||||
export const createHexColorPreviewMessageRenderer = () => |
||||
(message) => { |
||||
if (!message.html?.trim()) { |
||||
return message; |
||||
} |
||||
|
||||
function HexColorPreview(message) { |
||||
let msg; |
||||
if (s.trim(message.html) && settings.get('HexColorPreview_Enabled')) { |
||||
msg = message.html; |
||||
msg = msg.replace(/(?:^|\s|\n)(#[A-Fa-f0-9]{3}([A-Fa-f0-9]{3})?)\b/g, function(match, completeColor) { |
||||
return match.replace(completeColor, `<div class="message-color"><div class="message-color-sample" style="background-color:${ completeColor }"></div>${ completeColor.toUpperCase() }</div>`); |
||||
}); |
||||
message.html = msg; |
||||
} |
||||
return message; |
||||
} |
||||
const regex = /(?:^|\s|\n)(#[A-Fa-f0-9]{3}([A-Fa-f0-9]{3})?)\b/g; |
||||
|
||||
callbacks.add('renderMessage', HexColorPreview, callbacks.priority.MEDIUM, 'hexcolor'); |
||||
message.html = message.html.replace(regex, (match, completeColor) => match.replace(completeColor, `<div class="message-color"><div class="message-color-sample" style="background-color:${ completeColor }"></div>${ completeColor.toUpperCase() }</div>`)); |
||||
return message; |
||||
}; |
||||
|
||||
@ -1 +1 @@ |
||||
import './client'; |
||||
export { createHexColorPreviewMessageRenderer } from './client'; |
||||
|
||||
@ -1,17 +0,0 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
|
||||
import { TabBar } from '../../ui-utils/client'; |
||||
import { settings } from '../../settings'; |
||||
|
||||
Meteor.startup(function() { |
||||
return TabBar.addButton({ |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'discussions', |
||||
i18nTitle: 'Discussions', |
||||
icon: 'discussion', |
||||
template: 'discussionsTabbar', |
||||
full: true, |
||||
order: 1, |
||||
condition: () => settings.get('Discussion_enabled'), |
||||
}); |
||||
}); |
||||
@ -0,0 +1,18 @@ |
||||
import { useMemo, lazy, LazyExoticComponent, FC } from 'react'; |
||||
|
||||
import { addAction } from '../../../client/views/room/lib/Toolbox'; |
||||
import { useSetting } from '../../../client/contexts/SettingsContext'; |
||||
|
||||
addAction('discussions', () => { |
||||
const discussionEnabled = useSetting('Discussion_enabled'); |
||||
|
||||
return useMemo(() => (discussionEnabled ? { |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'discussions', |
||||
title: 'Discussions', |
||||
icon: 'discussion', |
||||
template: lazy(() => import('../../../client/views/room/contextualBar/Discussions')) as LazyExoticComponent<FC>, |
||||
full: true, |
||||
order: 1, |
||||
} : null), [discussionEnabled]); |
||||
}); |
||||
@ -1,11 +0,0 @@ |
||||
import { Template } from 'meteor/templating'; |
||||
|
||||
import './DiscussionTabbar.html'; |
||||
|
||||
Template.discussionsTabbar.helpers({ |
||||
close() { |
||||
const { data } = Template.instance(); |
||||
const { tabBar } = data; |
||||
return () => tabBar.close(); |
||||
}, |
||||
}); |
||||
@ -1,37 +0,0 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { Session } from 'meteor/session'; |
||||
import { Tracker } from 'meteor/tracker'; |
||||
|
||||
import { hasAllPermission } from '../../authorization'; |
||||
import { call, TabBar } from '../../ui-utils'; |
||||
import { ChatRoom } from '../../models'; |
||||
import { settings } from '../../settings'; |
||||
|
||||
Meteor.startup(() => { |
||||
Tracker.autorun(() => { |
||||
if (settings.get('E2E_Enable')) { |
||||
TabBar.addButton({ |
||||
groups: ['direct', 'group'], |
||||
id: 'e2e', |
||||
i18nTitle: 'E2E', |
||||
icon: 'key', |
||||
class: () => (ChatRoom.findOne(Session.get('openedRoom')) || {}).encrypted && 'enabled', |
||||
action: () => { |
||||
const room = ChatRoom.findOne(Session.get('openedRoom')); |
||||
call('saveRoomSettings', room._id, 'encrypted', !room.encrypted); |
||||
}, |
||||
order: 13, |
||||
condition: () => { |
||||
const session = Session.get('openedRoom'); |
||||
const room = ChatRoom.findOne(session); |
||||
if (room && room.t === 'd') { |
||||
return true; |
||||
} |
||||
return hasAllPermission('edit-room', session); |
||||
}, |
||||
}); |
||||
} else { |
||||
TabBar.removeButton('e2e'); |
||||
} |
||||
}); |
||||
}); |
||||
@ -0,0 +1,28 @@ |
||||
import { useMemo } from 'react'; |
||||
import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; |
||||
|
||||
import { addAction } from '../../../client/views/room/lib/Toolbox'; |
||||
import { useSetting } from '../../../client/contexts/SettingsContext'; |
||||
import { usePermission } from '../../../client/contexts/AuthorizationContext'; |
||||
import { useMethod } from '../../../client/contexts/ServerContext'; |
||||
|
||||
addAction('e2e', ({ room }) => { |
||||
const e2eEnabled = useSetting('E2E_Enable'); |
||||
const hasPermission = usePermission('edit-room', room._id); |
||||
const toggleE2E = useMethod('saveRoomSettings'); |
||||
|
||||
const action = useMutableCallback(() => { |
||||
toggleE2E(room._id, 'encrypted', !room.encrypted); |
||||
}); |
||||
|
||||
const enabledOnRoom = !!room.encrypted; |
||||
|
||||
return useMemo(() => (e2eEnabled && hasPermission ? { |
||||
groups: ['direct', 'group'], |
||||
id: 'e2e', |
||||
title: enabledOnRoom ? 'E2E_disable' : 'E2E_enable', |
||||
icon: 'key', |
||||
order: 13, |
||||
action, |
||||
} : null), [action, e2eEnabled, enabledOnRoom, hasPermission]); |
||||
}); |
||||
@ -1,10 +1,4 @@ |
||||
import './emojiParser'; |
||||
import { EmojiPicker } from './lib/EmojiPicker'; |
||||
import { renderEmoji } from './lib/emojiRenderer'; |
||||
import { emoji } from '../lib/rocketchat'; |
||||
|
||||
export { |
||||
renderEmoji, |
||||
emoji, |
||||
EmojiPicker, |
||||
}; |
||||
export { EmojiPicker } from './lib/EmojiPicker'; |
||||
export { renderEmoji } from './lib/emojiRenderer'; |
||||
export { emoji } from '../lib/rocketchat'; |
||||
export { createEmojiMessageRenderer } from './emojiParser'; |
||||
|
||||
@ -1,90 +1,70 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { Tracker } from 'meteor/tracker'; |
||||
|
||||
import { settings } from '../../settings'; |
||||
import { callbacks } from '../../callbacks'; |
||||
const getVisionAttributes = (attachment) => { |
||||
const attributes = {}; |
||||
const labels = []; |
||||
if (attachment.labels && attachment.labels.length > 0) { |
||||
attachment.labels.forEach((label) => { |
||||
labels.push({ label }); |
||||
}); |
||||
} |
||||
if (attachment.safeSearch && attachment.safeSearch && attachment.safeSearch.adult === true) { |
||||
labels.push({ label: 'NSFW', bgColor: 'red', fontColor: 'white' }); |
||||
} |
||||
if (attachment.safeSearch && attachment.safeSearch.violence === true) { |
||||
labels.push({ label: 'Violence', bgColor: 'red', fontColor: 'white' }); |
||||
} |
||||
if (attachment.colors && attachment.colors.length > 0) { |
||||
attributes.color = `#${ attachment.colors[0] }`; |
||||
} |
||||
if (attachment.logos && attachment.logos.length > 0) { |
||||
labels.push({ label: `Logo: ${ attachment.logos[0] }` }); |
||||
} |
||||
if (attachment.faces && attachment.faces.length > 0) { |
||||
let faceCount = 0; |
||||
attachment.faces.forEach((face) => { |
||||
const faceAttributes = []; |
||||
if (face.joy) { |
||||
faceAttributes.push('Joy'); |
||||
} |
||||
if (face.sorrow) { |
||||
faceAttributes.push('Sorrow'); |
||||
} |
||||
if (face.anger) { |
||||
faceAttributes.push('Anger'); |
||||
} |
||||
if (face.surprise) { |
||||
faceAttributes.push('Surprise'); |
||||
} |
||||
if (faceAttributes.length > 0) { |
||||
labels.push({ label: `Face ${ ++faceCount }: ${ faceAttributes.join(', ') }` }); |
||||
} |
||||
}); |
||||
} |
||||
if (labels.length > 0) { |
||||
attributes.labels = labels; |
||||
} |
||||
return attributes; |
||||
}; |
||||
|
||||
const GoogleVision = { |
||||
getVisionAttributes(attachment) { |
||||
const attributes = {}; |
||||
const labels = []; |
||||
if (attachment.labels && attachment.labels.length > 0) { |
||||
attachment.labels.forEach((label) => { |
||||
labels.push({ label }); |
||||
}); |
||||
} |
||||
if (attachment.safeSearch && attachment.safeSearch && attachment.safeSearch.adult === true) { |
||||
labels.push({ label: 'NSFW', bgColor: 'red', fontColor: 'white' }); |
||||
} |
||||
if (attachment.safeSearch && attachment.safeSearch.violence === true) { |
||||
labels.push({ label: 'Violence', bgColor: 'red', fontColor: 'white' }); |
||||
export const createGoogleVisionMessageRenderer = () => |
||||
(message) => { |
||||
if (!message.attachments?.length) { |
||||
return message; |
||||
} |
||||
if (attachment.colors && attachment.colors.length > 0) { |
||||
attributes.color = `#${ attachment.colors[0] }`; |
||||
} |
||||
if (attachment.logos && attachment.logos.length > 0) { |
||||
labels.push({ label: `Logo: ${ attachment.logos[0] }` }); |
||||
} |
||||
if (attachment.faces && attachment.faces.length > 0) { |
||||
let faceCount = 0; |
||||
attachment.faces.forEach((face) => { |
||||
const faceAttributes = []; |
||||
if (face.joy) { |
||||
faceAttributes.push('Joy'); |
||||
} |
||||
if (face.sorrow) { |
||||
faceAttributes.push('Sorrow'); |
||||
} |
||||
if (face.anger) { |
||||
faceAttributes.push('Anger'); |
||||
} |
||||
if (face.surprise) { |
||||
faceAttributes.push('Surprise'); |
||||
} |
||||
if (faceAttributes.length > 0) { |
||||
labels.push({ label: `Face ${ ++faceCount }: ${ faceAttributes.join(', ') }` }); |
||||
} |
||||
}); |
||||
} |
||||
if (labels.length > 0) { |
||||
attributes.labels = labels; |
||||
} |
||||
return attributes; |
||||
}, |
||||
|
||||
init() { |
||||
Tracker.autorun(() => { |
||||
if (settings.get('GoogleVision_Enable')) { |
||||
callbacks.add('renderMessage', (message) => { |
||||
if (message.attachments && message.attachments.length > 0) { |
||||
for (const index in message.attachments) { |
||||
if (message.attachments.hasOwnProperty(index)) { |
||||
const attachment = message.attachments[index]; |
||||
message.attachments[index] = Object.assign(message.attachments[index], this.getVisionAttributes(attachment)); |
||||
} |
||||
} |
||||
} |
||||
return message; |
||||
}, callbacks.priority.HIGH - 3, 'googlevision'); |
||||
message.attachments = message.attachments.map((attachment) => |
||||
Object.assign(attachment, getVisionAttributes(attachment))); |
||||
|
||||
callbacks.add('streamMessage', (message) => { |
||||
if (message.attachments && message.attachments.length > 0) { |
||||
for (const index in message.attachments) { |
||||
if (message.attachments.hasOwnProperty(index)) { |
||||
const attachment = message.attachments[index]; |
||||
message.attachments[index] = Object.assign(message.attachments[index], this.getVisionAttributes(attachment)); |
||||
} |
||||
} |
||||
} |
||||
}, callbacks.priority.HIGH - 3, 'googlevision-stream'); |
||||
} else { |
||||
callbacks.remove('renderMessage', 'googlevision'); |
||||
callbacks.remove('streamMessage', 'googlevision-stream'); |
||||
} |
||||
}); |
||||
}, |
||||
}; |
||||
return message; |
||||
}; |
||||
|
||||
export const createGoogleVisionMessageStreamHandler = () => |
||||
(message) => { |
||||
if (!message.attachments?.length) { |
||||
return message; |
||||
} |
||||
|
||||
message.attachments = message.attachments.map((attachment) => |
||||
Object.assign(attachment, getVisionAttributes(attachment))); |
||||
|
||||
Meteor.startup(function() { |
||||
GoogleVision.init(); |
||||
}); |
||||
return message; |
||||
}; |
||||
|
||||
@ -1 +1,4 @@ |
||||
import './googlevision'; |
||||
export { |
||||
createGoogleVisionMessageRenderer, |
||||
createGoogleVisionMessageStreamHandler, |
||||
} from './googlevision'; |
||||
|
||||
@ -1,39 +1,18 @@ |
||||
/* |
||||
* Highlights is a named function that will process Highlights |
||||
* @param {Object} message - The message object |
||||
*/ |
||||
import _ from 'underscore'; |
||||
import s from 'underscore.string'; |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { Tracker } from 'meteor/tracker'; |
||||
|
||||
import { highlightWords, getRegexHighlight, getRegexHighlightUrl } from './helper'; |
||||
import { callbacks } from '../../callbacks'; |
||||
import { getUserPreference } from '../../utils'; |
||||
|
||||
Tracker.autorun(() => { |
||||
const toHighlight = (getUserPreference(Meteor.userId(), 'highlights') || []).filter((highlight) => !s.isBlank(highlight)).map((highlight) => ({ |
||||
export const createHighlightWordsMessageRenderer = ({ wordsToHighlight }) => { |
||||
const highlights = wordsToHighlight.map((highlight) => ({ |
||||
highlight, |
||||
regex: getRegexHighlight(highlight), |
||||
urlRegex: getRegexHighlightUrl(highlight), |
||||
})); |
||||
|
||||
if (!toHighlight.length) { |
||||
return callbacks.remove('renderMessage', 'highlight-words'); |
||||
} |
||||
|
||||
function HighlightWordsClient(message) { |
||||
let msg = message; |
||||
|
||||
if (!_.isString(message)) { |
||||
if (!s.trim(message.html)) { |
||||
return message; |
||||
} |
||||
msg = message.html; |
||||
return (message) => { |
||||
if (!message.html?.trim()) { |
||||
return message; |
||||
} |
||||
|
||||
message.html = highlightWords(msg, toHighlight); |
||||
message.html = highlightWords(message.html, highlights); |
||||
return message; |
||||
} |
||||
callbacks.add('renderMessage', HighlightWordsClient, callbacks.priority.MEDIUM + 1, 'highlight-words'); |
||||
}); |
||||
}; |
||||
}; |
||||
|
||||
@ -1 +1 @@ |
||||
import './client'; |
||||
export { createHighlightWordsMessageRenderer } from './client'; |
||||
|
||||
@ -1,21 +1,12 @@ |
||||
import s from 'underscore.string'; |
||||
|
||||
import { settings } from '../../settings'; |
||||
import { callbacks } from '../../callbacks'; |
||||
export const createIssueLinksMessageRenderer = ({ template }) => (message) => { |
||||
if (!message.html?.trim()) { |
||||
return message; |
||||
} |
||||
|
||||
//
|
||||
// IssueLink is a named function that will add issue links
|
||||
// @param {Object} message - The message object
|
||||
//
|
||||
message.html = message.html.replace(/(?:^|\s|\n)(#[0-9]+)\b/g, (match, issueNumber) => { |
||||
const url = template.replace('%s', issueNumber.substring(1)); |
||||
return match.replace(issueNumber, `<a href="${ url }" target="_blank">${ issueNumber }</a>`); |
||||
}); |
||||
|
||||
function IssueLink(message) { |
||||
if (s.trim(message.html) && settings.get('IssueLinks_Enabled')) { |
||||
message.html = message.html.replace(/(?:^|\s|\n)(#[0-9]+)\b/g, function(match, issueNumber) { |
||||
const url = settings.get('IssueLinks_Template').replace('%s', issueNumber.substring(1)); |
||||
return match.replace(issueNumber, `<a href="${ url }" target="_blank">${ issueNumber }</a>`); |
||||
}); |
||||
} |
||||
return message; |
||||
} |
||||
|
||||
callbacks.add('renderMessage', IssueLink, callbacks.priority.MEDIUM, 'issuelink'); |
||||
}; |
||||
|
||||
@ -1 +1 @@ |
||||
import './client'; |
||||
export { createIssueLinksMessageRenderer } from './client'; |
||||
|
||||
@ -1,5 +0,0 @@ |
||||
{ |
||||
"globals": { |
||||
"Npm" : false |
||||
} |
||||
} |
||||
@ -1 +0,0 @@ |
||||
../../node_modules/katex/dist/katex.min.css |
||||
@ -1,10 +0,0 @@ |
||||
import { settings } from '../../settings'; |
||||
|
||||
|
||||
export default { |
||||
isEnabled: () => settings.get('Katex_Enabled'), |
||||
|
||||
isDollarSyntaxEnabled: () => settings.get('Katex_Dollar_Syntax'), |
||||
|
||||
isParenthesisSyntaxEnabled: () => settings.get('Katex_Parenthesis_Syntax'), |
||||
}; |
||||
@ -1,89 +0,0 @@ |
||||
import { Session } from 'meteor/session'; |
||||
|
||||
import { TabBar } from '../../ui-utils'; |
||||
import { Rooms } from '../../models'; |
||||
import { hasAllPermission } from '../../authorization'; |
||||
import { roomTypes } from '../../utils/client'; |
||||
|
||||
TabBar.addButton({ |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'rocket-search', |
||||
i18nTitle: 'Search_Messages', |
||||
icon: 'magnifier', |
||||
template: 'RocketSearch', |
||||
order: 4, |
||||
}); |
||||
|
||||
TabBar.addButton({ |
||||
groups: ['direct'], |
||||
id: 'user-info', |
||||
i18nTitle: 'User_Info', |
||||
icon: 'user', |
||||
template: 'membersList', |
||||
order: 5, |
||||
condition() { |
||||
const rid = Session.get('openedRoom'); |
||||
const room = Rooms.findOne({ |
||||
_id: rid, |
||||
}); |
||||
|
||||
return room && !roomTypes.getConfig(room.t).isGroupChat(room); |
||||
}, |
||||
}); |
||||
|
||||
TabBar.addButton({ |
||||
groups: ['direct'], |
||||
id: 'user-info-group', |
||||
i18nTitle: 'Members', |
||||
icon: 'team', |
||||
template: 'membersList', |
||||
order: 5, |
||||
condition() { |
||||
const rid = Session.get('openedRoom'); |
||||
const room = Rooms.findOne({ |
||||
_id: rid, |
||||
}); |
||||
|
||||
return room && roomTypes.getConfig(room.t).isGroupChat(room); |
||||
}, |
||||
}); |
||||
|
||||
TabBar.addButton({ |
||||
groups: ['channel', 'group'], |
||||
id: 'members-list', |
||||
i18nTitle: 'Members', |
||||
icon: 'team', |
||||
template: 'membersList', |
||||
order: 5, |
||||
condition() { |
||||
const rid = Session.get('openedRoom'); |
||||
const room = Rooms.findOne({ |
||||
_id: rid, |
||||
}); |
||||
|
||||
if (!room || !room.broadcast) { |
||||
return true; |
||||
} |
||||
|
||||
return hasAllPermission('view-broadcast-member-list', rid); |
||||
}, |
||||
}); |
||||
|
||||
TabBar.addButton({ |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'uploaded-files-list', |
||||
i18nTitle: 'Files', |
||||
icon: 'clip', |
||||
template: 'uploadedFilesList', |
||||
order: 6, |
||||
}); |
||||
|
||||
TabBar.addButton({ |
||||
groups: ['channel', 'group', 'direct'], |
||||
id: 'keyboard-shortcut-list', |
||||
i18nTitle: 'Keyboard_Shortcuts_Title', |
||||
icon: 'keyboard', |
||||
template: 'KeyboardShortcuts', |
||||
full: true, |
||||
order: 99, |
||||
}); |
||||
@ -1,6 +1,8 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import s from 'underscore.string'; |
||||
|
||||
import { escapeRegExp } from '../../../../lib/escapeRegExp'; |
||||
|
||||
export const checkEmailAvailability = function(email) { |
||||
return !Meteor.users.findOne({ 'emails.address': { $regex: new RegExp(`^${ s.trim(s.escapeRegExp(email)) }$`, 'i') } }); |
||||
return !Meteor.users.findOne({ 'emails.address': { $regex: new RegExp(`^${ s.trim(escapeRegExp(email)) }$`, 'i') } }); |
||||
}; |
||||
|
||||
@ -1,23 +0,0 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { Tracker } from 'meteor/tracker'; |
||||
|
||||
import { TabBar } from '../../../ui-utils/client'; |
||||
import { settings } from '../../../settings/client'; |
||||
|
||||
|
||||
Meteor.startup(function() { |
||||
Tracker.autorun(function() { |
||||
if (!settings.get('Omnichannel_External_Frame_Enabled')) { |
||||
return TabBar.removeButton('omnichannelExternalFrame'); |
||||
} |
||||
|
||||
TabBar.addButton({ |
||||
groups: ['live'], |
||||
id: 'omnichannelExternalFrame', |
||||
i18nTitle: 'Omnichannel_External_Frame', |
||||
icon: 'cube', |
||||
template: 'ExternalFrameContainer', |
||||
order: -1, |
||||
}); |
||||
}); |
||||
}); |
||||
@ -0,0 +1,18 @@ |
||||
import { useMemo } from 'react'; |
||||
|
||||
import { useSetting } from '../../../../client/contexts/SettingsContext'; |
||||
import { addAction } from '../../../../client/views/room/lib/Toolbox'; |
||||
|
||||
addAction('omnichannel-external-frame', () => { |
||||
const enabled = useSetting('Omnichannel_External_Frame_Enabled'); |
||||
|
||||
return useMemo(() => (enabled |
||||
? { |
||||
groups: ['live'], |
||||
id: 'omnichannel-external-frame', |
||||
title: 'Omnichannel_External_Frame', |
||||
icon: 'cube', |
||||
template: 'ExternalFrameContainer', |
||||
order: -1, |
||||
} : null), [enabled]); |
||||
}); |
||||
@ -1,29 +0,0 @@ |
||||
import { callbacks } from '../../../callbacks'; |
||||
|
||||
callbacks.add('onCreateRoomTabBar', (info) => { |
||||
const { tabBar, room } = info; |
||||
|
||||
if (!tabBar) { |
||||
return info; |
||||
} |
||||
|
||||
if (!room || !room.t || room.t !== 'l') { |
||||
return info; |
||||
} |
||||
|
||||
const button = tabBar.getButtons().find((button) => button.id === 'visitor-info'); |
||||
if (!button) { |
||||
return info; |
||||
} |
||||
|
||||
const { template, i18nTitle: label, icon } = button; |
||||
tabBar.setTemplate(template); |
||||
tabBar.setData({ |
||||
label, |
||||
icon, |
||||
}); |
||||
|
||||
tabBar.open(); |
||||
|
||||
return info; |
||||
}); |
||||
@ -0,0 +1,19 @@ |
||||
import { addAction } from '../../../client/views/room/lib/Toolbox'; |
||||
|
||||
addAction('visitor-info', { |
||||
groups: ['live'], |
||||
id: 'visitor-info', |
||||
title: 'Visitor_Info', |
||||
icon: 'info-circled', |
||||
template: 'visitorInfo', |
||||
order: 0, |
||||
}); |
||||
|
||||
addAction('contact-chat-history', { |
||||
groups: ['live'], |
||||
id: 'contact-chat-history', |
||||
title: 'Contact_Chat_History', |
||||
icon: 'clock', |
||||
template: 'contactChatHistory', |
||||
order: 11, |
||||
}); |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue