FIX: Replace references to flags in the header with review

This commit is contained in:
Robin Ward 2019-04-18 13:25:23 -04:00
parent a19d89364f
commit 8e77b4d58e
5 changed files with 18 additions and 50 deletions

View File

@ -7,11 +7,6 @@ import PanEvents, {
SWIPE_VELOCITY_THRESHOLD
} from "discourse/mixins/pan-events";
const _flagProperties = [];
function addFlagProperty(prop) {
_flagProperties.pushObject(prop);
}
const PANEL_BODY_MARGIN = 30;
//android supports pulling in from the screen edges
@ -32,7 +27,8 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
@observes(
"currentUser.unread_notifications",
"currentUser.unread_private_messages"
"currentUser.unread_private_messages",
"currentUser.reviewable_count"
)
notificationsChanged() {
this.queueRerender();
@ -274,10 +270,6 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
buildArgs() {
return {
flagCount: _flagProperties.reduce(
(prev, cur) => prev + (this.get(cur) || 0),
0
),
topic: this._topic,
canSignUp: this.get("canSignUp")
};
@ -410,23 +402,6 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
export default SiteHeaderComponent;
function applyFlaggedProperties() {
const args = _flagProperties.slice();
args.push(
function() {
this.queueRerender();
}.on("init")
);
SiteHeaderComponent.reopen({
_flagsChanged: Ember.observer.apply(this, args)
});
}
addFlagProperty("currentUser.reviewable_count");
export { addFlagProperty, applyFlaggedProperties };
export function headerHeight() {
const $header = $("header.d-header");
const headerOffset = $header.offset();

View File

@ -1,6 +0,0 @@
import { applyFlaggedProperties } from "discourse/components/site-header";
export default {
name: "apply-flagged-properties",
initialize: applyFlaggedProperties
};

View File

@ -1,3 +1,4 @@
import deprecated from "discourse-common/lib/deprecated";
import { iconNode } from "discourse-common/lib/icon-library";
import { addDecorator } from "discourse/widgets/post-cooked";
import ComposerEditor from "discourse/components/composer-editor";
@ -15,7 +16,6 @@ import {
} from "discourse/widgets/widget";
import { preventCloak } from "discourse/widgets/post-stream";
import { h } from "virtual-dom";
import { addFlagProperty } from "discourse/components/site-header";
import { addPopupMenuOptionsCallback } from "discourse/controllers/composer";
import { extraConnectorClass } from "discourse/lib/plugin-connectors";
import { addPostSmallActionIcon } from "discourse/widgets/post-small-action";
@ -536,11 +536,10 @@ class PluginApi {
return reopenWidget(name, args);
}
/**
* Adds a property that can be summed for calculating the flag counter
**/
addFlagProperty(property) {
return addFlagProperty(property);
deprecated(
"addFlagProperty has been removed. Use the reviewable API instead."
);
}
/**

View File

@ -184,18 +184,18 @@ createWidget("header-icons", {
action: "toggleHamburger",
href: "",
contents() {
if (!attrs.flagCount) {
return;
let { currentUser } = this;
if (currentUser && currentUser.reviewable_count) {
return h(
"div.badge-notification.reviewables",
{
attributes: {
title: I18n.t("notifications.reviewable_items")
}
},
this.currentUser.reviewable_count
);
}
return h(
"div.badge-notification.flagged-posts",
{
attributes: {
title: I18n.t("notifications.total_flagged")
}
},
attrs.flagCount
);
}
});

View File

@ -1640,7 +1640,7 @@ en:
empty: "No notifications found."
more: "view older notifications"
post_approved: "Your post was approved"
total_flagged: "total flagged posts"
reviewable_items: "items requiring review"
mentioned: "<span>{{username}}</span> {{description}}"
group_mentioned: "<span>{{username}}</span> {{description}}"
quoted: "<span>{{username}}</span> {{description}}"