Open mattermod opened 2 years ago
Can I take this one?
@amyblais we have a command available to create post using team and channel information
mmctl post create myteam:mychannel --message "some text for the post"
As per my understanding mentioned requirement is not possible since team can have many channels so it is not possible to select specific channel to create post in without channel information.
we have a command available to create post using team and channel information
mmctl post create myteam:mychannel --message "some text for the post"
As per my understanding mentioned requirement is not possible since team can have many channels so it is not possible to select specific channel to create post in without channel information.
cc @isacikgoz
@ChandanChainani this is possible through multiple steps.
Hello @hanzei. Please I want to work on this issue
Awesome, thanks @Kimbohlovette :+1:
Hello @hanzei, @isacikgoz Please I have a block on this issue
I have followed the steps @isacikgoz outlined above as follows
PostCreateDirectMessageCmd
in cmd/mmctl/commands/post.go
with its associated function PostCreateDirectMessageCmdF
.PostCreateDirectMessageCmdF
function, I collected the team
and user
parts from argument with the getTeamFromTeamArg
and getUserFromUserArg
functions.message
flag with the cmd.Flags().GetString()
method.c.GetUsersInTeam()
method
Check if both users belong to this list of users.
Unfortunately for me the c.GetUsersInTeam() needs the pagination parameters (page
and perPage
).
Please how can I check to see if two users belong to a team?Hello @hanzei, I still need your help here :pray:
Do we even need to check if the user is a member of a given team? The REST API call will fail anyway if that is not the case.
Another thought: Do we even need the --message
flag? Can we simplify here and use mmctl post create myteam:mychannel "some text for the post"
?
Do we even need to check if the user is a member of a given team? The REST API call will fail anyway if that is not the case.
Another thought: Do we even need the
--message
flag? Can we simplify here and usemmctl post create myteam:mychannel "some text for the post"
?
The aim was to be able to send a message directly to someone with a command such like mmctl post create myteam:@someuser "message"
mmctl can be used to send direct messages. With an easier way of using a command like
mmctl post create team:@user --message "message"
.If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.
New contributors please see our Developer's Guide.
Like here
@ChandanChainani this is possible through multiple steps.
- You'll need to provide a team to see if these two users can see each other.
- Create direct channel (this will return the direct channel if it's already created) via API. To get the channel you just need to provide the users ids ref
- You'll use the channel ID to post the message
Also look at these steps outlined here. It it shows that we need to make sure that both users are in the team provided. That is why I chose to get all the users for that team and check if both sender and receiver are there
@hanzei I still need more clarification on how to implement this issue. Could place give me some minutes of your time to clarify me please?
@Kimbohlovette I agree with @hanzei on the message should be in the form of the argument rather than a flag. You can scrape that information from the cmd.Args
.
@Kimbohlovette I agree with @hanzei on the message should be in the form of the argument rather than a flag. You can scrape that information from the
cmd.Args
.
Okay noted @isacikgoz.
And about making sure both users see each other should I still enforce that or I should let the server to handle that?
@Kimbohlovette I agree with @hanzei on the message should be in the form of the argument rather than a flag. You can scrape that information from the
cmd.Args
.
Hello sir, how do I get the message from a command here using cmd.Args
please?
@hanzei , @isacikgoz please I may be getting something wrongly in this task What does it mean to send direct messages? Does the command sends a single message to everyone in the team or it sends a single message to just one person? And I will also appreciate if you guys help me complete this task as fast as possible. Many thanks
Hi @Kimbohlovette,
The ticket is about sending a direct messages to another user.
cmd.Args[0]
contains the first argument that was passed to the command.
Hi @Kimbohlovette,
The ticket is about sending a direct messages to another user.
cmd.Args[0]
contains the first argument that was passed to the command.
okay
Hello @hanzei
Hi @Kimbohlovette.
Is there anything I can help you with?
Hello @hanzei you proposed that we should implement this send DM command as
mmctl post create team:@user "some direct mesage"
Currently we have the create post command to send a message to a channel in a team
mmctl post create team:channel --message "some message to channel"
My observation is that these commands are basically thesame with differences only in the way arguments are passed.
I am proposing that we should extend the command
mmctl post create team:channel --message "some channel message"
to
mmctl post create team:[channel | @user] --message "some message"
and then handle the [channel | @user]
section of the argument in the postCreateFn
by checking if a valid user exists in args[0] as below
Please I would like to hear your view on this
Do we even need the team
in team:@user
?
What you're saying is correct we do not need it even from the beginning
One thing to note would be to check how getChannelFromChannelArg()
parses the argument team:[channel | user]
. Same with the getUserFromUserArg()
function
Hello @hanzei I would like you to have a final say on this issue so that I can work
Are you sure that getUserFromUserArg
requires the team:user
format? I think it use a simple userID|username|email
format.
I just checked it's safe to use getUserFromUserArg
even when we scrap out the team section
Hello @hanzei I opened a PR for this issue [GH-19914] Adds ability to send direct message #26602 I will be waiting for your reviews Thanks
Awesome! I will take a look tomorrow.
Thanks 😊
mmctl can be used to send direct messages. With an easier way of using a command like
mmctl post create team:@user --message "message"
.If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.
New contributors please see our Developer's Guide.
JIRA: https://mattermost.atlassian.net/browse/MM-40525