Skip to content

Commit

Permalink
Merge with Develop 2024-1-14 (#2640)
Browse files Browse the repository at this point in the history
* 20241114060032 Deleted all files in the main branch in anticipation of merging develop into main cleanly

* 20241114060107 Merge develop into main
  • Loading branch information
palisadoes authored Nov 14, 2024
1 parent b6b186f commit c4fc7b6
Show file tree
Hide file tree
Showing 40 changed files with 4,079 additions and 198 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ updates:
directory: "/"
# Check the pub.dev registry for updates every day (weekdays)
schedule:
interval: "weekly"
interval: "monthly"
target-branch: "develop"
# # Add default reviewers
# reviewers:
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/authorized-changes-detection.yml

This file was deleted.

17 changes: 14 additions & 3 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Count lines of code in each file
run: chmod +x ./.github/workflows/countline.py
- name: Running count lines
run: ./.github/workflows/countline.py --exclude_directories test/ --exclude_files lib/custom_painters/talawa_logo.dart lib/custom_painters/language_icon.dart lib/custom_painters/whatsapp_logo.dart lib/utils/queries.dart lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart lib/view_model/pre_auth_view_models/select_organization_view_model.dart lib/views/after_auth_screens/profile/profile_page.dart lib/view_model/main_screen_view_model.dart lib/views/after_auth_screens/events/create_event_page.dart lib/views/after_auth_screens/org_info_screen.dart lib/views/after_auth_screens/events/manage_volunteer_group.dart
run: ./.github/workflows/countline.py --exclude_directories test/ --exclude_files lib/custom_painters/talawa_logo.dart lib/custom_painters/language_icon.dart lib/custom_painters/whatsapp_logo.dart lib/utils/queries.dart lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart lib/view_model/pre_auth_view_models/select_organization_view_model.dart lib/views/after_auth_screens/profile/profile_page.dart lib/view_model/main_screen_view_model.dart lib/views/after_auth_screens/events/create_event_page.dart lib/views/after_auth_screens/org_info_screen.dart lib/views/after_auth_screens/events/manage_volunteer_group.dart lib/views/after_auth_screens/events/create_agenda_item_page.dart lib/views/after_auth_screens/events/edit_agenda_item_page.dart lib/utils/event_queries.dart
- name: setup python
uses: actions/setup-python@v5
- name: Check for presence of ignore directives corresponding to custom lints
Expand Down Expand Up @@ -173,6 +173,7 @@ jobs:
run: flutter build ios --release --no-codesign

Branch-check:
if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }}
name: "Base branch check"
runs-on: ubuntu-latest
steps:
Expand All @@ -182,8 +183,9 @@ jobs:
echo "PR is not against develop branch. Please refer PR_GUIDELINES.md"
exit 1
Check-Unauthorized-Changes:
name: Checks if no unauthorized files are changed
Check-Sensitive-Files:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Checks if sensitive files have been changed without authorization
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -211,6 +213,14 @@ jobs:
LICENSE
setup.ts
.coderabbit.yaml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
DOCUMENTATION.md
INSTALLATION.md
ISSUE_GUIDELINES.md
PR_GUIDELINES.md
README.md
- name: List all changed unauthorized files
if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true'
env:
Expand All @@ -222,6 +232,7 @@ jobs:
exit 1
Count-Changed-Files:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Checks if number of files changed is acceptable
runs-on: ubuntu-latest
steps:
Expand Down
88 changes: 5 additions & 83 deletions .github/workflows/push.yaml → .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ env:
jobs:

Flutter-Codebase-Check:
name: Checking codebase
if: ${{ github.actor != 'dependabot[bot]' }}
name: Checking Codebase
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -72,90 +73,9 @@ jobs:
# - name: Echo the GitHub context for troubleshooting
# run: echo "${{ toJSON(github) }}"

Update-Documentation:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/automated-docs'
environment: TALAWA_ENVIRONMENT
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '12.0'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.3'
channel: 'stable'
- uses: dart-lang/setup-dart@v1
with:
sdk: '3.4.4'
- run: |
cd talawa_lint && flutter pub get && cd ..
flutter pub get
flutter analyze
dart analyze
flutter pub global activate dartdoc
flutter pub global run dartdoc . --output talawa-mobile-docs --format md --exclude=test/widget_tests/widgets/pinned_carousel_widget_test.dart, lib/widgets/pinned_carousel_widget.dart, lib/widgets/post_widget.dart, test/widget_tests/widgets/post_widget_test.dart
rm -rf talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/build.md
rm -rf talawa-mobile-docs/widgets_post_widget/PostContainerState/build.md
- uses: actions/upload-artifact@v1
with:
name: talawa-mobile-docs
path: talawa-mobile-docs
- name: Checking doc updated
id: DocUpdated
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "updateDoc=true" >> $GITHUB_OUTPUT
echo -e "Documentation has been updated!!"
else
Green='0;32'
NoColor='\033[0m'
echo -e "${Green}No documentation updated${NoColor}"
fi
- name: Set env variables
if: steps.DocUpdated.outputs.updateDoc
run: |
echo "commit_id=$(echo $(git rev-parse HEAD))" >> $GITHUB_ENV
echo "email=$(echo $(git log --pretty=format:"%ae" $commit_id))" >> $GITHUB_ENV
- name: Handle untracked files
if: steps.DocUpdated.outputs.updateDoc
run: |
git config --global user.name "${{github.actor}}"
git config --global user.email "${{env.email}}"
git add .
- name: Update Doc
if: steps.DocUpdated.outputs.updateDoc
run: |
Green='0;32'
NoColor='\033[0m'
git config --global user.name "${{github.actor}}"
git config --global user.email "${{env.email}}"
git commit -a -m "Updated docs"
git push
echo -e "🚀${Green} Hurrah! doc updated${NoColor}"
Documentation-to-talawa-docs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/automated-docs'
needs: Update-Documentation
steps:
- uses: actions/checkout@v4
- uses: dmnemec/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB_NEW }}
with:
source_file: 'talawa-mobile-docs/'
destination_repo: 'PalisadoesFoundation/talawa-docs'
destination_branch: 'develop'
destination_folder: 'docs'
user_email: '${{env.email}}'
user_name: '${{github.actor}}'
commit_message: 'Overwriting talawa-mobile-docs from talawa-repo'



Flutter-Testing:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Testing codebase
runs-on: ubuntu-latest
needs: Flutter-Codebase-Check
Expand Down Expand Up @@ -185,6 +105,7 @@ jobs:
name: '${{env.CODECOV_UNIQUE_NAME}}'

Android-Build-and-Release:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Testing build for android
permissions:
contents: write
Expand Down Expand Up @@ -224,6 +145,7 @@ jobs:
This may or may not be stable, so please have a look at the stable release(s).
iOS-Build:
if: ${{ github.actor != 'dependabot[bot]' }}
name: iOS Build and Relaese
runs-on: macos-latest
needs: Flutter-Testing
Expand Down
117 changes: 117 additions & 0 deletions .github/workflows/talawa_mobile_md_mdx_format_adjuster.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Script to adjust Dart documentation for MDX compatibility in Docusaurus.
This script scans Dart-generated Markdown files and modifies special characters,
code blocks, and Dart-specific symbols to comply with the MDX syntax used in
Docusaurus v3. It ensures compatibility with the markdown processor by making
adjustments like escaping certain characters and modifying code blocks.
This script complies with:
1) Pylint
2) Pydocstyle
3) Pycodestyle
4) Flake8
"""
import os
import argparse
import re

def escape_mdx_characters(text):
"""
Escape special characters (<, >, {, }) in Dart docs to make them MDX compatible.
Args:
text (str): The text content to be processed.
Returns:
str: The modified string with escaped MDX characters.
"""
# Replace unescaped <, >, {, } with their escaped equivalents
patterns = {
"<": r"(?<!\\)<",
">": r"(?<!\\)>",
"{": r"(?<!\\){",
"}": r"(?<!\\)}"
}

for char, pattern in patterns.items():
text = re.sub(pattern, f"\\{char}", text)

return text

def adjust_dart_code_blocks(text):
"""
Modify Dart code blocks to ensure they are correctly formatted in MDX.
This function replaces Dart code block annotations like `///` or `//`
and adjusts code block syntax.
Args:
text (str): The content to be processed.
Returns:
str: The modified text with Dart code blocks adjusted.
"""
# Ensure the Dart code blocks use ```dart for proper syntax highlighting
text = re.sub(r"```(\s*)dart", r"```dart", text)

# Handle single-line comments in Dart (`//` or `///`)
text = re.sub(r"(///|//)\s*", "", text)

return text

def process_file(filepath):
"""
Process a single Dart Markdown file for MDX compatibility.
Args:
filepath (str): The path to the Markdown file to be processed.
Returns:
None: Writes the processed content back to the file if any changes occur.
"""
with open(filepath, 'r', encoding='utf-8') as file:
content = file.read()

# Escape MDX special characters
content = escape_mdx_characters(content)
# Adjust Dart code blocks for MDX
content = adjust_dart_code_blocks(content)

# Write back to the file only if changes were made
with open(filepath, 'w', encoding='utf-8') as file:
file.write(content)

def main():
"""
Main function to process all Dart Markdown files in a specified directory.
Scans for Markdown files and processes them for MDX compatibility,
especially focusing on Dart-specific docs.
Args:
None
Returns:
None
"""
parser = argparse.ArgumentParser(description="Adjust Dart Markdown files for MDX compatibility.")
parser.add_argument(
"--directory",
type=str,
required=True,
help="Directory containing Markdown files to process."
)

args = parser.parse_args()

# Process each Markdown file in the directory
for root, _, files in os.walk(args.directory):
for file in files:
if file.lower().endswith(".md"):
process_file(os.path.join(root, file))

if __name__ == "__main__":
main()
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
.buildlog/
.history
.svn/
.metadata/
.metadata

# Ignore Google services configuration files
google-services.json
Expand Down Expand Up @@ -252,4 +254,4 @@ package.json
package-lock.json
yarn.lock
npm-debug.log
yarn-error.log
yarn-error.log
2 changes: 2 additions & 0 deletions lib/locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import 'package:talawa/view_model/access_request_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_agenda_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_event_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_calendar_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart';
Expand Down Expand Up @@ -151,6 +152,7 @@ Future<void> setupLocator() async {
locator.registerFactory(() => SetUrlViewModel());
locator.registerFactory(() => LoginViewModel());
locator.registerFactory(() => ManageVolunteerGroupViewModel());
locator.registerFactory(() => EditAgendaItemViewModel());
locator.registerFactory(() => SelectOrganizationViewModel());
locator.registerFactory(() => SignupDetailsViewModel());
locator.registerFactory(() => WaitingViewModel());
Expand Down
26 changes: 26 additions & 0 deletions lib/models/events/event_agenda_category.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
///This class creates an event agenda category model.
class AgendaCategory {
AgendaCategory({
this.id,
this.name,
this.description,
});

/// Creates a new `AgendaCategory` instance from a JSON map.
factory AgendaCategory.fromJson(Map<String, dynamic> json) {
return AgendaCategory(
id: json['_id'] as String?,
name: json['name'] as String?,
description: json['description'] as String?,
);
}

/// Id of the agenda category.
final String? id;

/// Name of the category.
final String? name;

/// Description of the category.
final String? description;
}
Loading

0 comments on commit c4fc7b6

Please sign in to comment.