Code Monkey home page Code Monkey logo

flarum-move-posts's Introduction

Move Posts

License Latest Stable Version Total Downloads

A Flarum extension. Move posts from one discussion to another.

WARNING: This extension can in certain scenarios result in breaking old URLs to posts of the discussion you're moving posts to.

Usage

Simple Move VS Complex Move

The extension allows you to select multiple posts to move from one discussion to another. Certain scenarios are not allowed, while others are allowed but yield to different results.

Moving posts can either be a simple process of pushing the posts at the end of the target discussion, or it can be a complicated process of pushing the posts in between the target discussion's posts, thus breaking the target discussion posts's old URLs (meaning old URLs will no longer point to the correct posts, because we update their number field to allow squeezing in the moved posts). Which method will be chosen depends on the creation date of the posts being moved, and the creation date of the target discussion's last post.

The extension makes knowing which method will be used easily, by providing a Check Operation Type button in the relevant modal, so that you know what you're dealing with before proceeding.

The following diagram summarizes the couple scenarios: move-posts

Moving The First Post

When moving the first post of a discussion:

  • If the discussion only has that one post, that post will be replace by a normal post with the content The discussion has been moved to Target Discussion (the content is customizable through the admin panel).
  • If the discussion has multiple posts, the first post will be replaced by an event posts (as per usual) and the second post will be set as first.

move-posts-first

Event Posts

Moved posts are replaced by event posts.

Installation

Install with composer:

composer require sycho/flarum-move-posts:"*"

Updating

composer update sycho/flarum-move-posts:"*" --with-dependencies
php flarum migrate
php flarum cache:clear

Support

This extension is under minimal maintenance.

It was developed for a client and released as open-source for the benefit of the community. I might publish simple bugfixes or compatibility updates for free.

Links

flarum-move-posts's People

Contributors

flarum-bot avatar hari-bonda avatar rob006 avatar sycho9 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

flarum-move-posts's Issues

permissions group needed

do add permissions group allow to give access for certain users based on roles or group like we have the similar feature in merge & split extensions

Example

image

Increase space of search window for desktop view

could you please increase the space of this window so we can use the search more efficiently
currently, we could not able to read the full title of the discussion when we are searching

thanks in advance.

image

checkbox is needed for every post once we hit move post

Once we hit move post from the 3dot section it would be good if all posts get a checkbox where we can easily tick the posts and add them to our cart

it's a bit hard to select each and every post when we want to move 4 to 8 posts with the current option we have.

Thanks in advance

image

unable to move posts when the content is same or posts are created at same time

unable to move posts between discussions when their content is the same or posts are created at the same time.

and also I've noticed being unable to move the same posts back and forth multiple times within the same discussions.

not sure which scenarios are causing the error Oops! Something went wrong. Please reload the page and try again.

I was testing how it would act in such scenarios, not intended to break things on purpose ๐Ÿ˜…

Notify post owner as post is moved to different discussion (web notification only)

It would be nice if we Notify post owner as post is moved to different discussion (web notification only) so he can easily go through it.

If user clicks on notification take him to new moved discussion

I am not sure about this but split or merge extensions have this feature. (Quoting those extensions because you may find existing code examples to use for our need ๐Ÿ™‚)

You can move discussion to itself

It might sound stupid, but I just did it. :P Discussion had only one posts and I moved first post to the same discussion (I pasted discussion ID in destination discussion input). Result look like this:

5d56eaea

It would be great to have some protection against such mistakes, since it should be relatively simple to implement and such operation never makes sense.

Fix: 8.2 Argument #2 ($xml) must be of type string, null given, called in

[2023-12-02 03:12:29] flarum.ERROR: TypeError: SychO\MovePosts\Formatter\UnparsePostMentions::__invoke(): Argument #2 ($xml) must be of type string, null given, called in /public_html/vendor/flarum/core/src/Foundation/ContainerUtil.php on line 30 and defined in /public_html/vendor/sycho/flarum-move-posts/src/Formatter/UnparsePostMentions.php:18

Add: protected $xml;

Unable to move posts for deleted users

When the poster has deleted their account, an error is generated in http request and the button continues to spin:

image

It's related to this line:

MovePostsHandler.php

/**
 * Creates a target discussion when specified.
 */
protected function createTargetDiscussion(Discussion $sourceDiscussion, CommentPost $firstPost, string $title, bool $emulate): Discussion
{
    $discussion = Discussion::start($title, $firstPost->user);

When starting the discussion it appears an actual User is required, but the user of the post deleted their account. Maybe it needs to support Guest user of some kind here?

flarum v1.3 support

hello, after the update to flarum v1.3 this extension is not working, the screen is getting stuck at proceed step and the loading icon is continue to load forever. I request you to please look into this.

you can also test this at https://nightly.flarum.site/d/42-sdfds

Flarum 1.3.0
PHP 7.4.27
MySQL 5.7.34-log

allow searching discussions while moving posts into existing discussion

Like we have a search feature while merging discussion into an existing discussion in merge extension consider adding the similar feature in move posts extensions.

it will be very much helpful to search existing posts based on discussion ID or discussion title

Preview is not needed if it's possible and easy to implement display preview of above and below 1-2 posts like merge extension does.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.