-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat(condo): DOMA-9613: Add recipients counter to cross-posting integrations #5026
feat(condo): DOMA-9613: Add recipients counter to cross-posting integrations #5026
Conversation
if (user.isAdmin || user.isSupport) return true | ||
|
||
const b2bContext = await getById('B2BAppContext', b2bAppContextId) | ||
if (!b2bContext) return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check status
and deletedAt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done that
apps/condo/domains/news/access/GetNewsSharingRecipientsCountersService.js
Show resolved
Hide resolved
apps/condo/domains/news/components/NewsForm/NewsItemSharingForm.tsx
Outdated
Show resolved
Hide resolved
e4e0045
to
18d7112
Compare
For messengers (telegram/viber), you can use number of group members as number of recipients |
type: 'File', | ||
isRequired: false, | ||
adapter: NEWS_SHARING_FILE_ADAPTER, | ||
}, | ||
|
||
pushNotificationSettings: { | ||
schemaDoc: 'Push notification settings', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
schemaDoc: 'Push notification settings', | |
schemaDoc: 'Push notification preferences for each B2BApp. The available options include: notifications are sent only for emergency alerts, all notifications are turned off, or all notifications are enabled', |
apps/condo/domains/miniapp/schema/B2BAppNewsSharingConfig.test.js
Outdated
Show resolved
Hide resolved
|
||
return ( | ||
<RecipientCounterContainer | ||
title={<>{MailingMessage}<Typography.Text strong>{buildMessageFromNewsItemScopes(newsItemScopes, intl)}</Typography.Text></>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks hacky. is it possible to move inise RecipientCounterContainer
or create a special component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see this as hacky, I think codebase would be more complex if I put this stuff inside component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least not before we implement Telegram :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to remove duplicated migration and update migration number
import { NewsItemSharingCustomRecipientCounter } from '../RecipientCounter' | ||
import { NewsItemScopeNoInstanceType } from '../types' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use absolute imports
import { TNewsItemScopeNoInstance, TUnit } from './types' | ||
import { NewsItemScopeNoInstanceType, TUnit } from './types' | ||
|
||
import { Loader } from '../../common/components/Loader' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
{ | ||
onCompleted: (data) => { | ||
console.log(data) | ||
console.log(get(data, ['result', 'receiversCount'])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove console.log
@@ -0,0 +1,59 @@ | |||
// auto generated by kmigrator | |||
// KMIGRATOR:0413_b2bappnewssharingconfig_customgetrecipientscountersurl_and_more:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDQuMi4xIG9uIDIwMjQtMDctMjggMjA6MTAKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzA0MTJfbWFya2V0c2V0dGluZ2hpc3RvcnlyZWNvcmRfYW5kX21vcmUnKSwKICAgIF0KCiAgICBvcGVyYXRpb25zID0gWwogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J2IyYmFwcG5ld3NzaGFyaW5nY29uZm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h0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0nYjJiYXBwbmV3c3NoYXJpbmdjb25maWcnLAogICAgICAgICAgICBuYW1lPSdnZXRSZWNpcGllbnRzVXJsJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICBdCg== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to rebase and regenerate migration to update it's number
// auto generated by kmigrator | ||
// KMIGRATOR:0414_b2bappnewssharingconfig_customgetrecipientscountersurl_and_more:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDQuMi4xIG9uIDIwMjQtMDctMjkgMTI6MzkKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzA0MTNfdXNlcnJpZ2h0c3NldF9jYW5yZWFkbWVzc2FnZXNfYW5kX21vcmUnKSwKICAgIF0KCiAgICBvcGVyYXRpb25zID0gWwogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J2IyYmFwcG5ld3NzaGFyaW5nY29uZmlnJywKICAgICAgICAgICAgbmFtZT0nY3VzdG9tR2V0UmVjaXBpZW50c0NvdW50ZXJzVXJsJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxf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ICAgICAgZmllbGQ9bW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICBdCg== | ||
|
||
exports.up = async (knex) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same migration as above. You need to remove it
de9fd4d
to
a798768
Compare
|
||
return ( | ||
<RecipientCounterContainer | ||
title={<>{MailingMessage}<Typography.Text strong>{buildMessageFromNewsItemScopes(newsItemScopes, intl)}</Typography.Text></>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see this as hacky, I think codebase would be more complex if I put this stuff inside component
|
||
return ( | ||
<RecipientCounterContainer | ||
title={<>{MailingMessage}<Typography.Text strong>{buildMessageFromNewsItemScopes(newsItemScopes, intl)}</Typography.Text></>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least not before we implement Telegram :-)
… news items using custom query
e7f128b
to
7e78659
Compare
Quality Gate passedIssues Measures |
Quality Gate passedIssues Measures |
Add recipients counter to cross-posting integrations
Context
Context: we want to add ability to check out number of recipients before you send cross-posted news item.
Solution
I've implemented custom query that allows our partners to give their users this data. This is not a final solution, as details and architecture may be changed, (thus it is Proof of work)
How it works
newsSharing
is outside of the scope of this PR)To do this they implement
POST
method calledcustomGetRecipientsCounters
(or whatever they want to call it) and put a url link to service that expose this API tonewsSharingConfig
Example url:
https://my-news-sharing-api/getNewsInfo
We expect that this method accepts this data:
Condo expects output in this format:
Note:
This method is created to support only advanced usecases with custom UI and custom Scopes logic. Integrations that do not require custom UI + custom Scopes logic (such as Telegram / Viber) would not require this logic.
More simple solution will be introduced later this year
Bonus
Sometimes you do not want
preview
to be shown, for example when your app does not have any preview (maybe internal system?)Sometimes you do not want to show preview for push messages. For example, if your app sends push messages ONLY for emergency news items
I've introduced a setting in
newsSharingConfig
that covers this usecase