Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MM-57964] Implement openThread and openStopRecordingModal #3073

Merged
merged 4 commits into from
Jun 20, 2024
Merged

Conversation

streamer45
Copy link
Contributor

Summary

We are extending the API to support the functionality in mattermost/mattermost-plugin-calls#779, namely:

  • Ability to open the call thread from the global widget.
  • Ability to show the stop recording confirmation modal when stopping a recording from the global widget.

Ticket Link

https://mattermost.atlassian.net/browse/MM-57964

Release Note

NONE

@streamer45 streamer45 added the 2: Dev Review Requires review by a core committer label Jun 19, 2024
@streamer45 streamer45 self-assigned this Jun 19, 2024
@devinbinnie devinbinnie added the 3: Security Review Review requested from Security Team label Jun 19, 2024
@@ -70,6 +70,12 @@ export type DesktopAPI = {

focusPopout: () => void;

openThread: (threadID: string) => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename these so that we know they're specific to calls?
Something like openThreadForCalls.
I know it's a bit "smurf naming" but it's important in this context to make sure the API is only used for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. This functionality was generic enough that I thought it could be used by something else in the future, but we can rename it for now since Calls is currently the only user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -504,6 +508,14 @@ export class CallsWidgetWindow {
};
};

private handleCallsOpenThread = (event: IpcMainEvent, threadID: string) => {
this.forwardToMainApp(CALLS_WIDGET_OPEN_THREAD)(event, threadID);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link me where in (I assume the calls plugin) code this is being received and what it's doing? We'll need to make sure that it's not something exploitable.

A quick look seems like nothing in the Desktop App should be an issue with this (since it's just forwarding through)

cc @enzowritescode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@cpoile cpoile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really slick, nicely done.

Comment on lines +117 to +118
openStopRecordingModal: (channelID) => ipcRenderer.send(CALLS_WIDGET_OPEN_STOP_RECORDING_MODAL, channelID),
onOpenStopRecordingModal: (listener) => createListener(CALLS_WIDGET_OPEN_STOP_RECORDING_MODAL, listener),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devinbinnie @cpoile Since we are here, I was considering making this a bit more generic (e.g. openCallsModal) so we could pass a modal ID (string or enum) and at least the channel/call ID which is hopefully sufficient in most cases. That would avoid the need to make desktop changes every time we want to add a modal interaction from the widget.

Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be okay with that, but I think we'd need to lock down the types of modals that could be opened somewhere, and this should never be used to open a modal that's native to the desktop app. If we're just using it as a relay to the calls plugin from the widget (or vice-versa) then I'm okay with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Of course we'd still be handling this event only for Calls windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be deferring this improvement to the next time we'll need this sort of functionality.

Copy link
Member

@devinbinnie devinbinnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@devinbinnie devinbinnie added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer 3: Security Review Review requested from Security Team labels Jun 20, 2024
@streamer45 streamer45 merged commit c0e2b2a into master Jun 20, 2024
20 checks passed
@streamer45 streamer45 deleted the MM-57964 branch June 20, 2024 16:42
@amyblais amyblais added this to the v5.9.0 milestone Jun 20, 2024
@streamer45
Copy link
Contributor Author

@devinbinnie Would you be able to publish a new API types NPM version? Thanks!

@devinbinnie
Copy link
Member

@devinbinnie Would you be able to publish a new API types NPM version? Thanks!

+ @mattermost/desktop-api@5.9.0-1
Done!

@devinbinnie
Copy link
Member

@devinbinnie Would you be able to publish a new API types NPM version? Thanks!

+ @mattermost/desktop-api@5.9.0-1 Done!

@streamer45 #3075
PR to bump the package numbers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants