build and bump version

This commit is contained in:
or-else
2018-08-17 16:07:03 +03:00
parent e2b19d72bc
commit fde40f4f51
3 changed files with 46 additions and 22 deletions
+44 -20
View File
@@ -662,7 +662,7 @@ class LetterTile extends React.PureComponent {
var color = "lettertile dark-color" + (Math.abs(stringHash(this.props.topic)) % 16); var color = "lettertile dark-color" + (Math.abs(stringHash(this.props.topic)) % 16);
avatar = (<div className={color}><div>{letter}</div></div>) avatar = (<div className={color}><div>{letter}</div></div>)
} else { } else {
avatar = (Tinode.getTopicType(this.props.topic) === "grp") ? avatar = (Tinode.topicType(this.props.topic) === "grp") ?
<i className="material-icons">group</i> : <i className="material-icons">group</i> :
<i className="material-icons">person</i>; <i className="material-icons">person</i>;
} }
@@ -2839,10 +2839,6 @@ 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);
if (topic.getType() === "grp") {
this.setState({tags: topic.tags()});
}
} }
} }
@@ -2901,6 +2897,13 @@ class InfoView extends React.Component {
auth: defacs.auth, auth: defacs.auth,
anon: defacs.anon anon: defacs.anon
}); });
if (topic.getType() === "grp" && acs && acs.isOwner()) {
// Requesting tags: owner is editing the topic.
topic.getMeta(topic.startMetaQuery().withTags().build()).then(() => {
this.setState({tags: topic.tags()});
});
}
} }
onMetaDesc(desc) { onMetaDesc(desc) {
@@ -3248,12 +3251,16 @@ class InfoView extends React.Component {
} }
</div> </div>
<div className="hr" /> <div className="hr" />
<TagManager {this.state.owner ?
title="Tags" <TagManager
tags={this.state.tags} title="Tags"
activated={false} tags={this.state.tags}
onSubmit={this.handleTagsUpdated} /> activated={false}
<div className="hr" /> onSubmit={this.handleTagsUpdated} />
:
null
}
{this.state.owner ? <div className="hr" /> : null }
{this.state.groupTopic ? {this.state.groupTopic ?
<div className="panel-form-column"> <div className="panel-form-column">
<div className="panel-form-row"> <div className="panel-form-row">
@@ -3662,20 +3669,29 @@ class MessagesView extends React.Component {
}); });
if (!topic.isSubscribed() && tryToResubscribe) { if (!topic.isSubscribed() && tryToResubscribe) {
var instance = this;
var getQuery = topic.startMetaQuery() var getQuery = topic.startMetaQuery()
.withLaterDesc() .withLaterDesc()
.withLaterSub() .withLaterSub()
.withLaterData(MESSAGES_PAGE) .withLaterData(MESSAGES_PAGE)
.withLaterDel(); .withLaterDel();
getQuery = topic.getType() == 'grp' ? getQuery.withTags() : getQuery; // Don't request the tags. They are useless unless the user
topic.subscribe(getQuery.build()).catch(function(err){ // is the owner and is editing the topic.
instance.props.onError(err.message, "err"); // getQuery = topic.getType() == 'grp' ? getQuery.withTags() : getQuery;
instance.setState({ // Show "loading" spinner.
this.setState({ fetchingMessages: true });
topic.subscribe(getQuery.build())
.then(() => {
// Hide spinner.
this.setState({ fetchingMessages: false });
})
.catch((err) => {
this.props.onError(err.message, "err");
this.setState({
title: "Not found", title: "Not found",
avatar: null, avatar: null,
readOnly: true, readOnly: true,
writeOnly: true writeOnly: true,
fetchingMessages: false
}); });
}); });
} }
@@ -3902,7 +3918,7 @@ class MessagesView extends React.Component {
var lastSeen = null; var lastSeen = null;
var cont = Tinode.getMeTopic().getContact(this.state.topic); var cont = Tinode.getMeTopic().getContact(this.state.topic);
if (cont && Tinode.getTopicType(cont.topic) === "p2p") { if (cont && Tinode.topicType(cont.topic) === "p2p") {
if (cont.online) { if (cont.online) {
lastSeen = "online now"; lastSeen = "online now";
} else if (cont.seen) { } else if (cont.seen) {
@@ -4405,7 +4421,7 @@ class TinodeWeb extends React.Component {
} }
// Topic for MessagesView selector. // Topic for MessagesView selector.
if (hash.path.length > 1 && hash.path[1] != this.state.topicSelected) { if (hash.path.length > 1 && hash.path[1] != this.state.topicSelected) {
var tp = Tinode.getTopicType(hash.path[1]); var tp = Tinode.topicType(hash.path[1]);
if (tp) { if (tp) {
this.setState({ this.setState({
topicSelected: hash.path[1], topicSelected: hash.path[1],
@@ -4644,7 +4660,7 @@ class TinodeWeb extends React.Component {
mobilePanel: 'topic-view', mobilePanel: 'topic-view',
topicSelectedOnline: online, topicSelectedOnline: online,
topicSelectedAcs: acs, topicSelectedAcs: acs,
infoPanelShowMembers: Tinode.getTopicType(topicName) === "grp" infoPanelShowMembers: Tinode.topicType(topicName) === "grp"
}); });
} else { } else {
if (this.state.topicSelected) { if (this.state.topicSelected) {
@@ -4695,6 +4711,12 @@ class TinodeWeb extends React.Component {
this.handleError(err.message, "err"); this.handleError(err.message, "err");
}); });
} }
if (!topic.isSubscribed()) {
if (!promise) {
promise = Promise.resolve();
}
promise = promise.then(() => { return topic.subscribe(); });
}
topic.publishDraft(msg, promise) topic.publishDraft(msg, promise)
.catch((err) => { .catch((err) => {
this.handleError(err.message, "err"); this.handleError(err.message, "err");
@@ -4784,6 +4806,8 @@ class TinodeWeb extends React.Component {
var query = topic.startMetaQuery().withDesc().withSub().withData(); var query = topic.startMetaQuery().withDesc().withSub().withData();
var setParams; var setParams;
if (!peerName) { if (!peerName) {
// Creator is the owner, has access to tags.
// Fetch default group topic tags, if any.
query = query.withTags(); query = query.withTags();
setParams = {desc: {public: pub, private: priv}, tags: tags}; setParams = {desc: {public: pub, private: priv}, tags: tags};
} }
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "tinode-webapp", "name": "tinode-webapp",
"description": "Tinode Web Client", "description": "Tinode Web Client",
"version": "0.15.4", "version": "0.15.5-rc1",
"devDependencies": { "devDependencies": {
"babel-cli": "^6.26.0", "babel-cli": "^6.26.0",
"babel-minify": "^0.4.3", "babel-minify": "^0.4.3",