관리자 알림 무시하기!

참고로, 이 컴포넌트의 설정을 테스트하고 싶지만 실제 알림을 트리거하는 작업을 수행하기 싫고 (ssh 접근 권한이 있는 경우), rails 콘솔에서 다음 명령을 사용하여 해당 이벤트 알림을 트리거할 수 있습니다 (컴포넌트 설정에 해당하는 트리거를 사용하세요):

cd /var/discourse
.launcher enter app
rails c
# 사용자 변수를 찾고 설정
u = User.find_by_username("YOUR ADMIN USERNAME")

# 트리거: 새 기능
Notification.create!(
  user: u,
  notification_type: Notification.types[:new_features],
  read: false,
  data: {}.to_json
)

# 트리거: 초대 수락
Notification.create!(
  user: u,
  notification_type: Notification.types[:invitee_accepted],
  read: false,
  data: { display_username: "awesome_new_user" }.to_json
)

# 트리거: 그룹 멤버십 수락
Notification.create!(
  user: u,
  notification_type: Notification.types[:membership_request_accepted],
  read: false,
  data: { group_name: "Trust_Level_4" }.to_json
)

# 트리거: 배지 부여
Notification.create!(
  user: u,
  notification_type: Notification.types[:granted_badge],
  read: false,
  data: { badge_name: "Great Topic", badge_id: 10 }.to_json
)

# 트리거: 예정된 변경 사항 홍보
Notification.create!(
  user: u,
  notification_type: Notification.types[:upcoming_change_automatically_promoted],
  read: false,
  data: { 
    upcoming_change_humanized_name: "Experimental CSS",
    upcoming_change_name: "experimental_css"
  }.to_json
)

# 브로드캐스트 (엔터를 누를 때 다른 창 또는 탭에서 브라우저를 지켜보세요!)
u.publish_notifications_state

가장 좋은 테스트 방법은 테스트하려는 컴포넌트의 설정을 비활성화한 후 관련 rails 트리거 명령을 실행하여 알림 팝업이 표시되는 것을 확인한 뒤, 설정을 다시 활성화하고 하드 리프레시(강제 새로고침)를 하여 알림이 사라지는 것을 확인하는 것입니다.

1개의 좋아요