fixed bugs in tags editing
This commit is contained in:
+131
-32
@@ -1932,105 +1932,204 @@ ul.tabbar li.active > a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Colors of letter tiles */
|
/* Colors of letter tiles */
|
||||||
.light-color0 {
|
.lt-bg-0 {
|
||||||
background-color: #ef9a9a;
|
background-color: #ef9a9a;
|
||||||
}
|
}
|
||||||
.light-color1 {
|
.lt-bg-1 {
|
||||||
background-color: #90caf9;
|
background-color: #90caf9;
|
||||||
}
|
}
|
||||||
.light-color2 {
|
.lt-bg-2 {
|
||||||
background-color: #b0bec5;
|
background-color: #b0bec5;
|
||||||
}
|
}
|
||||||
.light-color3 {
|
.lt-bg-3 {
|
||||||
background-color: #b39ddb;
|
background-color: #b39ddb;
|
||||||
}
|
}
|
||||||
.light-color4 {
|
.lt-bg-4 {
|
||||||
background-color: #ffab91;
|
background-color: #ffab91;
|
||||||
}
|
}
|
||||||
.light-color5 {
|
.lt-bg-5 {
|
||||||
background-color: #a5d6a7;
|
background-color: #a5d6a7;
|
||||||
}
|
}
|
||||||
.light-color6 {
|
.lt-bg-6 {
|
||||||
background-color: #eeeeee;
|
background-color: #eeeeee;
|
||||||
}
|
}
|
||||||
.light-color7 {
|
.lt-bg-7 {
|
||||||
background-color: #e6ee9c;
|
background-color: #e6ee9c;
|
||||||
}
|
}
|
||||||
.light-color8 {
|
.lt-bg-8 {
|
||||||
background-color: #c5e1a5;
|
background-color: #c5e1a5;
|
||||||
}
|
}
|
||||||
.light-color9 {
|
.lt-bg-9 {
|
||||||
background-color: #f0e57d;
|
background-color: #f0e57d;
|
||||||
}
|
}
|
||||||
.light-color10 {
|
.lt-bg-10 {
|
||||||
background-color: #f48fb1;
|
background-color: #f48fb1;
|
||||||
}
|
}
|
||||||
.light-color11 {
|
.lt-bg-11 {
|
||||||
background-color: #9fa8da;
|
background-color: #9fa8da;
|
||||||
}
|
}
|
||||||
.light-color12 {
|
.lt-bg-12 {
|
||||||
background-color: #ffe082;
|
background-color: #ffe082;
|
||||||
}
|
}
|
||||||
.light-color13 {
|
.lt-bg-13 {
|
||||||
background-color: #bcaaa4;
|
background-color: #bcaaa4;
|
||||||
}
|
}
|
||||||
.light-color14 {
|
.lt-bg-14 {
|
||||||
background-color: #80deea;
|
background-color: #80deea;
|
||||||
}
|
}
|
||||||
.light-color15 {
|
.lt-bg-15 {
|
||||||
background-color: #ce93d8;
|
background-color: #ce93d8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Darker version of letter tile colors */
|
/* Darker version of letter tile colors */
|
||||||
.dark-color0 {
|
.dk-bg-0 {
|
||||||
background-color: #C62828;
|
background-color: #C62828;
|
||||||
}
|
}
|
||||||
.dark-color1 {
|
.dk-bg-1 {
|
||||||
background-color: #AD1457;
|
background-color: #AD1457;
|
||||||
}
|
}
|
||||||
.dark-color2 {
|
.dk-bg-2 {
|
||||||
background-color: #6A1B9A;
|
background-color: #6A1B9A;
|
||||||
}
|
}
|
||||||
.dark-color3 {
|
.dk-bg-3 {
|
||||||
background-color: #4527A0;
|
background-color: #4527A0;
|
||||||
}
|
}
|
||||||
.dark-color4 {
|
.dk-bg-4 {
|
||||||
background-color: #283593;
|
background-color: #283593;
|
||||||
}
|
}
|
||||||
.dark-color5 {
|
.dk-bg-5 {
|
||||||
background-color: #1565C0;
|
background-color: #1565C0;
|
||||||
}
|
}
|
||||||
.dark-color6 {
|
.dk-bg-6 {
|
||||||
background-color: #0277BD;
|
background-color: #0277BD;
|
||||||
}
|
}
|
||||||
.dark-color7 {
|
.dk-bg-7 {
|
||||||
background-color: #00838F;
|
background-color: #00838F;
|
||||||
}
|
}
|
||||||
.dark-color8 {
|
.dk-bg-8 {
|
||||||
background-color: #00695C;
|
background-color: #00695C;
|
||||||
}
|
}
|
||||||
.dark-color9 {
|
.dk-bg-9 {
|
||||||
background-color: #2E7D32;
|
background-color: #2E7D32;
|
||||||
}
|
}
|
||||||
.dark-color10 {
|
.dk-bg-10 {
|
||||||
background-color: #558B2F;
|
background-color: #558B2F;
|
||||||
}
|
}
|
||||||
.dark-color11 {
|
.dk-bg-11 {
|
||||||
background-color: #9E9D24;
|
background-color: #9E9D24;
|
||||||
}
|
}
|
||||||
.dark-color12 {
|
.dk-bg-12 {
|
||||||
background-color: #F9A825;
|
background-color: #F9A825;
|
||||||
}
|
}
|
||||||
.dark-color13 {
|
.dk-bg-13 {
|
||||||
background-color: #FF8F00;
|
background-color: #FF8F00;
|
||||||
}
|
}
|
||||||
.dark-color14 {
|
.dk-bg-14 {
|
||||||
background-color: #EF6C00;
|
background-color: #EF6C00;
|
||||||
}
|
}
|
||||||
.dark-color15 {
|
.dk-bg-15 {
|
||||||
background-color: #D84315;
|
background-color: #D84315;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Same colors as above but for text as opposite to background */
|
||||||
|
.lt-fg-0 {
|
||||||
|
color: #ef9a9a!important;
|
||||||
|
}
|
||||||
|
.lt-fg-1 {
|
||||||
|
color: #90caf9!important;
|
||||||
|
}
|
||||||
|
.lt-fg-2 {
|
||||||
|
color: #b0bec5!important;
|
||||||
|
}
|
||||||
|
.lt-fg-3 {
|
||||||
|
color: #b39ddb!important;
|
||||||
|
}
|
||||||
|
.lt-fg-4 {
|
||||||
|
color: #ffab91!important;
|
||||||
|
}
|
||||||
|
.lt-fg-5 {
|
||||||
|
color: #a5d6a7!important;
|
||||||
|
}
|
||||||
|
.lt-fg-6 {
|
||||||
|
color: #eeeeee!important;
|
||||||
|
}
|
||||||
|
.lt-fg-7 {
|
||||||
|
color: #e6ee9c!important;
|
||||||
|
}
|
||||||
|
.lt-fg-8 {
|
||||||
|
color: #c5e1a5!important;
|
||||||
|
}
|
||||||
|
.lt-fg-9 {
|
||||||
|
color: #f0e57d!important;
|
||||||
|
}
|
||||||
|
.lt-fg-10 {
|
||||||
|
color: #f48fb1!important;
|
||||||
|
}
|
||||||
|
.lt-fg-11 {
|
||||||
|
color: #9fa8da!important;
|
||||||
|
}
|
||||||
|
.lt-fg-12 {
|
||||||
|
color: #ffe082!important;
|
||||||
|
}
|
||||||
|
.lt-fg-13 {
|
||||||
|
color: #bcaaa4!important;
|
||||||
|
}
|
||||||
|
.lt-fg-14 {
|
||||||
|
color: #80deea!important;
|
||||||
|
}
|
||||||
|
.lt-fg-15 {
|
||||||
|
color: #ce93d8!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dk-fg-0 {
|
||||||
|
color: #C62828!important;
|
||||||
|
}
|
||||||
|
.dk-fg-1 {
|
||||||
|
color: #AD1457!important;
|
||||||
|
}
|
||||||
|
.dk-fg-2 {
|
||||||
|
color: #6A1B9A!important;
|
||||||
|
}
|
||||||
|
.dk-fg-3 {
|
||||||
|
color: #4527A0!important;
|
||||||
|
}
|
||||||
|
.dk-fg-4 {
|
||||||
|
color: #283593!important;
|
||||||
|
}
|
||||||
|
.dk-fg-5 {
|
||||||
|
color: #1565C0!important;
|
||||||
|
}
|
||||||
|
.dk-fg-6 {
|
||||||
|
color: #0277BD!important;
|
||||||
|
}
|
||||||
|
.dk-fg-7 {
|
||||||
|
color: #00838F!important;
|
||||||
|
}
|
||||||
|
.dk-fg-8 {
|
||||||
|
color: #00695C!important;
|
||||||
|
}
|
||||||
|
.dk-fg-9 {
|
||||||
|
color: #2E7D32!important;
|
||||||
|
}
|
||||||
|
.dk-fg-10 {
|
||||||
|
color: #558B2F!important;
|
||||||
|
}
|
||||||
|
.dk-fg-11 {
|
||||||
|
color: #9E9D24!important;
|
||||||
|
}
|
||||||
|
.dk-fg-12 {
|
||||||
|
color: #F9A825!important;
|
||||||
|
}
|
||||||
|
.dk-fg-13 {
|
||||||
|
color: #FF8F00!important;
|
||||||
|
}
|
||||||
|
.dk-fg-14 {
|
||||||
|
color: #EF6C00!important;
|
||||||
|
}
|
||||||
|
.dk-fg-15 {
|
||||||
|
color: #D84315!important;
|
||||||
|
}
|
||||||
|
|
||||||
/* Material icons resized from the default 24pt */
|
/* Material icons resized from the default 24pt */
|
||||||
.material-icons {
|
.material-icons {
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -50,6 +50,10 @@ function stringToColorHash(value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Converts user or topic ID to a CSS color class. Ideally it should produce the same color value as Java version.
|
// Converts user or topic ID to a CSS color class. Ideally it should produce the same color value as Java version.
|
||||||
export function idToColorClass(string, light) {
|
// params:
|
||||||
return (light ? 'light-color' : 'dark-color') + (Math.abs(stringToColorHash(string)) % 16);
|
// - {string} id: user or topic ID
|
||||||
|
// - {boolean} light: light or dark version of the color.
|
||||||
|
// - {boolean} fg: foreground or background color.
|
||||||
|
export function idToColorClass(id, light, fg) {
|
||||||
|
return (light ? 'lt-' : 'dk-') + (fg ? 'fg-' : 'bg-') + (Math.abs(stringToColorHash(id)) % 16);
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-6
@@ -115,6 +115,7 @@ class InfoView extends React.Component {
|
|||||||
|
|
||||||
this.resetSubs = this.resetSubs.bind(this);
|
this.resetSubs = this.resetSubs.bind(this);
|
||||||
this.resetDesc = this.resetDesc.bind(this);
|
this.resetDesc = this.resetDesc.bind(this);
|
||||||
|
this.resetTags = this.resetTags.bind(this);
|
||||||
this.onMetaDesc = this.onMetaDesc.bind(this);
|
this.onMetaDesc = this.onMetaDesc.bind(this);
|
||||||
this.onSubsUpdated = this.onSubsUpdated.bind(this);
|
this.onSubsUpdated = this.onSubsUpdated.bind(this);
|
||||||
this.handleImageChanged = this.handleImageChanged.bind(this);
|
this.handleImageChanged = this.handleImageChanged.bind(this);
|
||||||
@@ -147,6 +148,7 @@ class InfoView extends React.Component {
|
|||||||
this.setState({topic: props.topic});
|
this.setState({topic: props.topic});
|
||||||
this.resetDesc(topic, props);
|
this.resetDesc(topic, props);
|
||||||
this.resetSubs(topic, props);
|
this.resetSubs(topic, props);
|
||||||
|
this.resetTags(topic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,8 +217,15 @@ class InfoView extends React.Component {
|
|||||||
auth: defacs.auth,
|
auth: defacs.auth,
|
||||||
anon: defacs.anon
|
anon: defacs.anon
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (topic.getType() == 'grp' && acs && acs.isOwner()) {
|
resetTags(topic) {
|
||||||
|
if (topic.getType() != 'grp') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const acs = topic.getAccessMode();
|
||||||
|
if (acs && acs.isOwner()) {
|
||||||
// Requesting tags: owner is editing the topic.
|
// Requesting tags: owner is editing the topic.
|
||||||
topic.getMeta(topic.startMetaQuery().withTags().build());
|
topic.getMeta(topic.startMetaQuery().withTags().build());
|
||||||
}
|
}
|
||||||
@@ -257,7 +266,6 @@ class InfoView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handlePermissionsChanged(which, perm) {
|
handlePermissionsChanged(which, perm) {
|
||||||
console.log("handlePermissionsChanged", which, perm);
|
|
||||||
switch (which) {
|
switch (which) {
|
||||||
case 'auth':
|
case 'auth':
|
||||||
this.props.onTopicDescUpdate(this.props.topic, null, null, {auth: perm});
|
this.props.onTopicDescUpdate(this.props.topic, null, null, {auth: perm});
|
||||||
@@ -279,7 +287,6 @@ class InfoView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleLaunchPermissionsEditor(which, uid) {
|
handleLaunchPermissionsEditor(which, uid) {
|
||||||
console.log(which, uid);
|
|
||||||
const {formatMessage} = this.props.intl;
|
const {formatMessage} = this.props.intl;
|
||||||
let toEdit, toCompare, toSkip, titleEdit, titleCompare, userTitle, userAvatar;
|
let toEdit, toCompare, toSkip, titleEdit, titleCompare, userTitle, userAvatar;
|
||||||
switch (which) {
|
switch (which) {
|
||||||
@@ -468,11 +475,10 @@ class InfoView extends React.Component {
|
|||||||
tinode={this.props.tinode}
|
tinode={this.props.tinode}
|
||||||
topic={this.props.topic}
|
topic={this.props.topic}
|
||||||
onCredAdd={this.props.onCredAdd}
|
onCredAdd={this.props.onCredAdd}
|
||||||
onTopicTagsUpdate={this.props.onTopicTagsUpdate}
|
onTopicTagsUpdateRequest={this.props.onTopicTagsUpdateRequest}
|
||||||
onCredConfirm={this.props.onCredConfirm}
|
onCredConfirm={this.props.onCredConfirm}
|
||||||
onCredDelete={this.props.onCredDelete}
|
onCredDelete={this.props.onCredDelete}
|
||||||
onUpdateTopicDesc={this.props.onTopicDescUpdate}
|
onUpdateTopicDesc={this.props.onTopicDescUpdateRequest}
|
||||||
onUpdateTags={this.props.onUpdateTags}
|
|
||||||
onError={this.props.onError} />
|
onError={this.props.onError} />
|
||||||
:
|
:
|
||||||
view == 'security' ?
|
view == 'security' ?
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class TinodeWeb extends React.Component {
|
|||||||
this.handleNewTopicCreated = this.handleNewTopicCreated.bind(this);
|
this.handleNewTopicCreated = this.handleNewTopicCreated.bind(this);
|
||||||
this.handleTopicUpdateRequest = this.handleTopicUpdateRequest.bind(this);
|
this.handleTopicUpdateRequest = this.handleTopicUpdateRequest.bind(this);
|
||||||
this.handleChangePermissions = this.handleChangePermissions.bind(this);
|
this.handleChangePermissions = this.handleChangePermissions.bind(this);
|
||||||
this.handleTagsUpdated = this.handleTagsUpdated.bind(this);
|
this.handleTagsUpdateRequest = this.handleTagsUpdateRequest.bind(this);
|
||||||
this.handleLogout = this.handleLogout.bind(this);
|
this.handleLogout = this.handleLogout.bind(this);
|
||||||
this.handleDeleteAccount = this.handleDeleteAccount.bind(this);
|
this.handleDeleteAccount = this.handleDeleteAccount.bind(this);
|
||||||
this.handleDeleteTopicRequest = this.handleDeleteTopicRequest.bind(this);
|
this.handleDeleteTopicRequest = this.handleDeleteTopicRequest.bind(this);
|
||||||
@@ -225,7 +225,7 @@ class TinodeWeb extends React.Component {
|
|||||||
serviceWorkerChannel.addEventListener('message', this.handlePushMessage);
|
serviceWorkerChannel.addEventListener('message', this.handlePushMessage);
|
||||||
} else {
|
} else {
|
||||||
// Safari is broken by design.
|
// Safari is broken by design.
|
||||||
console.warn('Your browser does not support BroadcastChannel. Some features will not be available');
|
console.warn("Your browser does not support BroadcastChannel. Some features will not be available");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Window/tab visible or invisible for pausing timers.
|
// Window/tab visible or invisible for pausing timers.
|
||||||
@@ -1269,7 +1269,7 @@ class TinodeWeb extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTagsUpdated(topicName, tags) {
|
handleTagsUpdateRequest(topicName, tags) {
|
||||||
const topic = this.tinode.getTopic(topicName);
|
const topic = this.tinode.getTopic(topicName);
|
||||||
if (topic) {
|
if (topic) {
|
||||||
topic.setMeta({tags: tags}).catch((err) => {
|
topic.setMeta({tags: tags}).catch((err) => {
|
||||||
@@ -1686,7 +1686,7 @@ class TinodeWeb extends React.Component {
|
|||||||
errorActionText={this.state.errorActionText}
|
errorActionText={this.state.errorActionText}
|
||||||
|
|
||||||
onNavigate={this.infoNavigator}
|
onNavigate={this.infoNavigator}
|
||||||
onTopicDescUpdate={this.handleTopicUpdateRequest}
|
onTopicDescUpdateRequest={this.handleTopicUpdateRequest}
|
||||||
onShowAlert={this.handleShowAlert}
|
onShowAlert={this.handleShowAlert}
|
||||||
onChangePermissions={this.handleChangePermissions}
|
onChangePermissions={this.handleChangePermissions}
|
||||||
onMemberUpdateRequest={this.handleMemberUpdateRequest}
|
onMemberUpdateRequest={this.handleMemberUpdateRequest}
|
||||||
@@ -1696,7 +1696,7 @@ class TinodeWeb extends React.Component {
|
|||||||
onBlockTopic={this.handleBlockTopicRequest}
|
onBlockTopic={this.handleBlockTopicRequest}
|
||||||
onReportTopic={this.handleReportTopic}
|
onReportTopic={this.handleReportTopic}
|
||||||
onAddMember={this.handleManageGroupMembers}
|
onAddMember={this.handleManageGroupMembers}
|
||||||
onTopicTagsUpdate={this.handleTagsUpdated}
|
onTopicTagsUpdateRequest={this.handleTagsUpdateRequest}
|
||||||
onInitFind={this.tnInitFind}
|
onInitFind={this.tnInitFind}
|
||||||
onError={this.handleError}
|
onError={this.handleError}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import LetterTile from './letter-tile.jsx';
|
|||||||
import ReceivedMarker from './received-marker.jsx'
|
import ReceivedMarker from './received-marker.jsx'
|
||||||
import UploadingImage from './uploading-image.jsx'
|
import UploadingImage from './uploading-image.jsx'
|
||||||
|
|
||||||
import { idToColorClass } from '../lib/strformat.js';
|
|
||||||
import { sanitizeImageUrl, sanitizeUrl } from '../lib/utils.js';
|
import { sanitizeImageUrl, sanitizeUrl } from '../lib/utils.js';
|
||||||
|
|
||||||
export default class ChatMessage extends React.Component {
|
export default class ChatMessage extends React.Component {
|
||||||
@@ -154,7 +153,7 @@ export default class ChatMessage extends React.Component {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
{fullDisplay ?
|
{fullDisplay ?
|
||||||
<div className={'author' + (this.props.userName ? idToColorClass(this.props.userFrom) : '')}>
|
<div className="author">
|
||||||
{this.props.userName ||
|
{this.props.userName ||
|
||||||
<i><FormattedMessage id="user_not_found" defaultMessage="Not found"
|
<i><FormattedMessage id="user_not_found" defaultMessage="Not found"
|
||||||
description="In place of a user's full name when the user is not found." /></i>
|
description="In place of a user's full name when the user is not found." /></i>
|
||||||
|
|||||||
@@ -21,10 +21,11 @@ export default class TopicCommon extends React.Component {
|
|||||||
addCredActive: false,
|
addCredActive: false,
|
||||||
addCredInvalid: false,
|
addCredInvalid: false,
|
||||||
newCred: '',
|
newCred: '',
|
||||||
tags: [],
|
tags: []
|
||||||
previousTagsUpdated: undefined
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.previousTagsUpdated = undefined;
|
||||||
|
|
||||||
this.onTagsUpdated = this.onTagsUpdated.bind(this);
|
this.onTagsUpdated = this.onTagsUpdated.bind(this);
|
||||||
this.handleTagsUpdated = this.handleTagsUpdated.bind(this);
|
this.handleTagsUpdated = this.handleTagsUpdated.bind(this);
|
||||||
this.tnCredsUpdated = this.tnCredsUpdated.bind(this);
|
this.tnCredsUpdated = this.tnCredsUpdated.bind(this);
|
||||||
@@ -105,17 +106,19 @@ export default class TopicCommon extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Server informs that the tags have been updated.
|
||||||
onTagsUpdated(tags) {
|
onTagsUpdated(tags) {
|
||||||
this.setState({tags: tags});
|
this.setState({tags: tags});
|
||||||
|
|
||||||
if (this.previousTagsUpdated && this.previousTagsUpdated != this.onTagsUpdated) {
|
if (this.previousTagsUpdated && this.previousTagsUpdated != this.onTagsUpdated) {
|
||||||
this.previousTagsUpdated();
|
this.previousTagsUpdated(tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Request server to change tags.
|
||||||
handleTagsUpdated(tags) {
|
handleTagsUpdated(tags) {
|
||||||
if (!arrayEqual(this.state.tags.slice(0), tags.slice(0))) {
|
if (!arrayEqual(this.state.tags.slice(0), tags.slice(0))) {
|
||||||
this.props.onTopicTagsUpdate(this.props.topic, tags);
|
this.props.onTopicTagsUpdateRequest(this.props.topic, tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +146,7 @@ export default class TopicCommon extends React.Component {
|
|||||||
tinode={this.props.tinode}
|
tinode={this.props.tinode}
|
||||||
topic={this.props.topic}
|
topic={this.props.topic}
|
||||||
onUpdateTopicDesc={this.props.onUpdateTopicDesc}
|
onUpdateTopicDesc={this.props.onUpdateTopicDesc}
|
||||||
onUpdateTags={this.props.onUpdateTags}
|
onUpdateTags={this.handleTagsUpdated}
|
||||||
onError={this.props.onError} />
|
onError={this.props.onError} />
|
||||||
{this.state.isMe ?
|
{this.state.isMe ?
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -28,12 +28,13 @@ export default class TopicDescEdit extends React.Component {
|
|||||||
private: topic.private ? topic.private.comment : null,
|
private: topic.private ? topic.private.comment : null,
|
||||||
description: topic.public ? topic.public.note : undefined,
|
description: topic.public ? topic.public.note : undefined,
|
||||||
avatar: makeImageUrl(topic.public ? topic.public.photo : null),
|
avatar: makeImageUrl(topic.public ? topic.public.photo : null),
|
||||||
tags: topic.tags(),
|
tags: topic.tags() || [],
|
||||||
newAvatar: null,
|
newAvatar: null,
|
||||||
newAvatarMime: null,
|
newAvatarMime: null
|
||||||
previousOnTags: topic.onTagsUpdated
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.previousOnTags = null;
|
||||||
|
|
||||||
this.tnNewTags = this.tnNewTags.bind(this);
|
this.tnNewTags = this.tnNewTags.bind(this);
|
||||||
this.handleFullNameUpdate = this.handleFullNameUpdate.bind(this);
|
this.handleFullNameUpdate = this.handleFullNameUpdate.bind(this);
|
||||||
this.handleImageUpdated = this.handleImageUpdated.bind(this);
|
this.handleImageUpdated = this.handleImageUpdated.bind(this);
|
||||||
@@ -47,12 +48,13 @@ export default class TopicDescEdit extends React.Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const topic = this.props.tinode.getTopic(this.props.topic);
|
const topic = this.props.tinode.getTopic(this.props.topic);
|
||||||
|
this.previousOnTags = topic.onTagsUpdated;
|
||||||
topic.onTagsUpdated = this.tnNewTags;
|
topic.onTagsUpdated = this.tnNewTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
const topic = this.props.tinode.getTopic(this.props.topic);
|
const topic = this.props.tinode.getTopic(this.props.topic);
|
||||||
topic.onTagsUpdated = this.state.previousOnTags;
|
topic.onTagsUpdated = this.previousOnTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
tnNewTags(tags) {
|
tnNewTags(tags) {
|
||||||
|
|||||||
+38
-28
@@ -508,7 +508,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony export */ "shortDateFormat": () => (/* binding */ shortDateFormat),
|
/* harmony export */ "shortDateFormat": () => (/* binding */ shortDateFormat),
|
||||||
/* harmony export */ "secondsToTime": () => (/* binding */ secondsToTime),
|
/* harmony export */ "secondsToTime": () => (/* binding */ secondsToTime),
|
||||||
/* harmony export */ "bytesToHumanSize": () => (/* binding */ bytesToHumanSize),
|
/* harmony export */ "bytesToHumanSize": () => (/* binding */ bytesToHumanSize),
|
||||||
/* harmony export */ "stringHash": () => (/* binding */ stringHash)
|
/* harmony export */ "idToColorClass": () => (/* binding */ idToColorClass)
|
||||||
/* harmony export */ });
|
/* harmony export */ });
|
||||||
function shortDateFormat(then, locale) {
|
function shortDateFormat(then, locale) {
|
||||||
locale = locale || window.navigator.userLanguage || window.navigator.language;
|
locale = locale || window.navigator.userLanguage || window.navigator.language;
|
||||||
@@ -555,7 +555,8 @@ function bytesToHumanSize(bytes) {
|
|||||||
const round = bucket > 0 ? count < 3 ? 2 : count < 30 ? 1 : 0 : 0;
|
const round = bucket > 0 ? count < 3 ? 2 : count < 30 ? 1 : 0 : 0;
|
||||||
return count.toFixed(round) + ' ' + sizes[bucket];
|
return count.toFixed(round) + ' ' + sizes[bucket];
|
||||||
}
|
}
|
||||||
function stringHash(value) {
|
|
||||||
|
function stringToColorHash(value) {
|
||||||
let hash = 0;
|
let hash = 0;
|
||||||
value = '' + value;
|
value = '' + value;
|
||||||
|
|
||||||
@@ -567,6 +568,10 @@ function stringHash(value) {
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function idToColorClass(id, light, fg) {
|
||||||
|
return (light ? 'lt-' : 'dk-') + (fg ? 'fg-' : 'bg-') + Math.abs(stringToColorHash(id)) % 16;
|
||||||
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./src/lib/utils.js":
|
/***/ "./src/lib/utils.js":
|
||||||
@@ -1872,6 +1877,7 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
};
|
};
|
||||||
this.resetSubs = this.resetSubs.bind(this);
|
this.resetSubs = this.resetSubs.bind(this);
|
||||||
this.resetDesc = this.resetDesc.bind(this);
|
this.resetDesc = this.resetDesc.bind(this);
|
||||||
|
this.resetTags = this.resetTags.bind(this);
|
||||||
this.onMetaDesc = this.onMetaDesc.bind(this);
|
this.onMetaDesc = this.onMetaDesc.bind(this);
|
||||||
this.onSubsUpdated = this.onSubsUpdated.bind(this);
|
this.onSubsUpdated = this.onSubsUpdated.bind(this);
|
||||||
this.handleImageChanged = this.handleImageChanged.bind(this);
|
this.handleImageChanged = this.handleImageChanged.bind(this);
|
||||||
@@ -1905,6 +1911,7 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
});
|
});
|
||||||
this.resetDesc(topic, props);
|
this.resetDesc(topic, props);
|
||||||
this.resetSubs(topic, props);
|
this.resetSubs(topic, props);
|
||||||
|
this.resetTags(topic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1978,8 +1985,16 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
auth: defacs.auth,
|
auth: defacs.auth,
|
||||||
anon: defacs.anon
|
anon: defacs.anon
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (topic.getType() == 'grp' && acs && acs.isOwner()) {
|
resetTags(topic) {
|
||||||
|
if (topic.getType() != 'grp') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const acs = topic.getAccessMode();
|
||||||
|
|
||||||
|
if (acs && acs.isOwner()) {
|
||||||
topic.getMeta(topic.startMetaQuery().withTags().build());
|
topic.getMeta(topic.startMetaQuery().withTags().build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2027,8 +2042,6 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
handlePermissionsChanged(which, perm) {
|
handlePermissionsChanged(which, perm) {
|
||||||
console.log("handlePermissionsChanged", which, perm);
|
|
||||||
|
|
||||||
switch (which) {
|
switch (which) {
|
||||||
case 'auth':
|
case 'auth':
|
||||||
this.props.onTopicDescUpdate(this.props.topic, null, null, {
|
this.props.onTopicDescUpdate(this.props.topic, null, null, {
|
||||||
@@ -2058,7 +2071,6 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleLaunchPermissionsEditor(which, uid) {
|
handleLaunchPermissionsEditor(which, uid) {
|
||||||
console.log(which, uid);
|
|
||||||
const {
|
const {
|
||||||
formatMessage
|
formatMessage
|
||||||
} = this.props.intl;
|
} = this.props.intl;
|
||||||
@@ -2273,11 +2285,10 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
tinode: this.props.tinode,
|
tinode: this.props.tinode,
|
||||||
topic: this.props.topic,
|
topic: this.props.topic,
|
||||||
onCredAdd: this.props.onCredAdd,
|
onCredAdd: this.props.onCredAdd,
|
||||||
onTopicTagsUpdate: this.props.onTopicTagsUpdate,
|
onTopicTagsUpdateRequest: this.props.onTopicTagsUpdateRequest,
|
||||||
onCredConfirm: this.props.onCredConfirm,
|
onCredConfirm: this.props.onCredConfirm,
|
||||||
onCredDelete: this.props.onCredDelete,
|
onCredDelete: this.props.onCredDelete,
|
||||||
onUpdateTopicDesc: this.props.onTopicDescUpdate,
|
onUpdateTopicDesc: this.props.onTopicDescUpdateRequest,
|
||||||
onUpdateTags: this.props.onUpdateTags,
|
|
||||||
onError: this.props.onError
|
onError: this.props.onError
|
||||||
}) : view == 'security' ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_topic_security_jsx__WEBPACK_IMPORTED_MODULE_12__.default, {
|
}) : view == 'security' ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_topic_security_jsx__WEBPACK_IMPORTED_MODULE_12__.default, {
|
||||||
tinode: this.props.tinode,
|
tinode: this.props.tinode,
|
||||||
@@ -4625,7 +4636,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
this.handleNewTopicCreated = this.handleNewTopicCreated.bind(this);
|
this.handleNewTopicCreated = this.handleNewTopicCreated.bind(this);
|
||||||
this.handleTopicUpdateRequest = this.handleTopicUpdateRequest.bind(this);
|
this.handleTopicUpdateRequest = this.handleTopicUpdateRequest.bind(this);
|
||||||
this.handleChangePermissions = this.handleChangePermissions.bind(this);
|
this.handleChangePermissions = this.handleChangePermissions.bind(this);
|
||||||
this.handleTagsUpdated = this.handleTagsUpdated.bind(this);
|
this.handleTagsUpdateRequest = this.handleTagsUpdateRequest.bind(this);
|
||||||
this.handleLogout = this.handleLogout.bind(this);
|
this.handleLogout = this.handleLogout.bind(this);
|
||||||
this.handleDeleteAccount = this.handleDeleteAccount.bind(this);
|
this.handleDeleteAccount = this.handleDeleteAccount.bind(this);
|
||||||
this.handleDeleteTopicRequest = this.handleDeleteTopicRequest.bind(this);
|
this.handleDeleteTopicRequest = this.handleDeleteTopicRequest.bind(this);
|
||||||
@@ -4713,7 +4724,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
const serviceWorkerChannel = new BroadcastChannel('tinode-sw');
|
const serviceWorkerChannel = new BroadcastChannel('tinode-sw');
|
||||||
serviceWorkerChannel.addEventListener('message', this.handlePushMessage);
|
serviceWorkerChannel.addEventListener('message', this.handlePushMessage);
|
||||||
} else {
|
} else {
|
||||||
console.warn('Your browser does not support BroadcastChannel. Some features will not be available');
|
console.warn("Your browser does not support BroadcastChannel. Some features will not be available");
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('visibilitychange', this.handleVisibilityEvent);
|
document.addEventListener('visibilitychange', this.handleVisibilityEvent);
|
||||||
@@ -5825,7 +5836,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTagsUpdated(topicName, tags) {
|
handleTagsUpdateRequest(topicName, tags) {
|
||||||
const topic = this.tinode.getTopic(topicName);
|
const topic = this.tinode.getTopic(topicName);
|
||||||
|
|
||||||
if (topic) {
|
if (topic) {
|
||||||
@@ -6237,7 +6248,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
errorAction: this.state.errorAction,
|
errorAction: this.state.errorAction,
|
||||||
errorActionText: this.state.errorActionText,
|
errorActionText: this.state.errorActionText,
|
||||||
onNavigate: this.infoNavigator,
|
onNavigate: this.infoNavigator,
|
||||||
onTopicDescUpdate: this.handleTopicUpdateRequest,
|
onTopicDescUpdateRequest: this.handleTopicUpdateRequest,
|
||||||
onShowAlert: this.handleShowAlert,
|
onShowAlert: this.handleShowAlert,
|
||||||
onChangePermissions: this.handleChangePermissions,
|
onChangePermissions: this.handleChangePermissions,
|
||||||
onMemberUpdateRequest: this.handleMemberUpdateRequest,
|
onMemberUpdateRequest: this.handleMemberUpdateRequest,
|
||||||
@@ -6247,7 +6258,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
onBlockTopic: this.handleBlockTopicRequest,
|
onBlockTopic: this.handleBlockTopicRequest,
|
||||||
onReportTopic: this.handleReportTopic,
|
onReportTopic: this.handleReportTopic,
|
||||||
onAddMember: this.handleManageGroupMembers,
|
onAddMember: this.handleManageGroupMembers,
|
||||||
onTopicTagsUpdate: this.handleTagsUpdated,
|
onTopicTagsUpdateRequest: this.handleTagsUpdateRequest,
|
||||||
onInitFind: this.tnInitFind,
|
onInitFind: this.tnInitFind,
|
||||||
onError: this.handleError,
|
onError: this.handleError,
|
||||||
showContextMenu: this.handleShowContextMenu
|
showContextMenu: this.handleShowContextMenu
|
||||||
@@ -7063,15 +7074,13 @@ class ChatMessage extends (react__WEBPACK_IMPORTED_MODULE_0___default().Componen
|
|||||||
className: "material-icons"
|
className: "material-icons"
|
||||||
}, "expand_more")))), fullDisplay ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
}, "expand_more")))), fullDisplay ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
className: "author"
|
className: "author"
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
|
}, this.props.userName || react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
|
||||||
id: "user_not_found",
|
id: "user_not_found",
|
||||||
defaultMessage: [{
|
defaultMessage: [{
|
||||||
"type": 0,
|
"type": 0,
|
||||||
"value": "Not found"
|
"value": "Not found"
|
||||||
}]
|
}]
|
||||||
}, notFound => {
|
}))) : null));
|
||||||
return this.props.userName || react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", null, notFound);
|
|
||||||
})) : null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9731,7 +9740,7 @@ class LetterTile extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompo
|
|||||||
|
|
||||||
if (this.props.avatar === true) {
|
if (this.props.avatar === true) {
|
||||||
const isGroup = tinode_sdk__WEBPACK_IMPORTED_MODULE_1___default().topicType(this.props.topic) == 'grp';
|
const isGroup = tinode_sdk__WEBPACK_IMPORTED_MODULE_1___default().topicType(this.props.topic) == 'grp';
|
||||||
const iconColor = (isGroup ? 'light-color' : 'dark-color') + Math.abs((0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_2__.stringHash)(this.props.topic)) % 16;
|
const iconColor = (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_2__.idToColorClass)(this.props.topic, isGroup);
|
||||||
|
|
||||||
if (this.props.topic && this.props.title && this.props.title.trim()) {
|
if (this.props.topic && this.props.title && this.props.title.trim()) {
|
||||||
const letter = this.props.title.trim().charAt(0);
|
const letter = this.props.title.trim().charAt(0);
|
||||||
@@ -11275,9 +11284,9 @@ class TopicCommon extends (react__WEBPACK_IMPORTED_MODULE_0___default().Componen
|
|||||||
addCredActive: false,
|
addCredActive: false,
|
||||||
addCredInvalid: false,
|
addCredInvalid: false,
|
||||||
newCred: '',
|
newCred: '',
|
||||||
tags: [],
|
tags: []
|
||||||
previousTagsUpdated: undefined
|
|
||||||
};
|
};
|
||||||
|
this.previousTagsUpdated = undefined;
|
||||||
this.onTagsUpdated = this.onTagsUpdated.bind(this);
|
this.onTagsUpdated = this.onTagsUpdated.bind(this);
|
||||||
this.handleTagsUpdated = this.handleTagsUpdated.bind(this);
|
this.handleTagsUpdated = this.handleTagsUpdated.bind(this);
|
||||||
this.tnCredsUpdated = this.tnCredsUpdated.bind(this);
|
this.tnCredsUpdated = this.tnCredsUpdated.bind(this);
|
||||||
@@ -11384,13 +11393,13 @@ class TopicCommon extends (react__WEBPACK_IMPORTED_MODULE_0___default().Componen
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (this.previousTagsUpdated && this.previousTagsUpdated != this.onTagsUpdated) {
|
if (this.previousTagsUpdated && this.previousTagsUpdated != this.onTagsUpdated) {
|
||||||
this.previousTagsUpdated();
|
this.previousTagsUpdated(tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTagsUpdated(tags) {
|
handleTagsUpdated(tags) {
|
||||||
if (!(0,_lib_utils_js__WEBPACK_IMPORTED_MODULE_4__.arrayEqual)(this.state.tags.slice(0), tags.slice(0))) {
|
if (!(0,_lib_utils_js__WEBPACK_IMPORTED_MODULE_4__.arrayEqual)(this.state.tags.slice(0), tags.slice(0))) {
|
||||||
this.props.onTopicTagsUpdate(this.props.topic, tags);
|
this.props.onTopicTagsUpdateRequest(this.props.topic, tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11431,7 +11440,7 @@ class TopicCommon extends (react__WEBPACK_IMPORTED_MODULE_0___default().Componen
|
|||||||
tinode: this.props.tinode,
|
tinode: this.props.tinode,
|
||||||
topic: this.props.topic,
|
topic: this.props.topic,
|
||||||
onUpdateTopicDesc: this.props.onUpdateTopicDesc,
|
onUpdateTopicDesc: this.props.onUpdateTopicDesc,
|
||||||
onUpdateTags: this.props.onUpdateTags,
|
onUpdateTags: this.handleTagsUpdated,
|
||||||
onError: this.props.onError
|
onError: this.props.onError
|
||||||
}), this.state.isMe ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
}), this.state.isMe ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
className: "hr"
|
className: "hr"
|
||||||
@@ -11526,11 +11535,11 @@ class TopicDescEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compon
|
|||||||
private: topic.private ? topic.private.comment : null,
|
private: topic.private ? topic.private.comment : null,
|
||||||
description: topic.public ? topic.public.note : undefined,
|
description: topic.public ? topic.public.note : undefined,
|
||||||
avatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_8__.makeImageUrl)(topic.public ? topic.public.photo : null),
|
avatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_8__.makeImageUrl)(topic.public ? topic.public.photo : null),
|
||||||
tags: topic.tags(),
|
tags: topic.tags() || [],
|
||||||
newAvatar: null,
|
newAvatar: null,
|
||||||
newAvatarMime: null,
|
newAvatarMime: null
|
||||||
previousOnTags: topic.onTagsUpdated
|
|
||||||
};
|
};
|
||||||
|
this.previousOnTags = null;
|
||||||
this.tnNewTags = this.tnNewTags.bind(this);
|
this.tnNewTags = this.tnNewTags.bind(this);
|
||||||
this.handleFullNameUpdate = this.handleFullNameUpdate.bind(this);
|
this.handleFullNameUpdate = this.handleFullNameUpdate.bind(this);
|
||||||
this.handleImageUpdated = this.handleImageUpdated.bind(this);
|
this.handleImageUpdated = this.handleImageUpdated.bind(this);
|
||||||
@@ -11544,12 +11553,13 @@ class TopicDescEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compon
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const topic = this.props.tinode.getTopic(this.props.topic);
|
const topic = this.props.tinode.getTopic(this.props.topic);
|
||||||
|
this.previousOnTags = topic.onTagsUpdated;
|
||||||
topic.onTagsUpdated = this.tnNewTags;
|
topic.onTagsUpdated = this.tnNewTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
const topic = this.props.tinode.getTopic(this.props.topic);
|
const topic = this.props.tinode.getTopic(this.props.topic);
|
||||||
topic.onTagsUpdated = this.state.previousOnTags;
|
topic.onTagsUpdated = this.previousOnTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
tnNewTags(tags) {
|
tnNewTags(tags) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user