FEATURE - allow category group moderators to split/merge topics (#10351)

This commit is contained in:
jbrw
2020-08-05 10:33:25 -04:00
committed by GitHub
parent a68533b394
commit 67e8bc5342
10 changed files with 488 additions and 286 deletions

View File

@@ -120,3 +120,27 @@ QUnit.test("moving posts from personal message", async assert => {
"it shows an option to move to existing message"
);
});
QUnit.test("group moderator moving posts", async assert => {
await visit("/t/topic-for-group-moderators/2480");
await click(".toggle-admin-menu");
await click(".topic-admin-multi-select .btn");
await click("#post_2 .select-below");
assert.equal(
find(".selected-posts .move-to-topic")
.text()
.trim(),
I18n.t("topic.move_to.action"),
"it should show the move to button"
);
await click(".selected-posts .move-to-topic");
assert.ok(
find(".choose-topic-modal .title")
.html()
.includes(I18n.t("topic.move_to.title")),
"it opens move to modal"
);
});

View File

@@ -5077,340 +5077,342 @@ export default {
pm_with_non_human_user: false
},
"/t/2480/1.json": {
"post_stream": {
"posts": [
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: 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: 3,
can_act: true
},
{
"id": 4,
"can_act": true
id: 4,
can_act: true
},
{
"id": 8,
"can_act": true
id: 8,
can_act: true
},
{
"id": 7,
"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
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: 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: 2,
can_act: true
},
{
"id": 3,
"can_act": true
id: 3,
can_act: true
},
{
"id": 4,
"can_act": true
id: 4,
can_act: true
},
{
"id": 8,
"can_act": true
id: 8,
can_act: true
},
{
"id": 6,
"can_act": true
id: 6,
can_act: true
},
{
"id": 7,
"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
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: 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: 3,
can_act: true
},
{
"id": 4,
"can_act": true
id: 4,
can_act: true
},
{
"id": 8,
"can_act": true
id: 8,
can_act: true
},
{
"id": 7,
"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
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": [
stream: [
41,
42,
43
]
},
"timeline_lookup": [
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: 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: 4,
count: 0,
hidden: false,
can_act: true
},
{
"id": 8,
"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
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": [
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_move_posts: true,
can_reply_as_new_topic: true,
can_flag_topic: true,
can_review_topic: true,
can_close_topic: true,
can_archive_topic: true,
can_split_merge_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: 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
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"
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"
last_poster: {
id: 3,
username: "group_moderator",
name: "",
avatar_template: "/images/avatar.png"
}
}
}