Skip to content

Commit

Permalink
filtered_records
Browse files Browse the repository at this point in the history
  • Loading branch information
SkywalkerSpace committed Jan 18, 2024
1 parent c66a94d commit fbc91fd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions events/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,19 +682,20 @@ def generate_activity_records(added_files, deleted_files, added_dirs,
record['old_path'] = de.path
records.append(record)

for index in range(len(records) - 1, -1, -1):
record = records[index]
filtered_records = []
for record in records:
if os.path.dirname(record['path']).startswith('/images/auto-upload'):
records.pop(index)
continue
if os.path.dirname(record['path']).startswith('/images/sdoc'):
records.pop(index)
continue
if os.path.dirname(record['path']).startswith('/_Internal'):
records.pop(index)
continue
if 'old_path' in record:
record['old_path'] = record['old_path'].rstrip('/')
record['path'] = record['path'].rstrip('/') if record['path'] != '/' else '/'
filtered_records.append(record)

return records
return filtered_records

def list_file_in_dir(repo_id, dirents, op_type):
_dirents = copy.copy(dirents)
Expand Down

0 comments on commit fbc91fd

Please sign in to comment.