FIX: Replace references to flags in the header with review
This commit is contained in:
parent
a19d89364f
commit
8e77b4d58e
|
@ -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();
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import { applyFlaggedProperties } from "discourse/components/site-header";
|
||||
|
||||
export default {
|
||||
name: "apply-flagged-properties",
|
||||
initialize: applyFlaggedProperties
|
||||
};
|
|
@ -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."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -184,19 +184,19 @@ createWidget("header-icons", {
|
|||
action: "toggleHamburger",
|
||||
href: "",
|
||||
contents() {
|
||||
if (!attrs.flagCount) {
|
||||
return;
|
||||
}
|
||||
let { currentUser } = this;
|
||||
if (currentUser && currentUser.reviewable_count) {
|
||||
return h(
|
||||
"div.badge-notification.flagged-posts",
|
||||
"div.badge-notification.reviewables",
|
||||
{
|
||||
attributes: {
|
||||
title: I18n.t("notifications.total_flagged")
|
||||
title: I18n.t("notifications.reviewable_items")
|
||||
}
|
||||
},
|
||||
attrs.flagCount
|
||||
this.currentUser.reviewable_count
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const search = this.attach("header-dropdown", {
|
||||
|
|
|
@ -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}}"
|
||||
|
|
Loading…
Reference in New Issue