]> Untitled Git - lemmy.git/commitdiff
Adding archive button for valid post urls.
authorDessalines <tyhou13@gmx.com>
Fri, 22 Nov 2019 02:14:59 +0000 (18:14 -0800)
committerDessalines <tyhou13@gmx.com>
Fri, 22 Nov 2019 02:14:59 +0000 (18:14 -0800)
- Fixes #342

README.md
ui/src/components/post-form.tsx
ui/src/translations/en.ts
ui/src/utils.ts

index f32cb5169b0c098f355bcd84896f010f26500fae..3b0155a7c83604df419013075cdde9bda62c4c73 100644 (file)
--- a/README.md
+++ b/README.md
@@ -246,15 +246,15 @@ If you'd like to add translations, take a look a look at the [English translatio
 
 lang | done | missing
 --- | --- | ---
-de | 79% | cross_posts,cross_post,users,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,settings,stickied,delete_account,delete_account_confirm,banned,creator,number_online,subscribed,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,expires,recent_comments,nsfw,show_nsfw,theme,crypto,monero,joined,by,to,transfer_community,transfer_site,are_you_sure,yes,no 
-eo | 88% | number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,theme,are_you_sure,yes,no 
-es | 96% | replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup 
-fr | 96% | replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup 
-it | 97% | forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup 
-nl | 90% | preview,upload_image,formatting_help,view_source,sticky,unsticky,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,theme 
-ru | 83% | cross_posts,cross_post,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,recent_comments,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no 
-sv | 96% | replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup 
-zh | 81% | cross_posts,cross_post,users,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,settings,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,recent_comments,nsfw,show_nsfw,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no 
+de | 79% | cross_posts,cross_post,users,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,archive_link,settings,stickied,delete_account,delete_account_confirm,banned,creator,number_online,subscribed,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,expires,recent_comments,nsfw,show_nsfw,theme,crypto,monero,joined,by,to,transfer_community,transfer_site,are_you_sure,yes,no 
+eo | 87% | number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,archive_link,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,theme,are_you_sure,yes,no 
+es | 96% | archive_link,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup 
+fr | 96% | archive_link,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup 
+it | 97% | archive_link,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup 
+nl | 89% | preview,upload_image,formatting_help,view_source,sticky,unsticky,archive_link,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,theme 
+ru | 83% | cross_posts,cross_post,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,archive_link,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,recent_comments,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no 
+sv | 96% | archive_link,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup 
+zh | 81% | cross_posts,cross_post,users,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,archive_link,settings,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,recent_comments,nsfw,show_nsfw,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no 
 
 
 If you'd like to update this report, run:
index d3739b471739a1b76c59ae35adc5182415c7dbab..a3ea8fa33cdcb6296da70de0b09fa8032f388414 100644 (file)
@@ -24,6 +24,7 @@ import {
   validURL,
   capitalizeFirstLetter,
   markdownHelpUrl,
+  archiveUrl,
   mdToHtml,
 } from '../utils';
 import * as autosize from 'autosize';
@@ -175,6 +176,17 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
                   onChange={linkEvent(this, this.handleImageUpload)}
                 />
               </form>
+              {validURL(this.state.postForm.url) && (
+                <a
+                  href={`${archiveUrl}/?run=1&url=${encodeURIComponent(
+                    this.state.postForm.url
+                  )}`}
+                  target="_blank"
+                  class="mr-2 d-inline-block float-right text-muted small font-weight-bold"
+                >
+                  <T i18nKey="archive_link">#</T>
+                </a>
+              )}
               {this.state.imageLoading && (
                 <svg class="icon icon-spinner spin">
                   <use xlinkHref="#icon-spinner"></use>
index f73e0d0989fb978eded7edd4064bb38b3ff2f99a..e20ba40a580340b79759793aca75bfb744a1bdc7 100644 (file)
@@ -35,6 +35,7 @@ export const en = {
     sticky: 'sticky',
     unsticky: 'unsticky',
     link: 'link',
+    archive_link: 'archive link',
     mod: 'mod',
     mods: 'mods',
     moderates: 'Moderates',
index 18144dde066b00a9da211fa519020129b6bf3477..2cf80d1411553422446b371758876ecb1a489419 100644 (file)
@@ -24,6 +24,7 @@ import * as emojiShortName from 'emoji-short-name';
 
 export const repoUrl = 'https://github.com/dessalines/lemmy';
 export const markdownHelpUrl = 'https://commonmark.org/help/';
+export const archiveUrl = 'https://archive.is';
 
 export const postRefetchSeconds: number = 60 * 1000;
 export const fetchLimit: number = 20;