Skip to content

Commit

Permalink
Following: Set correct FolderID
Browse files Browse the repository at this point in the history
  • Loading branch information
benpate committed Jan 23, 2024
1 parent 6c691b8 commit 41179af
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 27 deletions.
3 changes: 2 additions & 1 deletion _embed/templates/user-inbox/following-add.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{{- $search := .QueryParam "search" -}}
{{- $url := .QueryParam "url" -}}
{{- $folderID := .QueryParam "folderId" -}}
{{- $stream := .ActivityStream $url -}}
{{- $following := .AmFollowing $url -}}

{{- if ne "" $search -}}
<div class="margin-bottom">
<span role="link" class="link" hx-get="/@me/inbox/following-search?search={{$search}}" hx-target="#modal">
<span role="link" class="link" hx-get="/@me/inbox/following-search?search={{$search}}&folderId={{$folderID}}" hx-target="#modal">
&larr; Back to Search
</span>
</div>
Expand Down
5 changes: 3 additions & 2 deletions _embed/templates/user-inbox/following-search-results.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ $search := .QueryParam "search" }}
{{- $search := .QueryParam "search" -}}
{{- $folderID := .QueryParam "folderId" -}}
{{- $results := .ActivityStreamActors $search -}}
{{- $resultCount := len $results}}

Expand All @@ -12,7 +13,7 @@
<div class="text-light-gray margin-top">Found {{$resultCount}} {{pluralize $resultCount "result:" "results:"}}</div>
<div role="menu" class="menu margin-top">
{{- range $results -}}
<div role="menuitem" tabIndex="0" hx-get="/@me/inbox/following-add?url={{.ID}}&search={{$search}}">
<div role="menuitem" tabIndex="0" hx-get="/@me/inbox/following-add?url={{.ID}}&folderId={{$folderID}}&search={{$search}}">
<div class="flex-row margin-vertical-sm">
{{- if ne "" .Icon -}}
<img src="{{.Icon}}" class="circle-32">
Expand Down
7 changes: 5 additions & 2 deletions _embed/templates/user-inbox/following-search.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{- $search := .QueryParam "search" -}}
{{- $folderID := .QueryParam "folderId" -}}
<h2 class="margin-bottom-lg">{{icon "add"}} Follow a Person or Website</h2>

<div script="install menu(input:#following-search-input)">

<div role="input" class="flex-row">

<input
id="following-search-input"
type="text"
Expand All @@ -14,12 +15,14 @@ <h2 class="margin-bottom-lg">{{icon "add"}} Follow a Person or Website</h2>
tabIndex="0"
value="{{attr $search}}"
style="border:none; padding:0;"

script="on load call my focus() if my value is not empty then send initial"
hx-get="/@me/inbox/following-search-results"
hx-trigger="initial, keyup changed throttle:50ms queue:last"
hx-target="#following-search-results"
hx-swap="innerHTML"
hx-push-url="false">
hx-push-url="false"
hx-vals='{"folderId":"{{$folderID}}"}'>

</div>

Expand Down
44 changes: 23 additions & 21 deletions _embed/templates/user-inbox/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"children": [
{"type":"text", "path":"label", "label":"Name"},
{"type":"select", "path":"icon", "label":"Icon", "options":{"provider":"folder-icons"}},
{"type":"select", "path":"layout", "label":"Layout", "options": {"enum":"CHAT,SOCIAL,NEWSPAPER,MAGAZINE"}}
{"type":"select", "path":"layout", "label":"Layout", "options": {"enum":"SOCIAL,NEWSPAPER,MAGAZINE"}}
]}
},
{"step":"save"}
Expand Down Expand Up @@ -215,23 +215,25 @@
"type":"hidden",
"path":"url"
},
{
"type":"select",
"label":"Inbox Folder",
"path":"folderId",
"description":"Where should messages from this source be placed?",
"options":{"provider": "folders"}
},
{
"type":"select",
"label":"Content to Show",
"label":"Message Types",
"path":"behavior",
"description":"What kinds of posts should be shown in my timeline?",
"options":{"provider":"following-behaviors"}
},
{
"type":"select",
"label":"Folder",
"path":"folderId",
"options":{"provider": "folders"},
"description": "Automatically add items to this folder."
},
{
"type":"select",
"label":"Shared Blocks",
"path":"ruleAction",
"description":"How should blocks from this source be handled?",
"options":{"provider":"following-rule-actions"}
},
{
Expand All @@ -244,7 +246,7 @@
"type":"toggle",
"path":"isPublic",
"default":false,
"options":{"true-text":"Share this 'Follow' on my profile", "false-text":"Hide this 'Follow' from others"}
"options":{"true-text":"Public: This 'Follow' is visible on my profile", "false-text":"Private: This 'Follow' is hidden from others"}
}
]
}
Expand Down Expand Up @@ -279,25 +281,25 @@
"form":{
"type":"layout-vertical",
"children": [
{
"type":"select",
"label":"Inbox Folder",
"path":"folderId",
"description":"Where should messages from this source be placed?",
"options":{"provider": "folders"}
},
{
"type":"select",
"label":"Content to Show",
"label":"Message Types",
"path":"behavior",
"hint": "Which messages from this source should show up in your timeline?",
"description":"What kinds of posts should be shown in my timeline?",
"options":{"provider":"following-behaviors"}
},
{
"type":"select",
"label":"Folder",
"path":"folderId",
"options":{"provider": "folders"},
"description": "Automatically add items to this folder."
},
{
"type":"select",
"label":"Shared Blocks",
"path":"ruleAction",
"hint":"When this source blocks someone online, do you want to block them as well?",
"description":"How should blocks from this source be handled?",
"options":{"provider":"following-rule-actions"}
},
{
Expand All @@ -310,7 +312,7 @@
"type":"toggle",
"path":"isPublic",
"default":false,
"options":{"true-text":"Share this 'Follow' on my profile", "false-text":"Hide this 'Follow' from others"}
"options":{"true-text":"Public: This 'Follow' is visible on my profile", "false-text":"Private: This 'Follow' is hidden from others"}
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion _embed/templates/user-outbox/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
]
}},
{"step":"save", "comment":"Profile updated by me"}
]}
]},
{"step":"trigger-event", "event":"refreshPage"}
]
},
"photo": {
Expand Down

0 comments on commit 41179af

Please sign in to comment.