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
|
SWIPE_VELOCITY_THRESHOLD
|
||||||
} from "discourse/mixins/pan-events";
|
} from "discourse/mixins/pan-events";
|
||||||
|
|
||||||
const _flagProperties = [];
|
|
||||||
function addFlagProperty(prop) {
|
|
||||||
_flagProperties.pushObject(prop);
|
|
||||||
}
|
|
||||||
|
|
||||||
const PANEL_BODY_MARGIN = 30;
|
const PANEL_BODY_MARGIN = 30;
|
||||||
|
|
||||||
//android supports pulling in from the screen edges
|
//android supports pulling in from the screen edges
|
||||||
|
@ -32,7 +27,8 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
||||||
|
|
||||||
@observes(
|
@observes(
|
||||||
"currentUser.unread_notifications",
|
"currentUser.unread_notifications",
|
||||||
"currentUser.unread_private_messages"
|
"currentUser.unread_private_messages",
|
||||||
|
"currentUser.reviewable_count"
|
||||||
)
|
)
|
||||||
notificationsChanged() {
|
notificationsChanged() {
|
||||||
this.queueRerender();
|
this.queueRerender();
|
||||||
|
@ -274,10 +270,6 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
||||||
|
|
||||||
buildArgs() {
|
buildArgs() {
|
||||||
return {
|
return {
|
||||||
flagCount: _flagProperties.reduce(
|
|
||||||
(prev, cur) => prev + (this.get(cur) || 0),
|
|
||||||
0
|
|
||||||
),
|
|
||||||
topic: this._topic,
|
topic: this._topic,
|
||||||
canSignUp: this.get("canSignUp")
|
canSignUp: this.get("canSignUp")
|
||||||
};
|
};
|
||||||
|
@ -410,23 +402,6 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {
|
||||||
|
|
||||||
export default SiteHeaderComponent;
|
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() {
|
export function headerHeight() {
|
||||||
const $header = $("header.d-header");
|
const $header = $("header.d-header");
|
||||||
const headerOffset = $header.offset();
|
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 { iconNode } from "discourse-common/lib/icon-library";
|
||||||
import { addDecorator } from "discourse/widgets/post-cooked";
|
import { addDecorator } from "discourse/widgets/post-cooked";
|
||||||
import ComposerEditor from "discourse/components/composer-editor";
|
import ComposerEditor from "discourse/components/composer-editor";
|
||||||
|
@ -15,7 +16,6 @@ import {
|
||||||
} from "discourse/widgets/widget";
|
} from "discourse/widgets/widget";
|
||||||
import { preventCloak } from "discourse/widgets/post-stream";
|
import { preventCloak } from "discourse/widgets/post-stream";
|
||||||
import { h } from "virtual-dom";
|
import { h } from "virtual-dom";
|
||||||
import { addFlagProperty } from "discourse/components/site-header";
|
|
||||||
import { addPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
import { addPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
||||||
import { extraConnectorClass } from "discourse/lib/plugin-connectors";
|
import { extraConnectorClass } from "discourse/lib/plugin-connectors";
|
||||||
import { addPostSmallActionIcon } from "discourse/widgets/post-small-action";
|
import { addPostSmallActionIcon } from "discourse/widgets/post-small-action";
|
||||||
|
@ -536,11 +536,10 @@ class PluginApi {
|
||||||
return reopenWidget(name, args);
|
return reopenWidget(name, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a property that can be summed for calculating the flag counter
|
|
||||||
**/
|
|
||||||
addFlagProperty(property) {
|
addFlagProperty(property) {
|
||||||
return addFlagProperty(property);
|
deprecated(
|
||||||
|
"addFlagProperty has been removed. Use the reviewable API instead."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -184,19 +184,19 @@ createWidget("header-icons", {
|
||||||
action: "toggleHamburger",
|
action: "toggleHamburger",
|
||||||
href: "",
|
href: "",
|
||||||
contents() {
|
contents() {
|
||||||
if (!attrs.flagCount) {
|
let { currentUser } = this;
|
||||||
return;
|
if (currentUser && currentUser.reviewable_count) {
|
||||||
}
|
|
||||||
return h(
|
return h(
|
||||||
"div.badge-notification.flagged-posts",
|
"div.badge-notification.reviewables",
|
||||||
{
|
{
|
||||||
attributes: {
|
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", {
|
const search = this.attach("header-dropdown", {
|
||||||
|
|
|
@ -1640,7 +1640,7 @@ en:
|
||||||
empty: "No notifications found."
|
empty: "No notifications found."
|
||||||
more: "view older notifications"
|
more: "view older notifications"
|
||||||
post_approved: "Your post was approved"
|
post_approved: "Your post was approved"
|
||||||
total_flagged: "total flagged posts"
|
reviewable_items: "items requiring review"
|
||||||
mentioned: "<span>{{username}}</span> {{description}}"
|
mentioned: "<span>{{username}}</span> {{description}}"
|
||||||
group_mentioned: "<span>{{username}}</span> {{description}}"
|
group_mentioned: "<span>{{username}}</span> {{description}}"
|
||||||
quoted: "<span>{{username}}</span> {{description}}"
|
quoted: "<span>{{username}}</span> {{description}}"
|
||||||
|
|
Loading…
Reference in New Issue