Browse Source

Raito-FE: Display for reblogs

pull/58/head
Toromino 3 months ago
parent
commit
e581c20a28

+ 20
- 0
src/raito_fe/renderer.rs View File

@@ -626,6 +626,26 @@ fn prepare_status_context(status: Status) -> HashMap<String, String> {
626 626
     context.insert(String::from("status_created_at"), date);
627 627
     context.insert(String::from("status_favourites_count"), favourites_count);
628 628
     context.insert(String::from("status_id"), status.id.to_string());
629
+    context.insert(
630
+        String::from("status_reblog"),
631
+        status.reblog.is_some().to_string(),
632
+    );
633
+    match status.reblog {
634
+        Some(reblog_status) => {
635
+            let reblog: Status = serde_json::from_value(reblog_status).unwrap();
636
+            context.insert(String::from("reblog_account_acct"), reblog.account.acct);
637
+            context.insert(
638
+                String::from("reblog_account_url"),
639
+                format!("/account/{}", reblog.id),
640
+            );
641
+            context.insert(String::from("reblog_content"), reblog.content);
642
+        }
643
+        None => {
644
+            context.insert(String::from("reblog_account_acct"), String::from(""));
645
+            context.insert(String::from("reblog_account_url"), String::from(""));
646
+            context.insert(String::from("reblog_content"), String::from(""));
647
+        }
648
+    }
629 649
     context.insert(String::from("status_reblogs_count"), shares_count);
630 650
     context.insert(String::from("status_replies_count"), replies_count);
631 651
     context.insert(String::from("status_uri"), status.uri);

+ 29
- 0
static/raito_fe/themes/raito_light.css View File

@@ -573,6 +573,35 @@ textarea {
573 573
 	width: 35px;
574 574
 }
575 575
 
576
+.status-reblog-avatar {
577
+	float: left;
578
+	height: 25px !important;
579
+	width: 25px !important;
580
+	margin: 0 !important;
581
+}
582
+
583
+.status-reblog-content {
584
+	clear: both;
585
+	float: left;
586
+	margin: 0;
587
+	margin-top: 10px;
588
+}
589
+
590
+.status-reblog-divider {
591
+	font-weight: bold;
592
+	float: left;
593
+	margin-top: 5px;
594
+	margin-right: 15px;
595
+}
596
+
597
+.status-reblog-username {
598
+	color: var(--text-color) !important;
599
+	font-size: 15px;
600
+	float: left;
601
+	margin-top: 2px;
602
+	margin-left: 10px;
603
+}
604
+
576 605
 .status-user-avatar {
577 606
 	border-radius: 5px;
578 607
 	float: left;

+ 11
- 1
templates/raito_fe/components/status.html.tera View File

@@ -8,7 +8,17 @@
8 8
             <div class="status-user-info-username"><a href="{{status_account_url | safe}}">{{status_account_acct}}</a></div>
9 9
         </div>
10 10
     </div>
11
-    <div class="status-content">{{status_content | safe}}</div>
11
+    <div class="status-content">
12
+    {% if status_reblog == "true" %}
13
+    <span class="status-reblog-divider">Has shared</span>
14
+    <img src="/static/assets/default_avatar.png" class="status-reblog-avatar">
15
+    <a href="{{reblog_account_url}}" class="status-reblog-username">{{reblog_account_acct}}</a>
16
+    <br />
17
+    <p class="status-reblog-content">{{reblog_content | safe}}</p>
18
+    {% else %}
19
+    {{status_content | safe}}
20
+    {% endif %}
21
+    </div>
12 22
     <div class="status-info">
13 23
         <ul>
14 24
             <li>

Loading…
Cancel
Save