mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 19:29:34 +08:00
FEATURE: pasting a link into the title of the composer can automatically onebox it and update the title
This commit is contained in:
@ -320,6 +320,26 @@ export default function() {
|
||||
this.delete('/admin/users/:user_id/revoke_api_key', success);
|
||||
this.post('/admin/badges', success);
|
||||
this.delete('/admin/badges/:id', success);
|
||||
|
||||
this.get('/onebox', request => {
|
||||
if (request.queryParams.url === 'http://www.example.com/has-title.html') {
|
||||
return [
|
||||
200,
|
||||
{"Content-Type": "application/html"},
|
||||
'<aside class="onebox"><article class="onebox-body"><h3><a href="http://www.example.com/article.html">An interesting article</a></h3></article></aside>'
|
||||
];
|
||||
}
|
||||
|
||||
if (request.queryParams.url === 'http://www.example.com/no-title.html') {
|
||||
return [
|
||||
200,
|
||||
{"Content-Type": "application/html"},
|
||||
'<aside class="onebox"><article class="onebox-body"><p>No title</p></article></aside>'
|
||||
];
|
||||
}
|
||||
|
||||
return [404, {"Content-Type": "application/html"}, ''];;
|
||||
});
|
||||
});
|
||||
|
||||
server.prepareBody = function(body){
|
||||
|
Reference in New Issue
Block a user