define and use max tag count
This commit is contained in:
+2
-1
@@ -29,9 +29,10 @@ self.i18nMessage = function(id) {
|
|||||||
|
|
||||||
// This method shows the push notifications.
|
// This method shows the push notifications.
|
||||||
firebase.messaging().setBackgroundMessageHandler((payload) => {
|
firebase.messaging().setBackgroundMessageHandler((payload) => {
|
||||||
if (payload.data.silent === 'true') {
|
if (payload.data.silent == 'true') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pushType = payload.data.what || 'msg';
|
const pushType = payload.data.what || 'msg';
|
||||||
const title = payload.data.title || self.i18nMessage(pushType == 'msg' ? 'new_message' : 'new_chat');
|
const title = payload.data.title || self.i18nMessage(pushType == 'msg' ? 'new_message' : 'new_chat');
|
||||||
const options = {
|
const options = {
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ export const READ_DELAY = 1000;
|
|||||||
|
|
||||||
// The shortest allowed tag length. Matches the value on the server.
|
// The shortest allowed tag length. Matches the value on the server.
|
||||||
export const MIN_TAG_LENGTH = 4;
|
export const MIN_TAG_LENGTH = 4;
|
||||||
|
// The maximum number of tags allowed. Matches the value on the server.
|
||||||
|
export const MAX_TAG_COUNT = 16;
|
||||||
|
|
||||||
// Access mode for P2P subscriptions initiated by the current user.
|
// Access mode for P2P subscriptions initiated by the current user.
|
||||||
export const DEFAULT_P2P_ACCESS_MODE = 'JRWPS';
|
export const DEFAULT_P2P_ACCESS_MODE = 'JRWPS';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { FormattedMessage } from 'react-intl';
|
|||||||
|
|
||||||
import ChipInput from './chip-input.jsx';
|
import ChipInput from './chip-input.jsx';
|
||||||
|
|
||||||
import { MIN_TAG_LENGTH } from '../config.js';
|
import { MAX_TAG_COUNT, MIN_TAG_LENGTH } from '../config.js';
|
||||||
import { arrayEqual } from '../lib/utils.js';
|
import { arrayEqual } from '../lib/utils.js';
|
||||||
|
|
||||||
export default class TagManager extends React.Component {
|
export default class TagManager extends React.Component {
|
||||||
@@ -48,7 +48,7 @@ export default class TagManager extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleAddTag(tag) {
|
handleAddTag(tag) {
|
||||||
if (tag.length > 0) {
|
if (tag.length > 0 && this.state.tags.length < MAX_TAG_COUNT) {
|
||||||
const tags = this.state.tags.slice(0);
|
const tags = this.state.tags.slice(0);
|
||||||
tags.push(tag);
|
tags.push(tag);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user