mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Merge branch 'main' of gitlab.com:bashrc2/epicyon
						commit
						cdc4ebf0d5
					
				
							
								
								
									
										8
									
								
								utils.py
								
								
								
								
							
							
						
						
									
										8
									
								
								utils.py
								
								
								
								
							|  | @ -1025,7 +1025,13 @@ def display_name_is_emoji(display_name: str) -> bool: | ||||||
|     """Returns true if the given display name is an emoji |     """Returns true if the given display name is an emoji | ||||||
|     """ |     """ | ||||||
|     if ' ' in display_name: |     if ' ' in display_name: | ||||||
|         return False |         words = display_name.split(' ') | ||||||
|  |         for wrd in words: | ||||||
|  |             if not wrd.startswith(':'): | ||||||
|  |                 return False | ||||||
|  |             if not wrd.endswith(':'): | ||||||
|  |                 return False | ||||||
|  |         return True | ||||||
|     if len(display_name) < 2: |     if len(display_name) < 2: | ||||||
|         return False |         return False | ||||||
|     if not display_name.startswith(':'): |     if not display_name.startswith(':'): | ||||||
|  |  | ||||||
|  | @ -1143,17 +1143,13 @@ def _get_post_title_announce_html(base_dir: str, | ||||||
|             container_class_icons, container_class) |             container_class_icons, container_class) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def _reply_to_yourself_html(actor: str, display_name: str, | def _reply_to_yourself_html(translate: {}) -> str: | ||||||
|                             translate: {}) -> str: |  | ||||||
|     """Returns html for a title which is a reply to yourself |     """Returns html for a title which is a reply to yourself | ||||||
|     """ |     """ | ||||||
|     replying_to_themselves_str = 'replying to themselves' |     replying_to_themselves_str = 'replying to themselves' | ||||||
|     if translate.get(replying_to_themselves_str): |     if translate.get(replying_to_themselves_str): | ||||||
|         replying_to_themselves_str = translate[replying_to_themselves_str] |         replying_to_themselves_str = translate[replying_to_themselves_str] | ||||||
|     title_str = \ |     title_str = \ | ||||||
|         '    <a href="' + actor + \ |  | ||||||
|         '" class="announceOrReply"><span itemprop="author">' + \ |  | ||||||
|         display_name + '</span></a>\n' + \ |  | ||||||
|         '    <img loading="lazy" decoding="async" title="' + \ |         '    <img loading="lazy" decoding="async" title="' + \ | ||||||
|         replying_to_themselves_str + \ |         replying_to_themselves_str + \ | ||||||
|         '" alt="' + replying_to_themselves_str + \ |         '" alt="' + replying_to_themselves_str + \ | ||||||
|  | @ -1263,28 +1259,7 @@ def _get_post_title_reply_html(base_dir: str, | ||||||
| 
 | 
 | ||||||
|     # reply to self |     # reply to self | ||||||
|     if obj_json['inReplyTo'].startswith(post_actor): |     if obj_json['inReplyTo'].startswith(post_actor): | ||||||
|         # get the display name for the poster replying to themselves |         title_str += _reply_to_yourself_html(translate) | ||||||
|         self_display_name = \ |  | ||||||
|             get_display_name(base_dir, post_actor, person_cache) |  | ||||||
|         if self_display_name: |  | ||||||
|             if len(self_display_name) < 2 or \ |  | ||||||
|                display_name_is_emoji(self_display_name): |  | ||||||
|                 self_display_name = None |  | ||||||
|         if not self_display_name: |  | ||||||
|             self_nickname = get_nickname_from_actor(post_actor) |  | ||||||
|             self_domain, _ = get_domain_from_actor(post_actor) |  | ||||||
|             if self_nickname and self_domain: |  | ||||||
|                 self_display_name = self_nickname + '@' + self_domain |  | ||||||
|             else: |  | ||||||
|                 self_display_name = '' |  | ||||||
|         # add emoji to the display name |  | ||||||
|         if ':' in self_display_name: |  | ||||||
|             self_display_name = \ |  | ||||||
|                 add_emoji_to_display_name(None, base_dir, http_prefix, |  | ||||||
|                                           nickname, domain, |  | ||||||
|                                           self_display_name, False) |  | ||||||
|         title_str += \ |  | ||||||
|             _reply_to_yourself_html(post_actor, self_display_name, translate) |  | ||||||
|         return (title_str, reply_avatar_image_in_post, |         return (title_str, reply_avatar_image_in_post, | ||||||
|                 container_class_icons, container_class) |                 container_class_icons, container_class) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue