Skip to content

Commit a6784f9

Browse files
committed
Fixes an issue when opening post screen from action.
1 parent 6d5049f commit a6784f9

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/stores/App.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default App = types.model('App', {
111111
Login.trigger_login_from_url(event.url)
112112
}
113113
else if(event?.url && event?.url.includes('/post?text=') && Auth.is_logged_in()){
114-
App.navigate_to_screen("post", event.url)
114+
App.navigate_to_screen("post", event.url, true)
115115
}
116116
else if(event?.url && event?.url.includes('/indieauth') && Auth.is_logged_in()){
117117
console.log("Micropub:Opened app with IndieAuth")
@@ -127,7 +127,7 @@ export default App = types.model('App', {
127127
Login.trigger_login_from_url(value)
128128
}
129129
else if(value?.includes('/post?text=') && Auth.is_logged_in()){
130-
App.navigate_to_screen("post", value)
130+
App.navigate_to_screen("post", value, true)
131131
}
132132
})
133133
if(Platform.OS === "android"){
@@ -205,7 +205,7 @@ export default App = types.model('App', {
205205
}
206206
}),
207207

208-
navigate_to_screen: flow(function* (action, action_data) {
208+
navigate_to_screen: flow(function* (action, action_data, from_listener = false) {
209209
if(!self.is_scrolling){
210210
switch (action) {
211211
case "user":
@@ -222,9 +222,11 @@ export default App = types.model('App', {
222222
case "bookmark":
223223
return bookmarkScreen(action_data, self.current_screen_id)
224224
case "post":
225-
Auth.selected_user.posting.set_post_text_from_action(action_data)
225+
if(from_listener){
226+
Auth.selected_user.posting.set_post_text_from_action(action_data)
227+
}
226228
if (!self.post_modal_is_open) {
227-
return postingScreen(action_data)
229+
return postingScreen(!from_listener ? action_data : null)
228230
}
229231
return
230232
}

src/stores/models/Posting.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ export default Posting = types.model('Posting', {
112112
}),
113113

114114
set_post_text_from_action: flow(function* (value) {
115-
const text = value.replace("microblog://post?text=", "")
116-
self.post_text = decodeURI(text.replace(/%3A/g, ":"))
115+
self.post_text = decodeURI(value.replace("microblog://post?text=", "").replace(/%3A/g, ":"))
117116
}),
118117

119118
set_post_title: flow(function* (value) {

0 commit comments

Comments
 (0)