Coder Social home page Coder Social logo

gabrieljackson / mattermost-plugin-wrangler Goto Github PK

View Code? Open in Web Editor NEW
48.0 5.0 13.0 795 KB

Manage Mattermost Messages Masterfully!

License: Apache License 2.0

Makefile 3.57% Go 67.04% JavaScript 1.16% TypeScript 27.93% SCSS 0.30%
mattermost mattermost-plugin golang go typescript react redux

mattermost-plugin-wrangler's Introduction

wrangler

Mattermost Wrangler Plugin

CI Go Report Card

A community supported Mattermost plugin for managing messages.

About

Sometimes Mattermost messages just don't end up in the right place. Wrangler can help with that by providing the following:

  1. Move a single message or thread to a new channel.
  2. Copy a single message or thread to a new channel.
  3. Attach non-threaded messages to a thread.

These functions are designed to quickly bring messages to a place they likely have more relevance in. Example uses include moving a question to a channel where users have direct expertise or to attach a single message to a thread that it obviously was related to.

move-thread-modal

Install

  1. Go the releases page and download the latest release.
  2. On your Mattermost, go to System Console -> Plugin Management and upload it.
  3. Configure plugin settings as desired.
  4. In order for the plugin to properly recreate messages, ensure the following system console settings are set to true:
    1. Enable integrations to override usernames
    2. Enable integrations to override profile picture icons
  5. Start using the plugin!

Questions?

Start by reviewing the FAQ if you have any questions. Feel free to open a GitHub issue if you need additional assistance.

Commands

Type /wrangler for a list of all Wrangler commands.

/wrangler move thread

A powerful command that can "move" a message along with its parent thread to a new channel.

Note that the command works by creating new messages in the target channel, but preserves most of the original message metadata. Ordering is kept intact, but the messages contain new timestamps so that channel message history is not altered.

Example

A thread that was started in channel1 is moved to channel2.

channel1

The thread after being "moved" to channel2.

channel2

/wrangler copy thread

Similar to the move command, this will duplicate a message or thread and put the copy in another new channel.

/wrangler attach message

Attaches a message that is not currently in a thread to an existing message or thread in the same channel.

This is useful for bringing normal messages about a topic into threads that they relate to.

/wrangler list channels

Lists channel IDs that you belong to across all teams.

/wrangler list channels

Lists recent message IDs from the current channel.

/wrangler info

Shows version and commit information for the currently-running plugin build.

Configuration Options

The following plugin configuration is available:

  • Permitted Wrangler Users: Choose who is allowed to use the Wrangler plugin.
  • Allowed Email Domain: "(Optional) When set, users must have an email ending in this domain to use Wrangler. Multiple domains can be specified by separating them with commas. This also supports full email address matching if you want to limit plugin usage to specific users.
  • Enable Wrangler webapp functionality: Enable the work-in-progress Wrangler webapp functionality.
  • Enable Wrangler Command AutoComplete: Control whether command autocomplete is enabled or not. If enabled and Allowed Email Domain is set, then some users will be able to see the Wrangler commands, but will be unable to run them.
  • Max Thread Count Move Size: an optional setting to limit the size of threads that can be moved
  • Enable Moving Threads To Different Teams: Control whether Wrangler is permitted to move message threads from one team to another or not.
  • Enable Moving Threads From Private Channels: Control whether Wrangler is permitted to move message threads from private channels or not.
  • Enable Moving Threads From Direct Message Channels: Control whether Wrangler is permitted to move message threads from direct message channels or not.
  • Enable Moving Threads From Group Message Channels: Control whether Wrangler is permitted to move message threads from group message channels or not.
  • Message customization: Various customization options are available to tailor the direct messages that are sent from Wrangler.

FAQ

Q: I would very much like some UI please.

A: That isn't a question, but I hear you. The Wrangler UI can be enabled in plugin settings in the system console.


Q: Why don't I see any command autocomplete options when I type /wrangler?

A: Command autocomplete can also be enabled in plugin settings in the system console. Keep in mind that all users can see autocomplete prompts even if they don't have permissions to use Wrangler.


Q: It would be awesome if Wrangler could do this other thing! Is that coming any time soon?

A: Please open a GitHub issue and I will see if we can implement it. Keep in mind that security and stability is always prioritized when adding features that may have edge cases where message management could have undesired outcomes.


Q: Why do I see (message deleted) when I use Wrangler?

A: Wrangler often performs message management tasks by recreating messages and deleting the originals. This results in a fairly seamless experience, but does have some side effects that can't be resolved without some core changes to Mattermost itself. The (message deleted) system posts are the most common example of this. Ideally, future changes to Mattermost could allow for direct message movement which would provide a more seamless and efficient user experience. For now, this is the best we can do.


Q: When I run /wranger attach message it seems like the attached message is out of order?

A: When attaching a message, it's necessary to create a new post in the thread which triggers the default behavior of Mattermost to show the message at the bottom of the channel. The message has been attached to the thread with the correct timestamp of when it was originally posted though, so simply reloading the channel will resolve the out-of-order behavior you are initially experiencing. This is also something I would like to improve in the future if possible. (Note that this behavior was changed for Wrangler after v0.3.0 was cut)


Q: What are some of the edge cases of using Wrangler that I may want to know about?

A: As mentioned above, Wrangler simulates moving messages by creating new messages and deleting the originals. As such, here are some things to keep in mind.

If the process of creating the new messages fails for any reason then you may end up in a situation where some new messages exist at the target location along with all of the original messages remaining as they were. Wrangler only deletes the original messages after completing the given task successfully. The most common failure in message actions involves trying to manage lengthy threads that have many large file attachments. These attachments need to be duplicated in the new location which can put temporary strain on the Mattermost server completing the task.

Another situation which may be confusing involves moving messages to a channel or team where some of the original users are not a member of. The new messages will look like they were posted by these users in the new location, but the users themselves will still not be added as members of the new location. To summarize, Wrangler checks many aspects of the messages being moved, but it doesn't review memberships for each user of each message before taking action.


Q: Is there a way to undo the message action I just took?

A: No. If you moved a thread then moving it back should be simple enough, but there is no way to directly undo the actions that Wrangler takes.


Q: What does it mean for a plugin to be community supported?

A: Wrangler is one of many plugins that is available to be deployed to a Mattermost instance, but is not directly maintained by Mattermost. Instead, community contributions are accepted for fixes and new features.

mattermost-plugin-wrangler's People

Contributors

crspeller avatar gabrieljackson avatar haliax avatar swills avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mattermost-plugin-wrangler's Issues

Users get a white screen on browser & app when activated in 7.1/7.2

Some users are experiencing a white /empty screen with Wrangler enabled in 7.1/7.2

I disabled all plugins & enabled them one-by-one. Apparently, when enabling Wrangler the issue came back.

Server logs are empty. The issue doesn't affect all users, but I got messages from at least three.

Forwarding a message to another person

Hello to all friends

The "Wrangler" plugin can only be used to move and copy messages to other channels !!...

Forwarding a message to another person is one of the requirements for your messenger...

Plugin resources are loaded from mattermost domain disregarding context path

I have a Mattermost server behind nginx with a URL with a context path, eg https://MY-DOMAIN/mattermost/ (and Mattermost works fine)

When mattermost loads, I see the following URL in developer console with a 404:
https://MY-DOMAIN/plugins/com.github.matterpoll.matterpoll/api/v1/configuration

But it should be:
https://MY-DOMAIN/mattermost/plugins/com.github.matterpoll.matterpoll/api/v1/configuration

I am using the recommended nginx proxy configuration which does not cover /plugins (nor should it). Since I have a context path, my nginx location block is set to location /mattermost { .... The mattermost system console has the site url set with the context path.

Wrangler commands still work, but the UI does not load. I've attempted to temporarily add /plugins to the nginx proxied URLs, and the resource is then loaded correctly. I still did not discover any Wrangler UI (but I don't know where to look).

  • Mattermost Server 7.5.2
  • Wrangler Plugin 0.7.0

Inexplicable error message

I tried to post a post (thread) from a direct message channel to a private channel within the same team. However, I get the error message:

"Wrangler is currently configured to not allow moving messages to different teams"

RPC call OnConfigurationChange to plugin failed

Hi

I uploaded the plugin to my 5.19.0 instance and activated it. The plugin is showed as running and i can see it in the process list.

But when i type /wrangler it doesn't show up.

In the logs i see this:

{"level":"error","ts":1579872782.813044,"caller":"mlog/log.go:174","msg":"RPC call OnConfigurationChange to plugin failed.","plugin_id":"com.mattermost.wrangler","error":"connection is shut down"}

Commands: allow links to be used in stead of message IDs.

The Wrangler-UI and Mattermost's built-in moderation tools are currently not usable on mobile. The only way to move/copy messages on mobile is to use Slash-Commands. An example command would be /wrangler attach message message_id_1 message_id_2.

The only way to get those message IDs on mobile is to use the built-in 'copy link' feature. It gives a link like https://instance_url/team_id/pl/8w89igrsffyt3ghmwsmsgyeoqe. To use that ID for the command, a big part of that link has to be removed manually. It has to be done two times on small displays, and scrolling is quite tedious.

I would suggest allowing the use of URLs as parameters as well. With a simple regex, the URLs could be validated and edited to get the ID of the corresponding messages. This would greatly increase the usability of this plugin.

I am down to create a PR with these changes in the upcoming days if there are no reservations against it.

Give option for more discreet notification when a thread is moved

The bot's message when a thread is moved to a different channel takes a lot of space, it would be great if there was a way to have it be just a simple message that says "A thread has been moved to this channel" (and "this channel" could be hyperlinked to the thread's new location). If folks find it helpful to have all the information that is currently included in the message, this could be set in a plugin setting to show a short or long notification message.

Retain date order of integrated messages into a thread

It seems we're having problems where when we integrate a message into a thread it does not retain the original date order in the thread. This is very problematic as we have some very badly behaved users that frequently need thread integration (and they are in a position where we can't force them to improve their behavior)... We need the plugin to somehow retain message metadata and integrate at the time-appropriate point in threads, please.

Newly created channel does not show in Move Thread modal

Repro steps:

  • Create a new channel
  • Navigate to a different channel where a post exists
  • Click the Wrangler's post dropdown menu item
  • Observe that the new channel made does not show in the modal's dropdown

Refreshing makes it so the new channel appears in the modal

Option to disable bot notification message?

I would like to ask if the bot has an option (or if there is a consideration to provide an option) for users to copy messages/threads to a channel, and disable the notification message that comes with the copied message.

I probably understand that there is reason to keep the message (for privacy notice), and keeping the bot notification message on the original channel/PM is fine.

However, I am wondering if there is an option to disable the message that is attached to the copied message/thread on the receiving channel?

For example, my core use case for this bot is whenever a person leaves the organisation, we want to copy the history and paste it to a channel, so that the person taking over can have a knowledge transfer. However, with so many threads being copied, the whole channel seems flooded with notification messages from the bot.

Would like to know your thoughts on this feeedback/suggestion too.

Attaching a thread to a thread

This is a feature request.

In some cases, some people reply by using a thread, but others do not use the thread. As a result, there are some small parts of threads which should be merged into one thread.

I tried to check if this is possible with this plugin, wrangler. Attaching a message in a thread is unavailable from the UI button, but I could move the message by the slash command. But, in this case, associated messages following the moved message was removed completely.

Again, my suggestion is that enabling to attach a thread to thread from both the slash command and UI button is really useful to maintain the message flow in the channel.

Webapp crash on render error

An error occurred where team was undefined in this loop:

