Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

[PLAT-695] Add trending notifications to valid_types #3109

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

dylanjeffers
Copy link
Contributor

Description

  • Adds trending-playlist and trending-underground notification types to discovery-notifications "valid_types" parameter
  • Refactors fetchNotification function to more accurately switch between new and old notification format.

FeatureFlags.DISCOVERY_NOTIFICATIONS
FeatureFlags.REPOST_OF_REPOST_NOTIFICATIONS
)
const isSaveOfRepostEnabled = yield* call(
Copy link
Contributor

Choose a reason for hiding this comment

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

idk if this is any better or if its more confusing/longer but wondering if it would be easier to put these in a dict like:

featureFlagsToEnable = [FeatureFlags.SAVE_OF_REPOST_NOTIFICATIONS, FeatureFlags.REPOST_OF_REPOST_NOTIFICATIONS...]
isFeatureEnabled = {}
for feature in featureFlagsToEnable:
    isFeatureEnabled[feature] = yield* call(getFeatureEnabled, feature)

and then in validTypes we can access like:

  const validTypes = [
    isFeatureEnabled[FeatureFlags.REPOST_OF_REPOST_NOTIFICATIONS] ? 'repost_of_repost' : null,   
   ...
]

just wondering cuz i could see this getting clunky the more notifications we add (also sorry this is written in weird python js pseudo code lol)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yess i totally hear you, i like this!

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 just tried and it's annoyingly just as long :/ ideally wed have a "getFeatures" function and then that returns an object than we can access. even though it's a lot of redundant code at least it's easy to understand? but yeah i hear you not the best...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

new method:

  const validTypesFlags = [
    FeatureFlags.REPOST_OF_REPOST_NOTIFICATIONS,
    FeatureFlags.SAVE_OF_REPOST_NOTIFICATIONS,
    FeatureFlags.TRENDING_PLAYLIST_NOTIFICATIONS,
    FeatureFlags.TRENDING_UNDERGROUND_NOTIFICATIONS
  ]

  const validTypesMap: { [flag in FeatureFlags]?: boolean } = {}

  for (const validTypeFlag of validTypesFlags) {
    validTypesMap[validTypeFlag] = yield* call(getFeatureEnabled, validTypeFlag)
  }

  const validTypes = [
    validTypesMap[FeatureFlags.REPOST_OF_REPOST_NOTIFICATIONS]
      ? 'repost_of_repost'
      : null,

    validTypesMap[FeatureFlags.SAVE_OF_REPOST_NOTIFICATIONS]
      ? 'save_of_repost'
      : null,

    validTypesMap[FeatureFlags.TRENDING_PLAYLIST_NOTIFICATIONS]
      ? 'trending_playlist'
      : null,

    validTypesMap[FeatureFlags.TRENDING_UNDERGROUND_NOTIFICATIONS]
      ? 'trending_underground'
      : null
  ].filter(removeNullable)

old method:

  const isRepostOfRepostEnabled = yield* call(
    getFeatureEnabled,
    FeatureFlags.REPOST_OF_REPOST_NOTIFICATIONS
  )
  const isSaveOfRepostEnabled = yield* call(
    getFeatureEnabled,
    FeatureFlags.SAVE_OF_REPOST_NOTIFICATIONS
  )
  const isTrendingPlaylistEnabled = yield* call(
    getFeatureEnabled,
    FeatureFlags.TRENDING_PLAYLIST_NOTIFICATIONS
  )
  const isTrendingUndergroundEnabled = yield* call(
    getFeatureEnabled,
    FeatureFlags.TRENDING_UNDERGROUND_NOTIFICATIONS
  )

  const validTypes = [
    isRepostOfRepostEnabled ? 'repost_of_repost' : null,
    isSaveOfRepostEnabled ? 'save_of_repost' : null,
    isTrendingPlaylistEnabled ? 'trending_playlist' : null,
    isTrendingUndergroundEnabled ? 'trending_underground' : null
  ].filter(removeNullable)

Copy link
Contributor

Choose a reason for hiding this comment

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

damn jk then lol you can leave however you prefer in that case!

)
const isTrendingPlaylistEnabled = yield* call(
getFeatureEnabled,
FeatureFlags.SAVE_OF_REPOST_NOTIFICATIONS
Copy link
Contributor

Choose a reason for hiding this comment

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

is this checking the wrong feature flag??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes RIPP

)
const isTrendingUndergroundEnabled = yield* call(
getFeatureEnabled,
FeatureFlags.SAVE_OF_REPOST_NOTIFICATIONS
Copy link
Contributor

Choose a reason for hiding this comment

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

same here i think this is wrong feature flag?

@dylanjeffers dylanjeffers merged commit 6441421 into main Mar 28, 2023
@dylanjeffers dylanjeffers deleted the dj-plat-695-update-trending-query branch March 28, 2023 19:46
audius-infra pushed a commit that referenced this pull request Apr 1, 2023
[a82b6d2] [C-2391 PLAT-833] Handle get-discovery-notification error, notification processing (#3141) Dylan Jeffers
[b6a8470] [PAY-1073] Mobile messages settings screen (#3131) Reed
[c567b35] Separate chat text input to own component (#3142) Reed
[1a38cb1] [PAY-1090] - Subscribe to special access gates to unlock new tracks (#3108) Saliou Diallo
[9e5a45d] Set dev optimizely key (#3126) Sebastian Klingler
[c5e86fa] [PLAT-699] Add tastemaker notification to web (#3140) Dylan Jeffers
[4bc608c] [C-2295] Only show now-playing-artwork-tile when song enqueued (#3137) Dylan Jeffers
[aa34b32] [PAY-1039] Mobile chat header navs to profile (#3139) Reed
[55f5819] Optimizely attributes - use null if empty instead of undefined (#3134) nicoback2
[92ab79e] [C-2387] Improve permalink and user handle caching (#3117) Dylan Jeffers
[086af81] [PAY-1107][PAY-1112] Center mobile chat text input, enlarge icon (#3136) Reed
[fcec3f5] [PAY-1123] Fix mobile chat scroll being stuck (#3135) Reed
[a276e86] Revert "Allow Optimizely targeting w CodePush on mobile C-2394" (#3133) nicoback2
[3335b4a] [C-2357] Update the icon color of the podcast skip buttons to accept the theme color (#3132) Kyle Shanks
[1af5730] Fix dapp store versionCode (#3121) Dylan Jeffers
[7787115] Fix app store version fetched from Apple in Fastlane being out of date first 24h after new release C-2397 (#3128) nicoback2
[06c181d] Allow Optimizely targeting w CodePush on mobile C-2394 (#3127) nicoback2
[ff07c32] [PAY-1038] Fix mobile profile page button borders (#3130) Reed
[9286959] [PAY-1027] Mobile chat websockets (#3129) Reed
[81ef3b3] [PAY-1031] Mobile chat list views use full height (#3123) Reed
[41e3f5d] [C-2231] Remove audius-data, dynamically import web3modal (#1771) Raymond Jacobson
[34d80be] [PAY-1111] Remove "Done" row on ios keyboard for mobile chats (#3124) Reed
[9eb83a8] [PAY-1102] - Add supporters info drawer (#3112) Saliou Diallo
[6fe7abe] Add dependencies, bundle to mobile README (#3111) Reed
[dc8d4f2] Show header shadow in chat screens (#3106) Reed
[f871a38] [PAY-906] Mobile chats KeyboardAvoidingView (#3122) Reed
[fd00bf2] Fix chat reactions with createEntityAdapter (#3118) Reed
[9876137] Switch to 1s (#3120) Raymond Jacobson
[fe9efea] Tip using both erc_wallet and wallet (#3049) Michael Piazza
[fdfc0b6] Update dapp store readme (#3119) Raymond Jacobson
[ca58e69] [C-2359, C-2380] Update duration text for podcast tiles (#3116) Kyle Shanks
[6441421] [PLAT-695] Add trending notifications to valid_types (#3109) Dylan Jeffers
[4233ee6] [PAY-1083] - Only allow prompt modal when single track is being uploaded (#3115) Saliou Diallo
[36909d1] Always include user signature for stream (#3114) Raymond Jacobson
[b90eaf6] [C-2386] Fix notification button not toggling panel (#3110) Dylan Jeffers
[a3c2e91] Check if messagesStatus undefined in ChatScreen (#3113) Reed
[64d89ca] [C-2382] Update dapp-store cli, short_description length (#3104) Dylan Jeffers
[680931d] [C-2361, C-2360, C-2355, C-2346] Update skip 15s button behavior on mobile for podcasts (#3105) Kyle Shanks
[3eb742f] [C-2353, C-2358] Update playback position tracking for web and mobile (#3097) Kyle Shanks
[e06c4d9] Bump sdk to 2.0.3-beta.1 (#3098) Isaac Solo
[8191694] Fix "Pick some for me" button on android (#3102) Sebastian Klingler
@AudiusProject AudiusProject deleted a comment from linear bot Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants