fix: various push notification fixes (#1245)
This commit is contained in:
		
							parent
							
								
									164768e6c9
								
							
						
					
					
						commit
						3a2c56f0fa
					
				
					 3 changed files with 11 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -162,13 +162,15 @@ async function showRichNotification (data, notification) {
 | 
			
		|||
    case 'mention':
 | 
			
		||||
      const isPublic = ['public', 'unlisted'].includes(notification.status.visibility)
 | 
			
		||||
      const actions = [
 | 
			
		||||
        {
 | 
			
		||||
          action: 'favourite',
 | 
			
		||||
          title: 'Favorite'
 | 
			
		||||
        },
 | 
			
		||||
        isPublic && {
 | 
			
		||||
          action: 'reblog',
 | 
			
		||||
          icon: '/icon-push-fa-retweet.png', // generated manually from font-awesome-svg
 | 
			
		||||
          title: 'Boost'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          action: 'favourite',
 | 
			
		||||
          icon: '/icon-push-fa-star.png', // generated manually from font-awesome-svg
 | 
			
		||||
          title: 'Favorite'
 | 
			
		||||
        }
 | 
			
		||||
      ].filter(Boolean)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -191,10 +193,12 @@ async function showRichNotification (data, notification) {
 | 
			
		|||
const cloneNotification = notification => {
 | 
			
		||||
  const clone = {}
 | 
			
		||||
 | 
			
		||||
  // Object.assign() does not work with notifications
 | 
			
		||||
  for (let k in notification) {
 | 
			
		||||
    // intentionally not doing a hasOwnProperty check
 | 
			
		||||
    clone[k] = notification[k]
 | 
			
		||||
    // deliberately not doing a hasOwnProperty check, but skipping
 | 
			
		||||
    // functions and null props like onclick and onshow and showTrigger
 | 
			
		||||
    if (typeof notification[k] !== 'function' && notification[k] !== null) {
 | 
			
		||||
      clone[k] = notification[k]
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return clone
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										
											BIN
										
									
								
								static/icon-push-fa-retweet.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								static/icon-push-fa-retweet.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 505 B  | 
							
								
								
									
										
											BIN
										
									
								
								static/icon-push-fa-star.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								static/icon-push-fa-star.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 905 B  | 
		Loading…
	
	Add table
		
		Reference in a new issue