>
{this.state.allTeams.map((team) => (
<option
key={team.id}
id={team.id}
value={team.id}
>
{team.display_name}
</option>

I don't have consistent repo steps. It first happened when I exited the system console to go back to a team. There is an archived team on the instance if that could be affecting this.

Add to Plugin Marketplace

This is an awesome plugin that has already helped with maintain a clean message flow on the Community Server.

As discussed offline, this would be a great addition to Plugin Marketplace. Would you be interested on submitting your plugin ? You can find the process for submitting your plugin here.

Allow System Admin or Team Admin to use Wrangler

For now, plugin access is allowed for either all users or users with the "Allowed Email Domain". It could be nice to allow it to System Admin or Team Admin.

For example, we can choose in the settings between "Allowed Email Domain", "System Admins", "System and Team Admins" or "All users".
For Team Admins, it may be trickier : are they authorised to move a thread from a team to another ?

Move Channel to Another Team?

Wrangler can move a Thread from one Channel to another.
Is it possible to move a Channel from one Team to another?

Build fails with invalid sass loader options

With node 14 on OSX, make dist eventually failed with:

ERROR in ./src/components/left_sidebar_element/style.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./src/components/left_sidebar_element/style.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'includePaths'. These properties are valid:
   object { implementation?, sassOptions?, additionalData?, sourceMap?, webpackImporter?, warnRuleAsWarning? }
    at validate (/Users/dgittins/code/github/mattermost-plugin-wrangler.git/webapp/node_modules/schema-utils/dist/validate.js:105:11)
    at Object.getOptions (/Users/dgittins/code/github/mattermost-plugin-wrangler.git/webapp/node_modules/webpack/lib/NormalModule.js:527:19)
    at Object.loader (/Users/dgittins/code/github/mattermost-plugin-wrangler.git/webapp/node_modules/sass-loader/dist/index.js:25:24)

I was able to make the build complete with this patch:

diff --git a/webapp/webpack.config.js b/webapp/webpack.config.js
index 0fd7126..042899d 100644
--- a/webapp/webpack.config.js
+++ b/webapp/webpack.config.js
@@ -38,7 +38,9 @@ module.exports = {
                     {
                         loader: 'sass-loader',
                         options: {
-                            includePaths: ['node_modules/compass-mixins/lib', 'sass'],
+                            sassOptions: {
+                                includePaths: ['node_modules/compass-mixins/lib', 'sass'],
+                            },
                         },
                     },
                 ],

Is that the correct fix...?

I18n for the Wrangler

First, I want to thank you for this plugin, the work-in-progress UI is great and the features are really useful. And they are especially with new-comers, who haven't really understood the functioning of Mattermost WRT threads and channels.

And so, as these new comers aren't often comfortable with English when it's not their primary language, it could be great to have the "A thread has been moved" and "Someone wrangled one of your messages into a thread for you" messages translated for the user.

Messages cannot be moved

A message to contact the admin is displayed.

The following messages are printed to server log:

error [2022-08-16 08:52:26.639 +02:00] unable to re-upload file: DoUploadFile: File rejected by plugin. File Blocker plugin - There was an error retrieving the session information, caller="app/plugin_api.go:975" plugin_id=com.mattermost.wrangler

We've got the Flie Blocker plugin active, but never got any problems inserting images. This could be related to image files handled differently, when pasted/uploaded in contrast to be moved by Wrangler.

Wrangler creates http instead of https addresses

Hi,

when I move a message to another channel, the system message reports:

A thread has been moved: http://mm.ourdomain.de/zgk/pl/zc7spc9a7fg4ubskes5piutwgo

The correct address however, is httpS:///mm.ourdomain.de/zgk/pl/zc7spc9a7fg4ubskes5piutwgo As a result, when clicking on the link in the Mattermost desktop app, the newly created message is not opened in the app but in the standard browser.

When I edit the message manually (http://... > https://...), I'm led correctly to the message within the app.

As I am not an administrator, I don't know whether the issue is a matter of the wrangler extension or our configuration. Can anyone give me a hint whether this is a bug or our administrator must change something in the configuration file?

Frank

Allowing customizable Bot-Messages

After attaching a message to a thread or moving/copying a thread, a bot message is sent to the author of that message.

Problems with that message:

  1. The message is not customizable.
  2. someone wrangled one of your messages is very unclear. For non native speakers and people not knowing about "wrangler", this message does not make sense.
  3. It is not clear which moderator moved the message. Therefore not allowing the author to contact the executing moderator.

Possible fix:

  1. It would be nice to change someone to the name of the executing moderator.
  2. It would be nice to make the message customizable.

Bug: opening dropdown on a system message crashes the webapp

When opening the dropdown menu on a system message, the webapp crashes

Reproduce

  1. Enable the Wrangler webapp functionality [BETA]
  2. Refresh the webapp
  3. Click on the dropdown for a system message (i.e. "@someUse has joined the channel")
  4. The screen becomes white
  5. Refresh to restore the webapp

Webapp logs

TypeError: can't access property "user_id", n is undefined
    lt com.mattermost.wrangler_451a6ce528877b61_bundle.js:26
    Redux 5
    React 2
    k Redux
    React 9
    unstable_runWithPriority scheduler.production.min.js:19
    React 15
    unstable_runWithPriority scheduler.production.min.js:19
    React 2
    j scheduler.production.min.js:17
    onmessage scheduler.production.min.js:14
    EventHandlerNonNull* scheduler.production.min.js:13
    Webpack 13
react-dom.production.min.js:209:194
[Util] handleError::  TypeError: can't access property "user_id", n is undefined index.js:158:36
Uncaught TypeError: can't access property "user_id", n is undefined

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.