UX: Redirect to the login page if trying to view assigned topics as anon (#133)
This commit is contained in:
		
							parent
							
								
									ab568be98b
								
							
						
					
					
						commit
						0bf73af1d7
					
				|  | @ -1,10 +1,18 @@ | ||||||
| import I18n from "I18n"; | import I18n from "I18n"; | ||||||
| import UserTopicListRoute from "discourse/routes/user-topic-list"; | import UserTopicListRoute from "discourse/routes/user-topic-list"; | ||||||
|  | import cookie from "discourse/lib/cookie"; | ||||||
| 
 | 
 | ||||||
| export default UserTopicListRoute.extend({ | export default UserTopicListRoute.extend({ | ||||||
|   userActionType: 16, |   userActionType: 16, | ||||||
|   noContentHelpKey: "discourse_assigns.no_assigns", |   noContentHelpKey: "discourse_assigns.no_assigns", | ||||||
| 
 | 
 | ||||||
|  |   beforeModel() { | ||||||
|  |     if (this.currentUser === undefined) { | ||||||
|  |       cookie("destination_url", window.location.href); | ||||||
|  |       this.transitionTo("login"); | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  | 
 | ||||||
|   model(params) { |   model(params) { | ||||||
|     return this.store.findFiltered("topicList", { |     return this.store.findFiltered("topicList", { | ||||||
|       filter: `topics/messages-assigned/${this.modelFor("user").get( |       filter: `topics/messages-assigned/${this.modelFor("user").get( | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue