FIX: correct group icons and notification message (#193)
* New group icon * Group assignment notification displays group name instead of who assigned
This commit is contained in:
parent
978f3d74a1
commit
b42ec9f779
|
@ -196,9 +196,9 @@ function initialize(api) {
|
||||||
});
|
});
|
||||||
|
|
||||||
api.addPostSmallActionIcon("assigned", "user-plus");
|
api.addPostSmallActionIcon("assigned", "user-plus");
|
||||||
api.addPostSmallActionIcon("assigned_group", "user-plus");
|
api.addPostSmallActionIcon("assigned_group", "group-plus");
|
||||||
api.addPostSmallActionIcon("unassigned", "user-times");
|
api.addPostSmallActionIcon("unassigned", "user-times");
|
||||||
api.addPostSmallActionIcon("unassigned_group", "user-times");
|
api.addPostSmallActionIcon("unassigned_group", "group-times");
|
||||||
|
|
||||||
api.addPostTransformCallback((transformed) => {
|
api.addPostTransformCallback((transformed) => {
|
||||||
if (
|
if (
|
||||||
|
@ -221,7 +221,9 @@ function initialize(api) {
|
||||||
? topic.assignedToUserPath
|
? topic.assignedToUserPath
|
||||||
: topic.assignedToGroupPath;
|
: topic.assignedToGroupPath;
|
||||||
const tagName = params.tagName || "a";
|
const tagName = params.tagName || "a";
|
||||||
const icon = assignedToUser ? iconHTML("user-plus") : iconHTML("users");
|
const icon = assignedToUser
|
||||||
|
? iconHTML("user-plus")
|
||||||
|
: iconHTML("group-plus");
|
||||||
const href =
|
const href =
|
||||||
tagName === "a" ? `href="${assignedPath}" data-auto-route="true"` : "";
|
tagName === "a" ? `href="${assignedPath}" data-auto-route="true"` : "";
|
||||||
return `<${tagName} class="assigned-to discourse-tag simple" ${href}>
|
return `<${tagName} class="assigned-to discourse-tag simple" ${href}>
|
||||||
|
@ -254,7 +256,7 @@ function initialize(api) {
|
||||||
let { assignedToUser, assignedToGroup, href } = attrs;
|
let { assignedToUser, assignedToGroup, href } = attrs;
|
||||||
|
|
||||||
return h("p.assigned-to", [
|
return h("p.assigned-to", [
|
||||||
assignedToUser ? iconNode("user-plus") : iconNode("users"),
|
assignedToUser ? iconNode("user-plus") : iconNode("group-plus"),
|
||||||
h("span.assign-text", I18n.t("discourse_assign.assigned_to")),
|
h("span.assign-text", I18n.t("discourse_assign.assigned_to")),
|
||||||
h(
|
h(
|
||||||
"a",
|
"a",
|
||||||
|
@ -330,7 +332,7 @@ function initialize(api) {
|
||||||
|
|
||||||
api.replaceIcon(
|
api.replaceIcon(
|
||||||
"notification.discourse_assign.assign_group_notification",
|
"notification.discourse_assign.assign_group_notification",
|
||||||
"users"
|
"group-plus"
|
||||||
);
|
);
|
||||||
|
|
||||||
api.modifyClass("controller:preferences/notifications", {
|
api.modifyClass("controller:preferences/notifications", {
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default DropdownSelectBoxComponent.extend({
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
id: "unassign",
|
id: "unassign",
|
||||||
icon: "user-times",
|
icon: this.group ? "group-times" : "user-times",
|
||||||
name: I18n.t("discourse_assign.unassign.title"),
|
name: I18n.t("discourse_assign.unassign.title"),
|
||||||
description: I18n.t("discourse_assign.unassign.help", {
|
description: I18n.t("discourse_assign.unassign.help", {
|
||||||
username: this.assignee,
|
username: this.assignee,
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
{{assign-actions-dropdown
|
{{assign-actions-dropdown
|
||||||
topic=topic
|
topic=topic
|
||||||
assignee=topic.assigned_to_group.name
|
assignee=topic.assigned_to_group.name
|
||||||
|
group=true
|
||||||
unassign=unassign
|
unassign=unassign
|
||||||
reassign=reassign
|
reassign=reassign
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { h } from "virtual-dom";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
||||||
const ICON = "user-plus";
|
const ICON = "user-plus";
|
||||||
const GROUP_ICON = "users";
|
const GROUP_ICON = "group-plus";
|
||||||
|
|
||||||
createWidget("no-quick-access-assignments", {
|
createWidget("no-quick-access-assignments", {
|
||||||
html() {
|
html() {
|
||||||
|
|
|
@ -12,7 +12,8 @@ module Jobs
|
||||||
topic = Topic.find(args[:topic_id])
|
topic = Topic.find(args[:topic_id])
|
||||||
assigned_by = User.find(args[:assigned_by_id])
|
assigned_by = User.find(args[:assigned_by_id])
|
||||||
first_post = topic.posts.find_by(post_number: 1)
|
first_post = topic.posts.find_by(post_number: 1)
|
||||||
assigned_to_users = args[:assigned_to_type] == "User" ? [User.find(args[:assigned_to_id])] : Group.find(args[:assigned_to_id]).users
|
assigned_to = args[:assigned_to_type] == "User" ? User.find(args[:assigned_to_id]) : Group.find(args[:assigned_to_id])
|
||||||
|
assigned_to_users = args[:assigned_to_type] == "User" ? [assigned_to] : assigned_to.users
|
||||||
|
|
||||||
assigned_to_users.each do |user|
|
assigned_to_users.each do |user|
|
||||||
TopicAssigner.publish_topic_tracking_state(topic, user.id)
|
TopicAssigner.publish_topic_tracking_state(topic, user.id)
|
||||||
|
@ -40,7 +41,7 @@ module Jobs
|
||||||
high_priority: true,
|
high_priority: true,
|
||||||
data: {
|
data: {
|
||||||
message: args[:assigned_to_type] == "User" ? 'discourse_assign.assign_notification' : 'discourse_assign.assign_group_notification',
|
message: args[:assigned_to_type] == "User" ? 'discourse_assign.assign_notification' : 'discourse_assign.assign_group_notification',
|
||||||
display_username: assigned_by.username,
|
display_username: args[:assigned_to_type] == "User" ? assigned_by.username : assigned_to.name,
|
||||||
topic_title: topic.title
|
topic_title: topic.title
|
||||||
}.to_json
|
}.to_json
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,6 +14,8 @@ register_asset 'stylesheets/mobile/assigns.scss', :mobile
|
||||||
register_svg_icon "user-plus"
|
register_svg_icon "user-plus"
|
||||||
register_svg_icon "user-times"
|
register_svg_icon "user-times"
|
||||||
|
|
||||||
|
%w[user-plus user-times group-plus group-times].each { |i| register_svg_icon(i) }
|
||||||
|
|
||||||
load File.expand_path('../lib/discourse_assign/engine.rb', __FILE__)
|
load File.expand_path('../lib/discourse_assign/engine.rb', __FILE__)
|
||||||
load File.expand_path('../lib/discourse_assign/helpers.rb', __FILE__)
|
load File.expand_path('../lib/discourse_assign/helpers.rb', __FILE__)
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ RSpec.describe Jobs::AssignNotification do
|
||||||
high_priority: true,
|
high_priority: true,
|
||||||
data: {
|
data: {
|
||||||
message: 'discourse_assign.assign_group_notification',
|
message: 'discourse_assign.assign_group_notification',
|
||||||
display_username: user1.username,
|
display_username: group.name,
|
||||||
topic_title: topic.title
|
topic_title: topic.title
|
||||||
}.to_json
|
}.to_json
|
||||||
)
|
)
|
||||||
|
@ -107,7 +107,7 @@ RSpec.describe Jobs::AssignNotification do
|
||||||
high_priority: true,
|
high_priority: true,
|
||||||
data: {
|
data: {
|
||||||
message: 'discourse_assign.assign_group_notification',
|
message: 'discourse_assign.assign_group_notification',
|
||||||
display_username: user1.username,
|
display_username: group.name,
|
||||||
topic_title: topic.title
|
topic_title: topic.title
|
||||||
}.to_json
|
}.to_json
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
||||||
|
<symbol id='group-plus' viewBox="0 0 30.7 19"><path d="m13.8 9.04c-2.49 0-4.52-2.03-4.52-4.52s2.03-4.52 4.52-4.52 4.52 2.03 4.52 4.52-2.03 4.52-4.52 4.52z"/><path d="m21 19h-14.5c-0.5 0-0.969-0.408-0.904-0.904 0 0-0.0338-3.27 0.613-4.72 0.552-1.24 1.46-2.43 2.65-3.08 1.58-0.865 3.93 1.92 7.79-0.184 1.19-0.649 3.44 1.59 4.4 3.11 0.878 1.39 0.828 4.87 0.828 4.87 0 0.5-0.404 0.904-0.904 0.904z"/><path d="m8.12 4.02c0-0.177 0.0099-0.354 0.0262-0.526-0.664-0.778-1.64-1.28-2.74-1.28-1.99 0-3.62 1.62-3.62 3.62s1.62 3.62 3.62 3.62c1.66 0 3.05-1.14 3.47-2.67-0.48-0.81-0.761-1.75-0.761-2.76z"/><path d="m6.84 10.8s-2.71 0.42-3.96 0.0645c-1.23-0.351-2.06 1.78-2.55 3-0.634 1.58-0.161 3.33-0.161 3.33 0 0.5 0.404 0.917 0.904 0.904h3.62s-0.0879-1.58 0.484-3.56c0.571-1.97 0.976-2.36 1.41-2.87 0.237-0.316 0.258-0.87 0.258-0.87z"/><path d="m30.1 7.4h-2.52v-2.52c0-0.347-0.284-0.63-0.63-0.63h-1.26c-0.347 0-0.63 0.284-0.63 0.63v2.52h-2.52c-0.347 0-0.63 0.284-0.63 0.63v1.26c0 0.347 0.284 0.63 0.63 0.63h2.52v2.52c0 0.347 0.284 0.63 0.63 0.63h1.26c0.347 0 0.63-0.284 0.63-0.63v-2.52h2.52c0.347 0 0.63-0.284 0.63-0.63v-1.26c0-0.347-0.284-0.63-0.63-0.63z"/></symbol>
|
||||||
|
<symbol id='group-times' viewBox="0 0 30.7 19"><path d="m13.8 9.04c-2.49 0-4.52-2.03-4.52-4.52s2.03-4.52 4.52-4.52 4.52 2.03 4.52 4.52-2.03 4.52-4.52 4.52z"/><path d="m21 19h-14.5c-0.5 0-0.969-0.408-0.904-0.904 0 0-0.0338-3.27 0.613-4.72 0.552-1.24 1.46-2.43 2.65-3.08 1.58-0.865 3.93 1.92 7.79-0.184 1.19-0.649 3.44 1.59 4.4 3.11 0.878 1.39 0.828 4.87 0.828 4.87 0 0.5-0.404 0.904-0.904 0.904z"/><path d="m8.12 4.02c0-0.177 0.0099-0.354 0.0262-0.526-0.664-0.778-1.64-1.28-2.74-1.28-1.99 0-3.62 1.62-3.62 3.62s1.62 3.62 3.62 3.62c1.66 0 3.05-1.14 3.47-2.67-0.48-0.81-0.761-1.75-0.761-2.76z"/><path d="m6.84 10.8s-2.71 0.42-3.96 0.0645c-1.23-0.351-2.06 1.78-2.55 3-0.634 1.58-0.161 3.33-0.161 3.33 0 0.5 0.404 0.917 0.904 0.904h3.62s-0.0879-1.58 0.484-3.56c0.571-1.97 0.976-2.36 1.41-2.87 0.237-0.316 0.258-0.87 0.258-0.87z"/><path d="m28.1 5.1-1.78 1.78-1.78-1.78c-0.245-0.245-0.646-0.245-0.891 0l-0.891 0.891c-0.245 0.245-0.245 0.646 0 0.891l1.78 1.78-1.78 1.78c-0.245 0.245-0.245 0.646 0 0.891l0.891 0.891c0.245 0.245 0.646 0.245 0.891 0l1.78-1.78 1.78 1.78c0.245 0.245 0.646 0.245 0.891 0l0.891-0.891c0.245-0.245 0.245-0.646 0-0.891l-1.78-1.78 1.78-1.78c0.245-0.245 0.245-0.646 0-0.891l-0.891-0.891c-0.245-0.245-0.646-0.245-0.891 0z"/></symbol>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.5 KiB |
|
@ -75,7 +75,7 @@ acceptance("Discourse Assign | Assigned topic", function (needs) {
|
||||||
"Developers",
|
"Developers",
|
||||||
"shows assignment in the first post"
|
"shows assignment in the first post"
|
||||||
);
|
);
|
||||||
assert.ok(exists("#post_1 .assigned-to svg.d-icon-users"));
|
assert.ok(exists("#post_1 .assigned-to svg.d-icon-group-plus"));
|
||||||
assert.ok(
|
assert.ok(
|
||||||
exists("#topic-footer-button-assign .unassign-label"),
|
exists("#topic-footer-button-assign .unassign-label"),
|
||||||
"shows unassign button at the bottom of the topic"
|
"shows unassign button at the bottom of the topic"
|
||||||
|
|
Loading…
Reference in New Issue