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

[NEW] Notify admins via rocket.cat when a user requests to use an app #27858

Merged
merged 8 commits into from
Feb 7, 2023

Conversation

matheuslc
Copy link
Contributor

@matheuslc matheuslc commented Jan 26, 2023

Proposed changes (including videos or screenshots)

This PR adds a new feature on top of the app requests feature to notify all admins whenever a user requests to use an app. The notification happens via rocket.cat user.

Issue(s)

MKP-197
MKP-224

Steps to test or reproduce

Requirements

  • You need a workspace connected to the cloud
  • You need at least one admin user
  • You need at least one non-admin user (end-user)

Requesting an app

Logged as an end user, access the marketplace, and request an app.

Example:

Screenshot 2023-01-26 at 14 20 42

Notification

As soon as the user sends the request, admins will receive a notification.

Screenshot 2023-01-26 at 15 54 52

Further comments

@matheuslc matheuslc marked this pull request as ready for review January 26, 2023 19:09
@matheuslc matheuslc requested review from a team as code owners January 26, 2023 19:09
async post() {
const { appId, appName, message } = this.bodyParams;
const workspaceUrl = settings.get('Site_Url');
const learnMore = `${workspaceUrl}marketplace/explore/info/${appId}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Sometimes the Site_Url will end with a slash and sometimes it won't. I highly recommend ensuring it has one and putting it there if it doesn't. However, my information could be wrong, so I'd like input from others :)

Copy link
Contributor Author

@matheuslc matheuslc Jan 30, 2023

Choose a reason for hiding this comment

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

@graywolf336 we can ensure that using a regex that matches only at the end of the string. What do you think?

It would be something like that:

const example = "http://localhost/"
const regex = new RegExp('\\/$', 'gm')
const result = example.replace(regex, '');

console.log('Result:', result)

This way we ensure the site url doesn't have a / at the end of the url and we can add them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Digging more into the code, I've found out that they assume Site_Url always doesn't have the / at the end 🤔 But we may guarantee that through my suggestion above

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I'd rather error on the side of caution than just making an assumption. However, someone more experienced can provide more context and thoughts.

@codecov
Copy link

codecov bot commented Jan 26, 2023

Codecov Report

Merging #27858 (ca49a7f) into feat/new-marketplace (f3b818d) will decrease coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@                   Coverage Diff                    @@
##           feat/new-marketplace   #27858      +/-   ##
========================================================
- Coverage                 43.23%   43.18%   -0.05%     
========================================================
  Files                       821      821              
  Lines                     17041    17041              
  Branches                   2004     2004              
========================================================
- Hits                       7367     7359       -8     
- Misses                     9393     9402       +9     
+ Partials                    281      280       -1     
Flag Coverage Δ
e2e 43.18% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

…success toast message when the app request went successful
Copy link
Contributor

@rique223 rique223 left a comment

Choose a reason for hiding this comment

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

Nothing new on the Rocket.Chat front.

@matheuslc matheuslc merged commit 3bd4694 into feat/new-marketplace Feb 7, 2023
@matheuslc matheuslc deleted the feat/admin-rocket-cat-notification branch February 7, 2023 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants