* Updates the starred status of the post.
( postElement: HTMLElement, starred: boolean, )
| 346 | * Updates the starred status of the post. |
| 347 | */ |
| 348 | function updateStarredByCurrentUser( |
| 349 | postElement: HTMLElement, |
| 350 | starred: boolean, |
| 351 | ) { |
| 352 | const star = postElement.getElementsByClassName( |
| 353 | 'starred', |
| 354 | )[0] as HTMLDivElement; |
| 355 | const unStar = postElement.getElementsByClassName( |
| 356 | 'not-starred', |
| 357 | )[0] as HTMLDivElement; |
| 358 | |
| 359 | if (starred) { |
| 360 | star.style.display = 'inline-block'; |
| 361 | unStar.style.display = 'none'; |
| 362 | } else { |
| 363 | star.style.display = 'none'; |
| 364 | unStar.style.display = 'inline-block'; |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | /** |
| 369 | * Updates the number of stars displayed for a post. |