Revert "FEATURE: Publish read state on group messages. (#7989)"

This reverts commit 1630dae2db.
This commit is contained in:
romanrizzi
2019-08-20 10:24:34 -03:00
parent 1630dae2db
commit 67f5cc1ce8
35 changed files with 21 additions and 524 deletions
@@ -40,8 +40,7 @@ export default MountWidget.extend({
"gaps",
"selectedQuery",
"selectedPostsCount",
"searchService",
"showReadIndicator"
"searchService"
);
},
@@ -292,12 +291,6 @@ export default MountWidget.extend({
onRefresh: "refreshLikes"
});
}
if (args.refreshReaders) {
this.dirtyKeys.keyDirty(`post-menu-${args.id}`, {
onRefresh: "refreshReaders"
});
}
} else if (args.force) {
this.dirtyKeys.forceAll();
}
@@ -35,42 +35,6 @@ export const ListItemDefaults = {
attributeBindings: ["data-topic-id"],
"data-topic-id": Ember.computed.alias("topic.id"),
didInsertElement() {
this._super(...arguments);
if (typeof this.get("topic.read_by_group_member") !== "undefined") {
this.messageBus.subscribe(this.readIndicatorChannel, data => {
const nodeClassList = document.querySelector(
`.indicator-topic-${data.topic_id}`
).classList;
if (data.show_indicator) {
nodeClassList.remove("unread");
} else {
nodeClassList.add("unread");
}
});
}
},
willDestroyElement() {
this._super(...arguments);
if (typeof this.get("topic.read_by_group_member") !== "undefined") {
this.messageBus.unsubscribe(this.readIndicatorChannel);
}
},
@computed("topic.id")
readIndicatorChannel(topicId) {
return `/private-messages/group-read/${topicId}`;
},
@computed("topic.read_by_group_member")
unreadClass(readByGroupMember) {
return readByGroupMember ? "" : "unread";
},
@computed
newDotText() {
return this.currentUser && this.currentUser.trust_level > 0
@@ -1348,17 +1348,6 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
})
.then(() => refresh({ id: data.id, refreshLikes: true }));
break;
case "read":
postStream
.triggerChangedPost(data.id, data.updated_at, {
preserveCooked: true
})
.then(() =>
refresh({
id: data.id,
refreshReaders: topic.show_read_indicator
})
);
case "revised":
case "rebaked": {
postStream
@@ -71,8 +71,7 @@ export function transformBasicPost(post) {
expandablePost: false,
replyCount: post.reply_count,
locked: post.locked,
userCustomFields: post.user_custom_fields,
readCount: post.readers_count
userCustomFields: post.user_custom_fields
};
_additionalAttributes.forEach(a => (postAtts[a] = post[a]));
@@ -178,8 +178,7 @@ const Group = RestModel.extend({
allow_membership_requests: this.allow_membership_requests,
full_name: this.full_name,
default_notification_level: this.default_notification_level,
membership_request_template: this.membership_request_template,
publish_read_state: this.publish_read_state
membership_request_template: this.membership_request_template
};
if (!this.id) {
@@ -52,16 +52,6 @@
class="groups-form-messageable-level"}}
</div>
<div class="control-group">
<label>
{{input type="checkbox"
checked=model.publish_read_state
class="groups-form-publish-read-state"}}
{{i18n 'admin.groups.manage.interaction.publish_read_state'}}
</label>
</div>
{{#if showEmailSettings}}
<div class="control-group">
<label class="control-label">{{i18n 'admin.groups.manage.interaction.email'}}</label>
@@ -23,9 +23,6 @@
{{~#if showTopicPostBadges}}
{{~raw "topic-post-badges" unread=topic.unread newPosts=topic.displayNewPosts unseen=topic.unseen url=topic.lastUnreadUrl newDotText=newDotText}}
{{~/if}}
<span class='read-indicator indicator-topic-{{topic.id}} {{readStatus}}'>
{{~d-icon "far-eye"}}
</span>
</span>
<div class="link-bottom-line">
{{#unless hideCategory}}
@@ -177,7 +177,6 @@
selectedPostsCount=selectedPostsCount
selectedQuery=selectedQuery
gaps=model.postStream.gaps
showReadIndicator=model.show_read_indicator
showFlags=(action "showPostFlags")
editPost=(action "editPost")
showHistory=(route-action "showHistory")
@@ -52,36 +52,6 @@ export function buildButton(name, widget) {
}
}
registerButton("read-count", attrs => {
if (attrs.showReadIndicator) {
const count = attrs.readCount;
if (count > 0) {
return {
action: "toggleWhoRead",
title: "post.controls.read_indicator",
className: "button-count read-indicator",
contents: count,
iconRight: true,
addContainer: false
};
}
}
});
registerButton("read", attrs => {
const disabled = attrs.readCount === 0;
if (attrs.showReadIndicator) {
return {
action: "toggleWhoRead",
title: "post.controls.read_indicator",
icon: "far-eye",
before: "read-count",
addContainer: false,
disabled
};
}
});
function likeCount(attrs) {
const count = attrs.likeCount;
@@ -371,12 +341,7 @@ export default createWidget("post-menu", {
},
defaultState() {
return {
collapsed: true,
likedUsers: [],
readers: [],
adminVisible: false
};
return { collapsed: true, likedUsers: [], adminVisible: false };
},
buildKey: attrs => `post-menu-${attrs.id}`,
@@ -543,19 +508,6 @@ export default createWidget("post-menu", {
);
}
if (state.readers.length) {
const remaining = state.totalReaders - state.readers.length;
contents.push(
this.attach("small-user-list", {
users: state.readers,
addSelf: false,
listClassName: "who-read",
description: "post.actions.people.read",
count: remaining
})
);
}
return contents;
},
@@ -573,15 +525,9 @@ export default createWidget("post-menu", {
showMoreActions() {
this.state.collapsed = false;
const likesPromise = !this.state.likedUsers.length
? this.getWhoLiked()
: Ember.RSVP.resolve();
return likesPromise.then(() => {
if (!this.state.readers.length) {
return this.getWhoRead();
}
});
if (!this.state.likedUsers.length) {
return this.getWhoLiked();
}
},
like() {
@@ -616,12 +562,6 @@ export default createWidget("post-menu", {
}
},
refreshReaders() {
if (this.state.readers.length) {
return this.getWhoRead();
}
},
getWhoLiked() {
const { attrs, state } = this;
@@ -636,15 +576,6 @@ export default createWidget("post-menu", {
});
},
getWhoRead() {
const { attrs, state } = this;
return this.store.find("post-reader", { id: attrs.id }).then(users => {
state.readers = users.map(avatarAtts);
state.totalReaders = users.totalRows;
});
},
toggleWhoLiked() {
const state = this.state;
if (state.likedUsers.length) {
@@ -652,14 +583,5 @@ export default createWidget("post-menu", {
} else {
return this.getWhoLiked();
}
},
toggleWhoRead() {
const state = this.state;
if (this.state.readers.length) {
state.readers = [];
} else {
return this.getWhoRead();
}
}
});
@@ -136,7 +136,6 @@ export default createWidget("post-stream", {
this.attach("post-small-action", transformed, { model: post })
);
} else {
transformed.showReadIndicator = attrs.showReadIndicator;
result.push(this.attach("post", transformed, { model: post }));
}