Debian Codegraph @

plugin/quoted_message/quoted_message.rb

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2 # frozen_string_literal: true
3
4 Plugin.create :quoted_message do
5 command(:copy_message_permalink,
6 name: ->(opt) {
7 if opt
8 _('%{model_label}のURLをコピー') % {model_label: opt&.messages&.first&.class&.spec&.name }
9 else
10 _('この投稿のURLをコピー')
11 end
12 },
13 condition: ->(opt) { opt.messages.all?(&:perma_link) },
14 visible: true,
15 role: :timeline) do |opt|
16 Plugin.call(:clipboard_write, opt.messages.map(&:perma_link).join("\n"))
17 end
18
19 command(:quoted_message,
20 name: _('URLを引用して投稿'),
21 icon: Skin[:quote],
22 condition: ->(opt) { opt.messages.all?(&:perma_link) },
23 visible: true,
24 role: :timeline) do |opt|
25 messages = opt.messages
26 opt.widget.create_postbox(to: messages,
27 footer: ' ' + messages.map(&:perma_link).join(' '),
28 to_display_only: true)
29 end
30 end