fix: don't auto-fill source with @username when empty
Both frontend and backend were defaulting the source field to
@username when left empty. Now stores an empty string instead.
Frontend (app.js):
- saveProtocol: removed || '@' + currentUser.username fallback
- saveCollection: removed || '@' + currentUser.username fallback
Backend (api/index.php):
- Protocol create: ['source'] ?? '' instead of ?? ('@' . username)
- Collection create: ['source'] ?? '' instead of ?? ('@' . username)
This commit is contained in:
+2
-2
@@ -216,7 +216,7 @@ if ($parts[0] === 'protocols') {
|
||||
'slug' => $new_slug,
|
||||
'title' => substr($data['title'] ?? '', 0, 255),
|
||||
'description' => $data['description'] ?? '',
|
||||
'source' => $data['source'] ?? ('@' . $user['username']),
|
||||
'source' => $data['source'] ?? '',
|
||||
'source_url' => substr($data['source_url'] ?? '', 0, 500),
|
||||
'tags' => json_encode(array_slice($data['tags'] ?? [], 0, 20)),
|
||||
'forked_from' => $data['forked_from'] ?? null,
|
||||
@@ -345,7 +345,7 @@ if ($parts[0] === 'collections') {
|
||||
'slug' => $new_slug,
|
||||
'title' => substr($data['title'] ?? '', 0, 255),
|
||||
'description' => $data['description'] ?? '',
|
||||
'source' => $data['source'] ?? ('@' . $user['username']),
|
||||
'source' => $data['source'] ?? '',
|
||||
'image' => $data['image'] ?? null,
|
||||
'author_id' => $user['id'],
|
||||
'visibility' => validate_visibility($data['visibility'] ?? 'public'),
|
||||
|
||||
Reference in New Issue
Block a user