-
Notifications
You must be signed in to change notification settings - Fork 14
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(social-source): removed instagram source #767
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request involves a comprehensive removal of Instagram-related functionality across multiple files. The changes primarily focus on eliminating references to Instagram in type definitions, utility objects, localization files, and SVG sprite definitions. The modifications indicate a strategic decision to remove Instagram as a supported source for file uploads and related interactions across the application's internationalized components. Changes
Suggested reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Removing the source for instagram because the Instagram API doesn't work after Dec. 4 |
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
blocks/SourceList/SourceList.js (2)
12-15
: Consider enhancing error handling for invalid sourcesWhile the validation logic is correct, consider these improvements for better error handling in production:
- Use a proper error tracking service instead of console.error
- Add telemetry to monitor frequency of invalid source attempts
- if (!Object.values(UploadSource).includes(srcName)) { - console.error(`Source "${srcName}" not found in UploadSource`); - return; - } + if (!Object.values(UploadSource).includes(srcName)) { + this.trackError?.('invalid_source', { + source: srcName, + message: `Source "${srcName}" not found in UploadSource` + }); + return; + }
Line range hint
6-24
: Consider adding migration guidance for existing configurationsSince Instagram source is being removed, consider these architectural points:
- Add deprecation notices for configurations still including 'instagram' in sourceList
- Document migration steps for users in release notes
- Consider adding a temporary migration period where Instagram source is gracefully ignored instead of logging errors
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
blocks/SourceList/SourceList.js
(2 hunks)
🔇 Additional comments (2)
blocks/SourceList/SourceList.js (2)
3-3
: LGTM: Import statement is correctly added
The import of UploadSource
is necessary for the source validation logic.
16-19
: Verify complete removal of Instagram-specific markup
The source button generation looks correct, but let's verify there are no remaining Instagram-specific references in the markup or styles.
✅ Verification successful
Since the initial search didn't find any Instagram-related references, let me do one more targeted verification focusing on the source button component and its related files to be thorough.
Instagram-specific markup has been completely removed
The verification shows that all Instagram-related references have been properly removed. The source button component's markup and styles are clean, using only generic styling classes and variables without any platform-specific code.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining Instagram-related references in markup and styles
echo "Checking for Instagram references in source button related files..."
rg -i "instagram" --type=css --type=html --type=js
echo "Checking for Instagram-specific test files..."
fd -g "*instagram*.test.*"
Length of output: 325
Script:
#!/bin/bash
# Check source button component files specifically
echo "Checking source button component files:"
fd -g "*source-btn*"
# Show content of these files to verify no Instagram-specific code
echo -e "\nChecking content of source button files:"
fd -g "*source-btn*" -x cat {}
Length of output: 1360
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
blocks/SourceList/SourceList.js (2)
12-19
: Consider adjusting the error message and warning levelThe Instagram validation logic is good, but there are two suggestions for improvement:
- The error message contains a hardcoded future date ("December 4th, 2024"). Consider removing the year to make the message more maintainable.
- Consider using
console.warn
instead ofconsole.error
since this is a deprecated feature rather than an error condition.- if (srcName === 'instagram') { - console.error( - "Removed the source for Instagram because the Instagram API doesn't work after December 4th, 2024. " + + if (srcName === 'instagram') { + console.warn( + "Removed the source for Instagram because the Instagram API doesn't work after December 4th. " + 'Official statement, see here:' + 'https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US', ); return; }
21-24
: Consider collecting all invalid sources before reportingThe current implementation stops at the first invalid source. Consider collecting all invalid sources and reporting them together for better debugging experience.
+ const invalidSources = []; list.forEach((srcName) => { if (srcName === 'instagram') { console.warn(/*...*/); return; } - if (!Object.values(UploadSource).includes(srcName)) { - console.error(`Source "${srcName}" not found in UploadSource`); - return; - } + if (!Object.values(UploadSource).includes(srcName)) { + invalidSources.push(srcName); + return; + } html += /* HTML */ `<uc-source-btn type="${srcName}"></uc-source-btn>`; }); + if (invalidSources.length > 0) { + console.error(`Invalid sources found: ${invalidSources.join(', ')}`); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
blocks/SourceList/SourceList.js
(2 hunks)
🔇 Additional comments (2)
blocks/SourceList/SourceList.js (2)
3-3
: LGTM: Import statement is correctly added
The import of UploadSource
is necessary for the new validation logic and follows proper conventions.
Line range hint 1-35
: Verify complete removal of Instagram-related code
Let's ensure all Instagram-related code has been removed from the codebase.
✅ Verification successful
Instagram source has been properly removed from the codebase
Based on the verification results:
- The only remaining Instagram references are in the error message in SourceList.js explaining its removal
- Instagram is not present in the UploadSource configuration
- No Instagram-related component files or imports were found
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining Instagram-related code
echo "Searching for remaining Instagram references..."
rg -i "instagram" --type js --type ts --type css --type html
# Search for any Instagram-related test files
echo "Searching for Instagram-related test files..."
fd -e test.js -e spec.js -e test.ts -e spec.ts | xargs rg -i "instagram"
Length of output: 711
Script:
#!/bin/bash
# Search for Instagram-related code in utils and configuration
echo "Searching for Instagram in UploadSource..."
ast-grep --pattern 'instagram = $$$'
# Search for any Instagram-related configuration or constants
echo "Searching for Instagram-related configuration..."
rg -i "instagram" --type json --type yaml --type yml
# Search for Instagram in imports and exports
echo "Searching for Instagram-related imports/exports..."
ast-grep --pattern 'import $$ from $"$$instagram$$"'
ast-grep --pattern 'export $$ from $"$$instagram$$"'
Length of output: 542
Script:
#!/bin/bash
# Search for Instagram in UploadSource enum/object
echo "Searching for Instagram in UploadSource definition..."
rg -A 5 -B 5 "export (enum|const) UploadSource"
# Search for any Instagram-related component files
echo "Searching for Instagram-related component files..."
fd -e js -e ts | rg -i "instagram"
# Search for Instagram in HTML templates or components
echo "Searching for Instagram in templates..."
rg -i "instagram" --type html --type vue --type jsx
Length of output: 1012
@@ -8,8 +9,23 @@ export class SourceList extends Block { | |||
let list = stringToArray(val); | |||
let html = ''; | |||
list.forEach((srcName) => { | |||
if (srcName === 'instagram') { | |||
console.error( | |||
"Removed the source for Instagram because the Instagram API doesn't work after December 4th, 2024. " + |
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.
"Removed the source for Instagram because the Instagram API doesn't work after December 4th, 2024. " + | |
"Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024." + |
return; | ||
} | ||
|
||
if (!Object.values(UploadSource).includes(srcName)) { |
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.
This one will break undocumented custom tabs :(
I think we should place all this stuff (including instagram alert message) inside blocks/SourceBtn/SourceBtn.js
Description
Checklist
Summary by CodeRabbit