FEATURE - group modetators visual indicator (#10310)

This commit is contained in:
jbrw
2020-07-28 17:15:04 -04:00
committed by GitHub
parent 01a3fa1ca8
commit 74ab4f3bff
11 changed files with 414 additions and 17 deletions
@@ -228,6 +228,13 @@ QUnit.skip("Deleting a topic", async assert => {
assert.ok(exists(".widget-button.recover"), "it shows the recover button");
});
QUnit.test("Group category moderator posts", async assert => {
await visit("/t/topic-for-group-moderators/2480");
assert.ok(exists(".category-moderator"), "it has a class applied");
assert.ok(exists(".d-icon-shield-alt"), "it shows an icon");
});
acceptance("Topic featured links", {
loggedIn: true,
settings: {
+338
View File
@@ -5075,5 +5075,343 @@ export default {
message_bus_last_id: 7,
participant_count: 2,
pm_with_non_human_user: false
},
"/t/2480/1.json": {
"post_stream": {
"posts": [
{
"id": 41,
"name": "",
"username": "group_moderator",
"avatar_template": "/images/avatar.png",
"created_at": "2020-07-24T17:48:55.419Z",
"cooked": "<p>Here is my new topic. I am a group category moderator!</p>",
"post_number": 1,
"post_type": 1,
"updated_at": "2020-07-24T17:48:55.419Z",
"reply_count": 0,
"reply_to_post_number": null,
"quote_count": 0,
"incoming_link_count": 0,
"reads": 2,
"readers_count": 1,
"score": 0,
"yours": true,
"topic_id": 2480,
"topic_slug": "a-topic-with-group-category-moderators",
"display_username": "",
"primary_group_name": "group_moderators",
"primary_group_flair_url": "cheese",
"primary_group_flair_bg_color": "ff0",
"primary_group_flair_color": "",
"version": 1,
"can_edit": true,
"can_delete": false,
"can_recover": false,
"can_wiki": false,
"read": true,
"user_title": "a title",
"title_is_group": false,
"bookmarked": false,
"actions_summary": [
{
"id": 3,
"can_act": true
},
{
"id": 4,
"can_act": true
},
{
"id": 8,
"can_act": true
},
{
"id": 7,
"can_act": true
}
],
"moderator": false,
"admin": false,
"staff": false,
"group_moderator": true,
"user_id": 3,
"hidden": false,
"trust_level": 1,
"deleted_at": null,
"user_deleted": false,
"edit_reason": null,
"can_view_edit_history": true,
"wiki": false,
"reviewable_id": 0,
"reviewable_score_count": 0,
"reviewable_score_pending_count": 0
},
{
"id": 42,
"name": "",
"username": "normal_user",
"avatar_template": "/images/avatar.png",
"created_at": "2020-07-24T17:50:01.263Z",
"cooked": "<p>A fascinating topic worthy of discussion.</p>",
"post_number": 2,
"post_type": 1,
"updated_at": "2020-07-24T17:50:01.263Z",
"reply_count": 0,
"reply_to_post_number": null,
"quote_count": 0,
"incoming_link_count": 0,
"reads": 2,
"readers_count": 1,
"score": 0,
"yours": false,
"topic_id": 2480,
"topic_slug": "a-topic-with-group-category-moderators",
"display_username": "",
"primary_group_name": null,
"primary_group_flair_url": null,
"primary_group_flair_bg_color": null,
"primary_group_flair_color": null,
"version": 1,
"can_edit": false,
"can_delete": false,
"can_recover": false,
"can_wiki": false,
"read": true,
"user_title": null,
"bookmarked": false,
"actions_summary": [
{
"id": 2,
"can_act": true
},
{
"id": 3,
"can_act": true
},
{
"id": 4,
"can_act": true
},
{
"id": 8,
"can_act": true
},
{
"id": 6,
"can_act": true
},
{
"id": 7,
"can_act": true
}
],
"moderator": false,
"admin": false,
"staff": false,
"user_id": 2,
"hidden": false,
"trust_level": 1,
"deleted_at": null,
"user_deleted": false,
"edit_reason": null,
"can_view_edit_history": true,
"wiki": false,
"reviewable_id": 0,
"reviewable_score_count": 0,
"reviewable_score_pending_count": 0
},
{
"id": 43,
"name": "",
"username": "group_moderator",
"avatar_template": "/images/avatar.png",
"created_at": "2020-07-24T17:50:17.274Z",
"cooked": "<p>Thank you for your reply!</p>",
"post_number": 3,
"post_type": 1,
"updated_at": "2020-07-24T17:50:17.274Z",
"reply_count": 0,
"reply_to_post_number": null,
"quote_count": 0,
"incoming_link_count": 0,
"reads": 2,
"readers_count": 1,
"score": 0,
"yours": true,
"topic_id": 2480,
"topic_slug": "a-topic-with-group-category-moderators",
"display_username": "",
"primary_group_name": "group_moderators",
"primary_group_flair_url": "cheese",
"primary_group_flair_bg_color": "ff0",
"primary_group_flair_color": "",
"version": 1,
"can_edit": true,
"can_delete": true,
"can_recover": false,
"can_wiki": false,
"read": true,
"user_title": "a title",
"title_is_group": false,
"bookmarked": false,
"actions_summary": [
{
"id": 3,
"can_act": true
},
{
"id": 4,
"can_act": true
},
{
"id": 8,
"can_act": true
},
{
"id": 7,
"can_act": true
}
],
"moderator": false,
"admin": false,
"staff": false,
"group_moderator": true,
"user_id": 3,
"hidden": false,
"trust_level": 1,
"deleted_at": null,
"user_deleted": false,
"edit_reason": null,
"can_view_edit_history": true,
"wiki": false,
"reviewable_id": 0,
"reviewable_score_count": 0,
"reviewable_score_pending_count": 0
}
],
"stream": [
41,
42,
43
]
},
"timeline_lookup": [
[
1,
0
]
],
"id": 2480,
"title": "A Topic with Group Category Moderators",
"fancy_title": "A Topic with Group Category Moderators",
"posts_count": 3,
"created_at": "2020-07-24T17:48:54.986Z",
"views": 2,
"reply_count": 0,
"like_count": 0,
"last_posted_at": "2020-07-24T17:50:17.274Z",
"visible": true,
"closed": false,
"archived": false,
"has_summary": false,
"archetype": "regular",
"slug": "a-topic-with-group-category-moderators",
"category_id": 5,
"word_count": 22,
"deleted_at": null,
"user_id": 3,
"featured_link": null,
"pinned_globally": false,
"pinned_at": null,
"pinned_until": null,
"image_url": null,
"draft": null,
"draft_key": "topic_2480",
"draft_sequence": 1,
"posted": true,
"unpinned": null,
"pinned": false,
"current_post_number": 3,
"highest_post_number": 3,
"last_read_post_number": 3,
"last_read_post_id": 43,
"deleted_by": null,
"actions_summary": [
{
"id": 4,
"count": 0,
"hidden": false,
"can_act": true
},
{
"id": 8,
"count": 0,
"hidden": false,
"can_act": true
},
{
"id": 7,
"count": 0,
"hidden": false,
"can_act": true
}
],
"chunk_size": 20,
"bookmarked": false,
"topic_timer": null,
"private_topic_timer": null,
"message_bus_last_id": 4,
"participant_count": 2,
"show_read_indicator": false,
"thumbnails": null,
"details": {
"notification_level": 3,
"notifications_reason_id": 1,
"can_edit": true,
"can_create_post": true,
"can_reply_as_new_topic": true,
"can_flag_topic": true,
"can_review_topic": true,
"can_close_topic": true,
"can_archive_topic": true,
"can_edit_staff_notes": true,
"participants": [
{
"id": 3,
"username": "group_moderator",
"name": "",
"avatar_template": "/images/avatar.png",
"post_count": 2,
"primary_group_name": "group_moderators",
"primary_group_flair_url": "cheese",
"primary_group_flair_color": "",
"primary_group_flair_bg_color": "ff0"
},
{
"id": 2,
"username": "normal_user",
"name": "",
"avatar_template": "/images/avatar.png",
"post_count": 1,
"primary_group_name": null,
"primary_group_flair_url": null,
"primary_group_flair_color": null,
"primary_group_flair_bg_color": null
}
],
"created_by": {
"id": 3,
"username": "group_moderator",
"name": "",
"avatar_template": "/images/avatar.png"
},
"last_poster": {
"id": 3,
"username": "group_moderator",
"name": "",
"avatar_template": "/images/avatar.png"
}
}
}
};
+1 -8
View File
@@ -255,14 +255,7 @@ export function applyDefaultHandlers(pretender) {
pretender.get("/t/12.json", () => response(fixturesByUrl["/t/12/1.json"]));
pretender.put("/t/1234/re-pin", success);
pretender.get("/t/2480.json", () => {
const json = fixturesByUrl["/t/34/1.json"];
json.details.can_archive_topic = true;
json.details.can_close_topic = true;
json.details.can_edit_staff_notes = true;
return response(json);
});
pretender.get("/t/2480.json", () => response(fixturesByUrl["/t/2480/1.json"]));
pretender.get("/t/id_for/:slug", () => {
return response({